MarcoGervasoni / gwt-math

Automatically exported from code.google.com/p/gwt-math
0 stars 0 forks source link

excpetion after rpc return: "Value of BigDecimal isn't a right value." #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Send a serializable class through RPC with a BigDecimal field in it.
2.
3.

What is the expected output? What do you see instead?

Exception thrown on client side in Mozilla Firefox 3.0.8 or IE,
"Value of BigDecimal isn't a right value."

Works only in hosted browser.

What version of the product are you using? On what operating system?

Windows XP SP3, GWT 1.5.2, gwt-math 2.0.3_java5

Please provide any additional information below.

It works only in the hosted browser.

Original issue reported on code.google.com by gem.kapc...@gmail.com on 21 Apr 2009 at 7:48

GoogleCodeExporter commented 9 years ago
By modifying the source of gwt-math, I see, that the problem is here:

public BigDecimal(String val) {
  try {
    Double.parseDouble(val);
    internalBigDecimal = new InternalBigDecimal(val);
  }
  catch (Exception e) {
    throw new IllegalArgumentException("Value of BigDecimal isn't a right value. [" 
+ val + "]");
}

The browser shows the error message I see: [5315]
I think the Double.parseDouble(val) needs a .0 suffix or something..

Original comment by jant...@gmail.com on 21 Apr 2009 at 12:20

GoogleCodeExporter commented 9 years ago
No, the exception comes from a deeper source:

(TypeError): $wnd.BigDecimal is undefined fileName:
http://localhost:8080/....../F257F8BF51ED91CB36949C844ED12F2A.cache.html

I must be doing domething wrong.. any ideas?

Original comment by jant...@gmail.com on 21 Apr 2009 at 12:33

GoogleCodeExporter commented 9 years ago
All problem solved: I simply did not copy the bigdecimal.js and amathcontext.js 
files
into [webapp]/js/ directory.

I'll leave this thread here: it might be useful for someone..

Original comment by jant...@gmail.com on 21 Apr 2009 at 1:53

GoogleCodeExporter commented 9 years ago
Seems to me this is still a problem ...and I DO have the bigdecimal.js and
amathcontext.js in my [webapp]/js/ directory.  Of course, I didn't put these 
files in
there myself, but the compiler did (pulled from gwt-math-2.1.jar).

I've also tried placing these files in various other location, but with no luck!

Please help!!

Original comment by petercle...@gmail.com on 14 Oct 2009 at 9:04

GoogleCodeExporter commented 9 years ago
This is an issue for me using BigInteger's as well. The BigInteger constructor 
taking
a String argument seems to be calling Integer.parseInt(..) on the value. 
Believe it
or not the number I'm attempting to put in my BigInteger is bigger than
Integer.MAX_VALUE.

Original comment by tehdan...@gmail.com on 18 Feb 2010 at 1:19

GoogleCodeExporter commented 9 years ago
For science I build my own copy of gwt-math, commenting out the 
Integer.parseInt(..)
line. Worked perfectly. Which makes me sad, I was hoping the devs knew 
something I
didn't know and Integer.parseInt(..) in the context of GWT was different (i.e. 
called
a JS parseInt function which supported BigInteger length values).

Original comment by tehdan...@gmail.com on 18 Feb 2010 at 1:41

GoogleCodeExporter commented 9 years ago
Yes, we also "fixed" it the same way.  We simply removed the Integer.parseInt() 
call
...and made similar changes to the BigDecimal class.

Original comment by petercle...@gmail.com on 19 Feb 2010 at 1:28

GoogleCodeExporter commented 9 years ago
I am having the same issue, I suspect.  Can some one please tell which file to 
edit and comment 
Every thing works fine in the Dev Mode but within the Tomcat, I suspect 
Serialization Exception

Thanks

Original comment by rajesh.k...@gmail.com on 18 Sep 2010 at 12:39

GoogleCodeExporter commented 9 years ago
gwt-java-math is a complete implementation of java.math for GWT and handles 
this correctly.

http://code.google.com/p/gwt-java-math 

Original comment by rich...@zschech.net on 26 Sep 2010 at 5:09