You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Pavel Moravec (JIRA)" <ji...@apache.org> on 2011/08/05 12:33:27 UTC

[jira] [Created] (QPID-3395) Parsing exception of JNDI file should not be swallowed in Java library

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


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


[jira] [Updated] (QPID-3395) Parsing exception of JNDI file should not be swallowed in Java library

Posted by "Pavel Moravec (JIRA)" <ji...@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:     (was: parseexception.patch)

> 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.<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


[jira] [Resolved] (QPID-3395) Parsing exception of JNDI file should not be swallowed in Java library

Posted by "Rajith Attapattu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajith Attapattu resolved QPID-3395.
------------------------------------

    Resolution: Fixed
      Assignee: Rajith Attapattu

Applied Pavel's patch with minor modifications.
Verified the fix by testing manually.
Didn't add an automated test for the moment.

> 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
>            Assignee: Rajith Attapattu
>            Priority: Minor
>             Fix For: 0.14
>
>         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.<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


[jira] [Updated] (QPID-3395) Parsing exception of JNDI file should not be swallowed in Java library

Posted by "Pavel Moravec (JIRA)" <ji...@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: JIRA3395_reproduction.tar.gz

Stuff for reproduction

> 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
>
>
> 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


[jira] [Updated] (QPID-3395) Parsing exception of JNDI file should not be swallowed in Java library

Posted by "Pavel Moravec (JIRA)" <ji...@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.<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


[jira] [Updated] (QPID-3395) Parsing exception of JNDI file should not be swallowed in Java library

Posted by "Pavel Moravec (JIRA)" <ji...@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

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


[jira] [Updated] (QPID-3395) Parsing exception of JNDI file should not be swallowed in Java library

Posted by "Rajith Attapattu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajith Attapattu updated QPID-3395:
-----------------------------------

    Fix Version/s:     (was: 0.12)
                   0.14

> 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.14
>
>         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.<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