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 254624 - ExportSnapshotAction.export() calls FileUtil.copyFile with destination folder = null
Summary: ExportSnapshotAction.export() calls FileUtil.copyFile with destination folder...
Status: RESOLVED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Base (show other bugs)
Version: 8.1
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Jiri Sedlacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-23 07:41 UTC by stwr
Modified: 2015-09-04 01:24 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 219367


Attachments
stacktrace (2.30 KB, text/plain)
2015-08-23 07:41 UTC, stwr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description stwr 2015-08-23 07:41:41 UTC
Build: NetBeans IDE Dev (Build 201508200002)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.60-b23, Java(TM) SE Runtime Environment, 1.8.0_60-ea-b25
OS: Windows 7

User Comments:
stwr: Just wanted to export the IDE snapshot (selfsampler) taken during previous problem (slowness).




Stacktrace: 
java.lang.NullPointerException
   at org.openide.filesystems.FileUtil.copyFileImpl(FileUtil.java:573)
   at org.openide.filesystems.FileObject.copy(FileObject.java:163)
   at org.openide.filesystems.AbstractFileObject.copy(AbstractFileObject.java:656)
   at org.openide.filesystems.FileUtil.copyFile(FileUtil.java:640)
   at org.netbeans.modules.profiler.snaptracer.impl.ExportSnapshotAction$2.run(ExportSnapshotAction.java:144)
   at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
Comment 1 stwr 2015-08-23 07:41:43 UTC
Created attachment 155558 [details]
stacktrace
Comment 2 Jaroslav Havlin 2015-08-25 07:34:50 UTC
FileUtil.copyFile called with destFolder argument set to null from o.n.m.profiler.snaptracer.impl.ExportSnapshotAction.export.

Stwr, what file name did you choose for exporting?

Reassigning to profiler/Base. Please evaluate.

Thank you.
Comment 3 stwr 2015-08-25 07:39:43 UTC
Hello,

I did not change the name and I took the suggested one. I believe it was selfsampler.n*** (4-letters extension).
Comment 4 Jaroslav Havlin 2015-08-25 07:45:23 UTC
Do you also remember the directory into which the file was intended to be saved?

Thank you very much.
Comment 5 stwr 2015-08-25 07:51:39 UTC
Yes it was the Desktop. The absolute path does not contain blanks - C:\Users\cendrowiczm\Desktop.
Comment 6 Jaroslav Havlin 2015-08-25 08:21:07 UTC
Another related message from the log:

INFO [org.openide.filesystems.FileUtil]: Parameter file was not normalized. Was ShellFolder: 0x11(class java.io.File) instead of C:\Program Files\NetBeans Dev 201508200002\ShellFolder: 0x11(class java.io.File)
java.lang.IllegalArgumentException: Parameter file was not normalized. Was ShellFolder: 0x11(class java.io.File) instead of C:\Program Files\NetBeans Dev 201508200002\ShellFolder: 0x11(class java.io.File)
	at org.openide.filesystems.FileUtil.toFileObject(FileUtil.java:873)
	at org.netbeans.modules.profiler.snaptracer.impl.ExportSnapshotAction$2.run(ExportSnapshotAction.java:142)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
Comment 7 Jiri Sedlacek 2015-08-27 12:34:33 UTC
Thanks for investigating and providing all the details. The root cause seems to be a bug in JDK which doesn't handle special Windows folders, see JDK-8041437 resolved as wontfix.

Tried several other Save file actions in NetBeans, all failed. Will just workaround the NPE in profiler and show an error dialog instead.
Comment 8 Jiri Sedlacek 2015-08-27 12:43:53 UTC
Similar problem occurs for Snapshots Window | Export selected snapshot.
Comment 9 Tomas Hurka 2015-09-01 11:25:20 UTC
See also issue #219837 and JDK-8003399. This issue is fixed in JDK 9.
Comment 10 Jiri Sedlacek 2015-09-01 12:47:46 UTC
Fixed by http://hg.netbeans.org/profiler-main/rev/d8031aab1faa.
Comment 11 Quality Engineering 2015-09-04 01:24:13 UTC
Integrated into 'main-silver', will be available in build *201509040002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/d8031aab1faa
User: Jiri Sedlacek <jis@netbeans.org>
Log: Bugfix #254624 #254555 - handle invalid filenames/folders when saving files