aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2014-03-04 11:57:44 +0000
committerNick Burch <nick@apache.org>2014-03-04 11:57:44 +0000
commit0c38315f31a385ae251f89adc26578b2a35b25de (patch)
tree009c64b3785511af2ea90ddd8d45f304e9790f16
parent8587fd1f3e1c702a26e2b27a3a9d72ac60e06a0d (diff)
downloadpoi-0c38315f31a385ae251f89adc26578b2a35b25de.tar.gz
poi-0c38315f31a385ae251f89adc26578b2a35b25de.zip
POI is now on JDK 1.6, so remove 1.5 workaround
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1574049 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/poi/ss/usermodel/DataFormatter.java26
1 files changed, 4 insertions, 22 deletions
diff --git a/src/java/org/apache/poi/ss/usermodel/DataFormatter.java b/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
index 334cd0670f..b86b090447 100644
--- a/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
+++ b/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
@@ -894,38 +894,20 @@ public class DataFormatter {
}
/**
- * Enables excel style rounding mode (round half up)
- * on the Decimal Format if possible.
- * This will work for Java 1.6, but isn't possible
- * on Java 1.5.
+ * Enables excel style rounding mode (round half up) on the
+ * Decimal Format given.
*/
public static void setExcelStyleRoundingMode(DecimalFormat format) {
setExcelStyleRoundingMode(format, RoundingMode.HALF_UP);
}
/**
- * Enables custom rounding mode
- * on the Decimal Format if possible.
- * This will work for Java 1.6, but isn't possible
- * on Java 1.5.
+ * Enables custom rounding mode on the given Decimal Format.
* @param format DecimalFormat
* @param roundingMode RoundingMode
*/
public static void setExcelStyleRoundingMode(DecimalFormat format, RoundingMode roundingMode) {
- try {
- Method srm = format.getClass().getMethod("setRoundingMode", RoundingMode.class);
- srm.invoke(format, roundingMode);
- } catch(NoSuchMethodException e) {
- // Java 1.5
- } catch(IllegalAccessException iae) {
- // Shouldn't happen
- throw new RuntimeException("Unable to set rounding mode", iae);
- } catch(InvocationTargetException ite) {
- // Shouldn't happen
- throw new RuntimeException("Unable to set rounding mode", ite);
- } catch(SecurityException se) {
- // Not much we can do here
- }
+ format.setRoundingMode(roundingMode);
}
/**