harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang" <zhanghuang...@gmail.com>
Subject [classlib][sql] SerialJavaObject constructor throws SerialException when the object is unserializable?
Date Sun, 12 Nov 2006 16:30:55 GMT
Hi folks,

I'm confused by javax.sql.rowset.serial.SerialJavaObject spec. The spec of
SerialJavaObject constructor says "throws SerialException if the object is
found to be unserializable". It also mentions "Static or transient fields
cannot be serialized; an attempt to serialize them will result in a
SerialException object being thrown. ". Does it mean to throw
SerialException if the object doesn't implement Serializable or it contains
static/transient fields? I tried some tests[1], but SerialException is never
thrown. Am I missing something? Thank you in advance for your help!

[1] SerialJavaObject constructor test case:
 public void test_Constructor() throws Exception {
  Object obj = new NonSerializableClass();
  SerialJavaObject sjo = new SerialJavaObject(obj);
 }

 static class NonSerializableClass {
  public static int i;
  public static Thread t;
  public transient String s;
  NonSerializableClass() {

  }
 }

-- 
Best regards,
Andrew Zhang

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message