Revision: 2834
http://sourceforge.net/p/swingme/code/2834
Author: yuranet
Date: 2025-03-04 21:55:50 +0000 (Tue, 04 Mar 2025)
Log Message:
-----------
fix for logging to always work
Modified Paths:
--------------
me4se/src/javax/microedition/midlet/ApplicationManager.java
me4se/src/org/me4se/JadFile.java
me4se/src/org/me4se/MIDletRunner.java
me4se/src/org/me4se/System.java
me4se/src/org/me4se/scm/ScmWrapper.java
Modified: me4se/src/javax/microedition/midlet/ApplicationManager.java
===================================================================
--- me4se/src/javax/microedition/midlet/ApplicationManager.java 2025-03-03 00:21:05 UTC (rev 2833)
+++ me4se/src/javax/microedition/midlet/ApplicationManager.java 2025-03-04 21:55:50 UTC (rev 2834)
@@ -76,6 +76,8 @@
public class ApplicationManager {
+ private static final Logger logger = Logger.getLogger(ApplicationManager.class.getName());
+
public static final String ME4SE_VERSION_NUMBER = "3.1.9";
static final int[] PNG_SIGNATURE = { 137, 80, 78, 71, 13, 10, 26, 10 };
@@ -263,7 +265,7 @@
String type = sb.toString();
- // System.out.println("PNG Chunk: "+len+" "+sb.toString());
+ // logger.info("PNG Chunk: "+len+" "+sb.toString());
if (sb.toString().equals("IHDR")) {
dos.writeInt(len);
@@ -324,7 +326,7 @@
public BufferedImage getImage(String fileName) throws IOException {
- // System.out.println(imageCache);
+ // logger.info(imageCache);
BufferedImage img = (BufferedImage) imageCache.get(fileName);
@@ -382,7 +384,7 @@
}
public static InputStream openInputStream(Class clazz, String name) {
- // System.out.println("*** openInputStream(" + clazz + ", " + name + ")");
+ // logger.info("*** openInputStream(" + clazz + ", " + name + ")");
if (name.startsWith("/")) {
try {
@@ -399,7 +401,7 @@
s = p.getName().replace('.', '/');
}
- // System.out.println(s);
+ // logger.info(s);
return ApplicationManager.manager.openInputStream(s + "/" + name);
} catch (IOException ex) {
@@ -440,10 +442,10 @@
fileName = concatPath(documentBase, fileName);
- // System.out.println ("concatenated: "+fileName);
+ // logger.info("concatenated: "+fileName);
if (isUrl(fileName)) {
- // System.out.println("opening url: " + fileName);
+ // logger.info("opening url: " + fileName);
return new URL(fileName).openStream();
}
// try resource
@@ -454,7 +456,7 @@
*/
InputStream result = null;
- // System.out.println("Try to use activeClass ...");
+ // logger.info("Try to use activeClass ...");
if (activeClass != null) {
result = activeClass.getResourceAsStream(fileName);
if (result != null)
@@ -461,7 +463,7 @@
return result;
}
- // System.out.println("Try to use classLoader ...");
+ // logger.info("Try to use classLoader ...");
if (classLoader != null) {
result = classLoader.getResourceAsStream(fileName);
if (result != null)
@@ -468,7 +470,7 @@
return result;
}
- // System.out.println("Try to use ApplicationManager ...");
+ // logger.info("Try to use ApplicationManager ...");
result = ApplicationManager.class.getResourceAsStream(fileName);
if (result != null)
return result;
@@ -477,12 +479,12 @@
}
// file otherwise
- // System.out.println("opening file: " + fileName);
+ // logger.info("opening file: " + fileName);
if (applet == null && new File(fileName).exists()) {
return new FileInputStream(fileName);
} else {
- System.out.println("WARNING: Resource not found: " + fileName);
+ logger.info("WARNING: Resource not found: " + fileName);
return null;
}
}
@@ -578,12 +580,12 @@
java.lang.System.setProperty("sun.awt.noerasebackground","true");
}
catch(Throwable th) { }
-// System.out.println("Container: " + container);
+// logger.info("Container: " + container);
this.properties = properties == null ? new Properties() : properties;
// TODO Version Number of ME4SE !
- System.out.println("---=== ME4SE Version " + ME4SE_VERSION_NUMBER + " ===---");
+ logger.info("---=== ME4SE Version " + ME4SE_VERSION_NUMBER + " ===---");
// if (manager != null)
// manager.destroy(true, true); // notify, may not exit, killall
@@ -658,24 +660,24 @@
destroy(true, true); // notify, mayExit, killAll
}
public void windowDeactivated(WindowEvent e) {
- //Logger.getLogger(ApplicationManager.class.getName()).info("STOPING " + activePlayers);
+ //logger.info("STOPING " + activePlayers);
pausedPlayers = (Player[])activePlayers.toArray(new Player[0]);
for (int i = 0; i < pausedPlayers.length; i++) {
try {
pausedPlayers[i].stop();
} catch (Exception ex) {
- Logger.getLogger(ApplicationManager.class.getName()).log(Level.SEVERE, "can not stop", ex);
+ logger.log(Level.SEVERE, "can not stop", ex);
}
}
}
public void windowActivated(WindowEvent e) {
- //Logger.getLogger(ApplicationManager.class.getName()).info("STARTING " + Arrays.asList(pausedPlayers));
+ //logger.info("STARTING " + Arrays.asList(pausedPlayers));
if (pausedPlayers != null) {
for (int i = 0; i < pausedPlayers.length; i++) {
try {
pausedPlayers[i].start();
} catch (Exception ex) {
- Logger.getLogger(ApplicationManager.class.getName()).log(Level.SEVERE, "can not start", ex);
+ logger.log(Level.SEVERE, "can not start", ex);
}
}
}
@@ -756,11 +758,11 @@
String name = tokens.nextToken();
try {
Initializer init = (Initializer) instantiate(name);
- System.out.println("initializer parameter found for " + name + ": "
+ logger.info("initializer parameter found for " + name + ": "
+ init.getClass());
init.initialize(this);
} catch (ClassNotFoundException e) {
- System.out.println("cannot initialize module: " + name);
+ logger.info("cannot initialize module: " + name);
} catch (Exception e) {
e.printStackTrace();
}
@@ -773,11 +775,11 @@
try {
Initializer init = (Initializer) instantiate(name);
- System.out.println("initializer found for " + name + ": "
+ logger.info("initializer found for " + name + ": "
+ init.getClass());
init.initialize(this);
} catch (ClassNotFoundException e) {
- System.out.println("cannot initialize module: " + name);
+ logger.info("cannot initialize module: " + name);
} catch (Exception e) {
e.printStackTrace();
}
@@ -807,7 +809,7 @@
try {
jadFile.load(jadUrl);
} catch (Exception e) {
- System.err.println("JAD access error: " + e
+ logger.warning("JAD access error: " + e
+ "; trying midlet/jam property");
}
}
@@ -830,15 +832,15 @@
} else {
Enumeration e = this.getClass().getClassLoader().getResources(
"META-INF/MANIFEST.MF");
- // System.out.println("Manifest Enumeration has elements:
+ // logger.info("Manifest Enumeration has elements:
// "+e.hasMoreElements());
while (e.hasMoreElements()) {
URL url = (URL) e.nextElement();
- // System.out.println("Examining Manifest: "+url);
+ // logger.info("Examining Manifest: "+url);
manifest.load(url.openStream());
// for(int i = 0; i < Math.min(15, manifest.size()); i++){
- // System.out.println(" - "+manifest.get(i));
+ // logger.info(" - "+manifest.get(i));
// }
//
if (manifest.getMIDletCount() != 0) {
@@ -847,7 +849,7 @@
}
}
} catch (Exception e) {
- System.out.println("Error while reading/searching MANIFEST.MF");
+ logger.info("Error while reading/searching MANIFEST.MF");
e.printStackTrace();
}
@@ -921,7 +923,7 @@
v = (int) ((steps - 1) * v + 0.5); // 0..step
v *= 255.0 / (steps - 1); // 0..255
- // System.out.println("discretize ("+value+","+steps+")="+(int)v);
+ // logger.info("discretize ("+value+","+steps+")="+(int)v);
return (int) v;
}
@@ -990,7 +992,7 @@
* @param killAll - true if the event comes from the [x] in the window, and signals Everything must be closed
*/
public void destroy(boolean notifyMIDlet, boolean killAll) {
- //System.out.println("[ME4SE] destroy(notifyMIDlet="+notifyMIDlet+",killAll="+killAll+")");
+ // logger.info("[ME4SE] destroy(notifyMIDlet="+notifyMIDlet+",killAll="+killAll+")");
// imageCache = new Hashtable();
//ApplicationManager manager = ApplicationManager.manager;
@@ -1215,7 +1217,7 @@
public int getDeviceKeyCode(String buttonName) {
- // System.out.println("getKeyCode: "+buttonName);
+ // logger.info("getKeyCode: "+buttonName);
int i = getIntProperty("keycode." + buttonName, -12345);
if (i != -12345)
return i;
Modified: me4se/src/org/me4se/JadFile.java
===================================================================
--- me4se/src/org/me4se/JadFile.java 2025-03-03 00:21:05 UTC (rev 2833)
+++ me4se/src/org/me4se/JadFile.java 2025-03-04 21:55:50 UTC (rev 2834)
@@ -188,7 +188,7 @@
load(new URL(url).openStream());
} else {
if (new File(url).exists()) {
- System.out.println("Loading JAD from file : " + url);
+ java.lang.System.out.println("Loading JAD from file : " + url);
FileInputStream fin = new FileInputStream(url);
try {
load(fin);
@@ -198,7 +198,7 @@
} else {
InputStream in = getClass().getResourceAsStream(url);
if (in != null) {
- System.out.println("Loading JAD from classpath : " + url);
+ java.lang.System.out.println("Loading JAD from classpath : " + url);
load(in);
} else {
throw new IOException("\"" + url
Modified: me4se/src/org/me4se/MIDletRunner.java
===================================================================
--- me4se/src/org/me4se/MIDletRunner.java 2025-03-03 00:21:05 UTC (rev 2833)
+++ me4se/src/org/me4se/MIDletRunner.java 2025-03-04 21:55:50 UTC (rev 2834)
@@ -38,7 +38,7 @@
*/
public void start() {
- System.out.println("Applet start was called.");
+ java.lang.System.out.println("Applet start was called.");
startCount++;
@@ -47,7 +47,7 @@
} else {
boolean restartable = ApplicationManager.getBooleanProperty("me4se.restartable", true);
- System.out
+ java.lang.System.out
.println("Calling ApplicationManager.manager.start(); restartable: "
+ restartable + " start count: " + startCount);
@@ -83,7 +83,7 @@
boolean restartable = ApplicationManager.getBooleanProperty("me4se.restartable", true);
- System.out.println("Applet stop() was called. Restartable: " + restartable);
+ java.lang.System.out.println("Applet stop() was called. Restartable: " + restartable);
if (restartable) {
ApplicationManager.getInstance().pause();
@@ -96,7 +96,7 @@
*/
public void destroy() {
- System.out.println("Applet destroy() was called.");
+ java.lang.System.out.println("Applet destroy() was called.");
ApplicationManager.getInstance().destroy(true, true);
}
Modified: me4se/src/org/me4se/System.java
===================================================================
--- me4se/src/org/me4se/System.java 2025-03-03 00:21:05 UTC (rev 2833)
+++ me4se/src/org/me4se/System.java 2025-03-04 21:55:50 UTC (rev 2834)
@@ -11,11 +11,17 @@
*/
public class System {
+ /**
+ * @deprecated do not use as not captured by grasshopper
+ */
public static PrintStream err = java.lang.System.err;
+ /**
+ * @deprecated do not use as not captured by grasshopper
+ */
public static PrintStream out = java.lang.System.out;
-
+
public static Properties properties = new Properties();
-
+
public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length) {
java.lang.System.arraycopy(src, srcPos, dest, destPos, length);
}
Modified: me4se/src/org/me4se/scm/ScmWrapper.java
===================================================================
--- me4se/src/org/me4se/scm/ScmWrapper.java 2025-03-03 00:21:05 UTC (rev 2833)
+++ me4se/src/org/me4se/scm/ScmWrapper.java 2025-03-04 21:55:50 UTC (rev 2834)
@@ -270,7 +270,7 @@
g2.scale(scale, scale); // we have to scale the graphics as a pixel location on the image may not align exactly with a dip location
int x1 = (int) (clip.x/scale),y1 = (int) (clip.y/scale),x2 = (int) ((clip.x+clip.width)/scale),y2 = (int) ((clip.y+clip.height)/scale);
if (!g.drawImage(offScreenCache, x1, y1, x2, y2, x1, y1, x2, y2, this)) {
- System.out.println("DRAWIMAGE WAS RETURNING FALSE!!!");
+ java.lang.System.out.println("DRAWIMAGE WAS RETURNING FALSE!!!");
}
g2.scale(1 / scale, 1 / scale);
// g.drawImage(offScreen, 0, 0, this);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|