google-code-export / the-missing-android-xml-junit-test-runner

Automatically exported from code.google.com/p/the-missing-android-xml-junit-test-runner

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Null Pointer exception if junitOutputDirectory do not exist

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?
1. specify a custom junitOutputDirectory which do not exist in file system 
2. start the unit tests
3. Null pointer exception

What is the expected output? What do you see instead?
I expect the soft to create the output directory if it do not exist.
Instead the soft has crash while trying to delete older files.

What version of the product are you using? On what operating system?
the-missing-android-xml-junit-test-runner V1.1

I included a patch file which check if the directory exist (and create it if 
not) before calling deleteOldFiles method. I also added a null check in the 
method.

Please provide any additional information below.

Stacktrace:
05-06 10:04:22.168 D/PolideaInstrumentationTestRunner(  251): Creating the Test 
Runner with arguments: [junitOutputDirectory]
05-06 10:04:22.168 D/PolideaInstrumentationTestRunner(  251): Test runner is 
running with the following parameters:
05-06 10:04:22.168 D/PolideaInstrumentationTestRunner(  251): 
junitOutputDirectory: /sdcard/test
05-06 10:04:22.168 D/PolideaInstrumentationTestRunner(  251): 
junitOutputFilePostfix: -TEST.xml
05-06 10:04:22.168 D/PolideaInstrumentationTestRunner(  251): 
junitNoPackagePrefix: NO_PACKAGE
05-06 10:04:22.168 D/PolideaInstrumentationTestRunner(  251): junitSplitLevel: 
package
05-06 10:04:22.168 D/PolideaInstrumentationTestRunner(  251): 
junitSingleFileName: ALL-TEST.xml
05-06 10:04:22.168 D/PolideaInstrumentationTestRunner(  251): Deleting old files
05-06 10:04:22.178 D/PolideaInstrumentationTestRunner(  251): Deleting: null
05-06 10:04:22.188 D/AndroidRuntime(  251): Shutting down VM
05-06 10:04:22.188 W/dalvikvm(  251): threadid=3: thread exiting with uncaught 
exception (group=0x4001b188)
05-06 10:04:22.188 E/AndroidRuntime(  251): Uncaught handler: thread main 
exiting due to uncaught exception
05-06 10:04:22.508 E/AndroidRuntime(  251): java.lang.RuntimeException: 
Exception thrown in onCreate() of 
ComponentInfo{com.jeuxvideo/pl.polidea.instrumentation.PolideaInstrumentationTes
tRunner}: java.lang.NullPointerException
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
android.app.ActivityThread.handleBindApplication(ActivityThread.java:3985)
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
android.app.ActivityThread.access$2900(ActivityThread.java:119)
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1901)
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
android.os.Looper.loop(Looper.java:123)
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
android.app.ActivityThread.main(ActivityThread.java:4363)
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
java.lang.reflect.Method.invokeNative(Native Method)
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
java.lang.reflect.Method.invoke(Method.java:521)
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
dalvik.system.NativeStart.main(Native Method)
05-06 10:04:22.508 E/AndroidRuntime(  251): Caused by: 
java.lang.NullPointerException
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
pl.polidea.instrumentation.PolideaInstrumentationTestRunner.deleteOldFiles(Polid
eaInstrumentationTestRunner.java:449)
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
pl.polidea.instrumentation.PolideaInstrumentationTestRunner.onCreate(PolideaInst
rumentationTestRunner.java:427)
05-06 10:04:22.508 E/AndroidRuntime(  251):     at 
android.app.ActivityThread.handleBindApplication(ActivityThread.java:3982)
05-06 10:04:22.508 E/AndroidRuntime(  251):     ... 10 more
05-06 10:04:22.528 I/Process (   66): Sending signal. PID: 251 SIG: 3
05-06 10:04:22.528 I/dalvikvm(  251): threadid=7: reacting to signal 3
05-06 10:04:22.528 E/dalvikvm(  251): Unable to open stack trace file 
'/data/anr/traces.txt': Permission denied

Original issue reported on code.google.com by olivier....@gmail.com on 6 May 2011 at 9:43

Attachments:

Thanks a lot. I reviewed and applied your patch and bumped the version to 1.2. 
Thanks a lot for help!

Original comment by ja...@potiuk.com on 6 May 2011 at 12:21

  • Changed state: Fixed