From dev-return-29771-apmail-qpid-dev-archive=qpid.apache.org@qpid.apache.org Mon Aug 8 14:44:53 2011 Return-Path: X-Original-To: apmail-qpid-dev-archive@www.apache.org Delivered-To: apmail-qpid-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 372288C51 for ; Mon, 8 Aug 2011 14:44:53 +0000 (UTC) Received: (qmail 18934 invoked by uid 500); 8 Aug 2011 14:44:52 -0000 Delivered-To: apmail-qpid-dev-archive@qpid.apache.org Received: (qmail 18212 invoked by uid 500); 8 Aug 2011 14:44:52 -0000 Mailing-List: contact dev-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list dev@qpid.apache.org Received: (qmail 17828 invoked by uid 99); 8 Aug 2011 14:44:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2011 14:44:51 +0000 X-ASF-Spam-Status: No, hits=-2000.8 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2011 14:44:48 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 23F0EB14E9 for ; Mon, 8 Aug 2011 14:44:27 +0000 (UTC) Date: Mon, 8 Aug 2011 14:44:27 +0000 (UTC) From: "Pavel Moravec (JIRA)" To: dev@qpid.apache.org Message-ID: <2129982723.16679.1312814667143.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1815020269.11152.1312540407792.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (QPID-3395) Parsing exception of JNDI file should not be swallowed in Java library MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/QPID-3395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pavel Moravec updated QPID-3395: -------------------------------- Attachment: parseexception.patch Patch proposal - an internal parsing exception caught in createDestination and createFactory method is re-thrown as NamingException (the only exception type that can be thrown by getInitialContext method). > Parsing exception of JNDI file should not be swallowed in Java library > ---------------------------------------------------------------------- > > Key: QPID-3395 > URL: https://issues.apache.org/jira/browse/QPID-3395 > Project: Qpid > Issue Type: Improvement > Components: Java Client > Affects Versions: 0.10 > Reporter: Pavel Moravec > Priority: Minor > Fix For: 0.12 > > Attachments: JIRA3395_reproduction.tar.gz, parseexception.patch > > > Description of problem: > When JNDI file has a typo, InitialContext(properties) method should raise some > parsing exception to let client program know about the parsing problem. > Currently the exception is swallowed in > PropertiesFileInitialContextFactory.createDestination method, writing to stdout > the exception stack trace only. > How reproducible: > 100% > Steps to Reproduce: > 1. Run the attached program with the attached MRG.jms.properties > 2. In the output, distinguish between stdout and stderr > Actual results: > (*) stdout contains: > WARN [main] (PropertiesFileInitialContextFactory.java:244) - Unable to create > destination:org.apache.qpid.messaging.util.ParseError: expecting LBRACE, got > EOF line:1,7:queue2; > org.apache.qpid.messaging.util.ParseError: expecting LBRACE, got EOF > line:1,7:queue2; > at org.apache.qpid.messaging.util.Parser.eat(Parser.java:65) > at org.apache.qpid.messaging.util.AddressParser.map(AddressParser.java:282) > at > org.apache.qpid.messaging.util.AddressParser.address(AddressParser.java:270) > at org.apache.qpid.messaging.util.AddressParser.parse(AddressParser.java:241) > at org.apache.qpid.messaging.Address.parse(Address.java:40) > at > org.apache.qpid.client.AMQDestination.createAddressFromString(AMQDestination.java:855) > at > org.apache.qpid.client.AMQDestination.createDestination(AMQDestination.java:696) > at > org.apache.qpid.jndi.PropertiesFileInitialContextFactory.createDestination(PropertiesFileInitialContextFactory.java:240) > at > org.apache.qpid.jndi.PropertiesFileInitialContextFactory.createDestinations(PropertiesFileInitialContextFactory.java:160) > at > org.apache.qpid.jndi.PropertiesFileInitialContextFactory.getInitialContext(PropertiesFileInitialContextFactory.java:117) > at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667) > at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) > at javax.naming.InitialContext.init(InitialContext.java:223) > at javax.naming.InitialContext.(InitialContext.java:197) > at JNDIError.runTest(JNDIError.java:19) > at JNDIError.main(JNDIError.java:12) > (*) stderr contains: > javax.naming.NameNotFoundException: my-queue > at org.apache.qpid.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:271) > at javax.naming.InitialContext.lookup(InitialContext.java:392) > at JNDIError.runTest(JNDIError.java:20) > at JNDIError.main(JNDIError.java:12) > Expected results: > (*) program execution is interrupted by (laterly caught exception) even on > line: > Context context = new InitialContext(properties); > due to parsing error > (*) stderr contains the org.apache.qpid.messaging.util.ParseError exception, > not javax.naming.NameNotFoundException > Additional info: > The requirement makes sense as now only some error log is printed to stdout > (not catch-able by the Java client program). While the API should warn the > application directly using catch-able exception that the parsing went wrong > (and some destination / topic / whatever can't be used in the program later > on). -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:dev-subscribe@qpid.apache.org