You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rw...@apache.org on 2003/02/13 13:12:51 UTC
cvs commit: jakarta-commons-sandbox/jux/src/test/org/apache/commons/jux TestStringObjectTestCase.java
rwaldhoff 2003/02/13 04:12:51
Modified: jux/src/test/org/apache/commons/jux
TestStringObjectTestCase.java
Log:
add a simple diagnostic test to probe the gump failure
Revision Changes Path
1.2 +53 -2 jakarta-commons-sandbox/jux/src/test/org/apache/commons/jux/TestStringObjectTestCase.java
Index: TestStringObjectTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jux/src/test/org/apache/commons/jux/TestStringObjectTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestStringObjectTestCase.java 4 Feb 2003 23:26:29 -0000 1.1
+++ TestStringObjectTestCase.java 13 Feb 2003 12:12:50 -0000 1.2
@@ -56,7 +56,11 @@
*/
package org.apache.commons.jux;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
import java.io.InputStream;
+import java.net.URL;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -102,6 +106,53 @@
InputStream stream = this.getClass().getResourceAsStream("String.ser");
assertNotNull(stream);
return stream;
+ }
+
+ // some diagnostics for the gump failure, which I can't
+ // seem to recreate in any other environment (even
+ // running gump locally)
+ public void testDiagnose() throws Exception {
+ System.out.println("");
+ System.out.println("java.home: " + System.getProperty("java.home"));
+ System.out.println("java.version: " + System.getProperty("java.version"));
+ System.out.println("java.vendor: " + System.getProperty("java.vendor"));
+ System.out.println("java.class.path: " + System.getProperty("java.class.path"));
+ System.out.println("");
+ URL url = this.getClass().getResource("String.ser");
+ System.out.println("getResource(\"String.ser\"): " + url);
+ System.out.println("url.getPath(): " + url.getPath());
+ File file = new File(url.getPath());
+ System.out.println("File.exists()? " + file.exists());
+ System.out.println("File.canRead()? " + file.canRead());
+
+ System.out.println("");
+ System.out.println("From file:");
+ if(file.exists()) {
+ DataInputStream din = null;
+ try {
+ din = new DataInputStream(new FileInputStream(file));
+ System.out.println("magic number: " + din.readShort());
+ System.out.println("(expect : " + (short)0xaced + ")");
+ System.out.println("version: " + din.readShort());
+ System.out.println("(expect: " + 5 + ")");
+ } finally {
+ try { din.close(); } catch(Exception e) { }
+ }
+ }
+
+ System.out.println("");
+ System.out.println("From resource:");
+ DataInputStream din = null;
+ try {
+ din = new DataInputStream(getSerializedCanonicalInstanceStream());
+ System.out.println("magic number: " + din.readShort());
+ System.out.println("(expect : " + (short)0xaced + ")");
+ System.out.println("version: " + din.readShort());
+ System.out.println("(expect: " + 5 + ")");
+ } finally {
+ try { din.close(); } catch(Exception e) { }
+ }
+
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org