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 77647 - J2MEUNIT - can't run tests because of Security Exception
Summary: J2MEUNIT - can't run tests because of Security Exception
Status: VERIFIED FIXED
Alias: None
Product: javame
Classification: Unclassified
Component: JUnit (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: luky
URL:
Keywords:
: 83748 (view as bug list)
Depends on: 84326
Blocks: 77184
  Show dependency tree
 
Reported: 2006-06-09 17:23 UTC by Martin Ryzl
Modified: 2007-10-16 23:00 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Ryzl 2006-06-09 17:23:09 UTC
All tests fail with SecurityException because it is not allowed to create a new
instance of MIDlet.

1) testcommandAction(hello.HelloMidletTest)
java.lang.SecurityException: Application not authorized to access the restricted API
        at
com.sun.midp.security.SecurityToken.checkIfPermissionAllowed(SecurityToken.java:170)
        at
com.sun.midp.security.SecurityToken.checkIfPermissionAllowed(SecurityToken.java:145)
        at
com.sun.midp.midletsuite.MIDletSuiteImpl.checkIfPermissionAllowed(MIDletSuiteImpl.java:281)
        at com.sun.midp.midlet.MIDletState.<init>(MIDletState.java:301)
        at javax.microedition.midlet.MIDletProxy.<init>(MIDletProxy.java:33)
        at javax.microedition.midlet.MIDlet.<init>(MIDlet.java:70)
        at hello.HelloMidlet.<init>(HelloMidlet.java:19)
        at hello.HelloMidletTest.testcommandAction(HelloMidletTest.java:32)
        at hello.HelloMidletTest$1.run(HelloMidletTest.java:154)
        at j2meunit.framework.TestCase.runTest(+18)
        at j2meunit.framework.TestCase.runBare(+8)
        at j2meunit.framework.TestResult$1.protect(+7)
        at j2meunit.framework.TestResult.runProtected(+6)
        at j2meunit.framework.TestResult.run(+21)
        at j2meunit.framework.TestCase.run(+10)
        at j2meunit.framework.TestSuite.run(+41)
        at j2meunit.framework.TestSuite.run(+41)
        at j2meunit.midletui.TestRunner.doRun(+33)
        at j2meunit.midletui.TestRunner$1.run(+11)
Comment 1 Jiri Prazak 2006-06-20 14:22:01 UTC
This issue is caused by the fact that you cannot create new instances of MIDlet
classes, only the AMS can do that.  This means that we cannot create regular
j2meunit tests for MIDlet classes.  The workaround is to generate a new MIDlet
TestRunner class based on the tested MIDlet class inside which the tests will
run.  This is not a pretty hack and as such we should consider this as an
advanced feature for 6.0 or we should skip it completely.

For the 55 release all MIDlet classes will be filtered out from the test
generation que.
Comment 2 Lukas Hasik 2006-06-27 13:29:44 UTC
verified with jars 0627, Midlets are filtered out.
Comment 3 Lukas Hasik 2007-06-06 10:50:12 UTC
the general policy for issuezilla is "do not use the LATER/REMIND" resolution.
(http://qa.netbeans.org/bugzilla/issue-lifecycle.html).
These states are confusing and should be removed from issuezilla (unfortunately
colabnet doesn't know how to do it). Bug shouldn't be in RESOLVED state until it
is really resolved. IMO, that's not the case of LATER/REMIND.

Please, reevaluate the issue
1, When you don't plan to fix the issue close it as WONTFIX
2, you don't want to fix it now -> use TM=future

thank you for understanding
Comment 4 Adam Sotona 2007-08-21 15:37:32 UTC
*** Issue 83748 has been marked as a duplicate of this issue. ***
Comment 5 Adam Sotona 2007-08-21 15:39:39 UTC
*** Issue 83748 has been marked as a duplicate of this issue. ***
Comment 6 luky 2007-09-03 11:02:58 UTC
Can not add this feature as the support is still missing
Comment 7 luky 2007-10-03 15:49:06 UTC
Fixed
Checking in TestCreator.java;
/cvs/mobility/j2meunit/src/org/netbeans/modules/mobility/j2meunit/TestCreator.java,v  <--  TestCreator.java
new revision: 1.16; previous revision: 1.15
done
Checking in J2MEUnitPlugin.java;
/cvs/mobility/j2meunit/src/org/netbeans/modules/mobility/j2meunit/J2MEUnitPlugin.java,v  <--  J2MEUnitPlugin.java
new revision: 1.4; previous revision: 1.3
done
Checking in TestUtils.java;
/cvs/mobility/j2meunit/src/org/netbeans/modules/mobility/j2meunit/TestUtils.java,v  <--  TestUtils.java
new revision: 1.12; previous revision: 1.11
done
Comment 8 Lukas Hasik 2007-10-16 23:00:57 UTC
verified in 20071016 build

test skeletons are not generated for midlets