You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2014/03/04 12:57:45 UTC
svn commit: r1574049 -
/poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
Author: nick
Date: Tue Mar 4 11:57:44 2014
New Revision: 1574049
URL: http://svn.apache.org/r1574049
Log:
POI is now on JDK 1.6, so remove 1.5 workaround
Modified:
poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java?rev=1574049&r1=1574048&r2=1574049&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java Tue Mar 4 11:57:44 2014
@@ -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);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org