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 17575 - NPE in FileUtil while packaging a jar
Summary: NPE in FileUtil while packaging a jar
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 3.x
Hardware: PC Other
: P1 blocker (vote)
Assignee: _ ttran
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-13 00:31 UTC by Dana Bergen
Modified: 2008-12-22 16:06 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Mount these files to get an ejbmodule (5.38 KB, application/octet-stream)
2001-11-13 00:38 UTC, Dana Bergen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dana Bergen 2001-11-13 00:31:50 UTC
Reproducible with EE.  This is high-priority because basic EE functionality is 
broken.  Create an ejb and ejbmodule (or mount attached files) and use Export 
Jar action:

java.lang.NullPointerException
	at org.openide.filesystems.FileUtil.toFile(FileUtil.java:247)
	at org.openide.filesystems.FileUtil.fromFile(FileUtil.java:281)
	at org.netbeans.modules.jarpackager.JarCreator.recognizeFile
(JarCreator.java:679)
	at org.netbeans.modules.jarpackager.JarCreator.createJar
(JarCreator.java:147)
	at org.netbeans.modules.jarpackager.JarCreator.createJar
(JarCreator.java:106)
	at com.sun.forte4j.j2ee.packaging.PackagingUtil.writeJarFile
(PackagingUtil.java:263)
	at com.sun.forte4j.j2ee.ejbmodule.EJBModuleDataObject.writeEJBJar
(EJBModuleDataObject.java:2227)
	at 
com.sun.forte4j.j2ee.ejbmodule.actions.WriteEJBJarAction$1.computeClosure
(WriteEJBJarAction.java:82)
	at org.netbeans.modules.classclosure.ClosureCompiler$Group.start
(ClosureCompiler.java:93)
	at 
org.netbeans.core.compiler.CompilationEngineImpl$CompilerThread$GroupCompiler.ru
n(CompilationEngineImpl.java:257)

The cause is that in FileUtil.fromFile(), a recent code change caused "fo" to 
be referenced before it is tested for null:

>                 if (fileName.indexOf(rootName) == 0) {
>                     String res = fileName.substring(rootName.length()).replace
(File.separatorChar, '/');
>                     FileObject fo = fs.findResource(res);
>                     File       file2Fo = toFile(fo);
>                     if (fo != null && file2Fo != null &&
>                     file.equals(file2Fo.getCanonicalFile()))
>                         list.add(fo);
>                 }
Comment 1 Dana Bergen 2001-11-13 00:38:47 UTC
Created attachment 3372 [details]
Mount these files to get an ejbmodule
Comment 2 rmatous 2001-11-13 09:07:06 UTC
Fixed in trunk (FileUtil.java 1.54)
Comment 3 Marian Mirilovic 2002-10-19 17:34:12 UTC
It seems like works fine now, verified, closed