Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMSException is not caused when invalid argument is set for MapMessage class setBytes method #330

Open
glassfishrobot opened this issue Aug 8, 2013 · 5 comments

Comments

@glassfishrobot
Copy link

When invalid values are set for setBytes method of MapMessage, JMSException is not caused.

void setBytes(String name,byte[] value,int offset,int length)

  • When -1 is specified for length, NagativeArraySizeException is caused.
  • ArrayIndexOutOfBoundsException is caused when value < length.

I found a same bug in writeBytes method in StreamMessage as well.

void writeBytes(byte[] value, int offset, int length)

Environment

glassfish-4.0.1-b02-07_24_2013
Windows

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
Reported by tak09

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
tak09 said:
https://www.dropbox.com/sh/jk2re1abamtmg37/vwJQ6DQwfv

Test program.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
@nigeldeakin said:
The JMS spec doesn't define what should happen in this case (though it is clearly invalid and an exception of some kind should result). Throwing a JMSException would probably be valid, but throwing a more specific unchecked exception would be valid too, in my opinion.

As a general policy, I don't think the existence of JMSException should force the provider to catch every possible unchecked exception (e.g. java.lang.OutOfMemoryError) and wrap it in a JMSException. The only cases where a JMSException must be thrown are in the cases listed in the API documentation, which relate to using an inappropriate method to read data from the byte array.

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
This issue was imported from java.net JIRA MQ-330

@glassfishrobot
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants