]> source.dussan.org Git - poi.git/commitdiff
fixed compatibility issues with JDK 1.5
authorYegor Kozlov <yegor@apache.org>
Wed, 5 Jun 2013 02:03:07 +0000 (02:03 +0000)
committerYegor Kozlov <yegor@apache.org>
Wed, 5 Jun 2013 02:03:07 +0000 (02:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1489685 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/ss/formula/functions/Complex.java
src/java/org/apache/poi/ss/formula/functions/Quotient.java
src/java/org/apache/poi/ss/formula/functions/Rept.java
src/scratchpad/src/org/apache/poi/hwpf/model/UnhandledDataStructure.java

index 171898112e0534fa02916a84f721f869208f7e88..51c1770b1dc9186ebb83fdd0646c7d56df4dbdf5 100644 (file)
@@ -70,7 +70,7 @@ public class Complex extends Var2or3ArgFunction implements FreeRefFunction {
         }\r
 \r
         String suffixValue = OperandResolver.coerceValueToString(suffix);\r
-        if (suffixValue.isEmpty()) {\r
+        if (suffixValue.length() == 0) {\r
             suffixValue = DEFAULT_SUFFIX;\r
         }\r
         if (suffixValue.equals(DEFAULT_SUFFIX.toUpperCase()) || suffixValue.equals(SUPPORTED_SUFFIX.toUpperCase())) {\r
index b314f2f2642a7ec9e4b5cc358f094b739602da95..f1ed483ad5e13231713c7ac6749d265e206dd607 100644 (file)
@@ -23,7 +23,7 @@ import org.apache.poi.ss.formula.eval.*;
  * @author cedric dot walter @ gmail dot com\r
  */\r
 public class Quotient extends Fixed2ArgFunction {\r
-    @Override\r
+\r
     public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval venumerator, ValueEval vedenominator) {\r
 \r
         double enumerator = 0;\r
index a971e6b6d6370d09bcdd88dd7f441d73898c8821..b93d96915df5025cfe6e7224621420342774705e 100644 (file)
@@ -42,7 +42,6 @@ import java.math.BigDecimal;
 public class Rept extends Fixed2ArgFunction  {\r
 \r
 \r
-    @Override\r
     public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval text, ValueEval number_times) {\r
 \r
         ValueEval veText1;\r
index 967f46e803e527eb774e343a9705cf7d5f9d29ed..ac11f4b8b3ad30d69fb17ce5df3deaed38bdfcfd 100644 (file)
@@ -48,9 +48,23 @@ public final class UnhandledDataStructure
     }
     
     // Save that requested portion of the data 
-    _buf = Arrays.copyOfRange(buf, offset, offsetEnd);
+    _buf = copyOfRange(buf, offset, offsetEnd);
+
   }
 
+    /**
+     * YK: Arrays.copyOfRange is not in JDK 1.5
+     */
+    static byte[] copyOfRange(byte[] original, int from, int to) {
+        int newLength = to - from;
+        if (newLength < 0)
+            throw new IllegalArgumentException(from + " > " + to);
+        byte[] copy = new byte[newLength];
+        System.arraycopy(original, from, copy, 0,
+                Math.min(original.length - from, newLength));
+        return copy;
+    }
+
   byte[] getBuf()
   {
     return _buf;