cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r955098 - in /cxf/trunk/rt/databinding/aegis/src: main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java test/java/org/apache/cxf/aegis/type/BigDecimalStringTest.java
Date Wed, 16 Jun 2010 00:08:12 GMT
Author: bimargulies
Date: Wed Jun 16 00:08:11 2010
New Revision: 955098

URL: http://svn.apache.org/viewvc?rev=955098&view=rev
Log:
CXF-2847: fix decimal formatting

Added:
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/BigDecimalStringTest.java
  (with props)
Modified:
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java?rev=955098&r1=955097&r2=955098&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java
Wed Jun 16 00:08:11 2010
@@ -44,6 +44,6 @@ public class BigDecimalType extends Aegi
 
     @Override
     public void writeObject(final Object object, final MessageWriter writer, final Context
context) {
-        writer.writeValue(object.toString());
+    	writer.writeValue(((BigDecimal) object).toPlainString());
     }
 }

Added: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/BigDecimalStringTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/BigDecimalStringTest.java?rev=955098&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/BigDecimalStringTest.java
(added)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/BigDecimalStringTest.java
Wed Jun 16 00:08:11 2010
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.aegis.type;
+
+import java.math.BigDecimal;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class BigDecimalStringTest {
+
+    @Test
+    public void runMyTest() {
+        BigDecimal scientificNotation = new BigDecimal("0.000000001");
+        assertTrue(scientificNotation.toString().contains("E"));
+        assertFalse(scientificNotation.toPlainString().contains("E"));
+    }
+}

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/BigDecimalStringTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/BigDecimalStringTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message