Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 65032 invoked from network); 12 Dec 2006 13:08:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Dec 2006 13:08:06 -0000 Received: (qmail 9072 invoked by uid 500); 12 Dec 2006 13:08:14 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 9044 invoked by uid 500); 12 Dec 2006 13:08:14 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 9035 invoked by uid 99); 12 Dec 2006 13:08:14 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Dec 2006 05:08:14 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Dec 2006 05:07:50 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 4CBB97142AB for ; Tue, 12 Dec 2006 05:07:22 -0800 (PST) Message-ID: <14108734.1165928842311.JavaMail.jira@brutus> Date: Tue, 12 Dec 2006 05:07:22 -0800 (PST) From: "Vasily Zakharov (JIRA)" To: commits@harmony.apache.org Subject: [jira] Commented: (HARMONY-2638) [luni][jndi] javax.naming.NamingException.printStackTrace() output should contain the output of NamingException.toString() In-Reply-To: <28350195.1165926261070.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/HARMONY-2638?page=comments#action_12457697 ] Vasily Zakharov commented on HARMONY-2638: ------------------------------------------ I wonder why our implementation overrides that method at all. In RI, as you may see in JavaDoc, NamingException doesn't override printStackTrace() methods. Also, it looks like the following spec statement is violated: "This exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The root exception (or root cause) is the same object as the cause returned by the Throwable.getCause() method." It means that the same field must be used for getRootCause(), setRootCause(), getCause() and initCause() methods, and that is not true for our implementation. The overridden getCause() and initCause() do nothing in fact. Looks like this class requires essential cleanup. > [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 > Priority: Minor > > 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