Is Java6 required for jme2 now?

I just noticed that commit r4336 of src/com/jme/util/export/xml/DOMInputCapsule.java seems to use a Java6-only constructor for IOException:



No new functionality.

Fixed sloppy exception handling which created duplicate exception stacks and defeats compiler checking for customizations.

Allow for more standard XML usage by using 'size' attr for (now) optional validation and 'id' attr for its standardized purpose.


r4336 | christoph.luder | 2009-05-04 05:57:01 +0900 (Mon, 04 May 2009) | 1 line

Is this an oversight or a change?  For 32bit mac users this will be a little painful since the only java6 is via soylatte (which uses X11)...

-Tom

That would be an oversight. jME still targets 1.5 (mostly because of the mac issue)



I assume christoph wil fix it now? :slight_smile:

I think this is a safe patch since a no-op IOException should not call initCause (initCause can only be called once).  The patch certainly allows things to run again against Java 5 and if I am correct about initCause it should solve the original problem that christof was trying to solve (stacktrace info maintained).



-Tom


Index: src/com/jme/util/export/xml/DOMInputCapsule.java
===================================================================
--- src/com/jme/util/export/xml/DOMInputCapsule.java   (revision 4483)
+++ src/com/jme/util/export/xml/DOMInputCapsule.java   (working copy)
@@ -123,9 +123,13 @@
         try {
             return Byte.parseByte(currentElem.getAttribute(name));
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -158,9 +162,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -201,9 +209,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -215,9 +227,13 @@
                 ret = Integer.parseInt(s);
             }
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
         return ret;
     }
@@ -251,9 +267,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -297,9 +317,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -311,9 +335,13 @@
                 ret = Float.parseFloat(s);
             }
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
         return ret;
     }
@@ -347,7 +375,9 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -378,9 +408,13 @@
             }
             return tmp;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -389,9 +423,13 @@
         try {
             ret = Double.parseDouble(currentElem.getAttribute(name));
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
         return ret;
     }
@@ -425,9 +463,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -467,9 +509,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -478,9 +524,13 @@
         try {
             ret = Long.parseLong(currentElem.getAttribute(name));
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
         return ret;
     }
@@ -514,9 +564,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -556,9 +610,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -568,9 +626,13 @@
             if (attribute == null || attribute.length() == 0) { return defVal; }
             return Short.parseShort(attribute);
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -603,9 +665,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -646,9 +712,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -660,7 +730,9 @@
                 ret = Boolean.parseBoolean(s);
             }
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
         return ret;
     }
@@ -694,7 +766,9 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -734,9 +808,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -745,7 +823,9 @@
         try {
             ret = decodeString(currentElem.getAttribute(name));
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
         return ret;
     }
@@ -785,9 +865,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -827,9 +911,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -847,9 +935,13 @@
             }
             ret = set;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
         return ret;
     }
@@ -884,7 +976,9 @@
             } catch (IOException ioe) {
                 throw ioe;
             } catch (Exception e) {
-                throw new IOException(e);
+                IOException io = new IOException();
+                io.initCause(e);
+                throw io;
             }
         }
         return ret;
@@ -1004,7 +1098,9 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (Exception e) {
-            throw new IOException(e);
+            IOException io = new IOException();
+            io.initCause(e);
+            throw io;
         }
     }
 
@@ -1036,7 +1132,9 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (Exception e) {
-            throw new IOException(e);
+            IOException io = new IOException();
+            io.initCause(e);
+            throw io;
         }
     }
 
@@ -1067,7 +1165,9 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (Exception e) {
-            throw new IOException(e);
+            IOException io = new IOException();
+            io.initCause(e);
+            throw io;
         }
     }
 
@@ -1102,9 +1202,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -1136,7 +1240,9 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (Exception e) {
-            throw new IOException(e);
+            IOException io = new IOException();
+            io.initCause(e);
+            throw io;
         }
     }
 
@@ -1169,9 +1275,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -1262,9 +1372,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -1292,9 +1406,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -1322,9 +1440,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -1352,9 +1474,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
     }
 
@@ -1385,9 +1511,13 @@
         } catch (IOException ioe) {
             throw ioe;
         } catch (NumberFormatException nfe) {
-            throw new IOException(nfe);
+            IOException io = new IOException();
+            io.initCause(nfe);
+            throw io;
         } catch (DOMException de) {
-            throw new IOException(de);
+            IOException io = new IOException();
+            io.initCause(de);
+            throw io;
         }
    }
 
@@ -1400,7 +1530,9 @@
                 ret = Enum.valueOf(enumType, eVal);
             }
         } catch (Exception e) {
-            throw new IOException(e);
+            IOException io = new IOException();
+            io.initCause(e);
+            throw io;
         }
         return ret;      
    }

hmm,

revision 4336 was the warning cleanup, it has nothing to do with the DOMInputCapsule change you refer to.

http://code.google.com/p/jmonkeyengine/source/detail?r=4336

So, I'm not guilty ! :slight_smile:



Blaine is the one to blame  :wink:

http://code.google.com/p/jmonkeyengine/source/diff?spec=svn4468&r=4468&format=side&path=/trunk/src/com/jme/util/export/xml/DOMInputCapsule.java



And of course jme needs to stay java 1.5 Compatible until java 1.6 is widely accepted (yeah right in 10 years …)

Please post the patch in <code> tags.

Oops.  Sorry Christoph.  Late night and I must have been squinting at svn log :slight_smile:



Sorry about lack of code tags too…

I think with your change, the Exceptions detailMessage is not set anymore.

So to have the same exception as before we also would need to pass the message to the IOExceptions constructor.



Its fixed and committed now.

Thanks for covering for me, Core-Dump.  As PM'd, I've enhanced my build system to always test 1.5 before commiting henceforth.



Good code mods in rev. 4485.