Skip to content
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

NPE: java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference #13502

Closed
wrenix opened this issue Sep 2, 2024 · 5 comments · Fixed by #13612
Assignees
Labels

Comments

@wrenix
Copy link

wrenix commented Sep 2, 2024

Cause of error

Exception in thread "main" java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference
    at com.owncloud.android.datamodel.OCFile.isInternalFolderSync(OCFile.java:1058)
    at com.owncloud.android.ui.fragment.FileDetailFragment.updateFileDetails(FileDetailFragment.java:569)
    at com.owncloud.android.ui.fragment.FileDetailFragment.onViewCreated(FileDetailFragment.java:266)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3152)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:608)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:286)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2164)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2059)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
    at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:702)
    at android.os.Handler.handleCallback(Handler.java:959)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loopOnce(Looper.java:232)
    at android.os.Looper.loop(Looper.java:317)
    at android.app.ActivityThread.main(ActivityThread.java:8592)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)

App information

  • ID: com.nextcloud.android.beta
  • Version: 20240827
  • Build flavor: versionDev

Device information

  • Brand: Fairphone
  • Device: FP5
  • Model: FP5
  • Id: AP2A.240805.005
  • Product: FP5

Firmware

  • SDK: 34
  • Release: 14
  • Incremental: 24510032
@wrenix wrenix added the bug label Sep 2, 2024
@wrenix wrenix changed the title NullPointer in Details NullPointer in open Details Sep 2, 2024
@joshtrichards joshtrichards added stable-3.30 performance: NPE 🚫 NullPointerException / Null Pointer Exception labels Sep 2, 2024
@sujan6539
Copy link

sujan6539 commented Sep 3, 2024

The issue seems to originate from the FileEntity.getInternalTwoWaySync which is nullable, and there might be cases when it is actually null. The getter mentioned above is responsible for setting the internal folder sync timestamp using setInternalFolderSyncTimestamp in the manager. I prefer to change implementation of setInternalFolderSyncTimestamp in OCFile.java to set to default if a new time stamp is null for any future null setter.

I can work on it if you are satisfied with my response!

@WarpinWolf
Copy link

Not sure whether I'm allowed/whether it makes sense to add:

  • I open folder A in App.
  • I select one file.
  • I chose copy/move.
  • I select target folder B / copy.
  • I am back in the folder A.
  • I click on next file (ODF) in A -> Null Pointer

Cause of error

Exception in thread "main" java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference
    at com.owncloud.android.datamodel.OCFile.isInternalFolderSync(OCFile.java:1058)
    at com.owncloud.android.datamodel.FileDataStorageManager.isPartOfInternalTwoWaySync(FileDataStorageManager.java:2504)
    at com.owncloud.android.ui.fragment.FileDetailFragment.updateFileDetails(FileDetailFragment.java:572)
    at com.owncloud.android.ui.fragment.FileDetailFragment.onViewCreated(FileDetailFragment.java:266)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3152)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:608)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:286)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2164)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2059)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
    at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:702)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:205)
    at android.os.Looper.loop(Looper.java:294)
    at android.app.ActivityThread.main(ActivityThread.java:8225)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:573)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1058)

App information

  • ID: com.nextcloud.android.beta
  • Version: 20240827
  • Build flavor: versionDev

Device information

  • Brand: AGM
  • Device: AGM_PAD_P2
  • Model: AGM_PAD_P2
  • Id: UP1A.231005.007
  • Product: AGM_PAD_P2_EU

Firmware

  • SDK: 34
  • Release: 14
  • Incremental: 265180

@joshtrichards joshtrichards changed the title NullPointer in open Details NullPointer in open Details: java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference Sep 22, 2024
@joshtrichards joshtrichards changed the title NullPointer in open Details: java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference NPE: java.lang.NullPointerException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference Sep 22, 2024
@alperozturk96 alperozturk96 self-assigned this Sep 23, 2024
@alperozturk96
Copy link
Collaborator

Thanks for the report. Could you try with this PR: #13612 ?

@mrwsl
Copy link

mrwsl commented Sep 24, 2024

I downloaded the app and can confirm that the PR is working for me.

@CarlosCastaneda
Copy link

The same to me #13608, working as expected👍

@joshtrichards joshtrichards pinned this issue Oct 7, 2024
@joshtrichards joshtrichards unpinned this issue Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants