apache / apache/netbeans

NPE in Cordova Android project

Open
#4,573 0 comments 0 reactions 0 assignees View on GitHub
kind:bug needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 14

### What happened

java.lang.NullPointerException
at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
at java.base/java.util.Properties.put(Properties.java:1329)
at org.netbeans.modules.cordova.platforms.android.AndroidDevice.addProperties(AndroidDevice.java:161)
at org.netbeans.modules.cordova.CordovaPerformer.properties(CordovaPerformer.java:353)
at org.netbeans.modules.cordova.CordovaPerformer.access$200(CordovaPerformer.java:73)
at org.netbeans.modules.cordova.CordovaPerformer$1.run(CordovaPerformer.java:206)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

### How to reproduce

I have a new new working Cordova project which builds and runs in an Android emulator on a personal laptop (and does still work properly today). For reasons outside the scope of this message, I can not check this project into GitHub from the laptop, but instead I need to copy the code to another computer and check it in from there. As I stated earlier, this is a new project which has never been checked in before so when I moved it to the other computer I wanted to start cutting the project down trying to eliminate all the auto-generated files so as to have a clean set of minimally needed files checked into GitHub.

All references henceforth to “computer” means the computer used to check in code.

1. I moved a first pass cutdown set of code to the computer and it built fine. Wahoo!
2. I closed NetBeans and deleted the project directory to prepare for a second pass of cutting the code down even further. [I believe the project directory deletion is ultimately what caused the issue.]
3. I copied the new set of minimal code to the computer but when I tried to build it I got the error documented above.
4. I closed NetBeans and deleted the project directory to go back to my original set of code.
5. I copied the original set of code to the computer and tried to build it and I am still seeing the same error.
6. I closed NetBeans, deleted the project directory, and uninstalled/reinstalled NetBeans.
7. I copied the original set of code to the computer and again I’m still seeing the error.

Something has gotten corrupted by me merely deleting my project directory (with NetBeans closed)!

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Windows 11

### JDK

11.0.15.1

### Apache NetBeans packaging

Apache NetBeans provided installer

### Anything else

_No response_

### Are you willing to submit a pull request?

No

### Code of Conduct

Yes

Contributor guide

Open the contributing guide

Research direction

Start by examining the stack trace at org.netbeans.modules.cordova.platforms.android.AndroidDevice.addProperties, especially AndroidDevice.java:161, and trace its caller in CordovaPerformer.java:353. Reproduce the build with the reported Windows 11, JDK 11, and NetBeans 14 setup if possible; done means the Cordova project builds without the NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.