You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/05/14 09:00:12 UTC
[1/2] git commit: CAMEL-6358 Fixed the issue of
impliedDecimalSeparator doesn't work with big precision
Updated Branches:
refs/heads/master ce49f1b30 -> deb0b3bfa
CAMEL-6358 Fixed the issue of impliedDecimalSeparator doesn't work with big precision
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2dd9e86a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2dd9e86a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2dd9e86a
Branch: refs/heads/master
Commit: 2dd9e86ac6a864afc90471c7427d9989ba5f3f0d
Parents: dbd0ce5
Author: Willem Jiang <ni...@apache.org>
Authored: Tue May 14 11:13:12 2013 +0800
Committer: Willem Jiang <ni...@apache.org>
Committed: Tue May 14 11:13:12 2013 +0800
----------------------------------------------------------------------
.../bindy/format/AbstractNumberFormat.java | 6 +++---
.../dataformat/bindy/format/BigDecimalFormat.java | 11 ++++++-----
2 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2dd9e86a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/AbstractNumberFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/AbstractNumberFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/AbstractNumberFormat.java
index daee298..6c42975 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/AbstractNumberFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/AbstractNumberFormat.java
@@ -29,7 +29,7 @@ public abstract class AbstractNumberFormat<T extends Number> implements Format<T
private boolean impliedDecimalPosition;
private int precision;
private DecimalFormat format;
- private int multiplier;
+ private double multiplier;
/**
*
@@ -58,7 +58,7 @@ public abstract class AbstractNumberFormat<T extends Number> implements Format<T
if (this.impliedDecimalPosition) {
this.format.setMinimumFractionDigits(0);
this.format.setMaximumFractionDigits(0);
- this.multiplier = (int)Math.pow(10D, precision);
+ this.multiplier = Math.pow(10D, precision);
} else {
this.format.setMinimumFractionDigits(this.precision);
this.format.setMaximumFractionDigits(this.precision);
@@ -77,7 +77,7 @@ public abstract class AbstractNumberFormat<T extends Number> implements Format<T
return this.format;
}
- protected int getMultiplier() {
+ protected double getMultiplier() {
return multiplier;
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/2dd9e86a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalFormat.java
index 3c903a6..defba11 100755
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/format/BigDecimalFormat.java
@@ -17,6 +17,7 @@
package org.apache.camel.dataformat.bindy.format;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.util.Locale;
@@ -35,12 +36,12 @@ public class BigDecimalFormat extends AbstractNumberFormat<BigDecimal> {
public BigDecimal parse(String string) throws Exception {
BigDecimal result = new BigDecimal(string.trim());
if (super.hasImpliedDecimalPosition()) {
- result = result.divide(new BigDecimal(super.getMultiplier()));
+ result = result.divide(new BigDecimal(super.getMultiplier()), super.getPrecision(), RoundingMode.HALF_EVEN);
+ } else {
+ if (super.getPrecision() != -1) {
+ result = result.setScale(super.getPrecision());
+ }
}
- if (super.getPrecision() != -1) {
- result = result.setScale(super.getPrecision());
- }
-
return result;
}
}
[2/2] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/camel
Posted by ni...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/camel
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/deb0b3bf
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/deb0b3bf
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/deb0b3bf
Branch: refs/heads/master
Commit: deb0b3bfaa25fd98bf8f05df1397fd9ddba62eda
Parents: 2dd9e86 ce49f1b
Author: Willem Jiang <ni...@apache.org>
Authored: Tue May 14 14:58:36 2013 +0800
Committer: Willem Jiang <ni...@apache.org>
Committed: Tue May 14 14:58:36 2013 +0800
----------------------------------------------------------------------
.../org/apache/camel/util/StringQuoteHelper.java | 13 +-
.../apache/camel/language/simple/SimpleTest.java | 10 +
.../apache/camel/util/StingQuoteHelperTest.java | 28 ++
tests/camel-itest-spring30/pom.xml | 80 ------
.../src/main/resources/META-INF/LICENSE.txt | 203 ---------------
.../src/main/resources/META-INF/NOTICE.txt | 11 -
.../apache/camel/itest/spring30/JmsRouteTest.java | 42 ---
.../src/test/resources/log4j.properties | 37 ---
.../apache/camel/itest/spring30/JmsRouteTest.xml | 44 ---
tests/pom.xml | 1 -
10 files changed, 45 insertions(+), 424 deletions(-)
----------------------------------------------------------------------