]> source.dussan.org Git - poi.git/commitdiff
make the code compatible with JDK 1.4.2
authorYegor Kozlov <yegor@apache.org>
Tue, 26 Jun 2007 08:00:37 +0000 (08:00 +0000)
committerYegor Kozlov <yegor@apache.org>
Tue, 26 Jun 2007 08:00:37 +0000 (08:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@550726 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java
src/scratchpad/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java
src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java
src/scratchpad/src/org/apache/poi/hdgf/exceptions/HDGFException.java [new file with mode: 0644]
src/scratchpad/src/org/apache/poi/hdgf/streams/Stream.java

index a12f12623f30ec1096f4ffa4e99d4c2c3da80e29..00ca868fe3ce2bb57f75de2e314c5ed51c9ffbc2 100644 (file)
@@ -173,7 +173,7 @@ public class HSSFDateUtil
        }
        
        // Translate \- into just -, before matching
-       String fs = formatString.replace("\\-","-"); 
+       String fs = formatString.replaceAll("\\\\-","-");
        
        // Otherwise, check it's only made up of:
        //  y m d - /
index d54a091a36163fc1eea0fa830de35a2940a43f66..5f7392739fb22157dc160b1cfd31f0512ff0ee76 100644 (file)
@@ -280,7 +280,7 @@ public class XLS2CSVmra implements HSSFListener {
                        // Java wants M not m for month
                        format = format.replace('m','M');
                        // Change \- into -, if it's there
-                       format = format.replace("\\-","-");
+                       format = format.replaceAll("\\\\-","-");
                        
                        // Format as a date
                        Date d = HSSFDateUtil.getJavaDate(value);
index 3a4328858db6b2bc735be1e1ebc6cfde9ab357eb..3c20e4f3ffa64e5f44346dca348a0c7219aca632 100644 (file)
@@ -71,7 +71,7 @@ public class VSDDumper {
                System.out.println(ind + "  Length is\t" + ptr.getLength() +
                                " - " + Integer.toHexString(ptr.getLength()));
                System.out.println(ind + "  Compressed is\t" + ptr.destinationCompressed());
-               System.out.println(ind + "  Stream is\t" + stream.getClass().getCanonicalName());
+               System.out.println(ind + "  Stream is\t" + stream.getClass().getName());
                
                byte[] db = stream._getStore()._getContents();
                String ds = "";
diff --git a/src/scratchpad/src/org/apache/poi/hdgf/exceptions/HDGFException.java b/src/scratchpad/src/org/apache/poi/hdgf/exceptions/HDGFException.java
new file mode 100644 (file)
index 0000000..ae22b95
--- /dev/null
@@ -0,0 +1,44 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+\r
+\r
+package org.apache.poi.hdgf.exceptions;\r
+\r
+/**\r
+ * The superclass of all HDGF exceptions\r
+ *\r
+ * @author Yegor Kozlov\r
+ */\r
+public class HDGFException extends RuntimeException {\r
+\r
+    public HDGFException() {\r
+           super();\r
+    }\r
+\r
+   public HDGFException(String message) {\r
+           super(message);\r
+    }\r
+\r
+   public HDGFException(String message, Throwable cause) {\r
+        super(message, cause);\r
+    }\r
+\r
+    public HDGFException(Throwable cause) {\r
+        super(cause);\r
+    }\r
+\r
+}\r
index 0d26686e213401baa606a614694bb23c12b52e74..35aa7e5291a8ec8d860377347be1ff0a57936661 100644 (file)
@@ -21,6 +21,7 @@ import java.io.IOException;
 import org.apache.poi.hdgf.chunks.ChunkFactory;
 import org.apache.poi.hdgf.pointers.Pointer;
 import org.apache.poi.hdgf.pointers.PointerFactory;
+import org.apache.poi.hdgf.exceptions.HDGFException;
 
 /**
  * Base of all Streams within a HDGF document.
@@ -63,7 +64,7 @@ public abstract class Stream {
                                );
                        } catch(IOException e) {
                                // Should never occur
-                               throw new IllegalStateException(e);
+                               throw new HDGFException(e);
                        }
                } else {
                        store = new StreamStore(