MCPcopy Create free account
hub / github.com/BombusMod/BombusMod / loadMidlet

Method loadMidlet

src/main/java/org/microemu/app/Common.java:88–130  ·  view source on GitHub ↗
(Class midletClass, MIDletAccess previousMidletAccess)

Source from the content-addressed store, hash-verified

86 }
87
88 private MIDlet loadMidlet(Class midletClass, MIDletAccess previousMidletAccess) {
89 try {
90 if (previousMidletAccess != null) {
91 previousMidletAccess.destroyApp(true);
92 }
93 } catch (Throwable e) {
94 logger.error("Unable to destroy MIDlet", e);
95 }
96
97 MIDletContext context = new MIDletContext();
98 MIDletBridge.setThreadMIDletContext(context);
99 MIDletBridge.getRecordStoreManager().init(MIDletBridge.getMicroEmulator());
100 try {
101 MIDlet m;
102
103 final String errorTitle = "Error starting MIDlet";
104
105 try {
106 Object object = midletClass.newInstance();
107 m = (MIDlet) object;
108 } catch (Throwable e) {
109 logger.error("Unable to create MIDlet", e);
110 MIDletBridge.destroyMIDletContext(context);
111 return null;
112 }
113
114 try {
115 if (context.getMIDlet() != m) {
116 throw new Error("MIDlet Context corrupted");
117 }
118
119 return m;
120 } catch (Throwable e) {
121 logger.debug("Unable to start MIDlet", e);
122 MIDletBridge.destroyMIDletContext(context);
123 return null;
124 }
125
126 } finally {
127 MIDletBridge.setThreadMIDletContext(null);
128 }
129
130 }
131
132 public boolean platformRequest(final String URL) {
133 return emulatorContext.platformRequest(URL);

Callers 1

initMIDletMethod · 0.95

Calls 7

getRecordStoreManagerMethod · 0.95
getMicroEmulatorMethod · 0.95
destroyMIDletContextMethod · 0.95
getMIDletMethod · 0.95
initMethod · 0.65
destroyAppMethod · 0.45

Tested by

no test coverage detected