| Summary: | SWTUtils.captureScreenshot raises NPE when passed a filename without a directory | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Technology] SWTBot | Reporter: | Laurent Carbonnaux <laurent.carbonnaux> | ||||
| Component: | SWTBot | Assignee: | Project Inbox <swtbot-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | ||||||
| Version: | 2.0.0-dev | ||||||
| Target Milestone: | 2.0.0 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
ERROR SWTBot Build Identifier is : 2.0.0.568-dev-e35 The intent of SWTUtils.captureScreenshot() is to capture the screenshot in a file path specified in the argument. The SCREENSHOT_DIR preference is used only for capturing screenshots of test failure runs. I've put in a fix for the NPE that checks for the getParentFile() before invoking mkdirs() on it. Created attachment 178287 [details]
mylyn/context/zip
|
Build Identifier: 1.0.0.201006061939 bot.captureScreenshot("screenshot.jpeg") make a nullpointer exception. In SWTUtils class line 383 : "new File(fileName).getParentFile().mkdirs();" Since fileName is not concatened with pref SCREENSHOTS_DIR, calling mkdirs on screenshot.jpeg cannot work and raises a nullpointer exception Reproducible: Always Steps to Reproduce: Caused by: java.lang.NullPointerException at org.eclipse.swtbot.swt.finder.utils.SWTUtils.captureScreenshotInternal(SWTUtils.java:383) at org.eclipse.swtbot.swt.finder.utils.SWTUtils.captureScreenshotInternal(SWTUtils.java:367) at org.eclipse.swtbot.swt.finder.utils.SWTUtils.access$0(SWTUtils.java:366) at org.eclipse.swtbot.swt.finder.utils.SWTUtils$3.run(SWTUtils.java:312) at org.eclipse.swtbot.swt.finder.utils.SWTUtils$3.run(SWTUtils.java:1) at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$2.doRun(UIThreadRunnable.java:140) at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$1.run(UIThreadRunnable.java:89) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.lcx.robotframework.rcp.part1.Application.start(Application.java:20) at org.eclipse.swtbot.eclipse.core.UITestApplication.start(UITestApplication.java:54) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) at org.eclipse.equinox.launcher.Main.run(Main.java:1311) at org.eclipse.equinox.launcher.Main.main(Main.java:1287)