Skip to content

When uploading several files at once the date is missing #1854 #1979

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

Closed
wants to merge 4 commits into from

Conversation

ashishkumar468
Copy link
Collaborator

When uploading several files at once the date is missing

Fixes #1854 {When uploading several files at once the date is missing}

Description (required)

While uploading images, current date was being passed as date created instead of the actual date created
Fixes #1854 {When uploading several files at once the date is missing}
Instead of copying the image in a temp file, the app would now use the absolute path of the image to upload images. Also, save the actual date created in ContributionsDao in Column "timestamp" which is currently saving uploaded date [resulting in wrong date being show in web ui]

Tests performed (required)

Tested on {29l & Google Pixel}, with {build variant, ProdDebug}.

* used absolute file path while uploading images.
* updated ContributionsDao to save file creation date which previously as used to store current timestamp[the bug].
* creation notification channel before posting notification
@commons-app commons-app deleted a comment Nov 4, 2018
@commons-app commons-app deleted a comment Nov 4, 2018
@codecov-io
Copy link

Codecov Report

Merging #1979 into master will increase coverage by <.01%.
The diff coverage is 1.56%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1979      +/-   ##
=========================================
+ Coverage    4.37%   4.37%   +<.01%     
=========================================
  Files         211     211              
  Lines       10634   10654      +20     
  Branches      954     956       +2     
=========================================
+ Hits          465     466       +1     
- Misses      10134   10152      +18     
- Partials       35      36       +1
Impacted Files Coverage Δ
...ree/nrw/commons/contributions/ContributionDao.java 0% <0%> (ø) ⬆️
...java/fr/free/nrw/commons/upload/ShareActivity.java 0% <0%> (ø) ⬆️
...free/nrw/commons/upload/MultipleShareActivity.java 0% <0%> (ø) ⬆️
...ain/java/fr/free/nrw/commons/upload/FileUtils.java 3.18% <0%> (-0.05%) ⬇️
...r/free/nrw/commons/contributions/Contribution.java 0% <0%> (ø) ⬆️
...java/fr/free/nrw/commons/upload/UploadService.java 0% <0%> (ø) ⬆️
...a/fr/free/nrw/commons/upload/UploadController.java 0% <0%> (ø) ⬆️
app/src/main/java/fr/free/nrw/commons/Utils.java 27.02% <0%> (-6.31%) ⬇️
...n/java/fr/free/nrw/commons/CommonsApplication.java 44.57% <100%> (+0.67%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 27123f5...926e477. Read the comment docs.

@misaochan
Copy link
Member

misaochan commented Nov 4, 2018

Hi @ashishkumar468 , I tested this on Nexus S emulator running API 27. When uploading a single image via in-app Gallery, the app crashes on image selection (from Google Photos) with this log:

    java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=1, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {fr.free.nrw.commons/fr.free.nrw.commons.upload.ShareActivity}: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4268)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4312)
        at android.app.ActivityThread.-wrap19(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1644)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
        at android.database.AbstractCursor.checkPosition(AbstractCursor.java:468)
        at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
        at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
        at android.database.CursorWrapper.getString(CursorWrapper.java:137)
        at fr.free.nrw.commons.Utils.getImageFileAbsolutePath(Utils.java:216)
        at fr.free.nrw.commons.upload.ShareActivity.receiveImageIntent(ShareActivity.java:357)
        at fr.free.nrw.commons.upload.ShareActivity.onRequestPermissionsResult(ShareActivity.java:447)
        at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7429)
        at android.app.Activity.dispatchActivityResult(Activity.java:7280)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4264)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4312) 
        at android.app.ActivityThread.-wrap19(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1644) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 

And uploading from camera crashes with this log:

11-04 22:53:41.327 19084-19084/fr.free.nrw.commons E/AndroidRuntime: FATAL EXCEPTION: main
    Process: fr.free.nrw.commons, PID: 19084
    java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.free.nrw.commons/fr.free.nrw.commons.upload.ShareActivity}: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
        at android.database.AbstractCursor.checkPosition(AbstractCursor.java:468)
        at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
        at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
        at android.database.CursorWrapper.getString(CursorWrapper.java:137)
        at fr.free.nrw.commons.Utils.getImageFileAbsolutePath(Utils.java:216)
        at fr.free.nrw.commons.upload.ShareActivity.receiveImageIntent(ShareActivity.java:357)
        at fr.free.nrw.commons.upload.ShareActivity.onCreate(ShareActivity.java:299)
        at android.app.Activity.performCreate(Activity.java:7009)
        at android.app.Activity.performCreate(Activity.java:7000)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
11-04 22:53:46.117 19291-19331/fr.free.nrw.commons E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
    glUtilsParamSize: unknow param 0x000082da

If you are modifying the upload process to this extent, you may need to do a more thorough round of tests. Generally I would test:

  • Single uploads via Gallery and Camera
  • Multiple uploads via Share
  • Uploads via Nearby

That being said, #1968 should be viable for release soon. Would it be better to piggyback onto that instead? You can submit your change to @maskaravivek 's branch and then you two could include it in his PR.

@ashishkumar468
Copy link
Collaborator Author

@misaochan Piggybacking onto #1968 would be better. Also that might not require these many changes. I think fixing exif data params would just work on that, if that branch is stable and tested.
@maskaravivek What do you suggest ?

@ashishkumar468 ashishkumar468 deleted the bugfix/1854 branch November 5, 2018 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants