You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2006/12/18 15:52:23 UTC

[jira] Assigned: (HARMONY-2638) [luni][jndi] javax.naming.NamingException.printStackTrace() output should contain the output of NamingException.toString()

     [ http://issues.apache.org/jira/browse/HARMONY-2638?page=all ]

Tim Ellison reassigned HARMONY-2638:
------------------------------------

    Assignee: Tim Ellison

> [luni][jndi] javax.naming.NamingException.printStackTrace() output should contain the output of NamingException.toString()
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2638
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2638
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Ivanov
>         Assigned To: Tim Ellison
>            Priority: Minor
>         Attachments: HARMONY-2638.patch
>
>
> It is said in the specification of the method Throwable.printStackTrace():
> "The first line of output contains the result of the toString() method for this object"
> But NamingException.printStackTrace() doesn't follow this instruction. If the method NamingException.setRootCause(Throwable)
> was invoked, NamingException.printStackTrace() will not contain the result of the toString() method for this exception.
> The test to reproduce the problem:
> import javax.naming.*;
> import java.io.*;
> public class NamingExceptionTest {
>     public static void main(String[] args) throws Exception {
>         NamingException ex = new NamingException("test message");        
>         ByteArrayOutputStream bStream = new ByteArrayOutputStream();
>         PrintStream stream = new PrintStream(bStream);
>         
>         String firstString;
>         String stackTrace;
>  
>         System.setErr(stream);
>         ex.setRemainingName(new CompositeName("element/parent"));
>         ex.setRootCause(new Exception("root cause1"));
>         ex.printStackTrace();
>         stackTrace = bStream.toString();     
>         firstString = ex.toString();
>        
>         if (stackTrace.startsWith(firstString)) {
>             System.out.println("PASSED");
>         } else {
>             System.out.println("FAILED");
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira