qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel Moravec (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (QPID-3395) Parsing exception of JNDI file should not be swallowed in Java library
Date Tue, 09 Aug 2011 07:02:27 GMT

     [ 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

Improved patch proposal to re-throw also parse error in initial context URL.

Internal exceptions in PropertiesFileInitialContex.createFactory and PropertiesFileInitialContex.createDestination
are re-thrown as ConfigurationException with sting "Failed to parse JNDI properties file:
"+e.getMessage().

> 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, 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.<init>(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


Mime
View raw message