2007/8/15, Spark Shen <[EMAIL PROTECTED]>:
>
> Hi, all
> Seems JIRA 1568 needs further attention.
>
> Even fixed 1568, harmony still prints some shocking stack trace. The test
> case[1] given by 1568 will reveal this. Although this can be viewed as a
> non-bug difference, print such shocking error message when constructing a
> XMLDecoder may not be so elegant.
> I have two alternatives to amend this behavior:
>
> 1. simplify the error message printed out by DefaultExceptionListener, as
> the patch given below:
> Index: beans/src/main/java/java/beans/XMLDecoder.java
> ===================================================================
> --- beans/src/main/java/java/beans/XMLDecoder.java (revision 566039)
> +++ beans/src/main/java/java/beans/XMLDecoder.java (working copy)
> @@ -45,9 +45,10 @@
>
> private static class DefaultExceptionListener implements
> ExceptionListener {
>
> + @SuppressWarnings("nls")
> public void exceptionThrown(Exception e) {
> - e.printStackTrace();
> - System.err.println("Continue..."); //$NON-NLS-1$
> + System.err.println(e.getClass().getCanonicalName() + ": "
> +e.getMessage());
> + System.err.println("Continue...");
> }
> }
>
>
>
> 2. Delay inputStream parsing, moving it from constructor to other place
> like
> readObject.
>
> Or any other suggestions?
What's RI's behavior here?
[1] test case given by https://issues.apache.org/jira/browse/HARMONY-1568
> import java.beans.*;
> import java.io.ByteArrayInputStream;
>
> public class test {
> public static void main(String[] args) {
> System.out.println("res = " + new XMLDecoder(new
> ByteArrayInputStream(new byte[] {1, 2}), new Double(1),
> null).getExceptionListener());
> }
> }
>
> --
> Spark Shen
> China Software Development Lab, IBM
>
--
Paulex Yang
China Software Development laboratory
IBM