diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java b/src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java index a12f12623..00ca868fe 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java @@ -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 - / diff --git a/src/scratchpad/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java b/src/scratchpad/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java index d54a091a3..5f7392739 100644 --- a/src/scratchpad/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java +++ b/src/scratchpad/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java @@ -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); diff --git a/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java b/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java index 3a4328858..3c20e4f3f 100644 --- a/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java +++ b/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java @@ -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 index 000000000..ae22b95ca --- /dev/null +++ b/src/scratchpad/src/org/apache/poi/hdgf/exceptions/HDGFException.java @@ -0,0 +1,44 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + + +package org.apache.poi.hdgf.exceptions; + +/** + * The superclass of all HDGF exceptions + * + * @author Yegor Kozlov + */ +public class HDGFException extends RuntimeException { + + public HDGFException() { + super(); + } + + public HDGFException(String message) { + super(message); + } + + public HDGFException(String message, Throwable cause) { + super(message, cause); + } + + public HDGFException(Throwable cause) { + super(cause); + } + +} diff --git a/src/scratchpad/src/org/apache/poi/hdgf/streams/Stream.java b/src/scratchpad/src/org/apache/poi/hdgf/streams/Stream.java index 0d26686e2..35aa7e529 100644 --- a/src/scratchpad/src/org/apache/poi/hdgf/streams/Stream.java +++ b/src/scratchpad/src/org/apache/poi/hdgf/streams/Stream.java @@ -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(