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;
}