Updated error handling
This commit is contained in:
parent
32f289d454
commit
5d5afcbe83
|
|
@ -133,10 +133,10 @@ public class CropImageActivity extends MonitoredActivity {
|
|||
option.inSampleSize = sampleSize;
|
||||
rotateBitmap = new RotateBitmap(BitmapFactory.decodeStream(is, null, option), exifRotation);
|
||||
} catch (IOException e) {
|
||||
Log.e("Error reading picture: " + e.getMessage(), e);
|
||||
Log.e("Error reading image: " + e.getMessage(), e);
|
||||
setResultException(e);
|
||||
} catch (OutOfMemoryError e) {
|
||||
Log.e("OOM while reading picture: " + e.getMessage(), e);
|
||||
Log.e("OOM reading image: " + e.getMessage(), e);
|
||||
setResultException(e);
|
||||
} finally {
|
||||
CropUtil.closeSilently(is);
|
||||
|
|
@ -358,8 +358,11 @@ public class CropImageActivity extends MonitoredActivity {
|
|||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
Log.e("Error cropping picture: " + e.getMessage(), e);
|
||||
Log.e("Error cropping image: " + e.getMessage(), e);
|
||||
finish();
|
||||
} catch (OutOfMemoryError e) {
|
||||
Log.e("OOM cropping image: " + e.getMessage(), e);
|
||||
setResultException(e);
|
||||
} finally {
|
||||
CropUtil.closeSilently(is);
|
||||
}
|
||||
|
|
@ -382,9 +385,9 @@ public class CropImageActivity extends MonitoredActivity {
|
|||
m.setRectToRect(new RectF(r), dstRect, Matrix.ScaleToFit.FILL);
|
||||
m.preConcat(rotateBitmap.getRotateMatrix());
|
||||
canvas.drawBitmap(rotateBitmap.getBitmap(), m, null);
|
||||
|
||||
} catch (OutOfMemoryError e) {
|
||||
Log.e("Error cropping picture: " + e.getMessage(), e);
|
||||
Log.e("OOM cropping image: " + e.getMessage(), e);
|
||||
setResultException(e);
|
||||
System.gc();
|
||||
}
|
||||
|
||||
|
|
@ -409,7 +412,6 @@ public class CropImageActivity extends MonitoredActivity {
|
|||
if (outputStream != null) {
|
||||
croppedImage.compress(Bitmap.CompressFormat.JPEG, 90, outputStream);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
setResultException(e);
|
||||
Log.e("Cannot open file: " + saveUri, e);
|
||||
|
|
|
|||
Loading…
Reference in New Issue