You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Michael Herrmann (Commented) (JIRA)" <se...@james.apache.org> on 2012/01/19 15:14:40 UTC
[jira] [Commented] (JAMES-1241) Mail Attributes retrieved as String
even though set as Boolean
[ https://issues.apache.org/jira/browse/JAMES-1241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13189124#comment-13189124 ]
Michael Herrmann commented on JAMES-1241:
-----------------------------------------
Hi,
I'm having a similar problem when I try to set a Mail attribute value to an instance of one of my own classes. According to the JavaDoc http://docs.oracle.com/javaee/5/api/javax/jms/Message.html,
"The setObjectProperty method accepts values of class Boolean, Byte, Short, Integer, Long, Float, Double, and String. An attempt to use any other class must throw a JMSException.
The getObjectProperty method only returns values of class Boolean, Byte, Short, Integer, Long, Float, Double, and String."
I'm not getting a JMSException, but I'm getting a String back when trying to read the attribute, just as in the description of this issue. The SVN-commit to this issue looks like it assumes that set-/getObjectProperty can work with any Serializable, not just Boolean, Byte, ..., String. Isn't that a dangerous assumption?
Thanks!
> Mail Attributes retrieved as String even though set as Boolean
> --------------------------------------------------------------
>
> Key: JAMES-1241
> URL: https://issues.apache.org/jira/browse/JAMES-1241
> Project: JAMES Server
> Issue Type: Bug
> Components: Queue
> Affects Versions: 3.0-M2
> Reporter: Andrzej Rusin
> Assignee: Norman Maurer
> Fix For: 3.0-beta3
>
>
> I set a boolean attribute to a Mail:
> boolean smartHostSSL = false;
> mail.setAttribute(SMARTHOSTSSL, smartHostSSL);
> and then I retireve it in another method:
> boolean smartHostSSL = (Boolean)mail.getAttribute(SMARTHOSTSSL);
> and there's an exception on this very line:
> java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org