[jboss-jira] [JBoss JIRA] (AS7-4126) double values cannot be read from dmr response
Rob Cernich (JIRA)
jira-events at lists.jboss.org
Mon Mar 18 13:34:42 EDT 2013
[ https://issues.jboss.org/browse/AS7-4126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761643#comment-12761643 ]
Rob Cernich commented on AS7-4126:
----------------------------------
I recommend changing the signature to use JsArrayInteger, as this works in both dev and production modes. The current input can easily be converting using JsArrayUtils.readOnlyJsArray(doubleBytes).
> double values cannot be read from dmr response
> ----------------------------------------------
>
> Key: AS7-4126
> URL: https://issues.jboss.org/browse/AS7-4126
> Project: Application Server 7
> Issue Type: Bug
> Components: Console
> Affects Versions: 7.1.0.Final
> Reporter: Rob Cernich
> Assignee: Heiko Braun
> Fix For: 7.1.2.Final (EAP)
>
>
> This appears to be a bug in the GWT compiler. The compiler turns the following:
> {code:java|title=DataInput.readDouble()}
> return IEEE754.toDouble(bytes[pos++], bytes[pos++], bytes[pos++], bytes[pos++], bytes[pos++], bytes[pos++], bytes[pos++], bytes[pos++]);
> {code}
> into: (effectively; the GWT compiler is adding a set of parentheses around the parameters passed to the native function)
> {code:java|title=DataInput.readDouble() compiled}
> return IEEE754.toDouble(new byte[] {bytes[pos++], bytes[pos++], bytes[pos++], bytes[pos++], bytes[pos++], bytes[pos++], bytes[pos++], bytes[pos++]});
> {code}
> This results in all double values in the model being interpreted as NaN.
> I've patched the code I'm using in SwitchYard as follows:
> {code:java|title=DataInput.java}
> public double readDouble() throws IOException {
> byte doubleBytes[] = new byte[8];
> readFully(doubleBytes);
> return IEEE754.toDouble(doubleBytes);
> }
> {code}
> {code:java|title=IEEE754.java}
> public static native double toDouble(byte[] bytes) /*-{
> var ebits = 11;
> var fbits = 52;
> // Bytes to bits
> var bits = [];
> //snip...
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list