mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Close ContentResolver InputStream
This commit is contained in:
parent
35e13989af
commit
a9cf1e91ec
|
@ -187,8 +187,9 @@ final class QRCodeEncoder {
|
||||||
}
|
}
|
||||||
byte[] vcard;
|
byte[] vcard;
|
||||||
String vcardString;
|
String vcardString;
|
||||||
|
InputStream stream = null;
|
||||||
try {
|
try {
|
||||||
InputStream stream = activity.getContentResolver().openInputStream(uri);
|
stream = activity.getContentResolver().openInputStream(uri);
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
byte[] buffer = new byte[2048];
|
byte[] buffer = new byte[2048];
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
|
@ -199,6 +200,14 @@ final class QRCodeEncoder {
|
||||||
vcardString = new String(vcard, 0, vcard.length, "UTF-8");
|
vcardString = new String(vcard, 0, vcard.length, "UTF-8");
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw new WriterException(ioe);
|
throw new WriterException(ioe);
|
||||||
|
} finally {
|
||||||
|
if (stream != null) {
|
||||||
|
try {
|
||||||
|
stream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// continue
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Log.d(TAG, "Encoding share intent content:");
|
Log.d(TAG, "Encoding share intent content:");
|
||||||
Log.d(TAG, vcardString);
|
Log.d(TAG, vcardString);
|
||||||
|
|
Loading…
Reference in a new issue