This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 268404

Summary: NPE at org.netbeans.modules.j2me.common.ant.CopyLibletsTask.execute(CopyLibletsTask.java:93)
Product: javame Reporter: afarber
Component: ProjectAssignee: Roman Svitanic <rsvitanic>
Status: NEW ---    
Severity: normal CC: emi
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description afarber 2016-10-07 11:21:36 UTC
I have a bigger ME project (with 2430 Java files) which compiles well with NetBeans 8.0.2 and 8.1, but fails to run with NetBeans 8.2.

Here is the output with "--debug" added to Maven and Ant set to "Debug" level too:

Location: D:\mod\trunk\me-projects\Ocu2MindroidMeIntegration\nbproject\build-impl.xml:463:
-do-jar-copyliblets:
Setting project property: build.classes.dir.resolved -> D:\mod\trunk\me-projects\Ocu2MindroidMeIntegration\build\classes
Set property run.classpath.without.build.classes.dir = D:\mod\trunk\me-projects\MindroidMIDlet\dist\MindroidMIDlet.jar;
Setting project property: run.classpath.without.build.classes.dir -> D:\mod\trunk\me-projects\MindroidMIDlet\dist\MindroidMIDlet.jar;
Class java.util.ArrayList loaded from parent loader (parentFirst)
Class java.lang.Boolean loaded from parent loader (parentFirst)
D:\mod\trunk\me-projects\Ocu2MindroidMeIntegration\nbproject\build-impl.xml:478:
java.lang.NullPointerException
    at org.netbeans.modules.j2me.common.ant.CopyLibletsTask.execute(CopyLibletsTask.java:93)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    at sun.reflect.GeneratedMethodAccessor318.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 2 minutes 51 seconds)
Could not load class (org.apache.tools.ant.taskdefs.repository.MavenRepository) for type mavenrepository
Could not load a dependent class (jdepend/xmlui/JDepend) for type jdepend
Could not load a dependent class (javax/media/jai/PlanarImage) for type image
Could not load class (org.apache.tools.ant.taskdefs.repository.MavenRepository) for type mavenrepository
Could not load a dependent class (jdepend/xmlui/JDepend) for type jdepend
Could not load a dependent class (javax/media/jai/PlanarImage) for type image

Here is the build-impl.xml:

   <target name="-do-jar-copyliblets">
        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
        <pathconvert property="run.classpath.without.build.classes.dir">
            <path path="${run.classpath}"/>
            <map from="${build.classes.dir.resolved}" to=""/>
        </pathconvert>
        <nb-copyliblets runtimeclasspath="${run.classpath.without.build.classes.dir}"/>
    </target>

Is maybe Roman's change http://hg.netbeans.org/main-silver/rev/812b25952dee the culprit?
Comment 1 emi 2016-10-07 11:43:41 UTC
I don't believe that particular commit is the cause because it's just moving some util methods around.

The bug could be the jar.getManifest().getMainAttributes call.

According to the Javadoc, getManifest() might return null if there is none.

https://docs.oracle.com/javase/7/docs/api/java/util/jar/JarFile.html#getManifest()