-
Notifications
You must be signed in to change notification settings - Fork 1.6k
CB-13415 (android) Importing corrupt images using the Camera plugin c… #309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@infil00p |
| try { | ||
| fileStream = FileHelper.getInputStreamFromUriString(imageUrl, cordova); | ||
| image = BitmapFactory.decodeStream(fileStream); | ||
| } catch (OutOfMemoryError e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to catch any exception and not only OutOfMemoryError, it might fail due to other reasons, and then in the error callbackContext.error provide the exception message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. Exception will catch all exceptions including OutOfMemoryError. So do I need to change or you will?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alpesh12 You need to change this before I accept the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@infil00p ok will do after testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@infil00p @jcesarmobile Now its done can you please merge changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@infil00p i just check travis build failed for iOS can you please help or guide me to successful complete travis test
Thank you
|
We're still getting Travis issues on iOS 10 since the change to iOS. |
|
@infil00p Whats is the next step to pass Travis test any guideline or help will be appreciates |
|
I would keep the iOS and the Android parts separated (i.e. creating a new issue for iOS and removing the iOS code from this PR, and then send a new PR with the iOS code) |
|
@jcesarmobile |
|
Can you please check appveyor test i think there are some issue with that, for all last build it will take only 2-3 minutes but this time it will take 5hr then also its on queue state. |
|
Sometimes tests take a lot of time, I don't think we can control that. |
|
@jcesarmobile Done |
|
Best thing is to work in branches, so you can create a new CB-13415 branch with your current content, and reset your master to match the apache master, then create a new branch from master and do the changes there |
|
@jcesarmobile |
|
When somebody has time to properly test it and merge it. BTW, I still see the iOS file as modified, even though it shows not changes. Can you remove the file from the PR entirely? |
|
I've finally tested and the problem is only present when In the docs you can read:
So, I don't think you should hardcode the OutOfMemoryError to corrupted image as any big image not corrupted will also cause the OutOfMemoryError. |
|
@jcesarmobile @infil00p I agree that the OutOfMemoryError is a catch all that is not specific to corrupt images. Here are the sample images: Corrupt 5MB image: Valid 40MB image: I would like to move forward with the generic OutOfMemoryError as a catch all exception within this Pull Request, as it solves a high impact error (corrupt images crashing the entire Cordova app). Later, if/when a more accurate exception is found, it can be applied as an enhanced exception. |
|
I'm just talking about the error message returned I don't think we should hardcode the out of memory to "corrupted image selected". |
|
@jcesarmobile |
|
@jcesarmobile @ShemrickFlannigan |
|
@jcesarmobile @infil00p |
|
I would use the same e.getMessage() or e.getLocalizedMessage() for both, not one with e.getMessage() and the other e.getLocalizedMessage() (for consistency). I've checked other plugins and cordova-plugin-file uses e.getLocalizedMessage(), so I would use e.getLocalizedMessage() for both. The iOS file shows no changes, but appears as modified, so you should remove it from the PR, maybe with a git reset or something. Ah, and remove the comments, I think there is no need. |
|
+1 |
|
@alpesh12 can you remove the code comments? |
Removed comments from CameraLauncher.java
|
@jcesarmobile comment removed as you suggested. |
|
Merged, thanks! Will try to take a look into the iOS one this weekend, but no promises |
Platforms affected
What does this PR do?
What testing has been done on this change?
Tested with cordova-android 7.0.0
Checklist