Summary: | 1GOMQ6H:- NullPointerException when exporting to a jar | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | OTI Support <support> | ||||
Component: | UI | Assignee: | Dani Megert <daniel_megert> | ||||
Status: | RESOLVED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P1 | ||||||
Version: | 1.0 | ||||||
Target Milestone: | --- | ||||||
Hardware: | PC | ||||||
OS: | Windows 2000 | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
OTI Support
2001-12-13 14:16:02 EST
Created attachment 171 [details]
contains 2 .class files and 1 .java file
The stack trace I get is: Log: Thu Dec 13 15:01:21 EST 2001 4 org.eclipse.core.resources 368 Resource /P does not exist. Log: Thu Dec 13 15:04:45 EST 2001 4 org.eclipse.jdt.ui 1 Internal Error java.lang.reflect.InvocationTargetException: java.lang.NullPointerException at java.lang.String.<init>(String.java:210) at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.buildJavaToClassM ap(JarFileExportOperation.java:391) at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.filesOnClasspath( JarFileExportOperation.java:316) at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.exportElement(Jar FileExportOperation.java:210) at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.exportSelectedEle ments(JarFileExportOperation.java:282) at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.singleRun(JarFile ExportOperation.java:520) at org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation.run(JarFileExport Operation.java:502) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.jav a:98) The problem seems to be that inside JarFileExportOperation::buildJavaToClassMap method a call to sourceFileName()is done(String javaName= new String(cfReader.sourceFileName());). The method sourceFileName can return null. See the API on ClassFileReader: /** * (c)1998 Object Technology International. * (c)1998 International Business Machines Corporation. * * Answer the source file name attribute. Return null if there is no source file attribute for the receiver. * * @return char[] */ public char[] sourceFileName() { return this.sourceFileName; } And the null case is not handled properly. Suggest move to JDTUI. I fixed the bug but most likely the result will not be the expected one i.e. the offending class file will not be packaged. How did this file go into the build directory? How generated it?If you have class files which are already there, I suggest to put them into a so-called class folder. This is supported by the JAR file exporter. Available in builds > 20011213 |