My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 67 attachment: Common.java.patch (3.0 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Index: microemu-javase/src/main/java/org/microemu/app/Common.java
===================================================================
--- microemu-javase/src/main/java/org/microemu/app/Common.java (revision 2413)
+++ microemu-javase/src/main/java/org/microemu/app/Common.java (working copy)
@@ -602,30 +602,37 @@

Launcher.removeMIDletEntries();

- manifest.clear();
- InputStream is = null;
- try {
- is = midletClassLoader.getResourceAsStream("META-INF/MANIFEST.MF");
- if (is == null) {
- if (!describeJarProblem(url, midletClassLoader)) {
- Message.error("Unable to find MANIFEST in MIDlet jar");
+ // if we get properties via commandline --propertiesjad, then
+ // dont bother with any of this
+ if (propertiesJad == null) {
+ manifest.clear();
+ InputStream is = null;
+ try {
+ is = midletClassLoader.getResourceAsStream("META-INF/MANIFEST.MF");
+ if (is == null) {
+ if (!describeJarProblem(url, midletClassLoader)) {
+ Message.error("Unable to find MANIFEST in MIDlet jar");
+ }
+ return;
}
- return;
- }
- manifest.read(is);
-
- Attributes attributes = manifest.getMainAttributes();
- for (Iterator it = attributes.keySet().iterator(); it.hasNext(); ) {
- Attributes.Name key = (Attributes.Name) it.next();
- String value = (String) attributes.get(key);
- jad.getMainAttributes().put(key, value);
+ manifest.read(is);
+
+ Attributes attributes = manifest.getMainAttributes();
+ for (Iterator it = attributes.keySet().iterator(); it.hasNext(); ) {
+ Attributes.Name key = (Attributes.Name) it.next();
+ String value = (String) attributes.get(key);
+ // jad takes precedence over manifest, so only merge
+ // in attributes that are not already in the jad
+ if (jad.getProperty(key.toString()) == null) {
+ jad.getMainAttributes().put(key, value);
+ }
+ }
+ } catch (IOException e) {
+ Message.error("Unable to read MANIFEST", e);
+ } finally {
+ IOUtils.closeQuietly(is);
}
- } catch (IOException e) {
- Message.error("Unable to read MANIFEST", e);
- } finally {
- IOUtils.closeQuietly(is);
}
-
Launcher.setSuiteName(jad.getSuiteName());

for (Enumeration e = jad.getMidletEntries().elements(); e.hasMoreElements();) {
Powered by Google Project Hosting