diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/AbstractImageSource.java b/common/common-image/src/main/java/com/twelvemonkeys/image/AbstractImageSource.java
index ae3b8e9e..1a24085e 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/AbstractImageSource.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/AbstractImageSource.java
@@ -4,34 +4,36 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
-import java.awt.image.ImageProducer;
import java.awt.image.ImageConsumer;
-import java.util.List;
+import java.awt.image.ImageProducer;
import java.util.ArrayList;
+import java.util.List;
/**
* AbstractImageSource
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/AffineTransformOp.java b/common/common-image/src/main/java/com/twelvemonkeys/image/AffineTransformOp.java
index f362c0d4..c9621c51 100644
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/AffineTransformOp.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/AffineTransformOp.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/AreaAverageOp.java b/common/common-image/src/main/java/com/twelvemonkeys/image/AreaAverageOp.java
index 73e52172..96635d2d 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/AreaAverageOp.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/AreaAverageOp.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/BrightnessContrastFilter.java b/common/common-image/src/main/java/com/twelvemonkeys/image/BrightnessContrastFilter.java
index 0dbb7598..271c7e09 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/BrightnessContrastFilter.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/BrightnessContrastFilter.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageFactory.java b/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageFactory.java
index d6b097ff..22d9d565 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageFactory.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageFactory.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageIcon.java b/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageIcon.java
index 649666ba..d23b236a 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageIcon.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageIcon.java
@@ -4,36 +4,38 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
import com.twelvemonkeys.lang.Validate;
-import javax.swing.Icon;
-import java.awt.image.BufferedImage;
+import javax.swing.*;
import java.awt.*;
import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
/**
* An {@code Icon} implementation backed by a {@code BufferedImage}.
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/ConvolveWithEdgeOp.java b/common/common-image/src/main/java/com/twelvemonkeys/image/ConvolveWithEdgeOp.java
index 8a6ac22c..9b34249d 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/ConvolveWithEdgeOp.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/ConvolveWithEdgeOp.java
@@ -4,34 +4,36 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
-import java.awt.image.*;
import java.awt.*;
-import java.awt.geom.Rectangle2D;
import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.*;
/**
* This class implements a convolution from the source
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/CopyDither.java b/common/common-image/src/main/java/com/twelvemonkeys/image/CopyDither.java
index 041bb8a6..768fcaba 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/CopyDither.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/CopyDither.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
@@ -31,13 +33,7 @@ package com.twelvemonkeys.image;
import java.awt.*;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-import java.awt.image.BufferedImageOp;
-import java.awt.image.ColorModel;
-import java.awt.image.IndexColorModel;
-import java.awt.image.Raster;
-import java.awt.image.RasterOp;
-import java.awt.image.WritableRaster;
+import java.awt.image.*;
/**
* This BufferedImageOp simply copies pixels, converting to a
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/DiffusionDither.java b/common/common-image/src/main/java/com/twelvemonkeys/image/DiffusionDither.java
index d530d077..aa43d527 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/DiffusionDither.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/DiffusionDither.java
@@ -1,16 +1,39 @@
-package com.twelvemonkeys.image;
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.twelvemonkeys.image;
import java.awt.*;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-import java.awt.image.BufferedImageOp;
-import java.awt.image.ColorModel;
-import java.awt.image.IndexColorModel;
-import java.awt.image.Raster;
-import java.awt.image.RasterOp;
-import java.awt.image.WritableRaster;
+import java.awt.image.*;
import java.util.Random;
/**
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/GraphicsUtil.java b/common/common-image/src/main/java/com/twelvemonkeys/image/GraphicsUtil.java
index f221bdb5..2ff7c85d 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/GraphicsUtil.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/GraphicsUtil.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/GrayColorModel.java b/common/common-image/src/main/java/com/twelvemonkeys/image/GrayColorModel.java
index c636e9fc..9f02beaa 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/GrayColorModel.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/GrayColorModel.java
@@ -4,31 +4,33 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
-import java.awt.image.*;
+import java.awt.image.IndexColorModel;
/**
* This class represents a 256 color fixed grayscale IndexColorModel.
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/GrayFilter.java b/common/common-image/src/main/java/com/twelvemonkeys/image/GrayFilter.java
index 03e2dee1..6eedf33e 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/GrayFilter.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/GrayFilter.java
@@ -4,31 +4,33 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
-import java.awt.image.*;
+import java.awt.image.RGBImageFilter;
/**
* This class can convert a color image to grayscale.
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/ImageConversionException.java b/common/common-image/src/main/java/com/twelvemonkeys/image/ImageConversionException.java
index aefa2f2c..6e0a6c2e 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/ImageConversionException.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/ImageConversionException.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/ImageFilterException.java b/common/common-image/src/main/java/com/twelvemonkeys/image/ImageFilterException.java
index d05cb5c4..c10e84c9 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/ImageFilterException.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/ImageFilterException.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/ImageUtil.java b/common/common-image/src/main/java/com/twelvemonkeys/image/ImageUtil.java
index 88fd7f1d..0ddc9be3 100644
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/ImageUtil.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/ImageUtil.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java b/common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java
index f7419204..3838c9e3 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
******************************************************************************
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/InverseColorMap.java b/common/common-image/src/main/java/com/twelvemonkeys/image/InverseColorMap.java
index 838275b6..6b5b1d28 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/InverseColorMap.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/InverseColorMap.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/InverseColorMapIndexColorModel.java b/common/common-image/src/main/java/com/twelvemonkeys/image/InverseColorMapIndexColorModel.java
index 640fa002..46b976f5 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/InverseColorMapIndexColorModel.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/InverseColorMapIndexColorModel.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/Magick.java b/common/common-image/src/main/java/com/twelvemonkeys/image/Magick.java
index 48165b7e..b348e22e 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/Magick.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/Magick.java
@@ -1,3 +1,34 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
package com.twelvemonkeys.image;
/**
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/MagickAccelerator.java b/common/common-image/src/main/java/com/twelvemonkeys/image/MagickAccelerator.java
index 681f2854..786fc7fd 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/MagickAccelerator.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/MagickAccelerator.java
@@ -1,38 +1,41 @@
-package com.twelvemonkeys.image;
-
/*
* Copyright (c) 2008, Harald Kuhr
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.twelvemonkeys.lang.SystemUtil;
+package com.twelvemonkeys.image;
+
+import com.twelvemonkeys.lang.SystemUtil;
import magick.MagickImage;
-import java.awt.image.*;
+import java.awt.image.BufferedImage;
+import java.awt.image.BufferedImageOp;
/**
* This class accelerates certain graphics operations, using
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java b/common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java
index 8f648ded..154e1e0a 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java
@@ -4,31 +4,36 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
-import magick.*;
+import magick.ImageType;
+import magick.MagickException;
+import magick.MagickImage;
+import magick.PixelPacket;
import java.awt.*;
import java.awt.color.ColorSpace;
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/MonochromeColorModel.java b/common/common-image/src/main/java/com/twelvemonkeys/image/MonochromeColorModel.java
index 5e92dd86..275f9b9c 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/MonochromeColorModel.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/MonochromeColorModel.java
@@ -4,31 +4,34 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
-import java.awt.image.*;
+import java.awt.image.DataBuffer;
+import java.awt.image.IndexColorModel;
/**
* Monochrome B/W color model.
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/PixelizeOp.java b/common/common-image/src/main/java/com/twelvemonkeys/image/PixelizeOp.java
index f71dc330..8d850ab8 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/PixelizeOp.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/PixelizeOp.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/ResampleOp.java b/common/common-image/src/main/java/com/twelvemonkeys/image/ResampleOp.java
index 73cc9ccb..155f0728 100644
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/ResampleOp.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/ResampleOp.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
*******************************************************************************
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/SubsamplingFilter.java b/common/common-image/src/main/java/com/twelvemonkeys/image/SubsamplingFilter.java
index 839a5b5d..c553013c 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/SubsamplingFilter.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/SubsamplingFilter.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.image;
diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/package-info.java b/common/common-image/src/main/java/com/twelvemonkeys/image/package-info.java
index 9ee76555..4d688a6b 100755
--- a/common/common-image/src/main/java/com/twelvemonkeys/image/package-info.java
+++ b/common/common-image/src/main/java/com/twelvemonkeys/image/package-info.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
/**
* Classes for image manipulation.
*
diff --git a/common/common-image/src/test/java/com/twelvemonkeys/image/AffineTransformOpTest.java b/common/common-image/src/test/java/com/twelvemonkeys/image/AffineTransformOpTest.java
index edbd6218..c1c53f67 100644
--- a/common/common-image/src/test/java/com/twelvemonkeys/image/AffineTransformOpTest.java
+++ b/common/common-image/src/test/java/com/twelvemonkeys/image/AffineTransformOpTest.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
package com.twelvemonkeys.image;
import org.junit.Test;
@@ -10,9 +40,7 @@ import java.awt.image.*;
import java.util.Arrays;
import java.util.List;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
/**
* AffineTransformOpTest.
diff --git a/common/common-image/src/test/java/com/twelvemonkeys/image/BufferedImageFactoryTestCase.java b/common/common-image/src/test/java/com/twelvemonkeys/image/BufferedImageFactoryTest.java
similarity index 89%
rename from common/common-image/src/test/java/com/twelvemonkeys/image/BufferedImageFactoryTestCase.java
rename to common/common-image/src/test/java/com/twelvemonkeys/image/BufferedImageFactoryTest.java
index fa6cb48a..dbde4c0e 100644
--- a/common/common-image/src/test/java/com/twelvemonkeys/image/BufferedImageFactoryTestCase.java
+++ b/common/common-image/src/test/java/com/twelvemonkeys/image/BufferedImageFactoryTest.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
package com.twelvemonkeys.image;
import org.junit.Ignore;
@@ -12,7 +42,6 @@ import java.awt.image.IndexColorModel;
import java.net.URL;
import static org.junit.Assert.*;
-import static org.junit.Assert.assertEquals;
/**
* BufferedImageFactoryTestCase
@@ -21,7 +50,7 @@ import static org.junit.Assert.assertEquals;
* @author last modified by $Author: haraldk$
* @version $Id: BufferedImageFactoryTestCase.java,v 1.0 May 7, 2010 12:40:08 PM haraldk Exp$
*/
-public class BufferedImageFactoryTestCase {
+public class BufferedImageFactoryTest {
@Test(expected = IllegalArgumentException.class)
public void testCreateNullImage() {
new BufferedImageFactory((Image) null);
diff --git a/common/common-image/src/test/java/com/twelvemonkeys/image/ImageUtilTestCase.java b/common/common-image/src/test/java/com/twelvemonkeys/image/ImageUtilTest.java
similarity index 92%
rename from common/common-image/src/test/java/com/twelvemonkeys/image/ImageUtilTestCase.java
rename to common/common-image/src/test/java/com/twelvemonkeys/image/ImageUtilTest.java
index 4f8cd92d..7c14be3a 100755
--- a/common/common-image/src/test/java/com/twelvemonkeys/image/ImageUtilTestCase.java
+++ b/common/common-image/src/test/java/com/twelvemonkeys/image/ImageUtilTest.java
@@ -1,505 +1,534 @@
-
-package com.twelvemonkeys.image;
-
-import org.junit.Test;
-
-import javax.imageio.ImageIO;
-import java.awt.*;
-import java.awt.image.BufferedImage;
-import java.awt.image.IndexColorModel;
-import java.awt.image.RenderedImage;
-import java.io.InputStream;
-
-import static org.junit.Assert.*;
-
-public class ImageUtilTestCase {
-
- private final static String IMAGE_NAME = "/sunflower.jpg";
- private BufferedImage original;
- private BufferedImage image;
- private Image scaled;
-
- public ImageUtilTestCase() throws Exception {
- image = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
- scaled = image.getScaledInstance(5, 5, Image.SCALE_FAST);
-
- // Read image from class path
- InputStream is = getClass().getResourceAsStream(IMAGE_NAME);
- original = ImageIO.read(is);
-
- assertNotNull(original);
- }
-
- /*
- public void setUp() throws Exception {
- image = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
- scaled = image.getScaledInstance(5, 5, Image.SCALE_FAST);
-
- // Read image from class path
- InputStream is = ClassLoader.getSystemResourceAsStream(IMAGE_NAME);
- original = ImageIO.read(is);
-
- assertNotNull(original);
- }
-
- protected void tearDown() throws Exception {
- original = null;
- }
- */
-
- @Test
- public void testToBufferedImageNull() {
- BufferedImage img = null;
- boolean threwRuntimeException = false;
-
- try {
- img = ImageUtil.toBuffered((Image) null);
- }
- catch (RuntimeException ne) {
- threwRuntimeException = true;
- }
- // No input should return null
- assertNull(img);
-
- // Should have thrown an exception
- assertTrue(threwRuntimeException);
- }
-
- @Test
- public void testToBufferedImageTypeNull() {
- BufferedImage img = null;
- boolean threwRuntimeException = false;
-
- try {
- img = ImageUtil.toBuffered(null, BufferedImage.TYPE_INT_ARGB);
- }
- catch (RuntimeException ne) {
- threwRuntimeException = true;
- }
- // No input should return null
- assertNull(img);
-
- // Should have thrown an exception
- assertTrue(threwRuntimeException);
- }
-
- @Test
- public void testImageIsNotBufferedImage() {
- // Should not be a buffered image
- assertFalse(
- "FOR SOME IMPLEMENTATIONS THIS MIGHT FAIL!\nIn that case, testToBufferedImage() will fail too.",
- scaled instanceof BufferedImage
- );
- }
-
- @Test
- public void testToBufferedImage() {
- BufferedImage sameAsImage = ImageUtil.toBuffered((RenderedImage) image);
- BufferedImage bufferedScaled = ImageUtil.toBuffered(scaled);
-
- // Should be no need to convert
- assertSame(image, sameAsImage);
-
- // Should have same dimensions
- assertEquals(scaled.getWidth(null), bufferedScaled.getWidth());
- assertEquals(scaled.getHeight(null), bufferedScaled.getHeight());
- }
-
- @Test
- public void testToBufferedImageType() {
- // Assumes image is TYPE_INT_ARGB
- BufferedImage converted = ImageUtil.toBuffered(image, BufferedImage.TYPE_BYTE_INDEXED);
- BufferedImage convertedToo = ImageUtil.toBuffered(image, BufferedImage.TYPE_BYTE_BINARY);
-
- // Should not be the same
- assertNotSame(image, converted);
- assertNotSame(image, convertedToo);
-
- // Correct type
- assertTrue(converted.getType() == BufferedImage.TYPE_BYTE_INDEXED);
- assertTrue(convertedToo.getType() == BufferedImage.TYPE_BYTE_BINARY);
-
- // Should have same dimensions
- assertEquals(image.getWidth(), converted.getWidth());
- assertEquals(image.getHeight(), converted.getHeight());
-
- assertEquals(image.getWidth(), convertedToo.getWidth());
- assertEquals(image.getHeight(), convertedToo.getHeight());
- }
-
- @Test
- public void testBrightness() {
- final BufferedImage original = this.original;
- assertNotNull(original);
-
- final BufferedImage notBrightened = ImageUtil.toBuffered(ImageUtil.brightness(original, 0f));
- // Assumed: Images should be equal
- if (original != notBrightened) { // Don't care to test if images are same
- for (int y = 0; y < original.getHeight(); y++) {
- for (int x = 0; x < original.getWidth(); x++) {
- assertEquals(original.getRGB(x, y), notBrightened.getRGB(x, y));
- }
- }
- }
-
- // Assumed: All pixels should be brighter or equal to original
- final BufferedImage brightened = ImageUtil.toBuffered(ImageUtil.brightness(original, 0.4f));
- final BufferedImage brightenedMore = ImageUtil.toBuffered(ImageUtil.brightness(original, 0.9f));
- for (int y = 0; y < original.getHeight(); y++) {
- for (int x = 0; x < original.getWidth(); x++) {
- assertTrue(original.getRGB(x, y) <= brightened.getRGB(x, y));
- assertTrue(brightened.getRGB(x, y) <= brightenedMore.getRGB(x, y));
- }
- }
-
- // Assumed: Image should be all white
- final BufferedImage brightenedMax = ImageUtil.toBuffered(ImageUtil.brightness(original, 2f));
- for (int y = 0; y < brightenedMax.getHeight(); y++) {
- for (int x = 0; x < brightenedMax.getWidth(); x++) {
- assertEquals(0x00FFFFFF, brightenedMax.getRGB(x, y) & 0x00FFFFFF);
- }
- }
-
- // Assumed: All pixels should be darker or equal to originial
- final BufferedImage brightenedNegative = ImageUtil.toBuffered(ImageUtil.brightness(original, -0.4f));
- final BufferedImage brightenedNegativeMore = ImageUtil.toBuffered(ImageUtil.brightness(original, -0.9f));
- for (int y = 0; y < original.getHeight(); y++) {
- for (int x = 0; x < original.getWidth(); x++) {
- assertTrue(original.getRGB(x, y) >= brightenedNegative.getRGB(x, y));
- assertTrue(brightenedNegative.getRGB(x, y) >= brightenedNegativeMore.getRGB(x, y));
- }
- }
- // Assumed: Image should be all black
- final BufferedImage brightenedMaxNegative = ImageUtil.toBuffered(ImageUtil.brightness(original, -2f));
- for (int y = 0; y < brightenedMaxNegative.getHeight(); y++) {
- for (int x = 0; x < brightenedMaxNegative.getWidth(); x++) {
- assertEquals(0x0, brightenedMaxNegative.getRGB(x, y) & 0x00FFFFFF);
- }
- }
-
- /*
- JFrame frame = new JFrame("Sunflower - brightness");
- frame.setSize(sunflower.getWidth() * 4, sunflower.getHeight() * 2);
-
- Canvas canvas = new Canvas() {
- public void paint(Graphics g) {
- // Draw original for comparison
- g.drawImage(original, 0, 0, null);
-
- // This should look like original
- g.drawImage(notBrightened, 0, original.getHeight(), null);
-
- // Different versions
- g.drawImage(brightened, original.getWidth(), 0, null);
- g.drawImage(brightenedMore, original.getWidth() * 2, 0, null);
- g.drawImage(brightenedMax, original.getWidth() * 3, 0, null);
-
- g.drawImage(brightenedNegative, original.getWidth(), original.getHeight(), null);
- g.drawImage(brightenedNegativeMore, original.getWidth() * 2, original.getHeight(), null);
- g.drawImage(brightenedMaxNegative, original.getWidth() * 3, original.getHeight(), null);
- }
- };
-
- frame.getContentPane().add(canvas);
- frame.setVisible(true);
-
- assertTrue(true);
- */
- }
-
- @Test
- public void testContrast() {
- final BufferedImage original = this.original;
-
- assertNotNull(original);
-
- final BufferedImage notContrasted = ImageUtil.toBuffered(ImageUtil.contrast(original, 0f));
- // Assumed: Images should be equal
- if (original != notContrasted) { // Don't care to test if images are same
- for (int y = 0; y < original.getHeight(); y++) {
- for (int x = 0; x < original.getWidth(); x++) {
- assertEquals("0 constrast should not change image", original.getRGB(x, y), notContrasted.getRGB(x, y));
- }
- }
- }
-
- // Assumed: Contrast should be greater or equal to original
- final BufferedImage contrasted = ImageUtil.toBuffered(ImageUtil.contrast(original));
- final BufferedImage contrastedDefault = ImageUtil.toBuffered(ImageUtil.contrast(original, 0.5f));
- for (int y = 0; y < original.getHeight(); y++) {
- for (int x = 0; x < original.getWidth(); x++) {
- int oRGB = original.getRGB(x, y);
- int cRGB = contrasted.getRGB(x, y);
- int dRGB = contrastedDefault.getRGB(x, y);
-
- int oR = oRGB >> 16 & 0xFF;
- int oG = oRGB >> 8 & 0xFF;
- int oB = oRGB & 0xFF;
-
- int cR = cRGB >> 16 & 0xFF;
- int cG = cRGB >> 8 & 0xFF;
- int cB = cRGB & 0xFF;
-
- int dR = dRGB >> 16 & 0xFF;
- int dG = dRGB >> 8 & 0xFF;
- int dB = dRGB & 0xFF;
-
- // RED
- if (oR < 127) {
- assertTrue("Contrast should be decreased or same", oR >= cR && cR >= dR);
- }
- else {
- assertTrue("Contrast should be increased or same", oR <= cR && cR <= dR);
- }
- // GREEN
- if (oG < 127) {
- assertTrue("Contrast should be decreased or same", oG >= cG && cG >= dG);
- }
- else {
- assertTrue("Contrast should be increased or same", oG <= cG && cG <= dG);
- }
- // BLUE
- if (oB < 127) {
- assertTrue("Contrast should be decreased or same", oB >= cB && cB >= dB);
- }
- else {
- assertTrue("Contrast should be increased or same", oB <= cB && cB <= dB);
- }
- }
- }
- // Assumed: Only primary colors (w/b/r/g/b/c/y/m)
- final BufferedImage contrastedMax = ImageUtil.toBuffered(ImageUtil.contrast(original, 1f));
- for (int y = 0; y < contrastedMax.getHeight(); y++) {
- for (int x = 0; x < contrastedMax.getWidth(); x++) {
- int rgb = contrastedMax.getRGB(x, y);
- int r = rgb >> 16 & 0xFF;
- int g = rgb >> 8 & 0xFF;
- int b = rgb & 0xFF;
- assertTrue("Max contrast should only produce primary colors", r == 0 || r == 255);
- assertTrue("Max contrast should only produce primary colors", g == 0 || g == 255);
- assertTrue("Max contrast should only produce primary colors", b == 0 || b == 255);
- }
- }
-
- // Assumed: Contrasts should be less than or equal to original
- final BufferedImage contrastedNegative = ImageUtil.toBuffered(ImageUtil.contrast(original, -0.5f));
- for (int y = 0; y < original.getHeight(); y++) {
- for (int x = 0; x < original.getWidth(); x++) {
- int oRGB = original.getRGB(x, y);
- int cRGB = contrastedNegative.getRGB(x, y);
-
- int oR = oRGB >> 16 & 0xFF;
- int oG = oRGB >> 8 & 0xFF;
- int oB = oRGB & 0xFF;
-
- int cR = cRGB >> 16 & 0xFF;
- int cG = cRGB >> 8 & 0xFF;
- int cB = cRGB & 0xFF;
-
- // RED
- if (oR >= 127) {
- assertTrue("Contrast should be decreased or same", oR >= cR);
- }
- else {
- assertTrue("Contrast should be increased or same", oR <= cR);
- }
- // GREEN
- if (oG >= 127) {
- assertTrue("Contrast should be decreased or same", oG >= cG);
- }
- else {
- assertTrue("Contrast should be increased or same", oG <= cG);
- }
- // BLUE
- if (oB >= 127) {
- assertTrue("Contrast should be decreased or same", oB >= cB);
- }
- else {
- assertTrue("Contrast should be increased or same", oB <= cB);
- }
- }
- }
-
- // Assumed: All gray (127)!
- final BufferedImage contrastedMoreNegative = ImageUtil.toBuffered(ImageUtil.contrast(original, -1.0f));
- for (int y = 0; y < contrastedMoreNegative.getHeight(); y++) {
- for (int x = 0; x < contrastedMoreNegative.getWidth(); x++) {
- int rgb = contrastedMoreNegative.getRGB(x, y);
- int r = rgb >> 16 & 0xFF;
- int g = rgb >> 8 & 0xFF;
- int b = rgb & 0xFF;
- assertTrue("Minimum contrast should be all gray", r == 127 && g == 127 && b == 127);
- }
- }
-
- /*
- JFrame frame = new JFrame("Sunflower - contrast");
- frame.setSize(sunflower.getWidth() * 4, sunflower.getHeight() * 2);
-
- Canvas canvas = new Canvas() {
- public void paint(Graphics g) {
- // Draw original for comparison
- g.drawImage(original, 0, 0, null);
-
- // This should look like original
- g.drawImage(notContrasted, 0, original.getHeight(), null);
-
- // Different versions
- g.drawImage(contrasted, original.getWidth(), 0, null);
- g.drawImage(contrastedDefault, original.getWidth() * 2, 0, null);
- g.drawImage(contrastedMax, original.getWidth() * 3, 0, null);
- g.drawImage(contrastedNegative, original.getWidth() * 2, original.getHeight(), null);
- g.drawImage(contrastedMoreNegative, original.getWidth() * 3, original.getHeight(), null);
- }
- };
-
- frame.getContentPane().add(canvas);
- frame.setVisible(true);
-
- assertTrue(true);
- */
- }
-
- @Test
- public void testSharpen() {
- final BufferedImage original = this.original;
-
- assertNotNull(original);
-
- final BufferedImage notSharpened = ImageUtil.sharpen(original, 0f);
- // Assumed: Images should be equal
- if (original != notSharpened) { // Don't care to test if images are same
- for (int y = 0; y < original.getHeight(); y++) {
- for (int x = 0; x < original.getWidth(); x++) {
- assertEquals("0 sharpen should not change image", original.getRGB(x, y), notSharpened.getRGB(x, y));
- }
- }
- }
-
- // Assumed: Difference between neighbouring pixels should increase for higher sharpen values
- // Assumed: Dynamics of entire image should not change
- final BufferedImage sharpened = ImageUtil.sharpen(original);
- final BufferedImage sharpenedDefault = ImageUtil.sharpen(original, 0.3f);
- final BufferedImage sharpenedMore = ImageUtil.sharpen(original, 1.3f);
-
-// long diffOriginal = 0;
-// long diffSharpened = 0;
-// long diffDefault = 0;
-// long diffMore = 0;
-
- long absDiffOriginal = 0;
- long absDiffSharpened = 0;
- long absDiffDefault = 0;
- long absDiffMore = 0;
-
- for (int y = 0; y < original.getHeight(); y++) {
- for (int x = 1; x < original.getWidth(); x++) {
- int oRGB = 0x00FFFFFF & original.getRGB(x, y);
- int sRGB = 0x00FFFFFF & sharpened.getRGB(x, y);
- int dRGB = 0x00FFFFFF & sharpenedDefault.getRGB(x, y);
- int mRGB = 0x00FFFFFF & sharpenedMore.getRGB(x, y);
-
- int poRGB = 0x00FFFFFF & original.getRGB(x - 1, y);
- int psRGB = 0x00FFFFFF & sharpened.getRGB(x - 1, y);
- int pdRGB = 0x00FFFFFF & sharpenedDefault.getRGB(x - 1, y);
- int pmRGB = 0x00FFFFFF & sharpenedMore.getRGB(x - 1, y);
-
-// diffOriginal += poRGB - oRGB;
-// diffSharpened += psRGB - sRGB;
-// diffDefault += pdRGB - dRGB;
-// diffMore += pmRGB - mRGB;
-
- absDiffOriginal += Math.abs(poRGB - oRGB);
- absDiffSharpened += Math.abs(psRGB - sRGB);
- absDiffDefault += Math.abs(pdRGB - dRGB);
- absDiffMore += Math.abs(pmRGB - mRGB);
- }
- }
-
-// assertEquals("Difference should not change", diffOriginal, diffSharpened);
- assertTrue("Abs difference should increase", absDiffOriginal < absDiffSharpened);
-// assertEquals("Difference should not change", diffOriginal, diffDefault);
- assertTrue("Abs difference should increase", absDiffOriginal < absDiffDefault);
-// assertEquals("Difference should not change", diffOriginal, diffMore);
- assertTrue("Abs difference should increase", absDiffOriginal < absDiffMore);
-// assertEquals("Difference should not change", diffSharpened, diffMore);
- assertTrue("Abs difference should increase", absDiffSharpened < absDiffMore);
- }
-
- @Test
- public void testBlur() {
- final BufferedImage original = this.original;
-
- assertNotNull(original);
-
- final BufferedImage notBlurred = ImageUtil.blur(original, 0f);
- // Assumed: Images should be equal
- if (original != notBlurred) { // Don't care to test if images are same
- for (int y = 0; y < original.getHeight(); y++) {
- for (int x = 0; x < original.getWidth(); x++) {
- assertEquals("0 blur should not change image", original.getRGB(x, y), notBlurred.getRGB(x, y));
- }
- }
- }
-
- // Assumed: Difference between neighbouring pixels should decrease for higher blur values
- // Assumed: Dynamics of entire image should not change
- final BufferedImage blurred = ImageUtil.blur(original);
- final BufferedImage blurredDefault = ImageUtil.blur(original, 1.5f);
- final BufferedImage blurredMore = ImageUtil.blur(original, 3f);
-
-// long diffOriginal = 0;
-// long diffBlurred = 0;
-// long diffDefault = 0;
-// long diffMore = 0;
-
- long absDiffOriginal = 0;
- long absDiffBlurred = 0;
- long absDiffDefault = 0;
- long absDiffMore = 0;
-
- for (int y = 0; y < original.getHeight(); y++) {
- for (int x = 1; x < original.getWidth(); x++) {
- int oRGB = 0x00FFFFFF & original.getRGB(x, y);
- int bRGB = 0x00FFFFFF & blurred.getRGB(x, y);
- int dRGB = 0x00FFFFFF & blurredDefault.getRGB(x, y);
- int mRGB = 0x00FFFFFF & blurredMore.getRGB(x, y);
-
- int poRGB = 0x00FFFFFF & original.getRGB(x - 1, y);
- int pbRGB = 0x00FFFFFF & blurred.getRGB(x - 1, y);
- int pdRGB = 0x00FFFFFF & blurredDefault.getRGB(x - 1, y);
- int pmRGB = 0x00FFFFFF & blurredMore.getRGB(x - 1, y);
-
-// diffOriginal += poRGB - oRGB;
-// diffBlurred += pbRGB - bRGB;
-// diffDefault += pdRGB - dRGB;
-// diffMore += pmRGB - mRGB;
-
- absDiffOriginal += Math.abs(poRGB - oRGB);
- absDiffBlurred += Math.abs(pbRGB - bRGB);
- absDiffDefault += Math.abs(pdRGB - dRGB);
- absDiffMore += Math.abs(pmRGB - mRGB);
- }
- }
-
-// assertEquals("Difference should not change", diffOriginal, diffBlurred);
- assertTrue(String.format("Abs difference should decrease: %s <= %s", absDiffOriginal, absDiffBlurred), absDiffOriginal > absDiffBlurred);
-// assertEquals("Difference should not change", diffOriginal, diffDefault);
- assertTrue("Abs difference should decrease", absDiffOriginal > absDiffDefault);
-// assertEquals("Difference should not change", diffOriginal, diffMore);
- assertTrue("Abs difference should decrease", absDiffOriginal > absDiffMore);
-// assertEquals("Difference should not change", diffBlurred, diffMore);
- assertTrue("Abs difference should decrease", absDiffBlurred > absDiffMore);
- }
-
- @Test
- public void testIndexImage() {
- BufferedImage sunflower = original;
-
- assertNotNull(sunflower);
-
- BufferedImage image = ImageUtil.createIndexed(sunflower);
- assertNotNull("Image was null", image);
- assertTrue(image.getColorModel() instanceof IndexColorModel);
- }
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.image;
+
+import org.junit.Test;
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.awt.image.RenderedImage;
+import java.io.InputStream;
+
+import static org.junit.Assert.*;
+
+public class ImageUtilTest {
+
+ private final static String IMAGE_NAME = "/sunflower.jpg";
+ private BufferedImage original;
+ private BufferedImage image;
+ private Image scaled;
+
+ public ImageUtilTest() throws Exception {
+ image = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+ scaled = image.getScaledInstance(5, 5, Image.SCALE_FAST);
+
+ // Read image from class path
+ InputStream is = getClass().getResourceAsStream(IMAGE_NAME);
+ original = ImageIO.read(is);
+
+ assertNotNull(original);
+ }
+
+ /*
+ public void setUp() throws Exception {
+ image = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+ scaled = image.getScaledInstance(5, 5, Image.SCALE_FAST);
+
+ // Read image from class path
+ InputStream is = ClassLoader.getSystemResourceAsStream(IMAGE_NAME);
+ original = ImageIO.read(is);
+
+ assertNotNull(original);
+ }
+
+ protected void tearDown() throws Exception {
+ original = null;
+ }
+ */
+
+ @Test
+ public void testToBufferedImageNull() {
+ BufferedImage img = null;
+ boolean threwRuntimeException = false;
+
+ try {
+ img = ImageUtil.toBuffered((Image) null);
+ }
+ catch (RuntimeException ne) {
+ threwRuntimeException = true;
+ }
+ // No input should return null
+ assertNull(img);
+
+ // Should have thrown an exception
+ assertTrue(threwRuntimeException);
+ }
+
+ @Test
+ public void testToBufferedImageTypeNull() {
+ BufferedImage img = null;
+ boolean threwRuntimeException = false;
+
+ try {
+ img = ImageUtil.toBuffered(null, BufferedImage.TYPE_INT_ARGB);
+ }
+ catch (RuntimeException ne) {
+ threwRuntimeException = true;
+ }
+ // No input should return null
+ assertNull(img);
+
+ // Should have thrown an exception
+ assertTrue(threwRuntimeException);
+ }
+
+ @Test
+ public void testImageIsNotBufferedImage() {
+ // Should not be a buffered image
+ assertFalse(
+ "FOR SOME IMPLEMENTATIONS THIS MIGHT FAIL!\nIn that case, testToBufferedImage() will fail too.",
+ scaled instanceof BufferedImage
+ );
+ }
+
+ @Test
+ public void testToBufferedImage() {
+ BufferedImage sameAsImage = ImageUtil.toBuffered((RenderedImage) image);
+ BufferedImage bufferedScaled = ImageUtil.toBuffered(scaled);
+
+ // Should be no need to convert
+ assertSame(image, sameAsImage);
+
+ // Should have same dimensions
+ assertEquals(scaled.getWidth(null), bufferedScaled.getWidth());
+ assertEquals(scaled.getHeight(null), bufferedScaled.getHeight());
+ }
+
+ @Test
+ public void testToBufferedImageType() {
+ // Assumes image is TYPE_INT_ARGB
+ BufferedImage converted = ImageUtil.toBuffered(image, BufferedImage.TYPE_BYTE_INDEXED);
+ BufferedImage convertedToo = ImageUtil.toBuffered(image, BufferedImage.TYPE_BYTE_BINARY);
+
+ // Should not be the same
+ assertNotSame(image, converted);
+ assertNotSame(image, convertedToo);
+
+ // Correct type
+ assertTrue(converted.getType() == BufferedImage.TYPE_BYTE_INDEXED);
+ assertTrue(convertedToo.getType() == BufferedImage.TYPE_BYTE_BINARY);
+
+ // Should have same dimensions
+ assertEquals(image.getWidth(), converted.getWidth());
+ assertEquals(image.getHeight(), converted.getHeight());
+
+ assertEquals(image.getWidth(), convertedToo.getWidth());
+ assertEquals(image.getHeight(), convertedToo.getHeight());
+ }
+
+ @Test
+ public void testBrightness() {
+ final BufferedImage original = this.original;
+ assertNotNull(original);
+
+ final BufferedImage notBrightened = ImageUtil.toBuffered(ImageUtil.brightness(original, 0f));
+ // Assumed: Images should be equal
+ if (original != notBrightened) { // Don't care to test if images are same
+ for (int y = 0; y < original.getHeight(); y++) {
+ for (int x = 0; x < original.getWidth(); x++) {
+ assertEquals(original.getRGB(x, y), notBrightened.getRGB(x, y));
+ }
+ }
+ }
+
+ // Assumed: All pixels should be brighter or equal to original
+ final BufferedImage brightened = ImageUtil.toBuffered(ImageUtil.brightness(original, 0.4f));
+ final BufferedImage brightenedMore = ImageUtil.toBuffered(ImageUtil.brightness(original, 0.9f));
+ for (int y = 0; y < original.getHeight(); y++) {
+ for (int x = 0; x < original.getWidth(); x++) {
+ assertTrue(original.getRGB(x, y) <= brightened.getRGB(x, y));
+ assertTrue(brightened.getRGB(x, y) <= brightenedMore.getRGB(x, y));
+ }
+ }
+
+ // Assumed: Image should be all white
+ final BufferedImage brightenedMax = ImageUtil.toBuffered(ImageUtil.brightness(original, 2f));
+ for (int y = 0; y < brightenedMax.getHeight(); y++) {
+ for (int x = 0; x < brightenedMax.getWidth(); x++) {
+ assertEquals(0x00FFFFFF, brightenedMax.getRGB(x, y) & 0x00FFFFFF);
+ }
+ }
+
+ // Assumed: All pixels should be darker or equal to originial
+ final BufferedImage brightenedNegative = ImageUtil.toBuffered(ImageUtil.brightness(original, -0.4f));
+ final BufferedImage brightenedNegativeMore = ImageUtil.toBuffered(ImageUtil.brightness(original, -0.9f));
+ for (int y = 0; y < original.getHeight(); y++) {
+ for (int x = 0; x < original.getWidth(); x++) {
+ assertTrue(original.getRGB(x, y) >= brightenedNegative.getRGB(x, y));
+ assertTrue(brightenedNegative.getRGB(x, y) >= brightenedNegativeMore.getRGB(x, y));
+ }
+ }
+ // Assumed: Image should be all black
+ final BufferedImage brightenedMaxNegative = ImageUtil.toBuffered(ImageUtil.brightness(original, -2f));
+ for (int y = 0; y < brightenedMaxNegative.getHeight(); y++) {
+ for (int x = 0; x < brightenedMaxNegative.getWidth(); x++) {
+ assertEquals(0x0, brightenedMaxNegative.getRGB(x, y) & 0x00FFFFFF);
+ }
+ }
+
+ /*
+ JFrame frame = new JFrame("Sunflower - brightness");
+ frame.setSize(sunflower.getWidth() * 4, sunflower.getHeight() * 2);
+
+ Canvas canvas = new Canvas() {
+ public void paint(Graphics g) {
+ // Draw original for comparison
+ g.drawImage(original, 0, 0, null);
+
+ // This should look like original
+ g.drawImage(notBrightened, 0, original.getHeight(), null);
+
+ // Different versions
+ g.drawImage(brightened, original.getWidth(), 0, null);
+ g.drawImage(brightenedMore, original.getWidth() * 2, 0, null);
+ g.drawImage(brightenedMax, original.getWidth() * 3, 0, null);
+
+ g.drawImage(brightenedNegative, original.getWidth(), original.getHeight(), null);
+ g.drawImage(brightenedNegativeMore, original.getWidth() * 2, original.getHeight(), null);
+ g.drawImage(brightenedMaxNegative, original.getWidth() * 3, original.getHeight(), null);
+ }
+ };
+
+ frame.getContentPane().add(canvas);
+ frame.setVisible(true);
+
+ assertTrue(true);
+ */
+ }
+
+ @Test
+ public void testContrast() {
+ final BufferedImage original = this.original;
+
+ assertNotNull(original);
+
+ final BufferedImage notContrasted = ImageUtil.toBuffered(ImageUtil.contrast(original, 0f));
+ // Assumed: Images should be equal
+ if (original != notContrasted) { // Don't care to test if images are same
+ for (int y = 0; y < original.getHeight(); y++) {
+ for (int x = 0; x < original.getWidth(); x++) {
+ assertEquals("0 constrast should not change image", original.getRGB(x, y), notContrasted.getRGB(x, y));
+ }
+ }
+ }
+
+ // Assumed: Contrast should be greater or equal to original
+ final BufferedImage contrasted = ImageUtil.toBuffered(ImageUtil.contrast(original));
+ final BufferedImage contrastedDefault = ImageUtil.toBuffered(ImageUtil.contrast(original, 0.5f));
+ for (int y = 0; y < original.getHeight(); y++) {
+ for (int x = 0; x < original.getWidth(); x++) {
+ int oRGB = original.getRGB(x, y);
+ int cRGB = contrasted.getRGB(x, y);
+ int dRGB = contrastedDefault.getRGB(x, y);
+
+ int oR = oRGB >> 16 & 0xFF;
+ int oG = oRGB >> 8 & 0xFF;
+ int oB = oRGB & 0xFF;
+
+ int cR = cRGB >> 16 & 0xFF;
+ int cG = cRGB >> 8 & 0xFF;
+ int cB = cRGB & 0xFF;
+
+ int dR = dRGB >> 16 & 0xFF;
+ int dG = dRGB >> 8 & 0xFF;
+ int dB = dRGB & 0xFF;
+
+ // RED
+ if (oR < 127) {
+ assertTrue("Contrast should be decreased or same", oR >= cR && cR >= dR);
+ }
+ else {
+ assertTrue("Contrast should be increased or same", oR <= cR && cR <= dR);
+ }
+ // GREEN
+ if (oG < 127) {
+ assertTrue("Contrast should be decreased or same", oG >= cG && cG >= dG);
+ }
+ else {
+ assertTrue("Contrast should be increased or same", oG <= cG && cG <= dG);
+ }
+ // BLUE
+ if (oB < 127) {
+ assertTrue("Contrast should be decreased or same", oB >= cB && cB >= dB);
+ }
+ else {
+ assertTrue("Contrast should be increased or same", oB <= cB && cB <= dB);
+ }
+ }
+ }
+ // Assumed: Only primary colors (w/b/r/g/b/c/y/m)
+ final BufferedImage contrastedMax = ImageUtil.toBuffered(ImageUtil.contrast(original, 1f));
+ for (int y = 0; y < contrastedMax.getHeight(); y++) {
+ for (int x = 0; x < contrastedMax.getWidth(); x++) {
+ int rgb = contrastedMax.getRGB(x, y);
+ int r = rgb >> 16 & 0xFF;
+ int g = rgb >> 8 & 0xFF;
+ int b = rgb & 0xFF;
+ assertTrue("Max contrast should only produce primary colors", r == 0 || r == 255);
+ assertTrue("Max contrast should only produce primary colors", g == 0 || g == 255);
+ assertTrue("Max contrast should only produce primary colors", b == 0 || b == 255);
+ }
+ }
+
+ // Assumed: Contrasts should be less than or equal to original
+ final BufferedImage contrastedNegative = ImageUtil.toBuffered(ImageUtil.contrast(original, -0.5f));
+ for (int y = 0; y < original.getHeight(); y++) {
+ for (int x = 0; x < original.getWidth(); x++) {
+ int oRGB = original.getRGB(x, y);
+ int cRGB = contrastedNegative.getRGB(x, y);
+
+ int oR = oRGB >> 16 & 0xFF;
+ int oG = oRGB >> 8 & 0xFF;
+ int oB = oRGB & 0xFF;
+
+ int cR = cRGB >> 16 & 0xFF;
+ int cG = cRGB >> 8 & 0xFF;
+ int cB = cRGB & 0xFF;
+
+ // RED
+ if (oR >= 127) {
+ assertTrue("Contrast should be decreased or same", oR >= cR);
+ }
+ else {
+ assertTrue("Contrast should be increased or same", oR <= cR);
+ }
+ // GREEN
+ if (oG >= 127) {
+ assertTrue("Contrast should be decreased or same", oG >= cG);
+ }
+ else {
+ assertTrue("Contrast should be increased or same", oG <= cG);
+ }
+ // BLUE
+ if (oB >= 127) {
+ assertTrue("Contrast should be decreased or same", oB >= cB);
+ }
+ else {
+ assertTrue("Contrast should be increased or same", oB <= cB);
+ }
+ }
+ }
+
+ // Assumed: All gray (127)!
+ final BufferedImage contrastedMoreNegative = ImageUtil.toBuffered(ImageUtil.contrast(original, -1.0f));
+ for (int y = 0; y < contrastedMoreNegative.getHeight(); y++) {
+ for (int x = 0; x < contrastedMoreNegative.getWidth(); x++) {
+ int rgb = contrastedMoreNegative.getRGB(x, y);
+ int r = rgb >> 16 & 0xFF;
+ int g = rgb >> 8 & 0xFF;
+ int b = rgb & 0xFF;
+ assertTrue("Minimum contrast should be all gray", r == 127 && g == 127 && b == 127);
+ }
+ }
+
+ /*
+ JFrame frame = new JFrame("Sunflower - contrast");
+ frame.setSize(sunflower.getWidth() * 4, sunflower.getHeight() * 2);
+
+ Canvas canvas = new Canvas() {
+ public void paint(Graphics g) {
+ // Draw original for comparison
+ g.drawImage(original, 0, 0, null);
+
+ // This should look like original
+ g.drawImage(notContrasted, 0, original.getHeight(), null);
+
+ // Different versions
+ g.drawImage(contrasted, original.getWidth(), 0, null);
+ g.drawImage(contrastedDefault, original.getWidth() * 2, 0, null);
+ g.drawImage(contrastedMax, original.getWidth() * 3, 0, null);
+ g.drawImage(contrastedNegative, original.getWidth() * 2, original.getHeight(), null);
+ g.drawImage(contrastedMoreNegative, original.getWidth() * 3, original.getHeight(), null);
+ }
+ };
+
+ frame.getContentPane().add(canvas);
+ frame.setVisible(true);
+
+ assertTrue(true);
+ */
+ }
+
+ @Test
+ public void testSharpen() {
+ final BufferedImage original = this.original;
+
+ assertNotNull(original);
+
+ final BufferedImage notSharpened = ImageUtil.sharpen(original, 0f);
+ // Assumed: Images should be equal
+ if (original != notSharpened) { // Don't care to test if images are same
+ for (int y = 0; y < original.getHeight(); y++) {
+ for (int x = 0; x < original.getWidth(); x++) {
+ assertEquals("0 sharpen should not change image", original.getRGB(x, y), notSharpened.getRGB(x, y));
+ }
+ }
+ }
+
+ // Assumed: Difference between neighbouring pixels should increase for higher sharpen values
+ // Assumed: Dynamics of entire image should not change
+ final BufferedImage sharpened = ImageUtil.sharpen(original);
+ final BufferedImage sharpenedDefault = ImageUtil.sharpen(original, 0.3f);
+ final BufferedImage sharpenedMore = ImageUtil.sharpen(original, 1.3f);
+
+// long diffOriginal = 0;
+// long diffSharpened = 0;
+// long diffDefault = 0;
+// long diffMore = 0;
+
+ long absDiffOriginal = 0;
+ long absDiffSharpened = 0;
+ long absDiffDefault = 0;
+ long absDiffMore = 0;
+
+ for (int y = 0; y < original.getHeight(); y++) {
+ for (int x = 1; x < original.getWidth(); x++) {
+ int oRGB = 0x00FFFFFF & original.getRGB(x, y);
+ int sRGB = 0x00FFFFFF & sharpened.getRGB(x, y);
+ int dRGB = 0x00FFFFFF & sharpenedDefault.getRGB(x, y);
+ int mRGB = 0x00FFFFFF & sharpenedMore.getRGB(x, y);
+
+ int poRGB = 0x00FFFFFF & original.getRGB(x - 1, y);
+ int psRGB = 0x00FFFFFF & sharpened.getRGB(x - 1, y);
+ int pdRGB = 0x00FFFFFF & sharpenedDefault.getRGB(x - 1, y);
+ int pmRGB = 0x00FFFFFF & sharpenedMore.getRGB(x - 1, y);
+
+// diffOriginal += poRGB - oRGB;
+// diffSharpened += psRGB - sRGB;
+// diffDefault += pdRGB - dRGB;
+// diffMore += pmRGB - mRGB;
+
+ absDiffOriginal += Math.abs(poRGB - oRGB);
+ absDiffSharpened += Math.abs(psRGB - sRGB);
+ absDiffDefault += Math.abs(pdRGB - dRGB);
+ absDiffMore += Math.abs(pmRGB - mRGB);
+ }
+ }
+
+// assertEquals("Difference should not change", diffOriginal, diffSharpened);
+ assertTrue("Abs difference should increase", absDiffOriginal < absDiffSharpened);
+// assertEquals("Difference should not change", diffOriginal, diffDefault);
+ assertTrue("Abs difference should increase", absDiffOriginal < absDiffDefault);
+// assertEquals("Difference should not change", diffOriginal, diffMore);
+ assertTrue("Abs difference should increase", absDiffOriginal < absDiffMore);
+// assertEquals("Difference should not change", diffSharpened, diffMore);
+ assertTrue("Abs difference should increase", absDiffSharpened < absDiffMore);
+ }
+
+ @Test
+ public void testBlur() {
+ final BufferedImage original = this.original;
+
+ assertNotNull(original);
+
+ final BufferedImage notBlurred = ImageUtil.blur(original, 0f);
+ // Assumed: Images should be equal
+ if (original != notBlurred) { // Don't care to test if images are same
+ for (int y = 0; y < original.getHeight(); y++) {
+ for (int x = 0; x < original.getWidth(); x++) {
+ assertEquals("0 blur should not change image", original.getRGB(x, y), notBlurred.getRGB(x, y));
+ }
+ }
+ }
+
+ // Assumed: Difference between neighbouring pixels should decrease for higher blur values
+ // Assumed: Dynamics of entire image should not change
+ final BufferedImage blurred = ImageUtil.blur(original);
+ final BufferedImage blurredDefault = ImageUtil.blur(original, 1.5f);
+ final BufferedImage blurredMore = ImageUtil.blur(original, 3f);
+
+// long diffOriginal = 0;
+// long diffBlurred = 0;
+// long diffDefault = 0;
+// long diffMore = 0;
+
+ long absDiffOriginal = 0;
+ long absDiffBlurred = 0;
+ long absDiffDefault = 0;
+ long absDiffMore = 0;
+
+ for (int y = 0; y < original.getHeight(); y++) {
+ for (int x = 1; x < original.getWidth(); x++) {
+ int oRGB = 0x00FFFFFF & original.getRGB(x, y);
+ int bRGB = 0x00FFFFFF & blurred.getRGB(x, y);
+ int dRGB = 0x00FFFFFF & blurredDefault.getRGB(x, y);
+ int mRGB = 0x00FFFFFF & blurredMore.getRGB(x, y);
+
+ int poRGB = 0x00FFFFFF & original.getRGB(x - 1, y);
+ int pbRGB = 0x00FFFFFF & blurred.getRGB(x - 1, y);
+ int pdRGB = 0x00FFFFFF & blurredDefault.getRGB(x - 1, y);
+ int pmRGB = 0x00FFFFFF & blurredMore.getRGB(x - 1, y);
+
+// diffOriginal += poRGB - oRGB;
+// diffBlurred += pbRGB - bRGB;
+// diffDefault += pdRGB - dRGB;
+// diffMore += pmRGB - mRGB;
+
+ absDiffOriginal += Math.abs(poRGB - oRGB);
+ absDiffBlurred += Math.abs(pbRGB - bRGB);
+ absDiffDefault += Math.abs(pdRGB - dRGB);
+ absDiffMore += Math.abs(pmRGB - mRGB);
+ }
+ }
+
+// assertEquals("Difference should not change", diffOriginal, diffBlurred);
+ assertTrue(String.format("Abs difference should decrease: %s <= %s", absDiffOriginal, absDiffBlurred), absDiffOriginal > absDiffBlurred);
+// assertEquals("Difference should not change", diffOriginal, diffDefault);
+ assertTrue("Abs difference should decrease", absDiffOriginal > absDiffDefault);
+// assertEquals("Difference should not change", diffOriginal, diffMore);
+ assertTrue("Abs difference should decrease", absDiffOriginal > absDiffMore);
+// assertEquals("Difference should not change", diffBlurred, diffMore);
+ assertTrue("Abs difference should decrease", absDiffBlurred > absDiffMore);
+ }
+
+ @Test
+ public void testIndexImage() {
+ BufferedImage sunflower = original;
+
+ assertNotNull(sunflower);
+
+ BufferedImage image = ImageUtil.createIndexed(sunflower);
+ assertNotNull("Image was null", image);
+ assertTrue(image.getColorModel() instanceof IndexColorModel);
+ }
+}
diff --git a/common/common-image/src/test/java/com/twelvemonkeys/image/ResampleOpTestCase.java b/common/common-image/src/test/java/com/twelvemonkeys/image/ResampleOpTest.java
similarity index 87%
rename from common/common-image/src/test/java/com/twelvemonkeys/image/ResampleOpTestCase.java
rename to common/common-image/src/test/java/com/twelvemonkeys/image/ResampleOpTest.java
index 316fac6e..c6b43bf3 100644
--- a/common/common-image/src/test/java/com/twelvemonkeys/image/ResampleOpTestCase.java
+++ b/common/common-image/src/test/java/com/twelvemonkeys/image/ResampleOpTest.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
package com.twelvemonkeys.image;
import org.junit.Ignore;
@@ -19,7 +49,7 @@ import static org.junit.Assert.*;
* @author last modified by $Author: haku $
* @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/image/ResampleOpTestCase.java#1 $
*/
-public class ResampleOpTestCase {
+public class ResampleOpTest {
protected BufferedImage createImage(final int pWidth, final int pHeigth) {
return createImage(pWidth, pHeigth, BufferedImage.TYPE_INT_ARGB);
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/AbstractCachedSeekableStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/AbstractCachedSeekableStream.java
index 69f07bba..17d9038f 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/AbstractCachedSeekableStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/AbstractCachedSeekableStream.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
package com.twelvemonkeys.io;
import com.twelvemonkeys.lang.Validate;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/CompoundReader.java b/common/common-io/src/main/java/com/twelvemonkeys/io/CompoundReader.java
index e41562f1..77911567 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/CompoundReader.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/CompoundReader.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
@@ -32,8 +34,8 @@ import com.twelvemonkeys.lang.Validate;
import java.io.IOException;
import java.io.Reader;
-import java.util.Iterator;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
/**
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/EmptyReader.java b/common/common-io/src/main/java/com/twelvemonkeys/io/EmptyReader.java
index d83c9053..ea1a1abf 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/EmptyReader.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/EmptyReader.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/FastByteArrayOutputStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/FastByteArrayOutputStream.java
index bf6c5b5f..4bac2b82 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/FastByteArrayOutputStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/FastByteArrayOutputStream.java
@@ -4,34 +4,36 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
+import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import java.io.ByteArrayInputStream;
/**
* An unsynchronized {@code ByteArrayOutputStream} implementation. This version
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/FileCacheSeekableStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/FileCacheSeekableStream.java
index e514c3c8..bfdbaed8 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/FileCacheSeekableStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/FileCacheSeekableStream.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/FileSeekableStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/FileSeekableStream.java
index e86ad5f0..86c92e39 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/FileSeekableStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/FileSeekableStream.java
@@ -4,31 +4,36 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
-import java.io.*;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
/**
* A {@code SeekableInputStream} implementation that uses random access directly to a {@code File}.
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/FileSystem.java b/common/common-io/src/main/java/com/twelvemonkeys/io/FileSystem.java
index 9b18f789..b275e5bf 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/FileSystem.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/FileSystem.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java b/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java
index 8cad4665..58ee8f7f 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/FileUtil.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
@@ -33,11 +35,11 @@ import com.twelvemonkeys.lang.Validate;
import com.twelvemonkeys.util.Visitor;
import java.io.*;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
import java.net.URL;
import java.text.NumberFormat;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.UndeclaredThrowableException;
/**
* A utility class with some useful file and i/o related methods.
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/FilenameMaskFilter.java b/common/common-io/src/main/java/com/twelvemonkeys/io/FilenameMaskFilter.java
index 6a541621..26f5e477 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/FilenameMaskFilter.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/FilenameMaskFilter.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianDataInputStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianDataInputStream.java
index 7eb31923..401b92dd 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianDataInputStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianDataInputStream.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* From http://www.cafeaulait.org/books/javaio/ioexamples/index.html:
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianDataOutputStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianDataOutputStream.java
index 78699d73..84d6469f 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianDataOutputStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianDataOutputStream.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* From http://www.cafeaulait.org/books/javaio/ioexamples/index.html:
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianRandomAccessFile.java b/common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianRandomAccessFile.java
index 6cb701dc..73b222f5 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianRandomAccessFile.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/LittleEndianRandomAccessFile.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/MemoryCacheSeekableStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/MemoryCacheSeekableStream.java
index 70bf86ff..a60bc8a4 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/MemoryCacheSeekableStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/MemoryCacheSeekableStream.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/NullInputStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/NullInputStream.java
index aa27ac30..9e7af300 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/NullInputStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/NullInputStream.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/NullOutputStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/NullOutputStream.java
index ad99120b..2b274a37 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/NullOutputStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/NullOutputStream.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/RandomAccessStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/RandomAccessStream.java
index 196da6e9..79e09afe 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/RandomAccessStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/RandomAccessStream.java
@@ -4,34 +4,36 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
import java.io.DataInput;
import java.io.DataOutput;
-import java.io.IOException;
import java.io.EOFException;
+import java.io.IOException;
/**
* A data stream that is both readable and writable, much like a
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/Seekable.java b/common/common-io/src/main/java/com/twelvemonkeys/io/Seekable.java
index b84d5d3e..40b00ed9 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/Seekable.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/Seekable.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/SeekableInputStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/SeekableInputStream.java
index 0a605174..6935bcc3 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/SeekableInputStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/SeekableInputStream.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/SeekableOutputStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/SeekableOutputStream.java
index 133597ec..cc99cf73 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/SeekableOutputStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/SeekableOutputStream.java
@@ -4,32 +4,34 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
-import java.io.OutputStream;
import java.io.IOException;
+import java.io.OutputStream;
import java.util.Stack;
/**
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/StringArrayReader.java b/common/common-io/src/main/java/com/twelvemonkeys/io/StringArrayReader.java
index d90b3e1b..0270ef0a 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/StringArrayReader.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/StringArrayReader.java
@@ -4,35 +4,37 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
import com.twelvemonkeys.lang.Validate;
-import java.io.StringReader;
import java.io.IOException;
import java.io.Reader;
+import java.io.StringReader;
/**
* StringArrayReader
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/SubStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/SubStream.java
index d45d6b78..023d0a1f 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/SubStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/SubStream.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/UnixFileSystem.java b/common/common-io/src/main/java/com/twelvemonkeys/io/UnixFileSystem.java
index 3675fee5..761a2ab8 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/UnixFileSystem.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/UnixFileSystem.java
@@ -4,35 +4,37 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
import com.twelvemonkeys.util.StringTokenIterator;
+import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
-import java.io.BufferedReader;
/**
* UnixFileSystem
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/Win32File.java b/common/common-io/src/main/java/com/twelvemonkeys/io/Win32File.java
index 872ad480..ee3e3e1b 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/Win32File.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/Win32File.java
@@ -4,31 +4,36 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
-import java.io.*;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FilenameFilter;
+import java.io.IOException;
/**
* Win32File
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/Win32FileSystem.java b/common/common-io/src/main/java/com/twelvemonkeys/io/Win32FileSystem.java
index 8e8ff5a9..400164d1 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/Win32FileSystem.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/Win32FileSystem.java
@@ -4,32 +4,34 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
-import java.io.File;
import java.io.BufferedReader;
+import java.io.File;
import java.io.IOException;
/**
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/Win32Lnk.java b/common/common-io/src/main/java/com/twelvemonkeys/io/Win32Lnk.java
index 738243e1..7833c0fa 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/Win32Lnk.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/Win32Lnk.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/WriterOutputStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/WriterOutputStream.java
index d3c0a1a7..b9f9f39e 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/WriterOutputStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/WriterOutputStream.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
@@ -31,9 +33,9 @@ package com.twelvemonkeys.io;
import com.twelvemonkeys.lang.DateUtil;
import java.io.*;
-import java.nio.charset.Charset;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
+import java.nio.charset.Charset;
/**
* Wraps a {@code Writer} in an {@code OutputStream}.
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Base64Decoder.java b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Base64Decoder.java
index 7e385c3a..d433e387 100644
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Base64Decoder.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Base64Decoder.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.enc;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Base64Encoder.java b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Base64Encoder.java
index d8336498..a9317969 100644
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Base64Encoder.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Base64Encoder.java
@@ -4,32 +4,34 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.enc;
-import java.io.OutputStream;
import java.io.IOException;
+import java.io.OutputStream;
import java.nio.ByteBuffer;
/**
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/DecodeException.java b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/DecodeException.java
index 7acf88af..c54e8d09 100644
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/DecodeException.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/DecodeException.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.enc;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Decoder.java b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Decoder.java
index aa7576d0..75372bad 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Decoder.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Decoder.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.enc;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/DecoderStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/DecoderStream.java
index 07826694..188f8f0f 100644
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/DecoderStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/DecoderStream.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.enc;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Encoder.java b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Encoder.java
index 1864e4dc..42e235e4 100644
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Encoder.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/Encoder.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.enc;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/EncoderStream.java b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/EncoderStream.java
index f1ba67ef..a22ad5f0 100644
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/EncoderStream.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/EncoderStream.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.enc;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/PackBitsDecoder.java b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/PackBitsDecoder.java
index 86c32a1f..82b71ebc 100644
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/PackBitsDecoder.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/PackBitsDecoder.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.enc;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/PackBitsEncoder.java b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/PackBitsEncoder.java
index e51a94e8..501e7c57 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/PackBitsEncoder.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/PackBitsEncoder.java
@@ -4,32 +4,34 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.enc;
-import java.io.OutputStream;
import java.io.IOException;
+import java.io.OutputStream;
import java.nio.ByteBuffer;
/**
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/package-info.java b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/package-info.java
index 72d47b16..d7ff80c0 100644
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/enc/package-info.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/enc/package-info.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
/**
* Contains customized stream classes, that can read or write compressed data on the fly,
* along with encoders and decoders for popular stream formats, such as Base64, ZIP (deflate), LZW, PackBits etc..
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/CompoundDocument.java b/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/CompoundDocument.java
index 8dcffcc9..91cab4a5 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/CompoundDocument.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/CompoundDocument.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.ole2;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/CorruptDocumentException.java b/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/CorruptDocumentException.java
index e7340407..9a6f020c 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/CorruptDocumentException.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/CorruptDocumentException.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.ole2;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/Entry.java b/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/Entry.java
index d4ac6b60..c7951ff7 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/Entry.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/Entry.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.ole2;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/SIdChain.java b/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/SIdChain.java
index b1bb7b73..ac48c99b 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/SIdChain.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/SIdChain.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.ole2;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/package-info.java b/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/package-info.java
index 0220f950..35412b61 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/package-info.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/package-info.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
/**
* Contains classes for reading the contents of the
* Microsoft OLE 2 compound document format.
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/io/package_info.java b/common/common-io/src/main/java/com/twelvemonkeys/io/package_info.java
index 87a4749e..07897ee8 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/io/package_info.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/io/package_info.java
@@ -1,3 +1,32 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
/**
* Provides for system input and output through data streams, serialization and the file system.
*/
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/net/HTTPUtil.java b/common/common-io/src/main/java/com/twelvemonkeys/net/HTTPUtil.java
index 399adf29..d50e203e 100644
--- a/common/common-io/src/main/java/com/twelvemonkeys/net/HTTPUtil.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/net/HTTPUtil.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.net;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/net/MIMEUtil.java b/common/common-io/src/main/java/com/twelvemonkeys/net/MIMEUtil.java
index a576a5e4..a8196395 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/net/MIMEUtil.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/net/MIMEUtil.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.net;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/net/package_info.java b/common/common-io/src/main/java/com/twelvemonkeys/net/package_info.java
index 0a0322ca..8fae1caa 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/net/package_info.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/net/package_info.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
/**
* Provides classes for net access.
*/
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/xml/DOMSerializer.java b/common/common-io/src/main/java/com/twelvemonkeys/xml/DOMSerializer.java
index 4dd47830..30f716e9 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/xml/DOMSerializer.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/xml/DOMSerializer.java
@@ -4,34 +4,35 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
package com.twelvemonkeys.xml;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMImplementationList;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
import org.w3c.dom.bootstrap.DOMImplementationRegistry;
import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSOutput;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/xml/XMLSerializer.java b/common/common-io/src/main/java/com/twelvemonkeys/xml/XMLSerializer.java
index c1945f11..67f124be 100755
--- a/common/common-io/src/main/java/com/twelvemonkeys/xml/XMLSerializer.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/xml/XMLSerializer.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.xml;
diff --git a/common/common-io/src/main/java/com/twelvemonkeys/xml/package_info.java b/common/common-io/src/main/java/com/twelvemonkeys/xml/package_info.java
index 5aa03c91..ee8b3793 100644
--- a/common/common-io/src/main/java/com/twelvemonkeys/xml/package_info.java
+++ b/common/common-io/src/main/java/com/twelvemonkeys/xml/package_info.java
@@ -1,4 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
/**
* Provides XML support classes.
*/
- package com.twelvemonkeys.xml;
\ No newline at end of file
+package com.twelvemonkeys.xml;
\ No newline at end of file
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/CompoundReaderTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/CompoundReaderTest.java
similarity index 54%
rename from common/common-io/src/test/java/com/twelvemonkeys/io/CompoundReaderTestCase.java
rename to common/common-io/src/test/java/com/twelvemonkeys/io/CompoundReaderTest.java
index a3a4ed2f..6e1fb796 100755
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/CompoundReaderTestCase.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/CompoundReaderTest.java
@@ -1,68 +1,98 @@
-package com.twelvemonkeys.io;
-
-import com.twelvemonkeys.lang.StringUtil;
-import com.twelvemonkeys.util.CollectionUtil;
-import org.junit.Test;
-
-import java.io.Reader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.List;
-import java.util.ArrayList;
-
-import static org.junit.Assert.*;
-
-/**
- * CompoundReaderTestCase
- *
- *
- * @author Harald Kuhr
- * @author last modified by $Author: haku $
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/CompoundReaderTestCase.java#2 $
- */
-public class CompoundReaderTestCase extends ReaderAbstractTestCase {
- protected Reader makeReader(String pInput) {
- // Split
- String[] input = StringUtil.toStringArray(pInput, " ");
- List readers = new ArrayList(input.length);
-
- // Reappend spaces...
- // TODO: Add other readers
- for (int i = 0; i < input.length; i++) {
- if (i != 0) {
- input[i] = " " + input[i];
- }
- readers.add(new StringReader(input[i]));
- }
-
- return new CompoundReader(readers.iterator());
- }
-
- @Test
- public void testNullConstructor() {
- try {
- new CompoundReader(null);
- fail("Should not allow null argument");
- }
- catch (RuntimeException e) {
- assertNotNull(e.getMessage());
- }
- }
-
- @Test
- public void testEmptyIteratorConstructor() throws IOException {
- Reader reader = new CompoundReader(CollectionUtil.iterator(new Reader[0]));
- assertEquals(-1, reader.read());
- }
-
- @Test
- public void testIteratorWithNullConstructor() throws IOException {
- try {
- new CompoundReader(CollectionUtil.iterator(new Reader[] {null}));
- fail("Should not allow null in iterator argument");
- }
- catch (RuntimeException e) {
- assertNotNull(e.getMessage());
- }
- }
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io;
+
+import com.twelvemonkeys.lang.StringUtil;
+import com.twelvemonkeys.util.CollectionUtil;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.*;
+
+/**
+ * CompoundReaderTestCase
+ *
+ *
+ * @author Harald Kuhr
+ * @author last modified by $Author: haku $
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/CompoundReaderTestCase.java#2 $
+ */
+public class CompoundReaderTest extends ReaderAbstractTest {
+ protected Reader makeReader(String pInput) {
+ // Split
+ String[] input = StringUtil.toStringArray(pInput, " ");
+ List readers = new ArrayList(input.length);
+
+ // Reappend spaces...
+ // TODO: Add other readers
+ for (int i = 0; i < input.length; i++) {
+ if (i != 0) {
+ input[i] = " " + input[i];
+ }
+ readers.add(new StringReader(input[i]));
+ }
+
+ return new CompoundReader(readers.iterator());
+ }
+
+ @Test
+ public void testNullConstructor() {
+ try {
+ new CompoundReader(null);
+ fail("Should not allow null argument");
+ }
+ catch (RuntimeException e) {
+ assertNotNull(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testEmptyIteratorConstructor() throws IOException {
+ Reader reader = new CompoundReader(CollectionUtil.iterator(new Reader[0]));
+ assertEquals(-1, reader.read());
+ }
+
+ @Test
+ public void testIteratorWithNullConstructor() throws IOException {
+ try {
+ new CompoundReader(CollectionUtil.iterator(new Reader[] {null}));
+ fail("Should not allow null in iterator argument");
+ }
+ catch (RuntimeException e) {
+ assertNotNull(e.getMessage());
+ }
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/FastByteArrayOutputStreamTest.java b/common/common-io/src/test/java/com/twelvemonkeys/io/FastByteArrayOutputStreamTest.java
new file mode 100755
index 00000000..c3537431
--- /dev/null
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/FastByteArrayOutputStreamTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io;
+
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * FastByteArrayOutputStreamTestCase
+ *
+ *
+ * @author Harald Kuhr
+ * @author last modified by $Author: haku $
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/FastByteArrayOutputStreamTestCase.java#1 $
+ */
+public class FastByteArrayOutputStreamTest extends OutputStreamAbstractTest {
+ protected FastByteArrayOutputStream makeObject() {
+ return new FastByteArrayOutputStream(256);
+ }
+
+ @Test
+ public void testCreateInputStream() throws IOException {
+ FastByteArrayOutputStream out = makeObject();
+
+ String hello = "Hello World";
+ out.write(hello.getBytes("UTF-8"));
+
+ InputStream in = out.createInputStream();
+
+ byte[] read = FileUtil.read(in);
+
+ assertEquals(hello, new String(read, "UTF-8"));
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/FastByteArrayOutputStreamTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/FastByteArrayOutputStreamTestCase.java
deleted file mode 100755
index 95f09ccf..00000000
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/FastByteArrayOutputStreamTestCase.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.twelvemonkeys.io;
-
-import org.junit.Test;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * FastByteArrayOutputStreamTestCase
- *
- *
- * @author Harald Kuhr
- * @author last modified by $Author: haku $
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/FastByteArrayOutputStreamTestCase.java#1 $
- */
-public class FastByteArrayOutputStreamTestCase extends OutputStreamAbstractTestCase {
- protected FastByteArrayOutputStream makeObject() {
- return new FastByteArrayOutputStream(256);
- }
-
- @Test
- public void testCreateInputStream() throws IOException {
- FastByteArrayOutputStream out = makeObject();
-
- String hello = "Hello World";
- out.write(hello.getBytes("UTF-8"));
-
- InputStream in = out.createInputStream();
-
- byte[] read = FileUtil.read(in);
-
- assertEquals(hello, new String(read, "UTF-8"));
- }
-}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/FileCacheSeekableStreamTest.java b/common/common-io/src/test/java/com/twelvemonkeys/io/FileCacheSeekableStreamTest.java
new file mode 100755
index 00000000..01d139b1
--- /dev/null
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/FileCacheSeekableStreamTest.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * FileCacheSeekableStreamTestCase
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/FileCacheSeekableStreamTestCase.java#3 $
+ */
+public class FileCacheSeekableStreamTest extends SeekableInputStreamAbstractTest {
+ protected SeekableInputStream makeInputStream(final InputStream pStream) {
+ try {
+ return new FileCacheSeekableStream(pStream);
+ }
+ catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/FileCacheSeekableStreamTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/FileCacheSeekableStreamTestCase.java
deleted file mode 100755
index d12e9ca5..00000000
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/FileCacheSeekableStreamTestCase.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.twelvemonkeys.io;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * FileCacheSeekableStreamTestCase
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/FileCacheSeekableStreamTestCase.java#3 $
- */
-public class FileCacheSeekableStreamTestCase extends SeekableInputStreamAbstractTestCase {
- protected SeekableInputStream makeInputStream(final InputStream pStream) {
- try {
- return new FileCacheSeekableStream(pStream);
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/FileSeekableStreamTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/FileSeekableStreamTest.java
similarity index 55%
rename from common/common-io/src/test/java/com/twelvemonkeys/io/FileSeekableStreamTestCase.java
rename to common/common-io/src/test/java/com/twelvemonkeys/io/FileSeekableStreamTest.java
index 65f3c989..d4325af9 100755
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/FileSeekableStreamTestCase.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/FileSeekableStreamTest.java
@@ -1,74 +1,104 @@
-package com.twelvemonkeys.io;
-
-import org.junit.Test;
-
-import java.io.*;
-
-import static org.junit.Assert.*;
-
-/**
- * MemoryCacheSeekableStreamTestCase
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/FileSeekableStreamTestCase.java#3 $
- */
-public class FileSeekableStreamTestCase extends SeekableInputStreamAbstractTestCase {
- protected SeekableInputStream makeInputStream(final InputStream pStream) {
- try {
- return new FileSeekableStream(createFileWithContent(pStream));
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- private File createFileWithContent(final InputStream pStream) throws IOException {
- File temp = File.createTempFile("tm-io-junit", null);
- temp.deleteOnExit();
- OutputStream os = new FileOutputStream(temp);
- try {
- FileUtil.copy(pStream, os);
- }
- finally {
- os.close();
- pStream.close();
- }
- return temp;
- }
-
- @Test
- @Override
- public void testCloseUnderlyingStream() throws IOException {
- // There is no underlying stream here...
- }
-
- @Test
- public void testCloseUnderlyingFile() throws IOException {
- final boolean[] closed = new boolean[1];
-
- File file = createFileWithContent(new ByteArrayInputStream(makeRandomArray(256)));
-
- RandomAccessFile raf = new RandomAccessFile(file, "r") {
- @Override
- public void close() throws IOException {
- closed[0] = true;
- super.close();
- }
- };
-
- FileSeekableStream stream = new FileSeekableStream(raf);
-
- try {
- FileUtil.read(stream); // Read until EOF
-
- assertEquals("EOF not reached (test case broken)", -1, stream.read());
- assertFalse("Underlying stream closed before close", closed[0]);
- }
- finally {
- stream.close();
- }
-
- assertTrue("Underlying stream not closed", closed[0]);
- }
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io;
+
+import org.junit.Test;
+
+import java.io.*;
+
+import static org.junit.Assert.*;
+
+/**
+ * MemoryCacheSeekableStreamTestCase
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/FileSeekableStreamTestCase.java#3 $
+ */
+public class FileSeekableStreamTest extends SeekableInputStreamAbstractTest {
+ protected SeekableInputStream makeInputStream(final InputStream pStream) {
+ try {
+ return new FileSeekableStream(createFileWithContent(pStream));
+ }
+ catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private File createFileWithContent(final InputStream pStream) throws IOException {
+ File temp = File.createTempFile("tm-io-junit", null);
+ temp.deleteOnExit();
+ OutputStream os = new FileOutputStream(temp);
+ try {
+ FileUtil.copy(pStream, os);
+ }
+ finally {
+ os.close();
+ pStream.close();
+ }
+ return temp;
+ }
+
+ @Test
+ @Override
+ public void testCloseUnderlyingStream() throws IOException {
+ // There is no underlying stream here...
+ }
+
+ @Test
+ public void testCloseUnderlyingFile() throws IOException {
+ final boolean[] closed = new boolean[1];
+
+ File file = createFileWithContent(new ByteArrayInputStream(makeRandomArray(256)));
+
+ RandomAccessFile raf = new RandomAccessFile(file, "r") {
+ @Override
+ public void close() throws IOException {
+ closed[0] = true;
+ super.close();
+ }
+ };
+
+ FileSeekableStream stream = new FileSeekableStream(raf);
+
+ try {
+ FileUtil.read(stream); // Read until EOF
+
+ assertEquals("EOF not reached (test case broken)", -1, stream.read());
+ assertFalse("Underlying stream closed before close", closed[0]);
+ }
+ finally {
+ stream.close();
+ }
+
+ assertTrue("Underlying stream not closed", closed[0]);
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/InputStreamAbstractTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/InputStreamAbstractTest.java
similarity index 89%
rename from common/common-io/src/test/java/com/twelvemonkeys/io/InputStreamAbstractTestCase.java
rename to common/common-io/src/test/java/com/twelvemonkeys/io/InputStreamAbstractTest.java
index 9f21a06d..59e1ac38 100755
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/InputStreamAbstractTestCase.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/InputStreamAbstractTest.java
@@ -1,419 +1,448 @@
-/*
- * 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 com.twelvemonkeys.io;
-
-import com.twelvemonkeys.lang.ObjectAbstractTestCase;
-import org.junit.Test;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Random;
-
-import static org.junit.Assert.*;
-
-/**
- * InputStreamAbstractTestCase
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/InputStreamAbstractTestCase.java#1 $
- */
-public abstract class InputStreamAbstractTestCase extends ObjectAbstractTestCase {
- // TODO: FixMe! THIS TEST IS (WAS) COMPLETELY BROKEN...
- // It relies on the contents of the stream being a certain order byte0 == 0, byte1 == 1 etc..
- // But the subclasses don't implement this.. Need to fix.
-
- final static private long SEED = 29487982745l;
- final static Random sRandom = new Random(SEED);
-
- protected final Object makeObject() {
- return makeInputStream();
- }
-
- protected InputStream makeInputStream() {
- return makeInputStream(16);
- }
-
- protected InputStream makeInputStream(int pSize) {
- byte[] bytes = makeRandomArray(pSize);
- return makeInputStream(bytes);
- }
-
- protected abstract InputStream makeInputStream(byte[] pBytes);
-
- protected final byte[] makeRandomArray(final int pSize) {
- byte[] bytes = new byte[pSize];
- sRandom.nextBytes(bytes);
- return bytes;
- }
-
- protected final byte[] makeOrderedArray(final int pSize) {
- byte[] bytes = new byte[pSize];
- for (int i = 0; i < bytes.length; i++) {
- bytes[i] = (byte) i;
- }
- return bytes;
- }
-
- @Test
- public void testRead() throws Exception {
- int size = 5;
- InputStream input = makeInputStream(makeOrderedArray(size));
- for (int i = 0; i < size; i++) {
- assertTrue("Check Size [" + i + "]", (size - i) >= input.available());
- assertEquals("Check Value [" + i + "]", i, input.read());
- }
- assertEquals("Available after contents all read", 0, input.available());
-
- // Test reading after the end of file
- try {
- int result = input.read();
- assertEquals("Wrong value read after end of file", -1, result);
- }
- catch (IOException e) {
- fail("Should not have thrown an IOException: " + e.getMessage());
- }
- }
-
- @Test
- public void testAvailable() throws Exception {
- InputStream input = makeInputStream(1);
- assertFalse("Unexpected EOF", input.read() < 0);
- assertEquals("Available after contents all read", 0, input.available());
-
- // Check availbale is zero after End of file
- assertEquals("End of File", -1, input.read());
- assertEquals("Available after End of File", 0, input.available());
- }
-
- @Test
- public void testReadByteArray() throws Exception {
- byte[] bytes = new byte[10];
- byte[] data = makeOrderedArray(15);
- InputStream input = makeInputStream(data);
-
- // Read into array
- int count1 = input.read(bytes);
- assertEquals("Read 1", bytes.length, count1);
- for (int i = 0; i < count1; i++) {
- assertEquals("Check Bytes 1", i, bytes[i]);
- }
-
- // Read into array
- int count2 = input.read(bytes);
- assertEquals("Read 2", 5, count2);
- for (int i = 0; i < count2; i++) {
- assertEquals("Check Bytes 2", count1 + i, bytes[i]);
- }
-
- // End of File
- int count3 = input.read(bytes);
- assertEquals("Read 3 (EOF)", -1, count3);
-
- // Test reading after the end of file
- try {
- int result = input.read(bytes);
- assertEquals("Wrong value read after end of file", -1, result);
- }
- catch (IOException e) {
- fail("Should not have thrown an IOException: " + e.getMessage());
- }
-
- // Reset
- input = makeInputStream(data);
-
- // Read into array using offset & length
- int offset = 2;
- int lth = 4;
- int count5 = input.read(bytes, offset, lth);
- assertEquals("Read 5", lth, count5);
- for (int i = offset; i < lth; i++) {
- assertEquals("Check Bytes 2", i - offset, bytes[i]);
- }
- }
-
- @Test
- public void testEOF() throws Exception {
- InputStream input = makeInputStream(makeOrderedArray(2));
- assertEquals("Read 1", 0, input.read());
- assertEquals("Read 2", 1, input.read());
- assertEquals("Read 3", -1, input.read());
- assertEquals("Read 4", -1, input.read());
- assertEquals("Read 5", -1, input.read());
- }
-
- @Test
- public void testMarkResetUnsupported() throws IOException {
- InputStream input = makeInputStream(10);
- if (input.markSupported()) {
- return;
- }
-
- input.mark(100); // Should be a no-op
-
- int read = input.read();
- assertTrue(read >= 0);
-
- // TODO: According to InputStream#reset, it is allowed to do some
- // implementation specific reset, and still be correct...
- try {
- input.reset();
- fail("Should throw IOException");
- }
- catch (IOException e) {
- assertTrue("Wrong messge: " + e.getMessage(), e.getMessage().contains("reset"));
- }
- }
-
- @Test
- public void testResetNoMark() throws Exception {
- InputStream input = makeInputStream(makeOrderedArray(10));
-
- if (!input.markSupported()) {
- return; // Not supported, skip test
- }
-
- int read = input.read();
- assertEquals(0, read);
-
- // No mark may either throw exception, or reset to beginning of stream.
- try {
- input.reset();
- assertEquals("Re-read of reset data should be same", 0, input.read());
- }
- catch (Exception e) {
- assertTrue("Wrong no mark IOException message", e.getMessage().contains("mark"));
- }
- }
-
- @Test
- public void testMarkReset() throws Exception {
- InputStream input = makeInputStream(makeOrderedArray(25));
-
- if (!input.markSupported()) {
- return; // Not supported, skip test
- }
-
- int read = input.read();
- assertEquals(0, read);
-
- int position = 1;
- int readlimit = 10;
-
- // Mark
- input.mark(readlimit);
-
- // Read further
- for (int i = 0; i < 3; i++) {
- assertEquals("Read After Mark [" + i + "]", (position + i), input.read());
- }
-
- // Reset
- input.reset();
-
- // Read from marked position
- for (int i = 0; i < readlimit + 1; i++) {
- assertEquals("Read After Reset [" + i + "]", (position + i), input.read());
- }
- }
-
- @Test
- public void testResetAfterReadLimit() throws Exception {
- InputStream input = makeInputStream(makeOrderedArray(25));
-
- if (!input.markSupported()) {
- return; // Not supported, skip test
- }
-
- int read = input.read();
- assertEquals(0, read);
-
- int position = 1;
- int readlimit = 5;
-
- // Mark
- input.mark(readlimit);
-
- // Read past marked position
- for (int i = 0; i < readlimit + 1; i++) {
- assertEquals("Read After Reset [" + i + "]", (position + i), input.read());
- }
-
- // Reset after read limit passed, may either throw exception, or reset to last mark
- try {
- input.reset();
- assertEquals("Re-read of reset data should be same", 1, input.read());
- }
- catch (Exception e) {
- assertTrue("Wrong read-limit IOException message", e.getMessage().contains("mark"));
- }
- }
-
- @Test
- public void testResetAfterReset() throws Exception {
- InputStream input = makeInputStream(makeOrderedArray(25));
-
- if (!input.markSupported()) {
- return; // Not supported, skip test
- }
-
- int first = input.read();
- assertTrue("Expected to read positive value", first >= 0);
-
- int readlimit = 5;
-
- // Mark
- input.mark(readlimit);
- int read = input.read();
- assertTrue("Expected to read positive value", read >= 0);
-
- assertTrue(input.read() >= 0);
- assertTrue(input.read() >= 0);
-
- input.reset();
- assertEquals("Expected value read differs from actual", read, input.read());
-
- // Reset after read limit passed, may either throw exception, or reset to last good mark
- try {
- input.reset();
- int reRead = input.read();
- assertTrue("Re-read of reset data should be same as initially marked or first", reRead == read || reRead == first);
- }
- catch (Exception e) {
- assertTrue("Wrong read-limit IOException message", e.getMessage().contains("mark"));
- }
- }
-
- @Test
- public void testSkip() throws Exception {
- InputStream input = makeInputStream(makeOrderedArray(10));
-
- assertEquals("Unexpected value read", 0, input.read());
- assertEquals("Unexpected value read", 1, input.read());
- assertEquals("Unexpected number of bytes skipped", 5, input.skip(5));
- assertEquals("Unexpected value read", 7, input.read());
-
- assertEquals("Unexpected number of bytes skipped", 2, input.skip(5)); // only 2 left to skip
- assertEquals("Unexpected value read after EOF", -1, input.read());
-
- // Spec says skip might return 0 or negative after EOF...
- assertTrue("Positive value skipped after EOF", input.skip(5) <= 0); // End of file
- assertEquals("Unexpected value read after EOF", -1, input.read());
- }
-
- @Test
- public void testSanityOrdered() throws IOException {
- // This is to sanity check that the test itself is correct...
- byte[] bytes = makeOrderedArray(25);
- InputStream expected = new ByteArrayInputStream(bytes);
- InputStream actual = makeInputStream(bytes);
-
- for (byte b : bytes) {
- assertEquals((int) b, expected.read());
- assertEquals((int) b, actual.read());
- }
- }
-
- @Test
- public void testSanityOrdered2() throws IOException {
- // This is to sanity check that the test itself is correct...
- byte[] bytes = makeOrderedArray(25);
- InputStream expected = new ByteArrayInputStream(bytes);
- InputStream actual = makeInputStream(bytes);
-
- byte[] e = new byte[bytes.length];
- byte[] a = new byte[bytes.length];
-
- assertEquals(e.length, expected.read(e, 0, e.length));
- assertEquals(a.length, actual.read(a, 0, a.length));
-
- for (int i = 0; i < bytes.length; i++) {
- assertEquals(bytes[i], e[i]);
- assertEquals(bytes[i], a[i]);
- }
- }
-
- @Test
- public void testSanityNegative() throws IOException {
- // This is to sanity check that the test itself is correct...
- byte[] bytes = new byte[25];
- for (int i = 0; i < bytes.length; i++) {
- bytes[i] = (byte) (255 - i);
- }
- InputStream expected = new ByteArrayInputStream(bytes);
- InputStream actual = makeInputStream(bytes);
-
- for (byte b : bytes) {
- assertEquals(b & 0xff, expected.read());
- assertEquals(b & 0xff, actual.read());
- }
- }
-
- @Test
- public void testSanityNegative2() throws IOException {
- // This is to sanity check that the test itself is correct...
- byte[] bytes = new byte[25];
- for (int i = 0; i < bytes.length; i++) {
- bytes[i] = (byte) (255 - i);
- }
- InputStream expected = new ByteArrayInputStream(bytes);
- InputStream actual = makeInputStream(bytes);
-
- byte[] e = new byte[bytes.length];
- byte[] a = new byte[bytes.length];
-
- assertEquals(e.length, expected.read(e, 0, e.length));
- assertEquals(a.length, actual.read(a, 0, a.length));
-
- for (int i = 0; i < bytes.length; i++) {
- assertEquals(bytes[i], e[i]);
- assertEquals(bytes[i], a[i]);
- }
- }
-
- @Test
- public void testSanityRandom() throws IOException {
- // This is to sanity check that the test itself is correct...
- byte[] bytes = makeRandomArray(25);
- InputStream expected = new ByteArrayInputStream(bytes);
- InputStream actual = makeInputStream(bytes);
-
- for (byte b : bytes) {
- assertEquals(b & 0xff, expected.read());
- assertEquals(b & 0xff, actual.read());
- }
- }
-
- @Test
- public void testSanityRandom2() throws IOException {
- // This is to sanity check that the test itself is correct...
- byte[] bytes = makeRandomArray(25);
- InputStream expected = new ByteArrayInputStream(bytes);
- InputStream actual = makeInputStream(bytes);
-
- byte[] e = new byte[bytes.length];
- byte[] a = new byte[bytes.length];
-
- assertEquals(e.length, expected.read(e, 0, e.length));
- assertEquals(a.length, actual.read(a, 0, a.length));
-
- for (int i = 0; i < bytes.length; i++) {
- assertEquals(bytes[i], e[i]);
- assertEquals(bytes[i], a[i]);
- }
- }}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * 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 com.twelvemonkeys.io;
+
+import com.twelvemonkeys.lang.ObjectAbstractTest;
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Random;
+
+import static org.junit.Assert.*;
+
+/**
+ * InputStreamAbstractTestCase
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/InputStreamAbstractTestCase.java#1 $
+ */
+public abstract class InputStreamAbstractTest extends ObjectAbstractTest {
+ // TODO: FixMe! THIS TEST IS (WAS) COMPLETELY BROKEN...
+ // It relies on the contents of the stream being a certain order byte0 == 0, byte1 == 1 etc..
+ // But the subclasses don't implement this.. Need to fix.
+
+ final static private long SEED = 29487982745l;
+ final static Random sRandom = new Random(SEED);
+
+ protected final Object makeObject() {
+ return makeInputStream();
+ }
+
+ protected InputStream makeInputStream() {
+ return makeInputStream(16);
+ }
+
+ protected InputStream makeInputStream(int pSize) {
+ byte[] bytes = makeRandomArray(pSize);
+ return makeInputStream(bytes);
+ }
+
+ protected abstract InputStream makeInputStream(byte[] pBytes);
+
+ protected final byte[] makeRandomArray(final int pSize) {
+ byte[] bytes = new byte[pSize];
+ sRandom.nextBytes(bytes);
+ return bytes;
+ }
+
+ protected final byte[] makeOrderedArray(final int pSize) {
+ byte[] bytes = new byte[pSize];
+ for (int i = 0; i < bytes.length; i++) {
+ bytes[i] = (byte) i;
+ }
+ return bytes;
+ }
+
+ @Test
+ public void testRead() throws Exception {
+ int size = 5;
+ InputStream input = makeInputStream(makeOrderedArray(size));
+ for (int i = 0; i < size; i++) {
+ assertTrue("Check Size [" + i + "]", (size - i) >= input.available());
+ assertEquals("Check Value [" + i + "]", i, input.read());
+ }
+ assertEquals("Available after contents all read", 0, input.available());
+
+ // Test reading after the end of file
+ try {
+ int result = input.read();
+ assertEquals("Wrong value read after end of file", -1, result);
+ }
+ catch (IOException e) {
+ fail("Should not have thrown an IOException: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testAvailable() throws Exception {
+ InputStream input = makeInputStream(1);
+ assertFalse("Unexpected EOF", input.read() < 0);
+ assertEquals("Available after contents all read", 0, input.available());
+
+ // Check availbale is zero after End of file
+ assertEquals("End of File", -1, input.read());
+ assertEquals("Available after End of File", 0, input.available());
+ }
+
+ @Test
+ public void testReadByteArray() throws Exception {
+ byte[] bytes = new byte[10];
+ byte[] data = makeOrderedArray(15);
+ InputStream input = makeInputStream(data);
+
+ // Read into array
+ int count1 = input.read(bytes);
+ assertEquals("Read 1", bytes.length, count1);
+ for (int i = 0; i < count1; i++) {
+ assertEquals("Check Bytes 1", i, bytes[i]);
+ }
+
+ // Read into array
+ int count2 = input.read(bytes);
+ assertEquals("Read 2", 5, count2);
+ for (int i = 0; i < count2; i++) {
+ assertEquals("Check Bytes 2", count1 + i, bytes[i]);
+ }
+
+ // End of File
+ int count3 = input.read(bytes);
+ assertEquals("Read 3 (EOF)", -1, count3);
+
+ // Test reading after the end of file
+ try {
+ int result = input.read(bytes);
+ assertEquals("Wrong value read after end of file", -1, result);
+ }
+ catch (IOException e) {
+ fail("Should not have thrown an IOException: " + e.getMessage());
+ }
+
+ // Reset
+ input = makeInputStream(data);
+
+ // Read into array using offset & length
+ int offset = 2;
+ int lth = 4;
+ int count5 = input.read(bytes, offset, lth);
+ assertEquals("Read 5", lth, count5);
+ for (int i = offset; i < lth; i++) {
+ assertEquals("Check Bytes 2", i - offset, bytes[i]);
+ }
+ }
+
+ @Test
+ public void testEOF() throws Exception {
+ InputStream input = makeInputStream(makeOrderedArray(2));
+ assertEquals("Read 1", 0, input.read());
+ assertEquals("Read 2", 1, input.read());
+ assertEquals("Read 3", -1, input.read());
+ assertEquals("Read 4", -1, input.read());
+ assertEquals("Read 5", -1, input.read());
+ }
+
+ @Test
+ public void testMarkResetUnsupported() throws IOException {
+ InputStream input = makeInputStream(10);
+ if (input.markSupported()) {
+ return;
+ }
+
+ input.mark(100); // Should be a no-op
+
+ int read = input.read();
+ assertTrue(read >= 0);
+
+ // TODO: According to InputStream#reset, it is allowed to do some
+ // implementation specific reset, and still be correct...
+ try {
+ input.reset();
+ fail("Should throw IOException");
+ }
+ catch (IOException e) {
+ assertTrue("Wrong messge: " + e.getMessage(), e.getMessage().contains("reset"));
+ }
+ }
+
+ @Test
+ public void testResetNoMark() throws Exception {
+ InputStream input = makeInputStream(makeOrderedArray(10));
+
+ if (!input.markSupported()) {
+ return; // Not supported, skip test
+ }
+
+ int read = input.read();
+ assertEquals(0, read);
+
+ // No mark may either throw exception, or reset to beginning of stream.
+ try {
+ input.reset();
+ assertEquals("Re-read of reset data should be same", 0, input.read());
+ }
+ catch (Exception e) {
+ assertTrue("Wrong no mark IOException message", e.getMessage().contains("mark"));
+ }
+ }
+
+ @Test
+ public void testMarkReset() throws Exception {
+ InputStream input = makeInputStream(makeOrderedArray(25));
+
+ if (!input.markSupported()) {
+ return; // Not supported, skip test
+ }
+
+ int read = input.read();
+ assertEquals(0, read);
+
+ int position = 1;
+ int readlimit = 10;
+
+ // Mark
+ input.mark(readlimit);
+
+ // Read further
+ for (int i = 0; i < 3; i++) {
+ assertEquals("Read After Mark [" + i + "]", (position + i), input.read());
+ }
+
+ // Reset
+ input.reset();
+
+ // Read from marked position
+ for (int i = 0; i < readlimit + 1; i++) {
+ assertEquals("Read After Reset [" + i + "]", (position + i), input.read());
+ }
+ }
+
+ @Test
+ public void testResetAfterReadLimit() throws Exception {
+ InputStream input = makeInputStream(makeOrderedArray(25));
+
+ if (!input.markSupported()) {
+ return; // Not supported, skip test
+ }
+
+ int read = input.read();
+ assertEquals(0, read);
+
+ int position = 1;
+ int readlimit = 5;
+
+ // Mark
+ input.mark(readlimit);
+
+ // Read past marked position
+ for (int i = 0; i < readlimit + 1; i++) {
+ assertEquals("Read After Reset [" + i + "]", (position + i), input.read());
+ }
+
+ // Reset after read limit passed, may either throw exception, or reset to last mark
+ try {
+ input.reset();
+ assertEquals("Re-read of reset data should be same", 1, input.read());
+ }
+ catch (Exception e) {
+ assertTrue("Wrong read-limit IOException message", e.getMessage().contains("mark"));
+ }
+ }
+
+ @Test
+ public void testResetAfterReset() throws Exception {
+ InputStream input = makeInputStream(makeOrderedArray(25));
+
+ if (!input.markSupported()) {
+ return; // Not supported, skip test
+ }
+
+ int first = input.read();
+ assertTrue("Expected to read positive value", first >= 0);
+
+ int readlimit = 5;
+
+ // Mark
+ input.mark(readlimit);
+ int read = input.read();
+ assertTrue("Expected to read positive value", read >= 0);
+
+ assertTrue(input.read() >= 0);
+ assertTrue(input.read() >= 0);
+
+ input.reset();
+ assertEquals("Expected value read differs from actual", read, input.read());
+
+ // Reset after read limit passed, may either throw exception, or reset to last good mark
+ try {
+ input.reset();
+ int reRead = input.read();
+ assertTrue("Re-read of reset data should be same as initially marked or first", reRead == read || reRead == first);
+ }
+ catch (Exception e) {
+ assertTrue("Wrong read-limit IOException message", e.getMessage().contains("mark"));
+ }
+ }
+
+ @Test
+ public void testSkip() throws Exception {
+ InputStream input = makeInputStream(makeOrderedArray(10));
+
+ assertEquals("Unexpected value read", 0, input.read());
+ assertEquals("Unexpected value read", 1, input.read());
+ assertEquals("Unexpected number of bytes skipped", 5, input.skip(5));
+ assertEquals("Unexpected value read", 7, input.read());
+
+ assertEquals("Unexpected number of bytes skipped", 2, input.skip(5)); // only 2 left to skip
+ assertEquals("Unexpected value read after EOF", -1, input.read());
+
+ // Spec says skip might return 0 or negative after EOF...
+ assertTrue("Positive value skipped after EOF", input.skip(5) <= 0); // End of file
+ assertEquals("Unexpected value read after EOF", -1, input.read());
+ }
+
+ @Test
+ public void testSanityOrdered() throws IOException {
+ // This is to sanity check that the test itself is correct...
+ byte[] bytes = makeOrderedArray(25);
+ InputStream expected = new ByteArrayInputStream(bytes);
+ InputStream actual = makeInputStream(bytes);
+
+ for (byte b : bytes) {
+ assertEquals((int) b, expected.read());
+ assertEquals((int) b, actual.read());
+ }
+ }
+
+ @Test
+ public void testSanityOrdered2() throws IOException {
+ // This is to sanity check that the test itself is correct...
+ byte[] bytes = makeOrderedArray(25);
+ InputStream expected = new ByteArrayInputStream(bytes);
+ InputStream actual = makeInputStream(bytes);
+
+ byte[] e = new byte[bytes.length];
+ byte[] a = new byte[bytes.length];
+
+ assertEquals(e.length, expected.read(e, 0, e.length));
+ assertEquals(a.length, actual.read(a, 0, a.length));
+
+ for (int i = 0; i < bytes.length; i++) {
+ assertEquals(bytes[i], e[i]);
+ assertEquals(bytes[i], a[i]);
+ }
+ }
+
+ @Test
+ public void testSanityNegative() throws IOException {
+ // This is to sanity check that the test itself is correct...
+ byte[] bytes = new byte[25];
+ for (int i = 0; i < bytes.length; i++) {
+ bytes[i] = (byte) (255 - i);
+ }
+ InputStream expected = new ByteArrayInputStream(bytes);
+ InputStream actual = makeInputStream(bytes);
+
+ for (byte b : bytes) {
+ assertEquals(b & 0xff, expected.read());
+ assertEquals(b & 0xff, actual.read());
+ }
+ }
+
+ @Test
+ public void testSanityNegative2() throws IOException {
+ // This is to sanity check that the test itself is correct...
+ byte[] bytes = new byte[25];
+ for (int i = 0; i < bytes.length; i++) {
+ bytes[i] = (byte) (255 - i);
+ }
+ InputStream expected = new ByteArrayInputStream(bytes);
+ InputStream actual = makeInputStream(bytes);
+
+ byte[] e = new byte[bytes.length];
+ byte[] a = new byte[bytes.length];
+
+ assertEquals(e.length, expected.read(e, 0, e.length));
+ assertEquals(a.length, actual.read(a, 0, a.length));
+
+ for (int i = 0; i < bytes.length; i++) {
+ assertEquals(bytes[i], e[i]);
+ assertEquals(bytes[i], a[i]);
+ }
+ }
+
+ @Test
+ public void testSanityRandom() throws IOException {
+ // This is to sanity check that the test itself is correct...
+ byte[] bytes = makeRandomArray(25);
+ InputStream expected = new ByteArrayInputStream(bytes);
+ InputStream actual = makeInputStream(bytes);
+
+ for (byte b : bytes) {
+ assertEquals(b & 0xff, expected.read());
+ assertEquals(b & 0xff, actual.read());
+ }
+ }
+
+ @Test
+ public void testSanityRandom2() throws IOException {
+ // This is to sanity check that the test itself is correct...
+ byte[] bytes = makeRandomArray(25);
+ InputStream expected = new ByteArrayInputStream(bytes);
+ InputStream actual = makeInputStream(bytes);
+
+ byte[] e = new byte[bytes.length];
+ byte[] a = new byte[bytes.length];
+
+ assertEquals(e.length, expected.read(e, 0, e.length));
+ assertEquals(a.length, actual.read(a, 0, a.length));
+
+ for (int i = 0; i < bytes.length; i++) {
+ assertEquals(bytes[i], e[i]);
+ assertEquals(bytes[i], a[i]);
+ }
+ }}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/LittleEndianDataInputStreamTest.java b/common/common-io/src/test/java/com/twelvemonkeys/io/LittleEndianDataInputStreamTest.java
index 1f7c551b..9527c85c 100644
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/LittleEndianDataInputStreamTest.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/LittleEndianDataInputStreamTest.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io;
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/MemoryCacheSeekableStreamTest.java b/common/common-io/src/test/java/com/twelvemonkeys/io/MemoryCacheSeekableStreamTest.java
new file mode 100755
index 00000000..f8e5d028
--- /dev/null
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/MemoryCacheSeekableStreamTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io;
+
+import java.io.InputStream;
+
+/**
+ * MemoryCacheSeekableStreamTestCase
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/MemoryCacheSeekableStreamTestCase.java#2 $
+ */
+public class MemoryCacheSeekableStreamTest extends SeekableInputStreamAbstractTest {
+ protected SeekableInputStream makeInputStream(final InputStream pStream) {
+ return new MemoryCacheSeekableStream(pStream);
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/MemoryCacheSeekableStreamTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/MemoryCacheSeekableStreamTestCase.java
deleted file mode 100755
index 53387cb5..00000000
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/MemoryCacheSeekableStreamTestCase.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.twelvemonkeys.io;
-
-import java.io.InputStream;
-
-/**
- * MemoryCacheSeekableStreamTestCase
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/MemoryCacheSeekableStreamTestCase.java#2 $
- */
-public class MemoryCacheSeekableStreamTestCase extends SeekableInputStreamAbstractTestCase {
- protected SeekableInputStream makeInputStream(final InputStream pStream) {
- return new MemoryCacheSeekableStream(pStream);
- }
-}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/OutputStreamAbstractTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/OutputStreamAbstractTest.java
similarity index 79%
rename from common/common-io/src/test/java/com/twelvemonkeys/io/OutputStreamAbstractTestCase.java
rename to common/common-io/src/test/java/com/twelvemonkeys/io/OutputStreamAbstractTest.java
index d3405dae..c5f5a412 100755
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/OutputStreamAbstractTestCase.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/OutputStreamAbstractTest.java
@@ -1,254 +1,285 @@
-package com.twelvemonkeys.io;
-
-import com.twelvemonkeys.lang.ObjectAbstractTestCase;
-import org.junit.Test;
-
-import java.io.OutputStream;
-import java.io.IOException;
-
-import static org.junit.Assert.*;
-
-/**
- * InputStreamAbstractTestCase
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/OutputStreamAbstractTestCase.java#1 $
- */
-public abstract class OutputStreamAbstractTestCase extends ObjectAbstractTestCase {
- protected abstract OutputStream makeObject();
-
- @Test
- public void testWrite() throws IOException {
- OutputStream os = makeObject();
-
- for (int i = 0; i < 256; i++) {
- os.write((byte) i);
- }
- }
-
- @Test
- public void testWriteByteArray() throws IOException {
- OutputStream os = makeObject();
-
- os.write(new byte[256]);
- }
-
- @Test
- public void testWriteByteArrayNull() {
- OutputStream os = makeObject();
- try {
- os.write(null);
- fail("Should not accept null-argument");
- }
- catch (IOException e) {
- fail("Should not throw IOException of null-arguemnt: " + e.getMessage());
- }
- catch (NullPointerException e) {
- assertNotNull(e);
- }
- catch (RuntimeException e) {
- fail("Should only throw NullPointerException: " + e.getClass() + ": " + e.getMessage());
- }
- }
-
- @Test
- public void testWriteByteArrayOffsetLength() throws IOException {
- byte[] input = new byte[256];
-
- OutputStream os = makeObject();
-
- // TODO: How to test that data is actually written!?
- for (int i = 0; i < 256; i++) {
- input[i] = (byte) i;
- }
-
- for (int i = 0; i < 256; i++) {
- os.write(input, i, 256 - i);
- }
-
- for (int i = 0; i < 4; i++) {
- os.write(input, i * 64, 64);
- }
- }
-
- @Test
- public void testWriteByteArrayZeroLength() {
- OutputStream os = makeObject();
- try {
- os.write(new byte[1], 0, 0);
- }
- catch (Exception e) {
- fail("Should not throw Exception: " + e.getMessage());
- }
- }
-
- @Test
- public void testWriteByteArrayOffsetLengthNull() {
- OutputStream os = makeObject();
- try {
- os.write(null, 5, 10);
- fail("Should not accept null-argument");
- }
- catch (IOException e) {
- fail("Should not throw IOException of null-arguemnt: " + e.getMessage());
- }
- catch (NullPointerException e) {
- assertNotNull(e);
- }
- catch (RuntimeException e) {
- fail("Should only throw NullPointerException: " + e.getClass() + ": " + e.getMessage());
- }
- }
-
- @Test
- public void testWriteByteArrayNegativeOffset() {
- OutputStream os = makeObject();
- try {
- os.write(new byte[5], -3, 5);
- fail("Should not accept negative offset");
- }
- catch (IOException e) {
- fail("Should not throw IOException negative offset: " + e.getMessage());
- }
- catch (IndexOutOfBoundsException e) {
- assertNotNull(e);
- }
- catch (RuntimeException e) {
- fail("Should only throw IndexOutOfBoundsException: " + e.getClass() + ": " + e.getMessage());
- }
- }
-
- @Test
- public void testWriteByteArrayNegativeLength() {
- OutputStream os = makeObject();
- try {
- os.write(new byte[5], 2, -5);
- fail("Should not accept negative length");
- }
- catch (IOException e) {
- fail("Should not throw IOException negative length: " + e.getMessage());
- }
- catch (IndexOutOfBoundsException e) {
- assertNotNull(e);
- }
- catch (RuntimeException e) {
- fail("Should only throw IndexOutOfBoundsException: " + e.getClass() + ": " + e.getMessage());
- }
- }
-
- @Test
- public void testWriteByteArrayOffsetOutOfBounds() {
- OutputStream os = makeObject();
- try {
- os.write(new byte[5], 5, 1);
- fail("Should not accept offset out of bounds");
- }
- catch (IOException e) {
- fail("Should not throw IOException offset out of bounds: " + e.getMessage());
- }
- catch (IndexOutOfBoundsException e) {
- assertNotNull(e);
- }
- catch (RuntimeException e) {
- fail("Should only throw IndexOutOfBoundsException: " + e.getClass() + ": " + e.getMessage());
- }
- }
-
- @Test
- public void testWriteByteArrayLengthOutOfBounds() {
- OutputStream os = makeObject();
- try {
- os.write(new byte[5], 1, 5);
- fail("Should not accept length out of bounds");
- }
- catch (IOException e) {
- fail("Should not throw IOException length out of bounds: " + e.getMessage());
- }
- catch (IndexOutOfBoundsException e) {
- assertNotNull(e);
- }
- catch (RuntimeException e) {
- fail("Should only throw IndexOutOfBoundsException: " + e.getClass() + ": " + e.getMessage());
- }
- }
-
- @Test
- public void testFlush() {
- // TODO: Implement
- }
-
- @Test
- public void testClose() {
- // TODO: Implement
- }
-
- @Test
- public void testWriteAfterClose() throws IOException {
- OutputStream os = makeObject();
-
- os.close();
-
- boolean success = false;
- try {
- os.write(0);
- success = true;
- // TODO: Not all streams throw exception! (ByteArrayOutputStream)
- //fail("Write after close");
- }
- catch (IOException e) {
- assertNotNull(e.getMessage());
- }
-
- try {
- os.write(new byte[16]);
- // TODO: Not all streams throw exception! (ByteArrayOutputStream)
- //fail("Write after close");
- if (!success) {
- fail("Inconsistent write(int)/write(byte[]) after close");
- }
- }
- catch (IOException e) {
- assertNotNull(e.getMessage());
- if (success) {
- fail("Inconsistent write(int)/write(byte[]) after close");
- }
- }
- }
-
- @Test
- public void testFlushAfterClose() throws IOException {
- OutputStream os = makeObject();
-
- os.close();
-
- try {
- os.flush();
- // TODO: Not all streams throw exception! (ByteArrayOutputStream)
- //fail("Flush after close");
- try {
- os.write(0);
- }
- catch (IOException e) {
- fail("Inconsistent write/flush after close");
- }
- }
- catch (IOException e) {
- assertNotNull(e.getMessage());
- }
- }
-
- @Test
- public void testCloseAfterClose() throws IOException {
- OutputStream os = makeObject();
-
- os.close();
-
- try {
- os.close();
- }
- catch (IOException e) {
- fail("Close after close, failed: " + e.getMessage());
- }
- }
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io;
+
+import com.twelvemonkeys.lang.ObjectAbstractTest;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+/**
+ * InputStreamAbstractTestCase
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/OutputStreamAbstractTestCase.java#1 $
+ */
+public abstract class OutputStreamAbstractTest extends ObjectAbstractTest {
+ protected abstract OutputStream makeObject();
+
+ @Test
+ public void testWrite() throws IOException {
+ OutputStream os = makeObject();
+
+ for (int i = 0; i < 256; i++) {
+ os.write((byte) i);
+ }
+ }
+
+ @Test
+ public void testWriteByteArray() throws IOException {
+ OutputStream os = makeObject();
+
+ os.write(new byte[256]);
+ }
+
+ @Test
+ public void testWriteByteArrayNull() {
+ OutputStream os = makeObject();
+ try {
+ os.write(null);
+ fail("Should not accept null-argument");
+ }
+ catch (IOException e) {
+ fail("Should not throw IOException of null-arguemnt: " + e.getMessage());
+ }
+ catch (NullPointerException e) {
+ assertNotNull(e);
+ }
+ catch (RuntimeException e) {
+ fail("Should only throw NullPointerException: " + e.getClass() + ": " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testWriteByteArrayOffsetLength() throws IOException {
+ byte[] input = new byte[256];
+
+ OutputStream os = makeObject();
+
+ // TODO: How to test that data is actually written!?
+ for (int i = 0; i < 256; i++) {
+ input[i] = (byte) i;
+ }
+
+ for (int i = 0; i < 256; i++) {
+ os.write(input, i, 256 - i);
+ }
+
+ for (int i = 0; i < 4; i++) {
+ os.write(input, i * 64, 64);
+ }
+ }
+
+ @Test
+ public void testWriteByteArrayZeroLength() {
+ OutputStream os = makeObject();
+ try {
+ os.write(new byte[1], 0, 0);
+ }
+ catch (Exception e) {
+ fail("Should not throw Exception: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testWriteByteArrayOffsetLengthNull() {
+ OutputStream os = makeObject();
+ try {
+ os.write(null, 5, 10);
+ fail("Should not accept null-argument");
+ }
+ catch (IOException e) {
+ fail("Should not throw IOException of null-arguemnt: " + e.getMessage());
+ }
+ catch (NullPointerException e) {
+ assertNotNull(e);
+ }
+ catch (RuntimeException e) {
+ fail("Should only throw NullPointerException: " + e.getClass() + ": " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testWriteByteArrayNegativeOffset() {
+ OutputStream os = makeObject();
+ try {
+ os.write(new byte[5], -3, 5);
+ fail("Should not accept negative offset");
+ }
+ catch (IOException e) {
+ fail("Should not throw IOException negative offset: " + e.getMessage());
+ }
+ catch (IndexOutOfBoundsException e) {
+ assertNotNull(e);
+ }
+ catch (RuntimeException e) {
+ fail("Should only throw IndexOutOfBoundsException: " + e.getClass() + ": " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testWriteByteArrayNegativeLength() {
+ OutputStream os = makeObject();
+ try {
+ os.write(new byte[5], 2, -5);
+ fail("Should not accept negative length");
+ }
+ catch (IOException e) {
+ fail("Should not throw IOException negative length: " + e.getMessage());
+ }
+ catch (IndexOutOfBoundsException e) {
+ assertNotNull(e);
+ }
+ catch (RuntimeException e) {
+ fail("Should only throw IndexOutOfBoundsException: " + e.getClass() + ": " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testWriteByteArrayOffsetOutOfBounds() {
+ OutputStream os = makeObject();
+ try {
+ os.write(new byte[5], 5, 1);
+ fail("Should not accept offset out of bounds");
+ }
+ catch (IOException e) {
+ fail("Should not throw IOException offset out of bounds: " + e.getMessage());
+ }
+ catch (IndexOutOfBoundsException e) {
+ assertNotNull(e);
+ }
+ catch (RuntimeException e) {
+ fail("Should only throw IndexOutOfBoundsException: " + e.getClass() + ": " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testWriteByteArrayLengthOutOfBounds() {
+ OutputStream os = makeObject();
+ try {
+ os.write(new byte[5], 1, 5);
+ fail("Should not accept length out of bounds");
+ }
+ catch (IOException e) {
+ fail("Should not throw IOException length out of bounds: " + e.getMessage());
+ }
+ catch (IndexOutOfBoundsException e) {
+ assertNotNull(e);
+ }
+ catch (RuntimeException e) {
+ fail("Should only throw IndexOutOfBoundsException: " + e.getClass() + ": " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testFlush() {
+ // TODO: Implement
+ }
+
+ @Test
+ public void testClose() {
+ // TODO: Implement
+ }
+
+ @Test
+ public void testWriteAfterClose() throws IOException {
+ OutputStream os = makeObject();
+
+ os.close();
+
+ boolean success = false;
+ try {
+ os.write(0);
+ success = true;
+ // TODO: Not all streams throw exception! (ByteArrayOutputStream)
+ //fail("Write after close");
+ }
+ catch (IOException e) {
+ assertNotNull(e.getMessage());
+ }
+
+ try {
+ os.write(new byte[16]);
+ // TODO: Not all streams throw exception! (ByteArrayOutputStream)
+ //fail("Write after close");
+ if (!success) {
+ fail("Inconsistent write(int)/write(byte[]) after close");
+ }
+ }
+ catch (IOException e) {
+ assertNotNull(e.getMessage());
+ if (success) {
+ fail("Inconsistent write(int)/write(byte[]) after close");
+ }
+ }
+ }
+
+ @Test
+ public void testFlushAfterClose() throws IOException {
+ OutputStream os = makeObject();
+
+ os.close();
+
+ try {
+ os.flush();
+ // TODO: Not all streams throw exception! (ByteArrayOutputStream)
+ //fail("Flush after close");
+ try {
+ os.write(0);
+ }
+ catch (IOException e) {
+ fail("Inconsistent write/flush after close");
+ }
+ }
+ catch (IOException e) {
+ assertNotNull(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testCloseAfterClose() throws IOException {
+ OutputStream os = makeObject();
+
+ os.close();
+
+ try {
+ os.close();
+ }
+ catch (IOException e) {
+ fail("Close after close, failed: " + e.getMessage());
+ }
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/ReaderAbstractTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/ReaderAbstractTest.java
similarity index 79%
rename from common/common-io/src/test/java/com/twelvemonkeys/io/ReaderAbstractTestCase.java
rename to common/common-io/src/test/java/com/twelvemonkeys/io/ReaderAbstractTest.java
index cf9e63d5..8fc72aa6 100755
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/ReaderAbstractTestCase.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/ReaderAbstractTest.java
@@ -1,224 +1,254 @@
-package com.twelvemonkeys.io;
-
-import com.twelvemonkeys.lang.ObjectAbstractTestCase;
-import org.junit.Test;
-
-import java.io.Reader;
-import java.io.IOException;
-
-import static org.junit.Assert.*;
-
-/**
- * ReaderAbstractTestCase
- *
- *
- * @author Harald Kuhr
- * @author last modified by $Author: haku $
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/ReaderAbstractTestCase.java#1 $
- */
-public abstract class ReaderAbstractTestCase extends ObjectAbstractTestCase {
-
- // Kindly provided by lipsum.org :-)
- protected final String mInput =
- "Cras tincidunt euismod tellus. Aenean a odio. " +
- "Aenean metus. Sed tristique est non purus. Class aptent " +
- "taciti sociosqu ad litora torquent per conubia nostra, per " +
- "inceptos hymenaeos. Fusce vulputate dolor non mauris. " +
- "Nullam nunc massa, pretium quis, ultricies a, varius quis, " +
- "neque. Nam id nulla eu ante malesuada fermentum. Sed " +
- "vulputate purus eget magna. Sed mollis. Curabitur enim " +
- "diam, faucibus ac, hendrerit eu, consequat nec, augue.";
-
- protected final Object makeObject() {
- return makeReader();
- }
-
- protected Reader makeReader() {
- return makeReader(mInput);
- }
-
- protected abstract Reader makeReader(String pInput);
-
- @Test
- public void testRead() throws IOException {
- Reader reader = makeReader();
-
- int count = 0;
- int ch;
- StringBuilder buffer = new StringBuilder(mInput.length());
- while ((ch = reader.read()) > 0) {
- count++;
- buffer.append((char) ch);
- }
-
- assertEquals(mInput.length(), count);
- assertEquals(mInput, buffer.toString());
- }
-
- @Test
- public void testReadBuffer() throws IOException {
- Reader reader = makeReader();
-
- char[] chars = new char[mInput.length()];
- StringBuilder buffer = new StringBuilder(mInput.length());
-
- int count;
- int offset = 0;
- int lenght = chars.length;
- while ((count = reader.read(chars, offset, lenght)) > 0) {
- buffer.append(chars, offset, count);
- offset += count;
- lenght -= count;
- }
-
- assertEquals(mInput, buffer.toString());
- assertEquals(mInput, new String(chars));
- }
-
- @Test
- public void testSkipToEnd() throws IOException {
- Reader reader = makeReader();
-
- int toSkip = mInput.length();
- while (toSkip > 0) {
- long skipped = reader.skip(toSkip);
- assertFalse("Skipped < 0", skipped < 0);
- toSkip -= skipped;
- }
-
- assertEquals(0, toSkip);
- }
-
- @Test
- public void testSkipToEndAndRead() throws IOException {
- Reader reader = makeReader();
-
- int toSkip = mInput.length();
- while (toSkip > 0) {
- toSkip -= reader.skip(toSkip);
- }
-
- assertEquals(reader.read(), -1);
- }
-
- // TODO: It's possible to support reset and not mark (resets to beginning of stream, for example)
- @Test
- public void testResetMarkSupported() throws IOException {
- Reader reader = makeReader();
-
- if (reader.markSupported()) {
- // Mark at 0
- reader.mark(mInput.length() / 4);
-
- // Read one char
- char ch = (char) reader.read();
- reader.reset();
- assertEquals(ch, (char) reader.read());
- reader.reset();
-
- // Read from start
- StringBuilder first = new StringBuilder(mInput.length() / 4);
- for (int i = 0; i < mInput.length() / 4; i++) {
- first.append((char) reader.read());
- }
-
- reader.reset(); // 0
-
- StringBuilder second = new StringBuilder(mInput.length() / 4);
- for (int i = 0; i < mInput.length() / 4; i++) {
- second.append((char) reader.read());
- }
-
- assertEquals(first.toString(), second.toString());
-
- // Mark at 1/4
- reader.mark(mInput.length() / 4);
-
- // Read from 1/4
- first = new StringBuilder(mInput.length() / 4);
- for (int i = 0; i < mInput.length() / 4; i++) {
- first.append((char) reader.read());
- }
-
- reader.reset(); // 1/4
-
- second = new StringBuilder(mInput.length() / 4);
- for (int i = 0; i < mInput.length() / 4; i++) {
- second.append((char) reader.read());
- }
-
- assertEquals(first.toString(), second.toString());
-
- // Read past limit
- reader.read();
-
- // This may or may not fail, depending on the stream
- try {
- reader.reset();
- }
- catch (IOException ioe) {
- assertNotNull(ioe.getMessage());
- }
- }
- }
-
- @Test
- public void testResetMarkNotSupported() throws IOException {
- Reader reader = makeReader();
-
- if (!reader.markSupported()) {
- try {
- reader.mark(mInput.length());
- fail("Mark set, while markSupprted is false");
- }
- catch (IOException e) {
- assertNotNull(e.getMessage());
- }
-
- // Read one char
- char ch = (char) reader.read();
- try {
- reader.reset();
- assertEquals(ch, (char) reader.read());
- }
- catch (IOException ioe) {
- assertNotNull(ioe.getMessage());
- }
-
- // Read from start
- StringBuilder first = new StringBuilder(mInput.length() / 4);
- for (int i = 0; i < mInput.length() / 4; i++) {
- first.append((char) reader.read());
- }
-
- try {
- reader.reset(); // 0
-
- StringBuilder second = new StringBuilder(mInput.length() / 4);
- for (int i = 0; i < mInput.length() / 4; i++) {
- second.append((char) reader.read());
- }
-
- assertEquals(first.toString(), second.toString());
- }
- catch (IOException ioe) {
- assertNotNull(ioe.getMessage());
- }
- }
- }
-
- @Test
- public void testReadAfterClose() throws IOException {
- Reader reader = makeReader("foo bar");
-
- reader.close();
-
- try {
- reader.read();
- fail("Should not allow read after close");
- }
- catch (IOException ioe) {
- assertNotNull(ioe.getMessage());
- }
- }
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io;
+
+import com.twelvemonkeys.lang.ObjectAbstractTest;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import static org.junit.Assert.*;
+
+/**
+ * ReaderAbstractTestCase
+ *
+ *
+ * @author Harald Kuhr
+ * @author last modified by $Author: haku $
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/ReaderAbstractTestCase.java#1 $
+ */
+public abstract class ReaderAbstractTest extends ObjectAbstractTest {
+
+ // Kindly provided by lipsum.org :-)
+ protected final String mInput =
+ "Cras tincidunt euismod tellus. Aenean a odio. " +
+ "Aenean metus. Sed tristique est non purus. Class aptent " +
+ "taciti sociosqu ad litora torquent per conubia nostra, per " +
+ "inceptos hymenaeos. Fusce vulputate dolor non mauris. " +
+ "Nullam nunc massa, pretium quis, ultricies a, varius quis, " +
+ "neque. Nam id nulla eu ante malesuada fermentum. Sed " +
+ "vulputate purus eget magna. Sed mollis. Curabitur enim " +
+ "diam, faucibus ac, hendrerit eu, consequat nec, augue.";
+
+ protected final Object makeObject() {
+ return makeReader();
+ }
+
+ protected Reader makeReader() {
+ return makeReader(mInput);
+ }
+
+ protected abstract Reader makeReader(String pInput);
+
+ @Test
+ public void testRead() throws IOException {
+ Reader reader = makeReader();
+
+ int count = 0;
+ int ch;
+ StringBuilder buffer = new StringBuilder(mInput.length());
+ while ((ch = reader.read()) > 0) {
+ count++;
+ buffer.append((char) ch);
+ }
+
+ assertEquals(mInput.length(), count);
+ assertEquals(mInput, buffer.toString());
+ }
+
+ @Test
+ public void testReadBuffer() throws IOException {
+ Reader reader = makeReader();
+
+ char[] chars = new char[mInput.length()];
+ StringBuilder buffer = new StringBuilder(mInput.length());
+
+ int count;
+ int offset = 0;
+ int lenght = chars.length;
+ while ((count = reader.read(chars, offset, lenght)) > 0) {
+ buffer.append(chars, offset, count);
+ offset += count;
+ lenght -= count;
+ }
+
+ assertEquals(mInput, buffer.toString());
+ assertEquals(mInput, new String(chars));
+ }
+
+ @Test
+ public void testSkipToEnd() throws IOException {
+ Reader reader = makeReader();
+
+ int toSkip = mInput.length();
+ while (toSkip > 0) {
+ long skipped = reader.skip(toSkip);
+ assertFalse("Skipped < 0", skipped < 0);
+ toSkip -= skipped;
+ }
+
+ assertEquals(0, toSkip);
+ }
+
+ @Test
+ public void testSkipToEndAndRead() throws IOException {
+ Reader reader = makeReader();
+
+ int toSkip = mInput.length();
+ while (toSkip > 0) {
+ toSkip -= reader.skip(toSkip);
+ }
+
+ assertEquals(reader.read(), -1);
+ }
+
+ // TODO: It's possible to support reset and not mark (resets to beginning of stream, for example)
+ @Test
+ public void testResetMarkSupported() throws IOException {
+ Reader reader = makeReader();
+
+ if (reader.markSupported()) {
+ // Mark at 0
+ reader.mark(mInput.length() / 4);
+
+ // Read one char
+ char ch = (char) reader.read();
+ reader.reset();
+ assertEquals(ch, (char) reader.read());
+ reader.reset();
+
+ // Read from start
+ StringBuilder first = new StringBuilder(mInput.length() / 4);
+ for (int i = 0; i < mInput.length() / 4; i++) {
+ first.append((char) reader.read());
+ }
+
+ reader.reset(); // 0
+
+ StringBuilder second = new StringBuilder(mInput.length() / 4);
+ for (int i = 0; i < mInput.length() / 4; i++) {
+ second.append((char) reader.read());
+ }
+
+ assertEquals(first.toString(), second.toString());
+
+ // Mark at 1/4
+ reader.mark(mInput.length() / 4);
+
+ // Read from 1/4
+ first = new StringBuilder(mInput.length() / 4);
+ for (int i = 0; i < mInput.length() / 4; i++) {
+ first.append((char) reader.read());
+ }
+
+ reader.reset(); // 1/4
+
+ second = new StringBuilder(mInput.length() / 4);
+ for (int i = 0; i < mInput.length() / 4; i++) {
+ second.append((char) reader.read());
+ }
+
+ assertEquals(first.toString(), second.toString());
+
+ // Read past limit
+ reader.read();
+
+ // This may or may not fail, depending on the stream
+ try {
+ reader.reset();
+ }
+ catch (IOException ioe) {
+ assertNotNull(ioe.getMessage());
+ }
+ }
+ }
+
+ @Test
+ public void testResetMarkNotSupported() throws IOException {
+ Reader reader = makeReader();
+
+ if (!reader.markSupported()) {
+ try {
+ reader.mark(mInput.length());
+ fail("Mark set, while markSupprted is false");
+ }
+ catch (IOException e) {
+ assertNotNull(e.getMessage());
+ }
+
+ // Read one char
+ char ch = (char) reader.read();
+ try {
+ reader.reset();
+ assertEquals(ch, (char) reader.read());
+ }
+ catch (IOException ioe) {
+ assertNotNull(ioe.getMessage());
+ }
+
+ // Read from start
+ StringBuilder first = new StringBuilder(mInput.length() / 4);
+ for (int i = 0; i < mInput.length() / 4; i++) {
+ first.append((char) reader.read());
+ }
+
+ try {
+ reader.reset(); // 0
+
+ StringBuilder second = new StringBuilder(mInput.length() / 4);
+ for (int i = 0; i < mInput.length() / 4; i++) {
+ second.append((char) reader.read());
+ }
+
+ assertEquals(first.toString(), second.toString());
+ }
+ catch (IOException ioe) {
+ assertNotNull(ioe.getMessage());
+ }
+ }
+ }
+
+ @Test
+ public void testReadAfterClose() throws IOException {
+ Reader reader = makeReader("foo bar");
+
+ reader.close();
+
+ try {
+ reader.read();
+ fail("Should not allow read after close");
+ }
+ catch (IOException ioe) {
+ assertNotNull(ioe.getMessage());
+ }
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableAbstractTest.java b/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableAbstractTest.java
new file mode 100755
index 00000000..2ae256ec
--- /dev/null
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableAbstractTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * SeekableAbstractTestCase
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/SeekableAbstractTestCase.java#1 $
+ */
+public abstract class SeekableAbstractTest implements SeekableInterfaceTest {
+
+ protected abstract Seekable createSeekable();
+
+ @Test
+ public void testFail() {
+ fail("Do not create stand-alone test classes based on this class. Instead, create an inner class and delegate to it.");
+ }
+
+ @Test
+ public void testSeekable() {
+ assertTrue(createSeekable() instanceof Seekable);
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableAbstractTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableAbstractTestCase.java
deleted file mode 100755
index 28dfb036..00000000
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableAbstractTestCase.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.twelvemonkeys.io;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * SeekableAbstractTestCase
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/SeekableAbstractTestCase.java#1 $
- */
-public abstract class SeekableAbstractTestCase implements SeekableInterfaceTest {
-
- protected abstract Seekable createSeekable();
-
- @Test
- public void testFail() {
- fail("Do not create stand-alone test classes based on this class. Instead, create an inner class and delegate to it.");
- }
-
- @Test
- public void testSeekable() {
- assertTrue(createSeekable() instanceof Seekable);
- }
-}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableInputStreamAbstractTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableInputStreamAbstractTest.java
similarity index 90%
rename from common/common-io/src/test/java/com/twelvemonkeys/io/SeekableInputStreamAbstractTestCase.java
rename to common/common-io/src/test/java/com/twelvemonkeys/io/SeekableInputStreamAbstractTest.java
index 7a995e49..4a4b2d25 100755
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableInputStreamAbstractTestCase.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableInputStreamAbstractTest.java
@@ -1,488 +1,518 @@
-package com.twelvemonkeys.io;
-
-import org.junit.Test;
-
-import java.io.ByteArrayInputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-
-import static org.junit.Assert.*;
-
-/**
- * SeekableInputStreamAbstractTestCase
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/SeekableInputStreamAbstractTestCase.java#4 $
- */
-public abstract class SeekableInputStreamAbstractTestCase extends InputStreamAbstractTestCase implements SeekableInterfaceTest {
- //// TODO: Figure out a better way of creating interface tests without duplicating code
- final SeekableAbstractTestCase seekableTestCase = new SeekableAbstractTestCase() {
- protected Seekable createSeekable() {
- return makeInputStream();
- }
- };
-
- @Override
- protected SeekableInputStream makeInputStream() {
- return (SeekableInputStream) super.makeInputStream();
- }
-
- @Override
- protected SeekableInputStream makeInputStream(final int pSize) {
- return (SeekableInputStream) super.makeInputStream(pSize);
- }
-
- protected SeekableInputStream makeInputStream(byte[] pBytes) {
- return makeInputStream(new ByteArrayInputStream(pBytes));
- }
-
- protected abstract SeekableInputStream makeInputStream(InputStream pStream);
-
- @Test
- @Override
- public void testResetAfterReset() throws Exception {
- InputStream input = makeInputStream(makeOrderedArray(25));
-
- if (!input.markSupported()) {
- return; // Not supported, skip test
- }
-
- assertTrue("Expected to read positive value", input.read() >= 0);
-
- int readlimit = 5;
-
- // Mark
- input.mark(readlimit);
- int read = input.read();
- assertTrue("Expected to read positive value", read >= 0);
-
- input.reset();
- assertEquals("Expected value read differs from actual", read, input.read());
-
- // Reset after read limit passed, may either throw exception, or reset to last good mark
- try {
- input.reset();
- assertEquals("Re-read of reset data should be first", 0, input.read());
- }
- catch (Exception e) {
- assertTrue("Wrong read-limit IOException message", e.getMessage().contains("mark"));
- }
- }
-
- @Test
- public void testSeekable() {
- seekableTestCase.testSeekable();
- }
-
- @Test
- public void testFlushBeyondCurrentPos() throws Exception {
- SeekableInputStream seekable = makeInputStream(20);
-
- int pos = 10;
- try {
- seekable.flushBefore(pos);
- fail("Flush beyond current position should throw IndexOutOfBoundsException");
- }
- catch (IndexOutOfBoundsException e) {
- // Ignore
- }
- }
-
- @Test
- public void testSeek() throws Exception {
- SeekableInputStream seekable = makeInputStream(55);
- int pos = 37;
-
- seekable.seek(pos);
- long streamPos = seekable.getStreamPosition();
- assertEquals("Stream positon should match seeked position", pos, streamPos);
- }
-
- @Test
- public void testSeekFlush() throws Exception {
- SeekableInputStream seekable = makeInputStream(133);
- int pos = 45;
- seekable.seek(pos);
- seekable.flushBefore(pos);
- long flushedPos = seekable.getFlushedPosition();
- assertEquals("Flushed positon should match position", pos, flushedPos);
-
- try {
- seekable.seek(pos - 1);
- fail("Read before flushed position succeeded");
- }
- catch (IndexOutOfBoundsException e) {
- // Ignore
- }
- }
-
- @Test
- public void testMarkFlushReset() throws Exception {
- SeekableInputStream seekable = makeInputStream(77);
-
- seekable.mark();
-
- int position = 55;
- seekable.seek(position);
- seekable.flushBefore(position);
-
- try {
- seekable.reset();
- fail("Reset before flushed position succeeded");
- }
- catch (IOException e) {
- // Ignore
- }
-
- assertEquals(position, seekable.getStreamPosition());
- }
-
- @Test
- public void testSeekSkipRead() throws Exception {
- SeekableInputStream seekable = makeInputStream(133);
- int pos = 45;
- for (int i = 0; i < 10; i++) {
- seekable.seek(pos);
- //noinspection ResultOfMethodCallIgnored
- seekable.skip(i);
- byte[] bytes = FileUtil.read(seekable);
- assertEquals(133, seekable.getStreamPosition());
- assertEquals(133 - 45- i, bytes.length);
- }
- }
-
- protected void testSeekSkip(SeekableInputStream pSeekable, String pStr) throws IOException {
- System.out.println();
- pSeekable.seek(pStr.length());
- FileUtil.read(pSeekable);
- for (int i = 0; i < 10; i++) {
- byte[] bytes = FileUtil.read(pSeekable);
- int len = bytes.length;
- if (len != 0) {
- System.err.println("Error in buffer length after full read...");
- System.err.println("len: " + len);
- System.err.println("bytes: \"" + new String(bytes) + "\"");
- break;
- }
- }
-
- System.out.println();
-
- for (int i = 0; i < 10; i++) {
- pSeekable.seek(0);
- int skip = i * 3;
- //noinspection ResultOfMethodCallIgnored
- pSeekable.skip(skip);
- String str = new String(FileUtil.read(pSeekable));
- System.out.println(str);
- if (str.length() != pStr.length() - skip) {
- throw new Error("Error in buffer length after skip");
- }
- }
-
- System.out.println();
- System.out.println("seek/skip ok!");
- System.out.println();
- }
-
- protected static void markReset(SeekableInputStream pSeekable) throws IOException {
- for (int i = 0; i < 10; i++) {
- pSeekable.mark();
- System.out.println(new String(FileUtil.read(pSeekable)));
- pSeekable.reset();
- }
-
- System.out.println();
- System.out.println("mark/reset ok!");
- }
-
- protected static void timeRead(SeekableInputStream pSeekable) throws IOException {
- for (int i = 0; i < 5000; i++) {
- pSeekable.mark();
- FileUtil.read(pSeekable);
- pSeekable.reset();
- }
-
- long start = System.currentTimeMillis();
- final int times = 200000;
- for (int i = 0; i < times; i++) {
- pSeekable.mark();
- FileUtil.read(pSeekable);
- pSeekable.reset();
- }
- long time = System.currentTimeMillis() - start;
-
- System.out.println("Time; " + time + "ms (" + (time / (float) times) + "ms/inv)");
- }
-
- /*
-
- // Test code below...
- protected final static String STR = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce massa orci, adipiscing vel, dapibus et, vulputate tristique, tortor. Quisque sodales. Mauris varius turpis et pede. Nam ac dolor vel diam condimentum elementum. Pellentesque eget tellus. Praesent magna. Sed fringilla. Proin ullamcorper tincidunt ante. Fusce dapibus nibh nec dolor. Etiam erat. Nullam dignissim laoreet nibh. Maecenas scelerisque. Pellentesque in quam. Maecenas sollicitudin, magna nec imperdiet facilisis, metus quam tristique ipsum, vitae consequat massa purus eget leo. Nulla ipsum. Proin non purus eget tellus lobortis iaculis. In lorem justo, posuere id, vulputate at, adipiscing ut, nisl. Nunc dui erat, tincidunt ac, interdum quis, rutrum et, libero. Etiam lectus dui, viverra sit amet, elementum ut, malesuada sed, massa. Vestibulum mi nulla, sodales vel, vestibulum sed, congue blandit, velit.";
-
- protected static void flushSeek(SeekableInputStream pSeekable, String pStr) throws IOException {
- pSeekable.seek(0);
- pSeekable.mark();
- int pos = pStr.length() / 2;
- try {
- pSeekable.flushBefore(pos);
- System.err.println("Error in flush/seek");
- }
- catch (IndexOutOfBoundsException e) {
- // Ignore
- }
- pSeekable.seek(pos);
- long streamPos = pSeekable.getStreamPosition();
- if (streamPos != pos) {
- System.err.println("Streampos not equal seeked pos");
- }
-
- pSeekable.flushBefore(pos);
- long flushedPos = pSeekable.getFlushedPosition();
- if (flushedPos != pos) {
- System.err.println("flushedpos not equal set flushed pos");
- }
-
- for (int i = 0; i < 10; i++) {
- pSeekable.seek(pos);
- //noinspection ResultOfMethodCallIgnored
- pSeekable.skip(i);
- System.out.println(new String(FileUtil.read(pSeekable)));
- }
-
- try {
- pSeekable.seek(pos - 1);
- System.err.println("Error in flush/seek");
- }
- catch (IndexOutOfBoundsException e) {
- // Ignore
- }
- try {
- pSeekable.reset();
- System.err.println("Error in flush/seek");
- }
- catch (IOException e) {
- // Ignore
- }
-
- System.out.println();
- System.out.println("flush/seek ok!");
- }
-
- protected static void seekSkip(SeekableInputStream pSeekable, String pStr) throws IOException {
- System.out.println();
- pSeekable.seek(pStr.length());
- FileUtil.read(pSeekable);
- for (int i = 0; i < 10; i++) {
- byte[] bytes = FileUtil.read(pSeekable);
- int len = bytes.length;
- if (len != 0) {
- System.err.println("Error in buffer length after full read...");
- System.err.println("len: " + len);
- System.err.println("bytes: \"" + new String(bytes) + "\"");
- break;
- }
- }
-
- System.out.println();
-
- for (int i = 0; i < 10; i++) {
- pSeekable.seek(0);
- int skip = i * 3;
- //noinspection ResultOfMethodCallIgnored
- pSeekable.skip(skip);
- String str = new String(FileUtil.read(pSeekable));
- System.out.println(str);
- if (str.length() != pStr.length() - skip) {
- throw new Error("Error in buffer length after skip");
- }
- }
-
- System.out.println();
- System.out.println("seek/skip ok!");
- System.out.println();
- }
-
- protected static void markReset(SeekableInputStream pSeekable) throws IOException {
- for (int i = 0; i < 10; i++) {
- pSeekable.mark();
- System.out.println(new String(FileUtil.read(pSeekable)));
- pSeekable.reset();
- }
-
- System.out.println();
- System.out.println("mark/reset ok!");
- }
-
- protected static void timeRead(SeekableInputStream pSeekable) throws IOException {
- for (int i = 0; i < 5000; i++) {
- pSeekable.mark();
- FileUtil.read(pSeekable);
- pSeekable.reset();
- }
-
- long start = System.currentTimeMillis();
- final int times = 200000;
- for (int i = 0; i < times; i++) {
- pSeekable.mark();
- FileUtil.read(pSeekable);
- pSeekable.reset();
- }
- long time = System.currentTimeMillis() - start;
-
- System.out.println("Time; " + time + "ms (" + (time / (float) times) + "ms/inv)");
- }
- */
-
- @Test
- public void testReadResetReadDirectBufferBug() throws IOException {
- // Make sure we use the exact size of the buffer
- final int size = 1024;
-
- // Fill bytes
- byte[] bytes = new byte[size * 2];
- sRandom.nextBytes(bytes);
-
- // Create wrapper stream
- SeekableInputStream stream = makeInputStream(bytes);
-
- // Read to fill the buffer, then reset
- int val;
-
- val = stream.read();
- assertFalse("Unexepected EOF", val == -1);
- val = stream.read();
- assertFalse("Unexepected EOF", val == -1);
- val = stream.read();
- assertFalse("Unexepected EOF", val == -1);
- val = stream.read();
- assertFalse("Unexepected EOF", val == -1);
-
- stream.seek(0);
-
- // Read fully and compare
- byte[] result = new byte[size];
-
- readFully(stream, result);
- assertTrue(rangeEquals(bytes, 0, result, 0, size));
-
- readFully(stream, result);
- assertTrue(rangeEquals(bytes, size, result, 0, size));
- }
-
- @Test
- public void testReadAllByteValuesRegression() throws IOException {
- final int size = 128;
-
- // Fill bytes
- byte[] bytes = new byte[256];
- for (int i = 0; i < bytes.length; i++) {
- bytes[i] = (byte) i;
- }
-
- // Create wrapper stream
- SeekableInputStream stream = makeInputStream(bytes);
-
- // Fill buffer
- byte[] buffer = new byte[size];
- while (stream.read(buffer) >= 0) {
- }
-
- stream.seek(0);
- for (int i = 0; i < bytes.length; i += 2) {
- assertEquals("Wrong stream position", i, stream.getStreamPosition());
- int count = stream.read(buffer, 0, 2);
- assertEquals(2, count);
- assertEquals(String.format("Wrong value read at pos %d", stream.getStreamPosition()), bytes[i], buffer[0]);
- assertEquals(String.format("Wrong value read at pos %d", stream.getStreamPosition()), bytes[i + 1], buffer[1]);
- }
-
- stream.seek(0);
- for (int i = 0; i < bytes.length; i++) {
- assertEquals("Wrong stream position", i, stream.getStreamPosition());
- int actual = stream.read();
- assertEquals(String.format("Wrong value read at pos %d", stream.getStreamPosition()), bytes[i] & 0xff, actual);
- assertEquals(String.format("Wrong value read at pos %d", stream.getStreamPosition()), bytes[i], (byte) actual);
- }
-
- }
-
- @Test
- public void testCloseUnderlyingStream() throws IOException {
- final boolean[] closed = new boolean[1];
-
- ByteArrayInputStream input = new ByteArrayInputStream(makeRandomArray(256)) {
- @Override
- public void close() throws IOException {
- closed[0] = true;
- super.close();
- }
- };
-
- SeekableInputStream stream = makeInputStream(input);
-
- try {
- FileUtil.read(stream); // Read until EOF
-
- assertEquals("EOF not reached (test case broken)", -1, stream.read());
- assertFalse("Underlying stream closed before close", closed[0]);
- }
- finally {
- stream.close();
- }
-
- assertTrue("Underlying stream not closed", closed[0]);
-
- }
-
- private void readFully(InputStream pStream, byte[] pResult) throws IOException {
- int pos = 0;
- while (pos < pResult.length) {
- int read = pStream.read(pResult, pos, pResult.length - pos);
- if (read == -1) {
- throw new EOFException();
- }
- pos += read;
- }
- }
-
- /**
- * Test two arrays for range equality. That is, they contain the same elements for some specified range.
- *
- * @param pFirst one array to test for equality
- * @param pFirstOffset the offset into the first array to start testing for equality
- * @param pSecond the other array to test for equality
- * @param pSecondOffset the offset into the second array to start testing for equality
- * @param pLength the length of the range to check for equality
- *
- * @return {@code true} if both arrays are non-{@code null}
- * and have at least {@code offset + pLength} elements
- * and all elements in the range from the first array is equal to the elements from the second array,
- * or if {@code pFirst == pSecond} (including both arrays being {@code null})
- * and {@code pFirstOffset == pSecondOffset}.
- * Otherwise {@code false}.
- */
- static boolean rangeEquals(byte[] pFirst, int pFirstOffset, byte[] pSecond, int pSecondOffset, int pLength) {
- if (pFirst == pSecond && pFirstOffset == pSecondOffset) {
- return true;
- }
-
- if (pFirst == null || pSecond == null) {
- return false;
- }
-
- if (pFirst.length < pFirstOffset + pLength || pSecond.length < pSecondOffset + pLength) {
- return false;
- }
-
- for (int i = 0; i < pLength; i++) {
- if (pFirst[pFirstOffset + i] != pSecond[pSecondOffset + i]) {
- return false;
- }
- }
-
- return true;
- }
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io;
+
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.*;
+
+/**
+ * SeekableInputStreamAbstractTest
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/SeekableInputStreamAbstractTestCase.java#4 $
+ */
+public abstract class SeekableInputStreamAbstractTest extends InputStreamAbstractTest implements SeekableInterfaceTest {
+ //// TODO: Figure out a better way of creating interface tests without duplicating code
+ final SeekableAbstractTest seekableTestCase = new SeekableAbstractTest() {
+ protected Seekable createSeekable() {
+ return makeInputStream();
+ }
+ };
+
+ @Override
+ protected SeekableInputStream makeInputStream() {
+ return (SeekableInputStream) super.makeInputStream();
+ }
+
+ @Override
+ protected SeekableInputStream makeInputStream(final int pSize) {
+ return (SeekableInputStream) super.makeInputStream(pSize);
+ }
+
+ protected SeekableInputStream makeInputStream(byte[] pBytes) {
+ return makeInputStream(new ByteArrayInputStream(pBytes));
+ }
+
+ protected abstract SeekableInputStream makeInputStream(InputStream pStream);
+
+ @Test
+ @Override
+ public void testResetAfterReset() throws Exception {
+ InputStream input = makeInputStream(makeOrderedArray(25));
+
+ if (!input.markSupported()) {
+ return; // Not supported, skip test
+ }
+
+ assertTrue("Expected to read positive value", input.read() >= 0);
+
+ int readlimit = 5;
+
+ // Mark
+ input.mark(readlimit);
+ int read = input.read();
+ assertTrue("Expected to read positive value", read >= 0);
+
+ input.reset();
+ assertEquals("Expected value read differs from actual", read, input.read());
+
+ // Reset after read limit passed, may either throw exception, or reset to last good mark
+ try {
+ input.reset();
+ assertEquals("Re-read of reset data should be first", 0, input.read());
+ }
+ catch (Exception e) {
+ assertTrue("Wrong read-limit IOException message", e.getMessage().contains("mark"));
+ }
+ }
+
+ @Test
+ public void testSeekable() {
+ seekableTestCase.testSeekable();
+ }
+
+ @Test
+ public void testFlushBeyondCurrentPos() throws Exception {
+ SeekableInputStream seekable = makeInputStream(20);
+
+ int pos = 10;
+ try {
+ seekable.flushBefore(pos);
+ fail("Flush beyond current position should throw IndexOutOfBoundsException");
+ }
+ catch (IndexOutOfBoundsException e) {
+ // Ignore
+ }
+ }
+
+ @Test
+ public void testSeek() throws Exception {
+ SeekableInputStream seekable = makeInputStream(55);
+ int pos = 37;
+
+ seekable.seek(pos);
+ long streamPos = seekable.getStreamPosition();
+ assertEquals("Stream positon should match seeked position", pos, streamPos);
+ }
+
+ @Test
+ public void testSeekFlush() throws Exception {
+ SeekableInputStream seekable = makeInputStream(133);
+ int pos = 45;
+ seekable.seek(pos);
+ seekable.flushBefore(pos);
+ long flushedPos = seekable.getFlushedPosition();
+ assertEquals("Flushed positon should match position", pos, flushedPos);
+
+ try {
+ seekable.seek(pos - 1);
+ fail("Read before flushed position succeeded");
+ }
+ catch (IndexOutOfBoundsException e) {
+ // Ignore
+ }
+ }
+
+ @Test
+ public void testMarkFlushReset() throws Exception {
+ SeekableInputStream seekable = makeInputStream(77);
+
+ seekable.mark();
+
+ int position = 55;
+ seekable.seek(position);
+ seekable.flushBefore(position);
+
+ try {
+ seekable.reset();
+ fail("Reset before flushed position succeeded");
+ }
+ catch (IOException e) {
+ // Ignore
+ }
+
+ assertEquals(position, seekable.getStreamPosition());
+ }
+
+ @Test
+ public void testSeekSkipRead() throws Exception {
+ SeekableInputStream seekable = makeInputStream(133);
+ int pos = 45;
+ for (int i = 0; i < 10; i++) {
+ seekable.seek(pos);
+ //noinspection ResultOfMethodCallIgnored
+ seekable.skip(i);
+ byte[] bytes = FileUtil.read(seekable);
+ assertEquals(133, seekable.getStreamPosition());
+ assertEquals(133 - 45- i, bytes.length);
+ }
+ }
+
+ protected void testSeekSkip(SeekableInputStream pSeekable, String pStr) throws IOException {
+ System.out.println();
+ pSeekable.seek(pStr.length());
+ FileUtil.read(pSeekable);
+ for (int i = 0; i < 10; i++) {
+ byte[] bytes = FileUtil.read(pSeekable);
+ int len = bytes.length;
+ if (len != 0) {
+ System.err.println("Error in buffer length after full read...");
+ System.err.println("len: " + len);
+ System.err.println("bytes: \"" + new String(bytes) + "\"");
+ break;
+ }
+ }
+
+ System.out.println();
+
+ for (int i = 0; i < 10; i++) {
+ pSeekable.seek(0);
+ int skip = i * 3;
+ //noinspection ResultOfMethodCallIgnored
+ pSeekable.skip(skip);
+ String str = new String(FileUtil.read(pSeekable));
+ System.out.println(str);
+ if (str.length() != pStr.length() - skip) {
+ throw new Error("Error in buffer length after skip");
+ }
+ }
+
+ System.out.println();
+ System.out.println("seek/skip ok!");
+ System.out.println();
+ }
+
+ protected static void markReset(SeekableInputStream pSeekable) throws IOException {
+ for (int i = 0; i < 10; i++) {
+ pSeekable.mark();
+ System.out.println(new String(FileUtil.read(pSeekable)));
+ pSeekable.reset();
+ }
+
+ System.out.println();
+ System.out.println("mark/reset ok!");
+ }
+
+ protected static void timeRead(SeekableInputStream pSeekable) throws IOException {
+ for (int i = 0; i < 5000; i++) {
+ pSeekable.mark();
+ FileUtil.read(pSeekable);
+ pSeekable.reset();
+ }
+
+ long start = System.currentTimeMillis();
+ final int times = 200000;
+ for (int i = 0; i < times; i++) {
+ pSeekable.mark();
+ FileUtil.read(pSeekable);
+ pSeekable.reset();
+ }
+ long time = System.currentTimeMillis() - start;
+
+ System.out.println("Time; " + time + "ms (" + (time / (float) times) + "ms/inv)");
+ }
+
+ /*
+
+ // Test code below...
+ protected final static String STR = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce massa orci, adipiscing vel, dapibus et, vulputate tristique, tortor. Quisque sodales. Mauris varius turpis et pede. Nam ac dolor vel diam condimentum elementum. Pellentesque eget tellus. Praesent magna. Sed fringilla. Proin ullamcorper tincidunt ante. Fusce dapibus nibh nec dolor. Etiam erat. Nullam dignissim laoreet nibh. Maecenas scelerisque. Pellentesque in quam. Maecenas sollicitudin, magna nec imperdiet facilisis, metus quam tristique ipsum, vitae consequat massa purus eget leo. Nulla ipsum. Proin non purus eget tellus lobortis iaculis. In lorem justo, posuere id, vulputate at, adipiscing ut, nisl. Nunc dui erat, tincidunt ac, interdum quis, rutrum et, libero. Etiam lectus dui, viverra sit amet, elementum ut, malesuada sed, massa. Vestibulum mi nulla, sodales vel, vestibulum sed, congue blandit, velit.";
+
+ protected static void flushSeek(SeekableInputStream pSeekable, String pStr) throws IOException {
+ pSeekable.seek(0);
+ pSeekable.mark();
+ int pos = pStr.length() / 2;
+ try {
+ pSeekable.flushBefore(pos);
+ System.err.println("Error in flush/seek");
+ }
+ catch (IndexOutOfBoundsException e) {
+ // Ignore
+ }
+ pSeekable.seek(pos);
+ long streamPos = pSeekable.getStreamPosition();
+ if (streamPos != pos) {
+ System.err.println("Streampos not equal seeked pos");
+ }
+
+ pSeekable.flushBefore(pos);
+ long flushedPos = pSeekable.getFlushedPosition();
+ if (flushedPos != pos) {
+ System.err.println("flushedpos not equal set flushed pos");
+ }
+
+ for (int i = 0; i < 10; i++) {
+ pSeekable.seek(pos);
+ //noinspection ResultOfMethodCallIgnored
+ pSeekable.skip(i);
+ System.out.println(new String(FileUtil.read(pSeekable)));
+ }
+
+ try {
+ pSeekable.seek(pos - 1);
+ System.err.println("Error in flush/seek");
+ }
+ catch (IndexOutOfBoundsException e) {
+ // Ignore
+ }
+ try {
+ pSeekable.reset();
+ System.err.println("Error in flush/seek");
+ }
+ catch (IOException e) {
+ // Ignore
+ }
+
+ System.out.println();
+ System.out.println("flush/seek ok!");
+ }
+
+ protected static void seekSkip(SeekableInputStream pSeekable, String pStr) throws IOException {
+ System.out.println();
+ pSeekable.seek(pStr.length());
+ FileUtil.read(pSeekable);
+ for (int i = 0; i < 10; i++) {
+ byte[] bytes = FileUtil.read(pSeekable);
+ int len = bytes.length;
+ if (len != 0) {
+ System.err.println("Error in buffer length after full read...");
+ System.err.println("len: " + len);
+ System.err.println("bytes: \"" + new String(bytes) + "\"");
+ break;
+ }
+ }
+
+ System.out.println();
+
+ for (int i = 0; i < 10; i++) {
+ pSeekable.seek(0);
+ int skip = i * 3;
+ //noinspection ResultOfMethodCallIgnored
+ pSeekable.skip(skip);
+ String str = new String(FileUtil.read(pSeekable));
+ System.out.println(str);
+ if (str.length() != pStr.length() - skip) {
+ throw new Error("Error in buffer length after skip");
+ }
+ }
+
+ System.out.println();
+ System.out.println("seek/skip ok!");
+ System.out.println();
+ }
+
+ protected static void markReset(SeekableInputStream pSeekable) throws IOException {
+ for (int i = 0; i < 10; i++) {
+ pSeekable.mark();
+ System.out.println(new String(FileUtil.read(pSeekable)));
+ pSeekable.reset();
+ }
+
+ System.out.println();
+ System.out.println("mark/reset ok!");
+ }
+
+ protected static void timeRead(SeekableInputStream pSeekable) throws IOException {
+ for (int i = 0; i < 5000; i++) {
+ pSeekable.mark();
+ FileUtil.read(pSeekable);
+ pSeekable.reset();
+ }
+
+ long start = System.currentTimeMillis();
+ final int times = 200000;
+ for (int i = 0; i < times; i++) {
+ pSeekable.mark();
+ FileUtil.read(pSeekable);
+ pSeekable.reset();
+ }
+ long time = System.currentTimeMillis() - start;
+
+ System.out.println("Time; " + time + "ms (" + (time / (float) times) + "ms/inv)");
+ }
+ */
+
+ @Test
+ public void testReadResetReadDirectBufferBug() throws IOException {
+ // Make sure we use the exact size of the buffer
+ final int size = 1024;
+
+ // Fill bytes
+ byte[] bytes = new byte[size * 2];
+ sRandom.nextBytes(bytes);
+
+ // Create wrapper stream
+ SeekableInputStream stream = makeInputStream(bytes);
+
+ // Read to fill the buffer, then reset
+ int val;
+
+ val = stream.read();
+ assertFalse("Unexepected EOF", val == -1);
+ val = stream.read();
+ assertFalse("Unexepected EOF", val == -1);
+ val = stream.read();
+ assertFalse("Unexepected EOF", val == -1);
+ val = stream.read();
+ assertFalse("Unexepected EOF", val == -1);
+
+ stream.seek(0);
+
+ // Read fully and compare
+ byte[] result = new byte[size];
+
+ readFully(stream, result);
+ assertTrue(rangeEquals(bytes, 0, result, 0, size));
+
+ readFully(stream, result);
+ assertTrue(rangeEquals(bytes, size, result, 0, size));
+ }
+
+ @Test
+ public void testReadAllByteValuesRegression() throws IOException {
+ final int size = 128;
+
+ // Fill bytes
+ byte[] bytes = new byte[256];
+ for (int i = 0; i < bytes.length; i++) {
+ bytes[i] = (byte) i;
+ }
+
+ // Create wrapper stream
+ SeekableInputStream stream = makeInputStream(bytes);
+
+ // Fill buffer
+ byte[] buffer = new byte[size];
+ while (stream.read(buffer) >= 0) {
+ }
+
+ stream.seek(0);
+ for (int i = 0; i < bytes.length; i += 2) {
+ assertEquals("Wrong stream position", i, stream.getStreamPosition());
+ int count = stream.read(buffer, 0, 2);
+ assertEquals(2, count);
+ assertEquals(String.format("Wrong value read at pos %d", stream.getStreamPosition()), bytes[i], buffer[0]);
+ assertEquals(String.format("Wrong value read at pos %d", stream.getStreamPosition()), bytes[i + 1], buffer[1]);
+ }
+
+ stream.seek(0);
+ for (int i = 0; i < bytes.length; i++) {
+ assertEquals("Wrong stream position", i, stream.getStreamPosition());
+ int actual = stream.read();
+ assertEquals(String.format("Wrong value read at pos %d", stream.getStreamPosition()), bytes[i] & 0xff, actual);
+ assertEquals(String.format("Wrong value read at pos %d", stream.getStreamPosition()), bytes[i], (byte) actual);
+ }
+
+ }
+
+ @Test
+ public void testCloseUnderlyingStream() throws IOException {
+ final boolean[] closed = new boolean[1];
+
+ ByteArrayInputStream input = new ByteArrayInputStream(makeRandomArray(256)) {
+ @Override
+ public void close() throws IOException {
+ closed[0] = true;
+ super.close();
+ }
+ };
+
+ SeekableInputStream stream = makeInputStream(input);
+
+ try {
+ FileUtil.read(stream); // Read until EOF
+
+ assertEquals("EOF not reached (test case broken)", -1, stream.read());
+ assertFalse("Underlying stream closed before close", closed[0]);
+ }
+ finally {
+ stream.close();
+ }
+
+ assertTrue("Underlying stream not closed", closed[0]);
+
+ }
+
+ private void readFully(InputStream pStream, byte[] pResult) throws IOException {
+ int pos = 0;
+ while (pos < pResult.length) {
+ int read = pStream.read(pResult, pos, pResult.length - pos);
+ if (read == -1) {
+ throw new EOFException();
+ }
+ pos += read;
+ }
+ }
+
+ /**
+ * Test two arrays for range equality. That is, they contain the same elements for some specified range.
+ *
+ * @param pFirst one array to test for equality
+ * @param pFirstOffset the offset into the first array to start testing for equality
+ * @param pSecond the other array to test for equality
+ * @param pSecondOffset the offset into the second array to start testing for equality
+ * @param pLength the length of the range to check for equality
+ *
+ * @return {@code true} if both arrays are non-{@code null}
+ * and have at least {@code offset + pLength} elements
+ * and all elements in the range from the first array is equal to the elements from the second array,
+ * or if {@code pFirst == pSecond} (including both arrays being {@code null})
+ * and {@code pFirstOffset == pSecondOffset}.
+ * Otherwise {@code false}.
+ */
+ static boolean rangeEquals(byte[] pFirst, int pFirstOffset, byte[] pSecond, int pSecondOffset, int pLength) {
+ if (pFirst == pSecond && pFirstOffset == pSecondOffset) {
+ return true;
+ }
+
+ if (pFirst == null || pSecond == null) {
+ return false;
+ }
+
+ if (pFirst.length < pFirstOffset + pLength || pSecond.length < pSecondOffset + pLength) {
+ return false;
+ }
+
+ for (int i = 0; i < pLength; i++) {
+ if (pFirst[pFirstOffset + i] != pSecond[pSecondOffset + i]) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableInterfaceTest.java b/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableInterfaceTest.java
index 1c59b52c..2a5e92bc 100755
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableInterfaceTest.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/SeekableInterfaceTest.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
package com.twelvemonkeys.io;
/**
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/StringArrayReaderTest.java b/common/common-io/src/test/java/com/twelvemonkeys/io/StringArrayReaderTest.java
new file mode 100755
index 00000000..53af2336
--- /dev/null
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/StringArrayReaderTest.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io;
+
+import com.twelvemonkeys.lang.StringUtil;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import static org.junit.Assert.*;
+
+/**
+ * StringArrayReaderTestCase
+ *
+ *
+ * @author Harald Kuhr
+ * @author last modified by $Author: haku $
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/StringArrayReaderTestCase.java#1 $
+ */
+public class StringArrayReaderTest extends ReaderAbstractTest {
+
+ protected Reader makeReader(String pInput) {
+ // Split
+ String[] input = StringUtil.toStringArray(pInput, " ");
+ // Reappend spaces...
+ for (int i = 0; i < input.length; i++) {
+ if (i != 0) {
+ input[i] = " " + input[i];
+ }
+ }
+
+ return new StringArrayReader(input);
+ }
+
+ @Test
+ public void testNullConstructor() {
+ try {
+ new StringArrayReader(null);
+ fail("Should not allow null argument");
+ }
+ catch (RuntimeException e) {
+ assertNotNull(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testEmptyArrayConstructor() throws IOException {
+ Reader reader = new StringArrayReader(new String[0]);
+ assertEquals(-1, reader.read());
+ }
+
+ @Test
+ public void testEmptyStringConstructor() throws IOException {
+ Reader reader = new StringArrayReader(new String[] {""});
+ assertEquals(-1, reader.read());
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/StringArrayReaderTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/StringArrayReaderTestCase.java
deleted file mode 100755
index cf1594c9..00000000
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/StringArrayReaderTestCase.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.twelvemonkeys.io;
-
-import com.twelvemonkeys.lang.StringUtil;
-import org.junit.Test;
-
-import java.io.Reader;
-import java.io.IOException;
-
-import static org.junit.Assert.*;
-
-/**
- * StringArrayReaderTestCase
- *
- *
- * @author Harald Kuhr
- * @author last modified by $Author: haku $
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/StringArrayReaderTestCase.java#1 $
- */
-public class StringArrayReaderTestCase extends ReaderAbstractTestCase {
-
- protected Reader makeReader(String pInput) {
- // Split
- String[] input = StringUtil.toStringArray(pInput, " ");
- // Reappend spaces...
- for (int i = 0; i < input.length; i++) {
- if (i != 0) {
- input[i] = " " + input[i];
- }
- }
-
- return new StringArrayReader(input);
- }
-
- @Test
- public void testNullConstructor() {
- try {
- new StringArrayReader(null);
- fail("Should not allow null argument");
- }
- catch (RuntimeException e) {
- assertNotNull(e.getMessage());
- }
- }
-
- @Test
- public void testEmptyArrayConstructor() throws IOException {
- Reader reader = new StringArrayReader(new String[0]);
- assertEquals(-1, reader.read());
- }
-
- @Test
- public void testEmptyStringConstructor() throws IOException {
- Reader reader = new StringArrayReader(new String[] {""});
- assertEquals(-1, reader.read());
- }
-}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/Base64DecoderTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/Base64DecoderTest.java
similarity index 56%
rename from common/common-io/src/test/java/com/twelvemonkeys/io/enc/Base64DecoderTestCase.java
rename to common/common-io/src/test/java/com/twelvemonkeys/io/enc/Base64DecoderTest.java
index 922bf5b5..457fb901 100755
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/Base64DecoderTestCase.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/Base64DecoderTest.java
@@ -1,71 +1,103 @@
-package com.twelvemonkeys.io.enc;
-
-
-import com.twelvemonkeys.io.FileUtil;
-import org.junit.Test;
-
-import java.io.*;
-
-import static org.junit.Assert.*;
-
-/**
- * Base64DecoderTest
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/enc/Base64DecoderTestCase.java#1 $
- */
-public class Base64DecoderTestCase extends DecoderAbstractTestCase {
-
- public Decoder createDecoder() {
- return new Base64Decoder();
- }
-
- public Encoder createCompatibleEncoder() {
- return new Base64Encoder();
- }
-
- @Test
- public void testEmptyDecode2() throws IOException {
- String data = "";
-
- InputStream in = new DecoderStream(new ByteArrayInputStream(data.getBytes()), createDecoder());
- ByteArrayOutputStream bytes = new ByteArrayOutputStream();
-
- FileUtil.copy(in, bytes);
-
- assertEquals("Strings does not match", "", new String(bytes.toByteArray()));
- }
-
- @Test
- public void testShortDecode() throws IOException {
- String data = "dGVzdA==";
-
- InputStream in = new DecoderStream(new ByteArrayInputStream(data.getBytes()), createDecoder());
- ByteArrayOutputStream bytes = new ByteArrayOutputStream();
-
- FileUtil.copy(in, bytes);
-
- assertEquals("Strings does not match", "test", new String(bytes.toByteArray()));
- }
-
- @Test
- public void testLongDecode() throws IOException {
- String data = "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVlciBhZGlwaXNjaW5nIGVsaXQuIEZ1" +
- "c2NlIGVzdC4gTW9yYmkgbHVjdHVzIGNvbnNlY3RldHVlciBqdXN0by4gVml2YW11cyBkYXBpYnVzIGxh" +
- "b3JlZXQgcHVydXMuIE51bmMgdml2ZXJyYSBkaWN0dW0gbmlzbC4gSW50ZWdlciB1bGxhbWNvcnBlciwg" +
- "bmlzaSBpbiBkaWN0dW0gYW1ldC4=";
-
- InputStream in = new DecoderStream(new ByteArrayInputStream(data.getBytes()), createDecoder());
- ByteArrayOutputStream bytes = new ByteArrayOutputStream();
-
- FileUtil.copy(in, bytes);
-
- assertEquals("Strings does not match",
- "Lorem ipsum dolor sit amet, consectetuer adipiscing " +
- "elit. Fusce est. Morbi luctus consectetuer justo. Vivamus " +
- "dapibus laoreet purus. Nunc viverra dictum nisl. Integer " +
- "ullamcorper, nisi in dictum amet.",
- new String(bytes.toByteArray()));
- }
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io.enc;
+
+import com.twelvemonkeys.io.FileUtil;
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Base64DecoderTest
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/enc/Base64DecoderTestCase.java#1 $
+ */
+public class Base64DecoderTest extends DecoderAbstractTest {
+
+ public Decoder createDecoder() {
+ return new Base64Decoder();
+ }
+
+ public Encoder createCompatibleEncoder() {
+ return new Base64Encoder();
+ }
+
+ @Test
+ public void testEmptyDecode2() throws IOException {
+ String data = "";
+
+ InputStream in = new DecoderStream(new ByteArrayInputStream(data.getBytes()), createDecoder());
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+
+ FileUtil.copy(in, bytes);
+
+ assertEquals("Strings does not match", "", new String(bytes.toByteArray()));
+ }
+
+ @Test
+ public void testShortDecode() throws IOException {
+ String data = "dGVzdA==";
+
+ InputStream in = new DecoderStream(new ByteArrayInputStream(data.getBytes()), createDecoder());
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+
+ FileUtil.copy(in, bytes);
+
+ assertEquals("Strings does not match", "test", new String(bytes.toByteArray()));
+ }
+
+ @Test
+ public void testLongDecode() throws IOException {
+ String data = "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVlciBhZGlwaXNjaW5nIGVsaXQuIEZ1" +
+ "c2NlIGVzdC4gTW9yYmkgbHVjdHVzIGNvbnNlY3RldHVlciBqdXN0by4gVml2YW11cyBkYXBpYnVzIGxh" +
+ "b3JlZXQgcHVydXMuIE51bmMgdml2ZXJyYSBkaWN0dW0gbmlzbC4gSW50ZWdlciB1bGxhbWNvcnBlciwg" +
+ "bmlzaSBpbiBkaWN0dW0gYW1ldC4=";
+
+ InputStream in = new DecoderStream(new ByteArrayInputStream(data.getBytes()), createDecoder());
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+
+ FileUtil.copy(in, bytes);
+
+ assertEquals("Strings does not match",
+ "Lorem ipsum dolor sit amet, consectetuer adipiscing " +
+ "elit. Fusce est. Morbi luctus consectetuer justo. Vivamus " +
+ "dapibus laoreet purus. Nunc viverra dictum nisl. Integer " +
+ "ullamcorper, nisi in dictum amet.",
+ new String(bytes.toByteArray()));
+ }
}
\ No newline at end of file
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/Base64EncoderTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/Base64EncoderTest.java
similarity index 58%
rename from common/common-io/src/test/java/com/twelvemonkeys/io/enc/Base64EncoderTestCase.java
rename to common/common-io/src/test/java/com/twelvemonkeys/io/enc/Base64EncoderTest.java
index 0c3e7720..7e77196a 100644
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/Base64EncoderTestCase.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/Base64EncoderTest.java
@@ -1,68 +1,98 @@
-package com.twelvemonkeys.io.enc;
-
-import org.junit.Test;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import static org.junit.Assert.*;
-
-/**
- * Base64EncoderTest
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/enc/Base64EncoderTestCase.java#1 $
- */
-public class Base64EncoderTestCase extends EncoderAbstractTestCase {
-
- protected Encoder createEncoder() {
- return new Base64Encoder();
- }
-
- protected Decoder createCompatibleDecoder() {
- return new Base64Decoder();
- }
-
- @Test
- public void testEmptyEncode() throws IOException {
- String data = "";
-
- ByteArrayOutputStream bytes = new ByteArrayOutputStream();
- OutputStream out = new EncoderStream(bytes, createEncoder(), true);
- out.write(data.getBytes());
-
- assertEquals("Strings does not match", "", new String(bytes.toByteArray()));
- }
-
- @Test
- public void testShortEncode() throws IOException {
- String data = "test";
-
- ByteArrayOutputStream bytes = new ByteArrayOutputStream();
- OutputStream out = new EncoderStream(bytes, createEncoder(), true);
- out.write(data.getBytes());
-
- assertEquals("Strings does not match", "dGVzdA==", new String(bytes.toByteArray()));
- }
-
- @Test
- public void testLongEncode() throws IOException {
- String data = "Lorem ipsum dolor sit amet, consectetuer adipiscing " +
- "elit. Fusce est. Morbi luctus consectetuer justo. Vivamus " +
- "dapibus laoreet purus. Nunc viverra dictum nisl. Integer " +
- "ullamcorper, nisi in dictum amet.";
-
- ByteArrayOutputStream bytes = new ByteArrayOutputStream();
- OutputStream out = new EncoderStream(bytes, createEncoder(), true);
- out.write(data.getBytes());
-
- assertEquals("Strings does not match",
- "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVlciBhZGlwaXNjaW5nIGVsaXQuIEZ1" +
- "c2NlIGVzdC4gTW9yYmkgbHVjdHVzIGNvbnNlY3RldHVlciBqdXN0by4gVml2YW11cyBkYXBpYnVzIGxh" +
- "b3JlZXQgcHVydXMuIE51bmMgdml2ZXJyYSBkaWN0dW0gbmlzbC4gSW50ZWdlciB1bGxhbWNvcnBlciwg" +
- "bmlzaSBpbiBkaWN0dW0gYW1ldC4=",
- new String(bytes.toByteArray()));
- }
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io.enc;
+
+import org.junit.Test;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Base64EncoderTest
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/enc/Base64EncoderTestCase.java#1 $
+ */
+public class Base64EncoderTest extends EncoderAbstractTest {
+
+ protected Encoder createEncoder() {
+ return new Base64Encoder();
+ }
+
+ protected Decoder createCompatibleDecoder() {
+ return new Base64Decoder();
+ }
+
+ @Test
+ public void testEmptyEncode() throws IOException {
+ String data = "";
+
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ OutputStream out = new EncoderStream(bytes, createEncoder(), true);
+ out.write(data.getBytes());
+
+ assertEquals("Strings does not match", "", new String(bytes.toByteArray()));
+ }
+
+ @Test
+ public void testShortEncode() throws IOException {
+ String data = "test";
+
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ OutputStream out = new EncoderStream(bytes, createEncoder(), true);
+ out.write(data.getBytes());
+
+ assertEquals("Strings does not match", "dGVzdA==", new String(bytes.toByteArray()));
+ }
+
+ @Test
+ public void testLongEncode() throws IOException {
+ String data = "Lorem ipsum dolor sit amet, consectetuer adipiscing " +
+ "elit. Fusce est. Morbi luctus consectetuer justo. Vivamus " +
+ "dapibus laoreet purus. Nunc viverra dictum nisl. Integer " +
+ "ullamcorper, nisi in dictum amet.";
+
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ OutputStream out = new EncoderStream(bytes, createEncoder(), true);
+ out.write(data.getBytes());
+
+ assertEquals("Strings does not match",
+ "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVlciBhZGlwaXNjaW5nIGVsaXQuIEZ1" +
+ "c2NlIGVzdC4gTW9yYmkgbHVjdHVzIGNvbnNlY3RldHVlciBqdXN0by4gVml2YW11cyBkYXBpYnVzIGxh" +
+ "b3JlZXQgcHVydXMuIE51bmMgdml2ZXJyYSBkaWN0dW0gbmlzbC4gSW50ZWdlciB1bGxhbWNvcnBlciwg" +
+ "bmlzaSBpbiBkaWN0dW0gYW1ldC4=",
+ new String(bytes.toByteArray()));
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/DecoderAbstractTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/DecoderAbstractTest.java
similarity index 65%
rename from common/common-io/src/test/java/com/twelvemonkeys/io/enc/DecoderAbstractTestCase.java
rename to common/common-io/src/test/java/com/twelvemonkeys/io/enc/DecoderAbstractTest.java
index 51788010..6f1e8948 100644
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/DecoderAbstractTestCase.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/DecoderAbstractTest.java
@@ -1,115 +1,145 @@
-package com.twelvemonkeys.io.enc;
-
-import com.twelvemonkeys.io.FileUtil;
-import com.twelvemonkeys.lang.ObjectAbstractTestCase;
-import org.junit.Test;
-
-import java.io.*;
-import java.nio.ByteBuffer;
-
-import static org.junit.Assert.*;
-
-/**
- * AbstractDecoderTest
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/enc/DecoderAbstractTestCase.java#1 $
- */
-public abstract class DecoderAbstractTestCase extends ObjectAbstractTestCase {
-
- public abstract Decoder createDecoder();
- public abstract Encoder createCompatibleEncoder();
-
- protected Object makeObject() {
- return createDecoder();
- }
-
- @Test(expected = NullPointerException.class)
- public final void testNullDecode() throws IOException {
- Decoder decoder = createDecoder();
- ByteArrayInputStream bytes = new ByteArrayInputStream(new byte[20]);
-
- decoder.decode(bytes, null);
- fail("null should throw NullPointerException");
- }
-
- @Test
- public final void testEmptyDecode() throws IOException {
- Decoder decoder = createDecoder();
- ByteArrayInputStream bytes = new ByteArrayInputStream(new byte[0]);
-
- try {
- int count = decoder.decode(bytes, ByteBuffer.allocate(128));
- assertEquals("Should not be able to read any bytes", 0, count);
- }
- catch (EOFException allowed) {
- // Okay
- }
- }
-
- private byte[] createData(int pLength) throws Exception {
- byte[] bytes = new byte[pLength];
- EncoderAbstractTestCase.RANDOM.nextBytes(bytes);
- return bytes;
- }
-
- private void runStreamTest(int pLength) throws Exception {
- byte[] data = createData(pLength);
-
- ByteArrayOutputStream outBytes = new ByteArrayOutputStream();
- OutputStream out = new EncoderStream(outBytes, createCompatibleEncoder(), true);
- out.write(data);
- out.close();
- byte[] encoded = outBytes.toByteArray();
-
- byte[] decoded = FileUtil.read(new DecoderStream(new ByteArrayInputStream(encoded), createDecoder()));
- assertArrayEquals(String.format("Data %d", pLength), data, decoded);
-
- InputStream in = new DecoderStream(new ByteArrayInputStream(encoded), createDecoder());
- outBytes = new ByteArrayOutputStream();
- FileUtil.copy(in, outBytes);
- outBytes.close();
- in.close();
-
- decoded = outBytes.toByteArray();
- assertArrayEquals(String.format("Data %d", pLength), data, decoded);
- }
-
- @Test
- public final void testStreams() throws Exception {
- if (createCompatibleEncoder() == null) {
- return;
- }
-
- for (int i = 1; i < 100; i++) {
- try {
- runStreamTest(i);
- }
- catch (IOException e) {
- e.printStackTrace();
- fail(e.getMessage() + ": " + i);
- }
- }
-
- for (int i = 100; i < 2000; i += 250) {
- try {
- runStreamTest(i);
- }
- catch (IOException e) {
- e.printStackTrace();
- fail(e.getMessage() + ": " + i);
- }
- }
-
- for (int i = 2000; i < 80000; i += 1000) {
- try {
- runStreamTest(i);
- }
- catch (IOException e) {
- e.printStackTrace();
- fail(e.getMessage() + ": " + i);
- }
- }
- }
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io.enc;
+
+import com.twelvemonkeys.io.FileUtil;
+import com.twelvemonkeys.lang.ObjectAbstractTest;
+import org.junit.Test;
+
+import java.io.*;
+import java.nio.ByteBuffer;
+
+import static org.junit.Assert.*;
+
+/**
+ * AbstractDecoderTest
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/enc/DecoderAbstractTestCase.java#1 $
+ */
+public abstract class DecoderAbstractTest extends ObjectAbstractTest {
+
+ public abstract Decoder createDecoder();
+ public abstract Encoder createCompatibleEncoder();
+
+ protected Object makeObject() {
+ return createDecoder();
+ }
+
+ @Test(expected = NullPointerException.class)
+ public final void testNullDecode() throws IOException {
+ Decoder decoder = createDecoder();
+ ByteArrayInputStream bytes = new ByteArrayInputStream(new byte[20]);
+
+ decoder.decode(bytes, null);
+ fail("null should throw NullPointerException");
+ }
+
+ @Test
+ public final void testEmptyDecode() throws IOException {
+ Decoder decoder = createDecoder();
+ ByteArrayInputStream bytes = new ByteArrayInputStream(new byte[0]);
+
+ try {
+ int count = decoder.decode(bytes, ByteBuffer.allocate(128));
+ assertEquals("Should not be able to read any bytes", 0, count);
+ }
+ catch (EOFException allowed) {
+ // Okay
+ }
+ }
+
+ private byte[] createData(int pLength) throws Exception {
+ byte[] bytes = new byte[pLength];
+ EncoderAbstractTest.RANDOM.nextBytes(bytes);
+ return bytes;
+ }
+
+ private void runStreamTest(int pLength) throws Exception {
+ byte[] data = createData(pLength);
+
+ ByteArrayOutputStream outBytes = new ByteArrayOutputStream();
+ OutputStream out = new EncoderStream(outBytes, createCompatibleEncoder(), true);
+ out.write(data);
+ out.close();
+ byte[] encoded = outBytes.toByteArray();
+
+ byte[] decoded = FileUtil.read(new DecoderStream(new ByteArrayInputStream(encoded), createDecoder()));
+ assertArrayEquals(String.format("Data %d", pLength), data, decoded);
+
+ InputStream in = new DecoderStream(new ByteArrayInputStream(encoded), createDecoder());
+ outBytes = new ByteArrayOutputStream();
+ FileUtil.copy(in, outBytes);
+ outBytes.close();
+ in.close();
+
+ decoded = outBytes.toByteArray();
+ assertArrayEquals(String.format("Data %d", pLength), data, decoded);
+ }
+
+ @Test
+ public final void testStreams() throws Exception {
+ if (createCompatibleEncoder() == null) {
+ return;
+ }
+
+ for (int i = 1; i < 100; i++) {
+ try {
+ runStreamTest(i);
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage() + ": " + i);
+ }
+ }
+
+ for (int i = 100; i < 2000; i += 250) {
+ try {
+ runStreamTest(i);
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage() + ": " + i);
+ }
+ }
+
+ for (int i = 2000; i < 80000; i += 1000) {
+ try {
+ runStreamTest(i);
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage() + ": " + i);
+ }
+ }
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/EncoderAbstractTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/EncoderAbstractTest.java
similarity index 69%
rename from common/common-io/src/test/java/com/twelvemonkeys/io/enc/EncoderAbstractTestCase.java
rename to common/common-io/src/test/java/com/twelvemonkeys/io/enc/EncoderAbstractTest.java
index 6376a73d..23b4e057 100644
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/EncoderAbstractTestCase.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/EncoderAbstractTest.java
@@ -1,139 +1,170 @@
-package com.twelvemonkeys.io.enc;
-
-import com.twelvemonkeys.io.FileUtil;
-import com.twelvemonkeys.lang.ObjectAbstractTestCase;
-import org.junit.Test;
-
-import java.io.*;
-import java.util.Arrays;
-import java.util.Random;
-
-import static org.junit.Assert.*;
-
-/**
- * AbstractEncoderTest
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/enc/EncoderAbstractTestCase.java#1 $
- */
-public abstract class EncoderAbstractTestCase extends ObjectAbstractTestCase {
- // Use seed to make sure we create same number all the time
- static final long SEED = 12345678;
- static final Random RANDOM = new Random(SEED);
-
- protected abstract Encoder createEncoder();
- protected abstract Decoder createCompatibleDecoder();
-
- protected Object makeObject() {
- return createEncoder();
- }
-
- @Test
- public final void testNullEncode() throws IOException {
- Encoder encoder = createEncoder();
- ByteArrayOutputStream bytes = new ByteArrayOutputStream();
-
- try {
- encoder.encode(bytes, null);
- fail("null should throw NullPointerException");
- }
- catch (NullPointerException expected) {
- }
- }
-
- private byte[] createData(final int pLength) throws Exception {
- byte[] bytes = new byte[pLength];
- RANDOM.nextBytes(bytes);
- return bytes;
- }
-
- private void runStreamTest(final int pLength) throws Exception {
- byte[] data = createData(pLength);
- ByteArrayOutputStream outBytes = new ByteArrayOutputStream();
- OutputStream out = new EncoderStream(outBytes, createEncoder(), true);
-
- try {
- // Provoke failure for encoders that doesn't take array offset properly into account
- int off = (data.length + 1) / 2;
- out.write(data, 0, off);
- if (data.length > off) {
- out.write(data, off, data.length - off);
- }
- }
- finally {
- out.close();
- }
-
- byte[] encoded = outBytes.toByteArray();
-
-// System.err.println("encoded.length: " + encoded.length);
-// System.err.println("encoded: " + Arrays.toString(encoded));
-
- byte[] decoded = FileUtil.read(new DecoderStream(new ByteArrayInputStream(encoded), createCompatibleDecoder()));
- assertTrue(Arrays.equals(data, decoded));
-
- InputStream in = new DecoderStream(new ByteArrayInputStream(encoded), createCompatibleDecoder());
- outBytes = new ByteArrayOutputStream();
-
- try {
- FileUtil.copy(in, outBytes);
- }
- finally {
- outBytes.close();
- in.close();
- }
-
- decoded = outBytes.toByteArray();
- assertTrue(Arrays.equals(data, decoded));
- }
-
- @Test
- public final void testStreams() throws Exception {
- for (int i = 0; i < 100; i++) {
- try {
- runStreamTest(i);
- }
- catch (IOException e) {
- e.printStackTrace();
- fail(e.getMessage() + ": " + i);
- }
- catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage() + ": " + i);
- }
- }
-
- for (int i = 100; i < 2000; i += 250) {
- try {
- runStreamTest(i);
- }
- catch (IOException e) {
- e.printStackTrace();
- fail(e.getMessage() + ": " + i);
- }
- catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage() + ": " + i);
- }
- }
-
- for (int i = 2000; i < 80000; i += 1000) {
- try {
- runStreamTest(i);
- }
- catch (IOException e) {
- e.printStackTrace();
- fail(e.getMessage() + ": " + i);
- }
- catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage() + ": " + i);
- }
- }
- }
-
- // TODO: Test that the transition from byte[]Â to ByteBuffer didn't introduce bugs when writing to a wrapped array with offset.
-
-
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io.enc;
+
+import com.twelvemonkeys.io.FileUtil;
+import com.twelvemonkeys.lang.ObjectAbstractTest;
+import org.junit.Test;
+
+import java.io.*;
+import java.util.Arrays;
+import java.util.Random;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * AbstractEncoderTest
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/enc/EncoderAbstractTestCase.java#1 $
+ */
+public abstract class EncoderAbstractTest extends ObjectAbstractTest {
+ // Use seed to make sure we create same number all the time
+ static final long SEED = 12345678;
+ static final Random RANDOM = new Random(SEED);
+
+ protected abstract Encoder createEncoder();
+ protected abstract Decoder createCompatibleDecoder();
+
+ protected Object makeObject() {
+ return createEncoder();
+ }
+
+ @Test
+ public final void testNullEncode() throws IOException {
+ Encoder encoder = createEncoder();
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+
+ try {
+ encoder.encode(bytes, null);
+ fail("null should throw NullPointerException");
+ }
+ catch (NullPointerException expected) {
+ }
+ }
+
+ private byte[] createData(final int pLength) throws Exception {
+ byte[] bytes = new byte[pLength];
+ RANDOM.nextBytes(bytes);
+ return bytes;
+ }
+
+ private void runStreamTest(final int pLength) throws Exception {
+ byte[] data = createData(pLength);
+ ByteArrayOutputStream outBytes = new ByteArrayOutputStream();
+ OutputStream out = new EncoderStream(outBytes, createEncoder(), true);
+
+ try {
+ // Provoke failure for encoders that doesn't take array offset properly into account
+ int off = (data.length + 1) / 2;
+ out.write(data, 0, off);
+ if (data.length > off) {
+ out.write(data, off, data.length - off);
+ }
+ }
+ finally {
+ out.close();
+ }
+
+ byte[] encoded = outBytes.toByteArray();
+
+// System.err.println("encoded.length: " + encoded.length);
+// System.err.println("encoded: " + Arrays.toString(encoded));
+
+ byte[] decoded = FileUtil.read(new DecoderStream(new ByteArrayInputStream(encoded), createCompatibleDecoder()));
+ assertTrue(Arrays.equals(data, decoded));
+
+ InputStream in = new DecoderStream(new ByteArrayInputStream(encoded), createCompatibleDecoder());
+ outBytes = new ByteArrayOutputStream();
+
+ try {
+ FileUtil.copy(in, outBytes);
+ }
+ finally {
+ outBytes.close();
+ in.close();
+ }
+
+ decoded = outBytes.toByteArray();
+ assertTrue(Arrays.equals(data, decoded));
+ }
+
+ @Test
+ public final void testStreams() throws Exception {
+ for (int i = 0; i < 100; i++) {
+ try {
+ runStreamTest(i);
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage() + ": " + i);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage() + ": " + i);
+ }
+ }
+
+ for (int i = 100; i < 2000; i += 250) {
+ try {
+ runStreamTest(i);
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage() + ": " + i);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage() + ": " + i);
+ }
+ }
+
+ for (int i = 2000; i < 80000; i += 1000) {
+ try {
+ runStreamTest(i);
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage() + ": " + i);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage() + ": " + i);
+ }
+ }
+ }
+
+ // TODO: Test that the transition from byte[]Â to ByteBuffer didn't introduce bugs when writing to a wrapped array with offset.
+
+
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/PackBitsDecoderTest.java b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/PackBitsDecoderTest.java
new file mode 100755
index 00000000..6f974936
--- /dev/null
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/PackBitsDecoderTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io.enc;
+
+/**
+ * PackBitsDecoderTest
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/enc/PackBitsDecoderTestCase.java#1 $
+ */
+public class PackBitsDecoderTest extends DecoderAbstractTest {
+ public Decoder createDecoder() {
+ return new PackBitsDecoder();
+ }
+
+ public Encoder createCompatibleEncoder() {
+ return new PackBitsEncoder();
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/PackBitsDecoderTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/PackBitsDecoderTestCase.java
deleted file mode 100755
index 584be832..00000000
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/PackBitsDecoderTestCase.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.twelvemonkeys.io.enc;
-
-/**
- * PackBitsDecoderTest
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/enc/PackBitsDecoderTestCase.java#1 $
- */
-public class PackBitsDecoderTestCase extends DecoderAbstractTestCase {
- public Decoder createDecoder() {
- return new PackBitsDecoder();
- }
-
- public Encoder createCompatibleEncoder() {
- return new PackBitsEncoder();
- }
-}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/PackBitsEncoderTest.java b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/PackBitsEncoderTest.java
new file mode 100755
index 00000000..b1a13755
--- /dev/null
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/PackBitsEncoderTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io.enc;
+
+/**
+ * PackBitsEncoderTest
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/enc/PackBitsEncoderTestCase.java#1 $
+ */
+public class PackBitsEncoderTest extends EncoderAbstractTest {
+ protected Encoder createEncoder() {
+ return new PackBitsEncoder();
+ }
+
+ protected Decoder createCompatibleDecoder() {
+ return new PackBitsDecoder();
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/PackBitsEncoderTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/enc/PackBitsEncoderTestCase.java
deleted file mode 100755
index d214fd3f..00000000
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/enc/PackBitsEncoderTestCase.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.twelvemonkeys.io.enc;
-
-/**
- * PackBitsEncoderTest
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/enc/PackBitsEncoderTestCase.java#1 $
- */
-public class PackBitsEncoderTestCase extends EncoderAbstractTestCase {
- protected Encoder createEncoder() {
- return new PackBitsEncoder();
- }
-
- protected Decoder createCompatibleDecoder() {
- return new PackBitsDecoder();
- }
-}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocumentTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocumentTest.java
similarity index 76%
rename from common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocumentTestCase.java
rename to common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocumentTest.java
index ccbf18da..cef8106f 100755
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocumentTestCase.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocumentTest.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2011, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
package com.twelvemonkeys.io.ole2;
import com.twelvemonkeys.io.MemoryCacheSeekableStream;
@@ -22,7 +52,7 @@ import static org.junit.Assert.*;
* @author last modified by $Author: haku $
* @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocumentTestCase.java#1 $
*/
-public class CompoundDocumentTestCase {
+public class CompoundDocumentTest {
private static final String SAMPLE_DATA = "/Thumbs-camera.db";
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocument_SeekableLittleEndianDataInputStreamTest.java b/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocument_SeekableLittleEndianDataInputStreamTest.java
new file mode 100644
index 00000000..c0b80b76
--- /dev/null
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocument_SeekableLittleEndianDataInputStreamTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2011, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.io.ole2;
+
+import com.twelvemonkeys.io.*;
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+
+/**
+ * CompoundDocument_SeekableLittleEndianDataInputStreamTestCase
+ *
+ * @author Harald Kuhr
+ * @author last modified by $Author: haraldk$
+ * @version $Id: CompoundDocument_SeekableLittleEndianDataInputStreamTestCase.java,v 1.0 18.10.11 16:35 haraldk Exp$
+ */
+public class CompoundDocument_SeekableLittleEndianDataInputStreamTest extends InputStreamAbstractTest implements SeekableInterfaceTest {
+ private final SeekableInterfaceTest seekableTest = new SeekableAbstractTest() {
+ @Override
+ protected Seekable createSeekable() {
+ return (Seekable) makeInputStream();
+ }
+ };
+
+ @Override
+ protected CompoundDocument.SeekableLittleEndianDataInputStream makeInputStream(byte[] pBytes) {
+ return new CompoundDocument.SeekableLittleEndianDataInputStream(new MemoryCacheSeekableStream(new ByteArrayInputStream(pBytes)));
+ }
+
+ @Test
+ public void testSeekable() {
+ seekableTest.testSeekable();
+ }
+}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocument_SeekableLittleEndianDataInputStreamTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocument_SeekableLittleEndianDataInputStreamTestCase.java
deleted file mode 100644
index d4e426d6..00000000
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocument_SeekableLittleEndianDataInputStreamTestCase.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2011, Harald Kuhr
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.twelvemonkeys.io.ole2;
-
-import com.twelvemonkeys.io.*;
-import org.junit.Test;
-
-import java.io.ByteArrayInputStream;
-
-/**
- * CompoundDocument_SeekableLittleEndianDataInputStreamTestCase
- *
- * @author Harald Kuhr
- * @author last modified by $Author: haraldk$
- * @version $Id: CompoundDocument_SeekableLittleEndianDataInputStreamTestCase.java,v 1.0 18.10.11 16:35 haraldk Exp$
- */
-public class CompoundDocument_SeekableLittleEndianDataInputStreamTestCase extends InputStreamAbstractTestCase implements SeekableInterfaceTest {
- private final SeekableInterfaceTest seekableTest = new SeekableAbstractTestCase() {
- @Override
- protected Seekable createSeekable() {
- return (Seekable) makeInputStream();
- }
- };
-
- @Override
- protected CompoundDocument.SeekableLittleEndianDataInputStream makeInputStream(byte[] pBytes) {
- return new CompoundDocument.SeekableLittleEndianDataInputStream(new MemoryCacheSeekableStream(new ByteArrayInputStream(pBytes)));
- }
-
- @Test
- public void testSeekable() {
- seekableTest.testSeekable();
- }
-}
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocument_StreamTestCase.java b/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocument_StreamTest.java
similarity index 85%
rename from common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocument_StreamTestCase.java
rename to common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocument_StreamTest.java
index 14039eae..be188623 100644
--- a/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocument_StreamTestCase.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/io/ole2/CompoundDocument_StreamTest.java
@@ -4,31 +4,33 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.io.ole2;
-import com.twelvemonkeys.io.InputStreamAbstractTestCase;
+import com.twelvemonkeys.io.InputStreamAbstractTest;
import com.twelvemonkeys.io.LittleEndianDataOutputStream;
import com.twelvemonkeys.io.MemoryCacheSeekableStream;
import com.twelvemonkeys.io.SeekableInputStream;
@@ -50,7 +52,7 @@ import static org.junit.Assert.*;
* @version $Id: CompoundDocument_StreamTestCase.java,v 1.0 13.10.11 12:01 haraldk Exp$
*/
//@Ignore("Need proper in-memory creation of CompoundDocuments")
-public class CompoundDocument_StreamTestCase extends InputStreamAbstractTestCase {
+public class CompoundDocument_StreamTest extends InputStreamAbstractTest {
private static final String SAMPLE_DATA = "/Thumbs-camera.db";
protected final CompoundDocument createTestDocument() throws IOException {
diff --git a/common/common-io/src/test/java/com/twelvemonkeys/net/HTTPUtilTest.java b/common/common-io/src/test/java/com/twelvemonkeys/net/HTTPUtilTest.java
index 9bb83f53..f3912e92 100644
--- a/common/common-io/src/test/java/com/twelvemonkeys/net/HTTPUtilTest.java
+++ b/common/common-io/src/test/java/com/twelvemonkeys/net/HTTPUtilTest.java
@@ -4,33 +4,35 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.net;
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
/**
* HTTPUtilTest
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/lang/BeanUtil.java b/common/common-lang/src/main/java/com/twelvemonkeys/lang/BeanUtil.java
index 7eae35dd..dffd0bb3 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/lang/BeanUtil.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/lang/BeanUtil.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.lang;
@@ -35,8 +37,8 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.util.Map;
import java.util.Arrays;
+import java.util.Map;
/**
* A utility class with some useful bean-related functions.
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java b/common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java
index 1234eb3c..780a68dd 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.lang;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/lang/Platform.java b/common/common-lang/src/main/java/com/twelvemonkeys/lang/Platform.java
index d69f37c3..f0ab7e1a 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/lang/Platform.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/lang/Platform.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.lang;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/lang/ReflectUtil.java b/common/common-lang/src/main/java/com/twelvemonkeys/lang/ReflectUtil.java
index 349be257..615672ab 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/lang/ReflectUtil.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/lang/ReflectUtil.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.lang;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java b/common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java
index 1d244b72..5b546646 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.lang;
@@ -31,21 +33,21 @@ package com.twelvemonkeys.lang;
import com.twelvemonkeys.util.StringTokenIterator;
import java.awt.*;
+import java.io.UnsupportedEncodingException;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.nio.charset.UnsupportedCharsetException;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import java.util.ArrayList;
-import java.util.regex.PatternSyntaxException;
import java.util.regex.Pattern;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.UnsupportedCharsetException;
+import java.util.regex.PatternSyntaxException;
/**
* A utility class with some useful string manipulation methods.
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/lang/SystemUtil.java b/common/common-lang/src/main/java/com/twelvemonkeys/lang/SystemUtil.java
index 9e79347e..6a6069a0 100644
--- a/common/common-lang/src/main/java/com/twelvemonkeys/lang/SystemUtil.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/lang/SystemUtil.java
@@ -4,32 +4,32 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.lang;
-//import com.twelvemonkeys.util.XMLProperties;
-
import java.io.*;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/lang/Validate.java b/common/common-lang/src/main/java/com/twelvemonkeys/lang/Validate.java
index 16897f31..450081d4 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/lang/Validate.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/lang/Validate.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2009, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
package com.twelvemonkeys.lang;
import java.util.Arrays;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/lang/package_info.java b/common/common-lang/src/main/java/com/twelvemonkeys/lang/package_info.java
index ced3971b..92c3c925 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/lang/package_info.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/lang/package_info.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
/**
*Contains utils/helpers for classes in {@code java.lang}.
*/
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/AbstractDecoratedMap.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/AbstractDecoratedMap.java
index ab4e4fb7..4d551e1f 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/AbstractDecoratedMap.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/AbstractDecoratedMap.java
@@ -4,32 +4,34 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
-import java.util.*;
import java.io.Serializable;
+import java.util.*;
/**
* AbstractDecoratedMap
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/AbstractTokenIterator.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/AbstractTokenIterator.java
index 90e56161..aaebbe4e 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/AbstractTokenIterator.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/AbstractTokenIterator.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/BeanMap.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/BeanMap.java
index 8f830c00..906c3391 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/BeanMap.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/BeanMap.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
@@ -32,10 +34,10 @@ import java.beans.IndexedPropertyDescriptor;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
+import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
-import java.io.Serializable;
/**
* A {@code Map} adapter for a Java Bean.
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java
index 63e205ba..3b492a61 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/DuplicateHandler.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/DuplicateHandler.java
index 626eefb4..f3f56d28 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/DuplicateHandler.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/DuplicateHandler.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/ExpiringMap.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/ExpiringMap.java
index 5e2f7490..affa1a23 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/ExpiringMap.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/ExpiringMap.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/FilterIterator.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/FilterIterator.java
index 0e5e8586..7ca3df1a 100644
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/FilterIterator.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/FilterIterator.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/IgnoreCaseMap.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/IgnoreCaseMap.java
index 4258d723..b81d36fa 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/IgnoreCaseMap.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/IgnoreCaseMap.java
@@ -4,33 +4,35 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
+import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
-import java.io.Serializable;
/**
* A {@code Map} decorator that makes the mappings in the backing map
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/LRUHashMap.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/LRUHashMap.java
index eee68eeb..53bf7610 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/LRUHashMap.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/LRUHashMap.java
@@ -4,33 +4,35 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
-import java.util.Map;
-import java.util.LinkedHashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
/**
* Map implementation with size limit, that keeps its entries in LRU
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/LRUMap.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/LRUMap.java
index 040ed014..28a01d30 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/LRUMap.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/LRUMap.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/LinkedMap.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/LinkedMap.java
index e9a071a0..2cb7df05 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/LinkedMap.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/LinkedMap.java
@@ -4,32 +4,34 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
-import java.util.*;
import java.io.Serializable;
+import java.util.*;
/**
* Generic map and linked list implementation of the {@code Map} interface,
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/LinkedSet.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/LinkedSet.java
index 8a56b367..18d6385f 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/LinkedSet.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/LinkedSet.java
@@ -4,32 +4,34 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
-import java.util.*;
import java.io.Serializable;
+import java.util.*;
/**
* Generic map and linked list implementation of the {@code Set} interface,
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/NullMap.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/NullMap.java
index eb538915..8eaec564 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/NullMap.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/NullMap.java
@@ -4,32 +4,37 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
-import java.util.*;
import java.io.Serializable;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
/**
* An (immutable) empty {@link Map}, that supports all {@code Map} operations
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/StringTokenIterator.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/StringTokenIterator.java
index dc95c5d6..9ee89556 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/StringTokenIterator.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/StringTokenIterator.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/Time.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/Time.java
index c7be02a7..9c01fb18 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/Time.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/Time.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/TimeFormat.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/TimeFormat.java
index 68fb1d33..ac725c31 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/TimeFormat.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/TimeFormat.java
@@ -4,29 +4,30 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
package com.twelvemonkeys.util;
import com.twelvemonkeys.lang.StringUtil;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/TimeoutMap.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/TimeoutMap.java
index 800ce922..2b259dde 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/TimeoutMap.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/TimeoutMap.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/TokenIterator.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/TokenIterator.java
index 7fa70b7a..45f2f7af 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/TokenIterator.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/TokenIterator.java
@@ -4,32 +4,34 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
-import java.util.Iterator;
import java.util.Enumeration;
+import java.util.Iterator;
/**
* TokenIterator, Iterator-based replacement for StringTokenizer.
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/Visitor.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/Visitor.java
index e62026c6..cb3311e8 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/Visitor.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/Visitor.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
package com.twelvemonkeys.util;
/**
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/WeakWeakMap.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/WeakWeakMap.java
index d9737e92..9a1cc517 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/WeakWeakMap.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/WeakWeakMap.java
@@ -4,32 +4,34 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
-import java.util.*;
import java.lang.ref.WeakReference;
+import java.util.*;
/**
* Special-purpose map implementation with weak keys and weak values. This is
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConversionException.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConversionException.java
index 06bf09ab..675a6e67 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConversionException.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConversionException.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.convert;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/Converter.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/Converter.java
index 106b6164..4da27644 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/Converter.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/Converter.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.convert;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConverterImpl.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConverterImpl.java
index 321c6ee1..58a0eb6b 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConverterImpl.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConverterImpl.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.convert;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/DateConverter.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/DateConverter.java
index 9183fbb7..71e7ff77 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/DateConverter.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/DateConverter.java
@@ -4,35 +4,40 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.convert;
-import com.twelvemonkeys.lang.*;
+import com.twelvemonkeys.lang.BeanUtil;
+import com.twelvemonkeys.lang.StringUtil;
-import java.util.*;
-import java.text.*;
import java.lang.reflect.InvocationTargetException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
/**
* Converts strings to dates and back.
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/DefaultConverter.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/DefaultConverter.java
index 59236d7c..6ae3544b 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/DefaultConverter.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/DefaultConverter.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.convert;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/MissingTypeException.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/MissingTypeException.java
index e9b2da3f..cdd10c4c 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/MissingTypeException.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/MissingTypeException.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.convert;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/NoAvailableConverterException.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/NoAvailableConverterException.java
index 42631321..ebe2e73e 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/NoAvailableConverterException.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/NoAvailableConverterException.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.convert;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/NumberConverter.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/NumberConverter.java
index 13c7e322..2d9ae304 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/NumberConverter.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/NumberConverter.java
@@ -4,36 +4,42 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.convert;
-import com.twelvemonkeys.lang.*;
+import com.twelvemonkeys.lang.BeanUtil;
+import com.twelvemonkeys.lang.StringUtil;
import com.twelvemonkeys.util.LRUHashMap;
-import java.util.*;
-import java.math.*;
+import java.math.BigDecimal;
+import java.math.BigInteger;
import java.text.*;
+import java.util.Arrays;
+import java.util.Locale;
+import java.util.Map;
/**
* Converts strings to numbers and back.
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/PropertyConverter.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/PropertyConverter.java
index ae1bf51b..1822368b 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/PropertyConverter.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/PropertyConverter.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.convert;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/TimeConverter.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/TimeConverter.java
index 0a6fd5a6..d1f7234e 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/TimeConverter.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/TimeConverter.java
@@ -4,31 +4,33 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.convert;
-import com.twelvemonkeys.lang.*;
+import com.twelvemonkeys.lang.StringUtil;
import com.twelvemonkeys.util.Time;
import com.twelvemonkeys.util.TimeFormat;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/TypeMismathException.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/TypeMismathException.java
index acc8c0f6..9164a2f5 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/TypeMismathException.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/TypeMismathException.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.convert;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/pacakge_info.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/pacakge_info.java
index faed2215..26dcb8b8 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/pacakge_info.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/pacakge_info.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
/**
* Provides a general purpose conversion framework, for conversion of values
* between string representations and objects.
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/package_info.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/package_info.java
index 9cc218ca..4ede179d 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/package_info.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/package_info.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
/**
* Provides miscellaneous utility classes.
*/
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/regex/RegExTokenIterator.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/regex/RegExTokenIterator.java
index ce1219f9..17534e67 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/regex/RegExTokenIterator.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/regex/RegExTokenIterator.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.regex;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/regex/WildcardStringParser.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/regex/WildcardStringParser.java
index 5a40f96e..aa7f2e0c 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/regex/WildcardStringParser.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/regex/WildcardStringParser.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.regex;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/regex/package_info.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/regex/package_info.java
index 10302814..ca928070 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/regex/package_info.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/regex/package_info.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
/**
* Provides functionality for regular expressions.
*/
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/service/RegisterableService.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/service/RegisterableService.java
index 1c666ef2..e3c05e7d 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/service/RegisterableService.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/service/RegisterableService.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.service;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/service/ServiceConfigurationError.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/service/ServiceConfigurationError.java
index 0aa281f0..2e75c310 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/service/ServiceConfigurationError.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/service/ServiceConfigurationError.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.service;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/service/ServiceRegistry.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/service/ServiceRegistry.java
index c375d955..5aa059c1 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/service/ServiceRegistry.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/service/ServiceRegistry.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util.service;
diff --git a/common/common-lang/src/main/java/com/twelvemonkeys/util/service/package_info.java b/common/common-lang/src/main/java/com/twelvemonkeys/util/service/package_info.java
index ca790a2c..c35bc12b 100755
--- a/common/common-lang/src/main/java/com/twelvemonkeys/util/service/package_info.java
+++ b/common/common-lang/src/main/java/com/twelvemonkeys/util/service/package_info.java
@@ -1,3 +1,33 @@
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
/**
* Provides a service provider registry.
*
diff --git a/common/common-lang/src/test/java/com/twelvemonkeys/lang/BeanUtilTestCase.java b/common/common-lang/src/test/java/com/twelvemonkeys/lang/BeanUtilTest.java
similarity index 77%
rename from common/common-lang/src/test/java/com/twelvemonkeys/lang/BeanUtilTestCase.java
rename to common/common-lang/src/test/java/com/twelvemonkeys/lang/BeanUtilTest.java
index 59e69b97..b256a68d 100755
--- a/common/common-lang/src/test/java/com/twelvemonkeys/lang/BeanUtilTestCase.java
+++ b/common/common-lang/src/test/java/com/twelvemonkeys/lang/BeanUtilTest.java
@@ -1,235 +1,274 @@
-package com.twelvemonkeys.lang;
-
-import junit.framework.TestCase;
-
-import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * BeanUtilTestCase
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/lang/BeanUtilTestCase.java#1 $
- */
-public class BeanUtilTestCase extends TestCase {
-
- public void testConfigureNoMehtod() {
- TestBean bean = new TestBean();
-
- Map map = new HashMap();
-
- map.put("noSuchMethod", "jaffa");
-
- try {
- BeanUtil.configure(bean, map);
- }
- catch (InvocationTargetException e) {
- fail(e.getMessage());
- }
- }
-
- public void testConfigureNoMethodArgs() {
- TestBean bean = new TestBean();
-
- Map map = new HashMap();
-
- map.put("doubleValue", new Object()); // Should not be able to convert this
-
- try {
- BeanUtil.configure(bean, map);
- }
- catch (InvocationTargetException e) {
- fail(e.getMessage());
- }
-
- assertNull(bean.getDoubleValue());
-
- }
-
- public void testConfigureNullValue() {
- TestBean bean = new TestBean();
-
- Map map = new HashMap();
-
- map.put("stringValue", null);
-
- try {
- BeanUtil.configure(bean, map);
- }
- catch (InvocationTargetException e) {
- fail(e.getMessage());
- }
-
- assertNull(bean.getStringValue());
- }
-
- public void testConfigureSimple() {
- TestBean bean = new TestBean();
-
- Map map = new HashMap();
-
- map.put("stringValue", "one");
- map.put("intValue", 2);
- map.put("doubleValue", .3);
-
- try {
- BeanUtil.configure(bean, map);
- }
- catch (InvocationTargetException e) {
- fail(e.getMessage());
- }
-
- assertEquals("one", bean.getStringValue());
- assertEquals(2, bean.getIntValue());
- assertEquals(.3, bean.getDoubleValue());
- }
-
- public void testConfigureConvert() {
- TestBean bean = new TestBean();
-
- Map map = new HashMap();
-
- map.put("stringValue", 1);
- map.put("intValue", "2");
- map.put("doubleValue", ".3");
-
- try {
- BeanUtil.configure(bean, map);
- }
- catch (InvocationTargetException e) {
- fail(e.getMessage());
- }
-
- assertEquals("1", bean.getStringValue());
- assertEquals(2, bean.getIntValue());
- assertEquals(0.3, bean.getDoubleValue());
- }
-
- public void testConfigureAmbiguous1() {
- TestBean bean = new TestBean();
-
- Map map = new HashMap();
-
- String value = "one";
- map.put("ambiguous", value);
-
- try {
- BeanUtil.configure(bean, map);
- }
- catch (InvocationTargetException e) {
- fail(e.getMessage());
- }
-
- assertNotNull(bean.getAmbiguous());
- assertEquals("String converted rather than invoking setAmbiguous(String), ordering not predictable",
- "one", bean.getAmbiguous());
- assertSame("String converted rather than invoking setAmbiguous(String), ordering not predictable",
- value, bean.getAmbiguous());
- }
-
- public void testConfigureAmbiguous2() {
- TestBean bean = new TestBean();
-
- Map map = new HashMap();
-
- Integer value = 2;
- map.put("ambiguous", value);
-
- try {
- BeanUtil.configure(bean, map);
- }
- catch (InvocationTargetException e) {
- fail(e.getMessage());
- }
-
- assertNotNull(bean.getAmbiguous());
- assertEquals("Integer converted rather than invoking setAmbiguous(Integer), ordering not predictable",
- 2, bean.getAmbiguous());
- assertSame("Integer converted rather than invoking setAmbiguous(Integer), ordering not predictable",
- value, bean.getAmbiguous());
- }
-
- public void testConfigureAmbiguous3() {
- TestBean bean = new TestBean();
-
- Map map = new HashMap();
-
- Double value = .3;
- map.put("ambiguous", value);
-
- try {
- BeanUtil.configure(bean, map);
- }
- catch (InvocationTargetException e) {
- fail(e.getMessage());
- }
-
- assertNotNull(bean.getAmbiguous());
- assertEquals("Object converted rather than invoking setAmbiguous(Object), ordering not predictable",
- value.getClass(), bean.getAmbiguous().getClass());
- assertSame("Object converted rather than invoking setAmbiguous(Object), ordering not predictable",
- value, bean.getAmbiguous());
- }
-
- static class TestBean {
- private String stringVal;
- private int intVal;
- private Double doubleVal;
-
- private Object ambiguous;
-
- public Double getDoubleValue() {
- return doubleVal;
- }
-
- public int getIntValue() {
- return intVal;
- }
-
- public String getStringValue() {
- return stringVal;
- }
-
- @SuppressWarnings("UnusedDeclaration")
- public void setStringValue(String pString) {
- stringVal = pString;
- }
-
- @SuppressWarnings("UnusedDeclaration")
- public void setIntValue(int pInt) {
- intVal = pInt;
- }
-
- @SuppressWarnings("UnusedDeclaration")
- public void setDoubleValue(Double pDouble) {
- doubleVal = pDouble;
- }
-
- @SuppressWarnings("UnusedDeclaration")
- public void setAmbiguous(String pString) {
- ambiguous = pString;
- }
-
- @SuppressWarnings("UnusedDeclaration")
- public void setAmbiguous(Object pObject) {
- ambiguous = pObject;
- }
-
- @SuppressWarnings("UnusedDeclaration")
- public void setAmbiguous(Integer pInteger) {
- ambiguous = pInteger;
- }
-
- @SuppressWarnings("UnusedDeclaration")
- public void setAmbiguous(int pInt) {
- ambiguous = (long) pInt; // Just to differentiate...
- }
-
- public Object getAmbiguous() {
- return ambiguous;
- }
- }
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.lang;
+
+import org.junit.Test;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * BeanUtilTestCase
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/lang/BeanUtilTestCase.java#1 $
+ */
+public class BeanUtilTest {
+
+ @Test
+ public void testConfigureNoMehtod() {
+ TestBean bean = new TestBean();
+
+ Map map = new HashMap();
+
+ map.put("noSuchMethod", "jaffa");
+
+ try {
+ BeanUtil.configure(bean, map);
+ }
+ catch (InvocationTargetException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testConfigureNoMethodArgs() {
+ TestBean bean = new TestBean();
+
+ Map map = new HashMap();
+
+ map.put("doubleValue", new Object()); // Should not be able to convert this
+
+ try {
+ BeanUtil.configure(bean, map);
+ }
+ catch (InvocationTargetException e) {
+ fail(e.getMessage());
+ }
+
+ assertNull(bean.getDoubleValue());
+
+ }
+
+ @Test
+ public void testConfigureNullValue() {
+ TestBean bean = new TestBean();
+
+ Map map = new HashMap();
+
+ map.put("stringValue", null);
+
+ try {
+ BeanUtil.configure(bean, map);
+ }
+ catch (InvocationTargetException e) {
+ fail(e.getMessage());
+ }
+
+ assertNull(bean.getStringValue());
+ }
+
+ public void testConfigureSimple() {
+ TestBean bean = new TestBean();
+
+ Map map = new HashMap();
+
+ map.put("stringValue", "one");
+ map.put("intValue", 2);
+ map.put("doubleValue", .3);
+
+ try {
+ BeanUtil.configure(bean, map);
+ }
+ catch (InvocationTargetException e) {
+ fail(e.getMessage());
+ }
+
+ assertEquals("one", bean.getStringValue());
+ assertEquals(2, bean.getIntValue());
+ assertEquals(.3, bean.getDoubleValue(), 0);
+ }
+
+ @Test
+ public void testConfigureConvert() {
+ TestBean bean = new TestBean();
+
+ Map map = new HashMap();
+
+ map.put("stringValue", 1);
+ map.put("intValue", "2");
+ map.put("doubleValue", ".3");
+
+ try {
+ BeanUtil.configure(bean, map);
+ }
+ catch (InvocationTargetException e) {
+ fail(e.getMessage());
+ }
+
+ assertEquals("1", bean.getStringValue());
+ assertEquals(2, bean.getIntValue());
+ assertEquals(0.3, bean.getDoubleValue(), 0);
+ }
+
+ @Test
+ public void testConfigureAmbiguous1() {
+ TestBean bean = new TestBean();
+
+ Map map = new HashMap();
+
+ String value = "one";
+ map.put("ambiguous", value);
+
+ try {
+ BeanUtil.configure(bean, map);
+ }
+ catch (InvocationTargetException e) {
+ fail(e.getMessage());
+ }
+
+ assertNotNull(bean.getAmbiguous());
+ assertEquals("String converted rather than invoking setAmbiguous(String), ordering not predictable",
+ "one", bean.getAmbiguous());
+ assertSame("String converted rather than invoking setAmbiguous(String), ordering not predictable",
+ value, bean.getAmbiguous());
+ }
+
+ @Test
+ public void testConfigureAmbiguous2() {
+ TestBean bean = new TestBean();
+
+ Map map = new HashMap();
+
+ Integer value = 2;
+ map.put("ambiguous", value);
+
+ try {
+ BeanUtil.configure(bean, map);
+ }
+ catch (InvocationTargetException e) {
+ fail(e.getMessage());
+ }
+
+ assertNotNull(bean.getAmbiguous());
+ assertEquals("Integer converted rather than invoking setAmbiguous(Integer), ordering not predictable",
+ 2, bean.getAmbiguous());
+ assertSame("Integer converted rather than invoking setAmbiguous(Integer), ordering not predictable",
+ value, bean.getAmbiguous());
+ }
+
+ @Test
+ public void testConfigureAmbiguous3() {
+ TestBean bean = new TestBean();
+
+ Map map = new HashMap();
+
+ Double value = .3;
+ map.put("ambiguous", value);
+
+ try {
+ BeanUtil.configure(bean, map);
+ }
+ catch (InvocationTargetException e) {
+ fail(e.getMessage());
+ }
+
+ assertNotNull(bean.getAmbiguous());
+ assertEquals("Object converted rather than invoking setAmbiguous(Object), ordering not predictable",
+ value.getClass(), bean.getAmbiguous().getClass());
+ assertSame("Object converted rather than invoking setAmbiguous(Object), ordering not predictable",
+ value, bean.getAmbiguous());
+ }
+
+ static class TestBean {
+ private String stringVal;
+ private int intVal;
+ private Double doubleVal;
+
+ private Object ambiguous;
+
+ public Double getDoubleValue() {
+ return doubleVal;
+ }
+
+ public int getIntValue() {
+ return intVal;
+ }
+
+ public String getStringValue() {
+ return stringVal;
+ }
+
+ @SuppressWarnings("UnusedDeclaration")
+ public void setStringValue(String pString) {
+ stringVal = pString;
+ }
+
+ @SuppressWarnings("UnusedDeclaration")
+ public void setIntValue(int pInt) {
+ intVal = pInt;
+ }
+
+ @SuppressWarnings("UnusedDeclaration")
+ public void setDoubleValue(Double pDouble) {
+ doubleVal = pDouble;
+ }
+
+ @SuppressWarnings("UnusedDeclaration")
+ public void setAmbiguous(String pString) {
+ ambiguous = pString;
+ }
+
+ @SuppressWarnings("UnusedDeclaration")
+ public void setAmbiguous(Object pObject) {
+ ambiguous = pObject;
+ }
+
+ @SuppressWarnings("UnusedDeclaration")
+ public void setAmbiguous(Integer pInteger) {
+ ambiguous = pInteger;
+ }
+
+ @SuppressWarnings("UnusedDeclaration")
+ public void setAmbiguous(int pInt) {
+ ambiguous = (long) pInt; // Just to differentiate...
+ }
+
+ public Object getAmbiguous() {
+ return ambiguous;
+ }
+ }
+}
diff --git a/common/common-lang/src/test/java/com/twelvemonkeys/lang/DateUtilTest.java b/common/common-lang/src/test/java/com/twelvemonkeys/lang/DateUtilTest.java
index 6f4959e1..0dde4b48 100644
--- a/common/common-lang/src/test/java/com/twelvemonkeys/lang/DateUtilTest.java
+++ b/common/common-lang/src/test/java/com/twelvemonkeys/lang/DateUtilTest.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.lang;
diff --git a/common/common-lang/src/test/java/com/twelvemonkeys/lang/ObjectAbstractTestCase.java b/common/common-lang/src/test/java/com/twelvemonkeys/lang/ObjectAbstractTest.java
similarity index 86%
rename from common/common-lang/src/test/java/com/twelvemonkeys/lang/ObjectAbstractTestCase.java
rename to common/common-lang/src/test/java/com/twelvemonkeys/lang/ObjectAbstractTest.java
index 6ed3f622..4b5397c7 100755
--- a/common/common-lang/src/test/java/com/twelvemonkeys/lang/ObjectAbstractTestCase.java
+++ b/common/common-lang/src/test/java/com/twelvemonkeys/lang/ObjectAbstractTest.java
@@ -1,309 +1,339 @@
-package com.twelvemonkeys.lang;
-
-import org.junit.Test;
-
-import java.io.*;
-import java.lang.reflect.Method;
-
-import static org.junit.Assert.*;
-
-/**
- * AbstractObjectTestCase
- *
- *
- * @author Harald Kuhr
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/lang/ObjectAbstractTestCase.java#1 $
- */
-public abstract class ObjectAbstractTestCase {
- // TODO: See com.tm.util.ObjectAbstractTestCase
- // TODO: The idea is that this should be some generic base-class that
- // implements the basic object tests
-
- // TODO: Create Serializable test similar way
- // TODO: Create Comparable test similar way
-
- /**
- * Returns an instance of the class we are testing.
- * Implement this method to return the object to test.
- *
- * @return the object to test
- */
- protected abstract Object makeObject();
-
- // TODO: Can we really do serious testing with just one object?
- // TODO: How can we make sure we create equal or different objects?!
- //protected abstract Object makeDifferentObject(Object pObject);
- //protected abstract Object makeEqualObject(Object pObject);
-
-
- @Test
- public void testToString() {
- assertNotNull(makeObject().toString());
- // TODO: What more can we test?
- }
-
- // TODO: assert that either BOTH or NONE of equals/hashcode is overridden
- @Test
- public void testEqualsHashCode(){
- Object obj = makeObject();
-
- Class cl = obj.getClass();
- if (isEqualsOverriden(cl)) {
- assertTrue("Class " + cl.getName() + " implements equals but not hashCode", isHashCodeOverriden(cl));
- }
- else if (isHashCodeOverriden(cl)) {
- assertTrue("Class " + cl.getName() + " implements hashCode but not equals", isEqualsOverriden(cl));
- }
-
- }
-
- protected static boolean isEqualsOverriden(Class pClass) {
- return getDeclaredMethod(pClass, "equals", new Class[]{Object.class}) != null;
- }
-
- protected static boolean isHashCodeOverriden(Class pClass) {
- return getDeclaredMethod(pClass, "hashCode", null) != null;
- }
-
- private static Method getDeclaredMethod(Class pClass, String pName, Class[] pArameters) {
- try {
- return pClass.getDeclaredMethod(pName, pArameters);
- }
- catch (NoSuchMethodException ignore) {
- return null;
- }
- }
-
- @Test
- public void testObjectEqualsSelf() {
- Object obj = makeObject();
- assertEquals("An Object should equal itself", obj, obj);
- }
-
- @Test
- public void testEqualsNull() {
- Object obj = makeObject();
- // NOTE: Makes sure this doesn't throw NPE either
- //noinspection ObjectEqualsNull
- assertFalse("An object should never equal null", obj.equals(null));
- }
-
- @Test
- public void testObjectHashCodeEqualsSelfHashCode() {
- Object obj = makeObject();
- assertEquals("hashCode should be repeatable", obj.hashCode(), obj.hashCode());
- }
-
- @Test
- public void testObjectHashCodeEqualsContract() {
- Object obj1 = makeObject();
- if (obj1.equals(obj1)) {
- assertEquals(
- "[1] When two objects are equal, their hashCodes should be also.",
- obj1.hashCode(), obj1.hashCode());
- }
- // TODO: Make sure we create at least one equal object, and one different object
- Object obj2 = makeObject();
- if (obj1.equals(obj2)) {
- assertEquals(
- "[2] When two objects are equal, their hashCodes should be also.",
- obj1.hashCode(), obj2.hashCode());
- assertTrue(
- "When obj1.equals(obj2) is true, then obj2.equals(obj1) should also be true",
- obj2.equals(obj1));
- }
- }
-
- /*
- public void testFinalize() {
- // TODO: Implement
- }
- */
-
- ////////////////////////////////////////////////////////////////////////////
- // Cloneable interface
- @Test
- public void testClone() throws Exception {
- Object obj = makeObject();
- if (obj instanceof Cloneable) {
- Class cl = obj.getClass();
-
- Method clone = findMethod(cl, "clone");
-
- // Disregard protected modifier
- // NOTE: This will throw a SecurityException if a SecurityManager
- // disallows access, but should not happen in a test context
- if (!clone.isAccessible()) {
- clone.setAccessible(true);
- }
-
- Object cloned = clone.invoke(obj);
-
- assertNotNull("Cloned object should never be null", cloned);
-
- // TODO: This can only be asserted if equals() test is based on
- // value equality, not reference (identity) equality
- // Maybe it's possible to do a reflective introspection of
- // the objects fields?
- if (isHashCodeOverriden(cl)) {
- assertEquals("Cloned object not equal", obj, cloned);
- }
- }
- }
-
- private static Method findMethod(Class pClass, String pName) throws NoSuchMethodException {
- if (pClass == null) {
- throw new IllegalArgumentException("class == null");
- }
- if (pName == null) {
- throw new IllegalArgumentException("name == null");
- }
-
- Class cl = pClass;
-
- while (cl != null) {
- try {
- return cl.getDeclaredMethod(pName, new Class[0]);
- }
- catch (NoSuchMethodException e) {
- }
- catch (SecurityException e) {
- }
-
- cl = cl.getSuperclass();
- }
-
- throw new NoSuchMethodException(pName + " in class " + pClass.getName());
- }
-
- ///////////////////////////////////////////////////////////////////////////
- // Serializable interface
- @Test
- public void testSerializeDeserializeThenCompare() throws Exception {
- Object obj = makeObject();
- if (obj instanceof Serializable) {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(buffer);
- try {
- out.writeObject(obj);
- }
- finally {
- out.close();
- }
-
- Object dest;
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
- try {
- dest = in.readObject();
- }
- finally {
- in.close();
- }
-
- // TODO: This can only be asserted if equals() test is based on
- // value equality, not reference (identity) equality
- // Maybe it's possible to do a reflective introspection of
- // the objects fields?
- if (isEqualsOverriden(obj.getClass())) {
- assertEquals("obj != deserialize(serialize(obj))", obj, dest);
- }
- }
- }
-
- /**
- * Sanity check method, makes sure that any {@code Serializable}
- * class can be serialized and de-serialized in memory,
- * using the handy makeObject() method
- *
- * @throws java.io.IOException
- * @throws ClassNotFoundException
- */
- @Test
- public void testSimpleSerialization() throws Exception {
- Object o = makeObject();
- if (o instanceof Serializable) {
- byte[] object = writeExternalFormToBytes((Serializable) o);
- readExternalFormFromBytes(object);
- }
- }
-
- /**
- * Write a Serializable or Externalizable object as
- * a file at the given path.
- * NOT USEFUL as part
- * of a unit test; this is just a utility method
- * for creating disk-based objects in CVS that can become
- * the basis for compatibility tests using
- * readExternalFormFromDisk(String path)
- *
- * @param o Object to serialize
- * @param path path to write the serialized Object
- * @exception java.io.IOException
- */
- protected void writeExternalFormToDisk(Serializable o, String path) throws IOException {
- FileOutputStream fileStream = new FileOutputStream(path);
- writeExternalFormToStream(o, fileStream);
- }
-
- /**
- * Converts a Serializable or Externalizable object to
- * bytes. Useful for in-memory tests of serialization
- *
- * @param o Object to convert to bytes
- * @return serialized form of the Object
- * @exception java.io.IOException
- */
- protected byte[] writeExternalFormToBytes(Serializable o) throws IOException {
- ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
- writeExternalFormToStream(o, byteStream);
- return byteStream.toByteArray();
- }
-
- /**
- * Reads a Serialized or Externalized Object from disk.
- * Useful for creating compatibility tests between
- * different CVS versions of the same class
- *
- * @param path path to the serialized Object
- * @return the Object at the given path
- * @exception java.io.IOException
- * @exception ClassNotFoundException
- */
- protected Object readExternalFormFromDisk(String path) throws IOException, ClassNotFoundException {
- FileInputStream stream = new FileInputStream(path);
- return readExternalFormFromStream(stream);
- }
-
- /**
- * Read a Serialized or Externalized Object from bytes.
- * Useful for verifying serialization in memory.
- *
- * @param b byte array containing a serialized Object
- * @return Object contained in the bytes
- * @exception java.io.IOException
- * @exception ClassNotFoundException
- */
- protected Object readExternalFormFromBytes(byte[] b) throws IOException, ClassNotFoundException {
- ByteArrayInputStream stream = new ByteArrayInputStream(b);
- return readExternalFormFromStream(stream);
- }
-
- // private implementation
- //-----------------------------------------------------------------------
- private Object readExternalFormFromStream(InputStream stream) throws IOException, ClassNotFoundException {
- ObjectInputStream oStream = new ObjectInputStream(stream);
- return oStream.readObject();
- }
-
- private void writeExternalFormToStream(Serializable o, OutputStream stream) throws IOException {
- ObjectOutputStream oStream = new ObjectOutputStream(stream);
- oStream.writeObject(o);
- }
-
- public static final class SanityTestTestCase extends ObjectAbstractTestCase {
- protected Object makeObject() {
- return new Cloneable() {};
- }
- }
-
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.lang;
+
+import org.junit.Test;
+
+import java.io.*;
+import java.lang.reflect.Method;
+
+import static org.junit.Assert.*;
+
+/**
+ * AbstractObjectTestCase
+ *
+ *
+ * @author Harald Kuhr
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/lang/ObjectAbstractTestCase.java#1 $
+ */
+public abstract class ObjectAbstractTest {
+ // TODO: See com.tm.util.ObjectAbstractTestCase
+ // TODO: The idea is that this should be some generic base-class that
+ // implements the basic object tests
+
+ // TODO: Create Serializable test similar way
+ // TODO: Create Comparable test similar way
+
+ /**
+ * Returns an instance of the class we are testing.
+ * Implement this method to return the object to test.
+ *
+ * @return the object to test
+ */
+ protected abstract Object makeObject();
+
+ // TODO: Can we really do serious testing with just one object?
+ // TODO: How can we make sure we create equal or different objects?!
+ //protected abstract Object makeDifferentObject(Object pObject);
+ //protected abstract Object makeEqualObject(Object pObject);
+
+
+ @Test
+ public void testToString() {
+ assertNotNull(makeObject().toString());
+ // TODO: What more can we test?
+ }
+
+ // TODO: assert that either BOTH or NONE of equals/hashcode is overridden
+ @Test
+ public void testEqualsHashCode(){
+ Object obj = makeObject();
+
+ Class cl = obj.getClass();
+ if (isEqualsOverriden(cl)) {
+ assertTrue("Class " + cl.getName() + " implements equals but not hashCode", isHashCodeOverriden(cl));
+ }
+ else if (isHashCodeOverriden(cl)) {
+ assertTrue("Class " + cl.getName() + " implements hashCode but not equals", isEqualsOverriden(cl));
+ }
+
+ }
+
+ protected static boolean isEqualsOverriden(Class pClass) {
+ return getDeclaredMethod(pClass, "equals", new Class[]{Object.class}) != null;
+ }
+
+ protected static boolean isHashCodeOverriden(Class pClass) {
+ return getDeclaredMethod(pClass, "hashCode", null) != null;
+ }
+
+ private static Method getDeclaredMethod(Class pClass, String pName, Class[] pArameters) {
+ try {
+ return pClass.getDeclaredMethod(pName, pArameters);
+ }
+ catch (NoSuchMethodException ignore) {
+ return null;
+ }
+ }
+
+ @Test
+ public void testObjectEqualsSelf() {
+ Object obj = makeObject();
+ assertEquals("An Object should equal itself", obj, obj);
+ }
+
+ @Test
+ public void testEqualsNull() {
+ Object obj = makeObject();
+ // NOTE: Makes sure this doesn't throw NPE either
+ //noinspection ObjectEqualsNull
+ assertFalse("An object should never equal null", obj.equals(null));
+ }
+
+ @Test
+ public void testObjectHashCodeEqualsSelfHashCode() {
+ Object obj = makeObject();
+ assertEquals("hashCode should be repeatable", obj.hashCode(), obj.hashCode());
+ }
+
+ @Test
+ public void testObjectHashCodeEqualsContract() {
+ Object obj1 = makeObject();
+ if (obj1.equals(obj1)) {
+ assertEquals(
+ "[1] When two objects are equal, their hashCodes should be also.",
+ obj1.hashCode(), obj1.hashCode());
+ }
+ // TODO: Make sure we create at least one equal object, and one different object
+ Object obj2 = makeObject();
+ if (obj1.equals(obj2)) {
+ assertEquals(
+ "[2] When two objects are equal, their hashCodes should be also.",
+ obj1.hashCode(), obj2.hashCode());
+ assertTrue(
+ "When obj1.equals(obj2) is true, then obj2.equals(obj1) should also be true",
+ obj2.equals(obj1));
+ }
+ }
+
+ /*
+ public void testFinalize() {
+ // TODO: Implement
+ }
+ */
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Cloneable interface
+ @Test
+ public void testClone() throws Exception {
+ Object obj = makeObject();
+ if (obj instanceof Cloneable) {
+ Class cl = obj.getClass();
+
+ Method clone = findMethod(cl, "clone");
+
+ // Disregard protected modifier
+ // NOTE: This will throw a SecurityException if a SecurityManager
+ // disallows access, but should not happen in a test context
+ if (!clone.isAccessible()) {
+ clone.setAccessible(true);
+ }
+
+ Object cloned = clone.invoke(obj);
+
+ assertNotNull("Cloned object should never be null", cloned);
+
+ // TODO: This can only be asserted if equals() test is based on
+ // value equality, not reference (identity) equality
+ // Maybe it's possible to do a reflective introspection of
+ // the objects fields?
+ if (isHashCodeOverriden(cl)) {
+ assertEquals("Cloned object not equal", obj, cloned);
+ }
+ }
+ }
+
+ private static Method findMethod(Class pClass, String pName) throws NoSuchMethodException {
+ if (pClass == null) {
+ throw new IllegalArgumentException("class == null");
+ }
+ if (pName == null) {
+ throw new IllegalArgumentException("name == null");
+ }
+
+ Class cl = pClass;
+
+ while (cl != null) {
+ try {
+ return cl.getDeclaredMethod(pName, new Class[0]);
+ }
+ catch (NoSuchMethodException e) {
+ }
+ catch (SecurityException e) {
+ }
+
+ cl = cl.getSuperclass();
+ }
+
+ throw new NoSuchMethodException(pName + " in class " + pClass.getName());
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Serializable interface
+ @Test
+ public void testSerializeDeserializeThenCompare() throws Exception {
+ Object obj = makeObject();
+ if (obj instanceof Serializable) {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(buffer);
+ try {
+ out.writeObject(obj);
+ }
+ finally {
+ out.close();
+ }
+
+ Object dest;
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
+ try {
+ dest = in.readObject();
+ }
+ finally {
+ in.close();
+ }
+
+ // TODO: This can only be asserted if equals() test is based on
+ // value equality, not reference (identity) equality
+ // Maybe it's possible to do a reflective introspection of
+ // the objects fields?
+ if (isEqualsOverriden(obj.getClass())) {
+ assertEquals("obj != deserialize(serialize(obj))", obj, dest);
+ }
+ }
+ }
+
+ /**
+ * Sanity check method, makes sure that any {@code Serializable}
+ * class can be serialized and de-serialized in memory,
+ * using the handy makeObject() method
+ *
+ * @throws java.io.IOException
+ * @throws ClassNotFoundException
+ */
+ @Test
+ public void testSimpleSerialization() throws Exception {
+ Object o = makeObject();
+ if (o instanceof Serializable) {
+ byte[] object = writeExternalFormToBytes((Serializable) o);
+ readExternalFormFromBytes(object);
+ }
+ }
+
+ /**
+ * Write a Serializable or Externalizable object as
+ * a file at the given path.
+ * NOT USEFUL as part
+ * of a unit test; this is just a utility method
+ * for creating disk-based objects in CVS that can become
+ * the basis for compatibility tests using
+ * readExternalFormFromDisk(String path)
+ *
+ * @param o Object to serialize
+ * @param path path to write the serialized Object
+ * @exception java.io.IOException
+ */
+ protected void writeExternalFormToDisk(Serializable o, String path) throws IOException {
+ FileOutputStream fileStream = new FileOutputStream(path);
+ writeExternalFormToStream(o, fileStream);
+ }
+
+ /**
+ * Converts a Serializable or Externalizable object to
+ * bytes. Useful for in-memory tests of serialization
+ *
+ * @param o Object to convert to bytes
+ * @return serialized form of the Object
+ * @exception java.io.IOException
+ */
+ protected byte[] writeExternalFormToBytes(Serializable o) throws IOException {
+ ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+ writeExternalFormToStream(o, byteStream);
+ return byteStream.toByteArray();
+ }
+
+ /**
+ * Reads a Serialized or Externalized Object from disk.
+ * Useful for creating compatibility tests between
+ * different CVS versions of the same class
+ *
+ * @param path path to the serialized Object
+ * @return the Object at the given path
+ * @exception java.io.IOException
+ * @exception ClassNotFoundException
+ */
+ protected Object readExternalFormFromDisk(String path) throws IOException, ClassNotFoundException {
+ FileInputStream stream = new FileInputStream(path);
+ return readExternalFormFromStream(stream);
+ }
+
+ /**
+ * Read a Serialized or Externalized Object from bytes.
+ * Useful for verifying serialization in memory.
+ *
+ * @param b byte array containing a serialized Object
+ * @return Object contained in the bytes
+ * @exception java.io.IOException
+ * @exception ClassNotFoundException
+ */
+ protected Object readExternalFormFromBytes(byte[] b) throws IOException, ClassNotFoundException {
+ ByteArrayInputStream stream = new ByteArrayInputStream(b);
+ return readExternalFormFromStream(stream);
+ }
+
+ // private implementation
+ //-----------------------------------------------------------------------
+ private Object readExternalFormFromStream(InputStream stream) throws IOException, ClassNotFoundException {
+ ObjectInputStream oStream = new ObjectInputStream(stream);
+ return oStream.readObject();
+ }
+
+ private void writeExternalFormToStream(Serializable o, OutputStream stream) throws IOException {
+ ObjectOutputStream oStream = new ObjectOutputStream(stream);
+ oStream.writeObject(o);
+ }
+
+ public static final class SanityTestTest extends ObjectAbstractTest {
+ protected Object makeObject() {
+ return new Cloneable() {};
+ }
+ }
+
+}
diff --git a/common/common-lang/src/test/java/com/twelvemonkeys/lang/PlatformTest.java b/common/common-lang/src/test/java/com/twelvemonkeys/lang/PlatformTest.java
index ed1aa5e7..724cef40 100644
--- a/common/common-lang/src/test/java/com/twelvemonkeys/lang/PlatformTest.java
+++ b/common/common-lang/src/test/java/com/twelvemonkeys/lang/PlatformTest.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.lang;
@@ -33,7 +35,8 @@ import org.junit.Test;
import java.util.Properties;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
/**
* PlatformTest
diff --git a/common/common-lang/src/test/java/com/twelvemonkeys/lang/StringUtilTestCase.java b/common/common-lang/src/test/java/com/twelvemonkeys/lang/StringUtilTest.java
similarity index 95%
rename from common/common-lang/src/test/java/com/twelvemonkeys/lang/StringUtilTestCase.java
rename to common/common-lang/src/test/java/com/twelvemonkeys/lang/StringUtilTest.java
index c889f559..5837ebd8 100644
--- a/common/common-lang/src/test/java/com/twelvemonkeys/lang/StringUtilTestCase.java
+++ b/common/common-lang/src/test/java/com/twelvemonkeys/lang/StringUtilTest.java
@@ -1,858 +1,947 @@
-
-package com.twelvemonkeys.lang;
-
-import junit.framework.TestCase;
-
-import java.awt.*;
-import java.util.Date;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.Locale;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.sql.Timestamp;
-
-/**
- * StringUtilTestCase
- *
- * @author Harald Kuhr
- * @author last modified by $Author: haku $
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/lang/StringUtilTestCase.java#1 $
- *
- */
-public class StringUtilTestCase extends TestCase {
- final static Object TEST_OBJECT = new Object();
- final static Integer TEST_INTEGER = 42;
- final static String TEST_STRING = "TheQuickBrownFox"; // No WS!
- final static String TEST_SUB_STRING = TEST_STRING.substring(2, 5);
- final static String TEST_DELIM_STRING = "one,two, three\n four\tfive six";
- final static String[] STRING_ARRAY = {"one", "two", "three", "four", "five", "six"};
- final static String TEST_INT_DELIM_STRING = "1,2, 3\n 4\t5 6";
- final static int[] INT_ARRAY = {1, 2, 3, 4, 5, 6};
- final static String TEST_DOUBLE_DELIM_STRING = "1.4,2.1, 3\n .4\t-5 6e5";
- final static double[] DOUBLE_ARRAY = {1.4, 2.1, 3, .4, -5, 6e5};
- final static String EMPTY_STRING = "";
- final static String WHITESPACE_STRING = " \t \r \n ";
-
- public void testValueOfObject() {
-
- assertNotNull(StringUtil.valueOf(TEST_OBJECT));
- assertEquals(StringUtil.valueOf(TEST_OBJECT), TEST_OBJECT.toString());
- assertEquals(StringUtil.valueOf(TEST_INTEGER), TEST_INTEGER.toString());
- assertEquals(StringUtil.valueOf(TEST_STRING), TEST_STRING);
- assertSame(StringUtil.valueOf(TEST_STRING), TEST_STRING);
-
- assertNull(StringUtil.valueOf(null));
- }
-
- public void testToUpperCase() {
- String str = StringUtil.toUpperCase(TEST_STRING);
- assertNotNull(str);
- assertEquals(TEST_STRING.toUpperCase(), str);
-
- str = StringUtil.toUpperCase(null);
- assertNull(str);
- }
-
- public void testToLowerCase() {
- String str = StringUtil.toLowerCase(TEST_STRING);
- assertNotNull(str);
- assertEquals(TEST_STRING.toLowerCase(), str);
-
- str = StringUtil.toLowerCase(null);
- assertNull(str);
- }
-
- public void testIsEmpty() {
- assertTrue(StringUtil.isEmpty((String) null));
- assertTrue(StringUtil.isEmpty(EMPTY_STRING));
- assertTrue(StringUtil.isEmpty(WHITESPACE_STRING));
- assertFalse(StringUtil.isEmpty(TEST_STRING));
- }
-
- public void testIsEmptyArray() {
- assertTrue(StringUtil.isEmpty((String[]) null));
- assertTrue(StringUtil.isEmpty(new String[]{EMPTY_STRING}));
- assertTrue(StringUtil.isEmpty(new String[]{EMPTY_STRING, WHITESPACE_STRING}));
- assertFalse(StringUtil.isEmpty(new String[]{EMPTY_STRING, TEST_STRING}));
- assertFalse(StringUtil.isEmpty(new String[]{WHITESPACE_STRING, TEST_STRING}));
- }
-
- public void testContains() {
- assertTrue(StringUtil.contains(TEST_STRING, TEST_STRING));
- assertTrue(StringUtil.contains(TEST_STRING, TEST_SUB_STRING));
- assertTrue(StringUtil.contains(TEST_STRING, EMPTY_STRING));
- assertFalse(StringUtil.contains(TEST_STRING, WHITESPACE_STRING));
- assertFalse(StringUtil.contains(TEST_SUB_STRING, TEST_STRING));
- assertFalse(StringUtil.contains(EMPTY_STRING, TEST_STRING));
- assertFalse(StringUtil.contains(WHITESPACE_STRING, TEST_STRING));
- assertFalse(StringUtil.contains(null, TEST_STRING));
- assertFalse(StringUtil.contains(null, null));
- }
-
- public void testContainsIgnoreCase() {
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_STRING));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase()));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_SUB_STRING));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase()));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, EMPTY_STRING));
- assertFalse(StringUtil.containsIgnoreCase(TEST_STRING, WHITESPACE_STRING));
- assertFalse(StringUtil.containsIgnoreCase(TEST_SUB_STRING, TEST_STRING));
- assertFalse(StringUtil.containsIgnoreCase(EMPTY_STRING, TEST_STRING));
- assertFalse(StringUtil.containsIgnoreCase(WHITESPACE_STRING, TEST_STRING));
- assertFalse(StringUtil.containsIgnoreCase(null, TEST_STRING));
- assertFalse(StringUtil.containsIgnoreCase(null, null));
- }
-
- public void testContainsChar() {
- for (int i = 0; i < TEST_STRING.length(); i++) {
- assertTrue(StringUtil.contains(TEST_STRING, TEST_STRING.charAt(i)));
- assertFalse(StringUtil.contains(EMPTY_STRING, TEST_STRING.charAt(i)));
- assertFalse(StringUtil.contains(WHITESPACE_STRING, TEST_STRING.charAt(i)));
- assertFalse(StringUtil.contains(null, TEST_STRING.charAt(i)));
- }
- for (int i = 0; i < TEST_SUB_STRING.length(); i++) {
- assertTrue(StringUtil.contains(TEST_STRING, TEST_SUB_STRING.charAt(i)));
- }
- for (int i = 0; i < WHITESPACE_STRING.length(); i++) {
- assertFalse(StringUtil.contains(TEST_STRING, WHITESPACE_STRING.charAt(i)));
- }
-
- // Test all alpha-chars
- for (int i = 'a'; i < 'z'; i++) {
- if (TEST_STRING.indexOf(i) < 0) {
- assertFalse(TEST_STRING + " seems to contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), StringUtil.contains(TEST_STRING, i));
- }
- else {
- assertTrue(TEST_STRING + " seems to not contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), StringUtil.contains(TEST_STRING, i));
- }
- }
- }
-
- public void testContainsIgnoreCaseChar() {
- // Must contain all chars in string
- for (int i = 0; i < TEST_STRING.length(); i++) {
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_STRING.charAt(i)));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.charAt(i)));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.charAt(i)));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, Character.toUpperCase(TEST_STRING.charAt(i))));
- assertFalse(StringUtil.containsIgnoreCase(EMPTY_STRING, TEST_STRING.charAt(i)));
- assertFalse(StringUtil.containsIgnoreCase(WHITESPACE_STRING, TEST_STRING.charAt(i)));
- assertFalse(StringUtil.containsIgnoreCase(null, TEST_STRING.charAt(i)));
- }
- for (int i = 0; i < TEST_SUB_STRING.length(); i++) {
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_SUB_STRING.charAt(i)));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING.charAt(i)));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING.charAt(i)));
- assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase().charAt(i)));
- }
-
- for (int i = 0; i < WHITESPACE_STRING.length(); i++) {
- assertFalse(StringUtil.containsIgnoreCase(TEST_STRING, WHITESPACE_STRING.charAt(i)));
- }
-
- // Test all alpha-chars
- for (int i = 'a'; i < 'z'; i++) {
- if ((TEST_STRING.indexOf(i) < 0) && (TEST_STRING.indexOf(Character.toUpperCase((char) i)) < 0)) {
- assertFalse(TEST_STRING + " seems to contain '" + (char) i + "', at index " + Math.max(TEST_STRING.indexOf(i), TEST_STRING.indexOf(Character.toUpperCase((char) i))), StringUtil.containsIgnoreCase(TEST_STRING, i));
- }
- else {
- assertTrue(TEST_STRING + " seems to not contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), StringUtil.containsIgnoreCase(TEST_STRING, i));
- }
- }
- }
-
- public void testIndexOfIgnoreCase() {
- assertEquals(0, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING));
- assertEquals(0, StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING));
- assertEquals(0, StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING));
- assertEquals(0, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase()));
- assertEquals(0, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase()));
-
- for (int i = 1; i < TEST_STRING.length(); i++) {
- assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.substring(i)));
- assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.substring(i)));
- assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.substring(i)));
- assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase().substring(i)));
- assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase().substring(i)));
- }
-
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase()));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toLowerCase()));
-
- for (int i = 1; i < TEST_STRING.length(); i++) {
- assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING.substring(i), TEST_STRING));
- assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING.substring(i), TEST_STRING));
- }
-
- assertEquals(-1, StringUtil.indexOfIgnoreCase(null, TEST_STRING));
- assertEquals(-1, StringUtil.indexOfIgnoreCase(null, null));
- }
-
- public void testIndexOfIgnoreCasePos() {
- assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING, 1));
- assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING, 2));
- assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING, 3));
- assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase(), 4));
- assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase(), 5));
-
- for (int i = 1; i < TEST_STRING.length(); i++) {
- assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.substring(i), i - 1));
- assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.substring(i), i - 1));
- assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.substring(i), i - 1));
- assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase().substring(i), i - 1));
- assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase().substring(i), i - 1));
- }
-
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING, 1));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING, 1));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING, 2));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase(), 1));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toLowerCase(), 2));
-
- assertEquals(-1, StringUtil.indexOfIgnoreCase(null, TEST_STRING, 234));
- assertEquals(-1, StringUtil.indexOfIgnoreCase(null, null, -45));
- }
-
- public void testLastIndexOfIgnoreCase() {
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING));
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING));
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING));
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase()));
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase()));
-
- for (int i = 1; i < TEST_STRING.length(); i++) {
- assertEquals(i, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.substring(i)));
- assertEquals(i, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.substring(i)));
- assertEquals(i, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.substring(i)));
- assertEquals(i, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase().substring(i)));
- assertEquals(i, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase().substring(i)));
- }
-
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase()));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toLowerCase()));
-
- for (int i = 1; i < TEST_STRING.length(); i++) {
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.substring(i), TEST_STRING));
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.substring(i), TEST_STRING));
- }
-
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(null, TEST_STRING));
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(null, null));
-
- }
-
- public void testLastIndexOfIgnoreCasePos() {
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING, 1));
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING, 2));
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING, 3));
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase(), 4));
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase(), 5));
-
- for (int i = 1; i < TEST_STRING.length(); i++) {
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.substring(0, i), i - 1));
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.substring(0, i), i - 1));
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.substring(0, i), i - 1));
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase().substring(0, i), i - 1));
- assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase().substring(0, i), i - 1));
- }
-
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING, TEST_SUB_STRING.length() + 3));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING, TEST_SUB_STRING.length() + 3));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING, TEST_SUB_STRING.length() + 4));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase(), TEST_SUB_STRING.length() + 3));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toLowerCase(), TEST_SUB_STRING.length() + 4));
-
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(null, TEST_STRING, 234));
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(null, null, -45));
-
- }
-
- public void testIndexOfIgnoreCaseChar() {
- // Must contain all chars in string
- for (int i = 0; i < TEST_STRING.length(); i++) {
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.charAt(i)));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.charAt(i)));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.charAt(i)));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, Character.toUpperCase(TEST_STRING.charAt(i))));
- assertEquals(-1, StringUtil.indexOfIgnoreCase(EMPTY_STRING, TEST_STRING.charAt(i)));
- assertEquals(-1, StringUtil.indexOfIgnoreCase(WHITESPACE_STRING, TEST_STRING.charAt(i)));
- assertEquals(-1, StringUtil.indexOfIgnoreCase(null, TEST_STRING.charAt(i)));
- }
-
- for (int i = 0; i < TEST_SUB_STRING.length(); i++) {
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.charAt(i)));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING.charAt(i)));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING.charAt(i)));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase().charAt(i)));
- }
-
- for (int i = 0; i < WHITESPACE_STRING.length(); i++) {
- assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING, WHITESPACE_STRING.charAt(i)));
- }
-
- // Test all alpha-chars
- for (int i = 'a'; i < 'z'; i++) {
- if ((TEST_STRING.indexOf(i) < 0) && (TEST_STRING.indexOf(Character.toUpperCase((char) i)) < 0)) {
- assertEquals(TEST_STRING + " seems to contain '" + (char) i + "', at index " + Math.max(TEST_STRING.indexOf(i), TEST_STRING.indexOf(Character.toUpperCase((char) i))), -1, StringUtil.indexOfIgnoreCase(TEST_STRING, i));
- }
- else {
- assertTrue(TEST_STRING + " seems to not contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), 0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, i));
- }
- }
- }
-
- public void testIndexOfIgnoreCaseCharPos() {
- // Must contain all chars in string
- for (int i = 0; i < TEST_STRING.length(); i++) {
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.charAt(i), i));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.charAt(i), i));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.charAt(i), i));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, Character.toUpperCase(TEST_STRING.charAt(i)), i));
- assertEquals(-1, StringUtil.indexOfIgnoreCase(EMPTY_STRING, TEST_STRING.charAt(i), i));
- assertEquals(-1, StringUtil.indexOfIgnoreCase(WHITESPACE_STRING, TEST_STRING.charAt(i), i));
- assertEquals(-1, StringUtil.indexOfIgnoreCase(null, TEST_STRING.charAt(i), i));
- }
-
- for (int i = 0; i < TEST_SUB_STRING.length(); i++) {
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.charAt(i), i));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING.charAt(i), i));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING.charAt(i), i));
- assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase().charAt(i), i));
- }
-
- for (int i = 0; i < WHITESPACE_STRING.length(); i++) {
- assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING, WHITESPACE_STRING.charAt(i), i));
- }
-
- // Test all alpha-chars
- for (int i = 'a'; i < 'z'; i++) {
- if ((TEST_STRING.indexOf(i) < 0) && (TEST_STRING.indexOf(Character.toUpperCase((char) i)) < 0)) {
- assertEquals(TEST_STRING + " seems to contain '" + (char) i + "', at index " + Math.max(TEST_STRING.indexOf(i), TEST_STRING.indexOf(Character.toUpperCase((char) i))), -1, StringUtil.indexOfIgnoreCase(TEST_STRING, i, 0));
- }
- else {
- assertTrue(TEST_STRING + " seems to not contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), 0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, i, 0));
- }
- }
- }
-
- public void testLastIndexOfIgnoreCaseChar() {
- // Must contain all chars in string
- for (int i = 0; i < TEST_STRING.length(); i++) {
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.charAt(i)));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.charAt(i)));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.charAt(i)));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, Character.toUpperCase(TEST_STRING.charAt(i))));
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(EMPTY_STRING, TEST_STRING.charAt(i)));
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(WHITESPACE_STRING, TEST_STRING.charAt(i)));
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(null, TEST_STRING.charAt(i)));
- }
-
- for (int i = 0; i < TEST_SUB_STRING.length(); i++) {
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.charAt(i)));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING.charAt(i)));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING.charAt(i)));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase().charAt(i)));
- }
-
- for (int i = 0; i < WHITESPACE_STRING.length(); i++) {
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, WHITESPACE_STRING.charAt(i)));
- }
-
- // Test all alpha-chars
- for (int i = 'a'; i < 'z'; i++) {
- if ((TEST_STRING.indexOf(i) < 0) && (TEST_STRING.indexOf(Character.toUpperCase((char) i)) < 0)) {
- assertEquals(TEST_STRING + " seems to contain '" + (char) i + "', at index " + Math.max(TEST_STRING.indexOf(i), TEST_STRING.indexOf(Character.toUpperCase((char) i))), -1, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, i));
- }
- else {
- assertTrue(TEST_STRING + " seems to not contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), 0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, i));
- }
- }
- }
-
- public void testLastIndexOfIgnoreCaseCharPos() {
- // Must contain all chars in string
- for (int i = 0; i < TEST_STRING.length(); i++) {
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.charAt(i), i));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.charAt(i), i));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.charAt(i), i));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, Character.toUpperCase(TEST_STRING.charAt(i)), i));
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(EMPTY_STRING, TEST_STRING.charAt(i), i));
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(WHITESPACE_STRING, TEST_STRING.charAt(i), i));
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(null, TEST_STRING.charAt(i), i));
- }
-
- for (int i = 0; i < TEST_SUB_STRING.length(); i++) {
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.charAt(i), TEST_STRING.length()));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING.charAt(i), TEST_STRING.length()));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING.charAt(i), TEST_STRING.length()));
- assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase().charAt(i), TEST_STRING.length()));
- }
-
- for (int i = 0; i < WHITESPACE_STRING.length(); i++) {
- assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, WHITESPACE_STRING.charAt(i), TEST_STRING.length()));
- }
-
- // Test all alpha-chars
- for (int i = 'a'; i < 'z'; i++) {
- if ((TEST_STRING.indexOf(i) < 0) && (TEST_STRING.indexOf(Character.toUpperCase((char) i)) < 0)) {
- assertEquals(TEST_STRING + " seems to contain '" + (char) i + "', at index " + Math.max(TEST_STRING.indexOf(i), TEST_STRING.indexOf(Character.toUpperCase((char) i))), -1, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, i, TEST_STRING.length()));
- }
- else {
- assertTrue(TEST_STRING + " seems to not contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), 0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, i, TEST_STRING.length()));
- }
- }
- }
-
- public void testLtrim() {
- assertEquals(TEST_STRING, StringUtil.ltrim(TEST_STRING));
- assertEquals(TEST_STRING, StringUtil.ltrim(" " + TEST_STRING));
- assertEquals(TEST_STRING, StringUtil.ltrim(WHITESPACE_STRING + TEST_STRING));
- assertFalse(TEST_STRING.equals(StringUtil.ltrim(TEST_STRING + WHITESPACE_STRING)));
- // TODO: Test is not complete
- }
-
- public void testRtrim() {
- assertEquals(TEST_STRING, StringUtil.rtrim(TEST_STRING));
- assertEquals(TEST_STRING, StringUtil.rtrim(TEST_STRING + " "));
- assertEquals(TEST_STRING, StringUtil.rtrim(TEST_STRING + WHITESPACE_STRING));
- assertFalse(TEST_STRING.equals(StringUtil.rtrim(WHITESPACE_STRING + TEST_STRING)));
- // TODO: Test is not complete
- }
-
- public void testReplace() {
- assertEquals("", StringUtil.replace(TEST_STRING, TEST_STRING, ""));
- assertEquals("", StringUtil.replace("", "", ""));
- assertEquals("", StringUtil.replace("", "xyzzy", "xyzzy"));
- assertEquals(TEST_STRING, StringUtil.replace(TEST_STRING, "", "xyzzy"));
- assertEquals("aabbdd", StringUtil.replace("aabbccdd", "c", ""));
- assertEquals("aabbccdd", StringUtil.replace("aabbdd", "bd", "bccd"));
- // TODO: Test is not complete
- }
-
- public void testReplaceIgnoreCase() {
- assertEquals("", StringUtil.replaceIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase(), ""));
- assertEquals("", StringUtil.replaceIgnoreCase("", "", ""));
- assertEquals("", StringUtil.replaceIgnoreCase("", "xyzzy", "xyzzy"));
- assertEquals(TEST_STRING, StringUtil.replaceIgnoreCase(TEST_STRING, "", "xyzzy"));
- assertEquals("aabbdd", StringUtil.replaceIgnoreCase("aabbCCdd", "c", ""));
- assertEquals("aabbdd", StringUtil.replaceIgnoreCase("aabbccdd", "C", ""));
- assertEquals("aabbccdd", StringUtil.replaceIgnoreCase("aabbdd", "BD", "bccd"));
- assertEquals("aabbccdd", StringUtil.replaceIgnoreCase("aabBDd", "bd", "bccd"));
- // TODO: Test is not complete
- }
-
- public void testCut() {
- assertEquals(TEST_STRING, StringUtil.cut(TEST_STRING, TEST_STRING.length(), ".."));
- assertEquals("This is a test..", StringUtil.cut("This is a test of how this works", 16, ".."));
- assertEquals("This is a test", StringUtil.cut("This is a test of how this works", 16, null));
- assertEquals("This is a test", StringUtil.cut("This is a test of how this works", 16, ""));
- // TODO: Test is not complete
- }
-
- public void testCaptialize() {
- assertNull(StringUtil.capitalize(null));
- assertEquals(TEST_STRING.toUpperCase(), StringUtil.capitalize(TEST_STRING.toUpperCase()));
- assertTrue(StringUtil.capitalize("abc").charAt(0) == 'A');
- }
-
- public void testCaptializePos() {
- assertNull(StringUtil.capitalize(null, 45));
-
- // TODO: Should this throw IllegalArgument or StringIndexOutOfBonds?
- assertEquals(TEST_STRING, StringUtil.capitalize(TEST_STRING, TEST_STRING.length() + 45));
-
- for (int i = 0; i < TEST_STRING.length(); i++) {
- assertTrue(Character.isUpperCase(StringUtil.capitalize(TEST_STRING, i).charAt(i)));
- }
- }
-
- public void testPad() {
- assertEquals(TEST_STRING + "...", StringUtil.pad(TEST_STRING, TEST_STRING.length() + 3, "..", false));
- assertEquals(TEST_STRING, StringUtil.pad(TEST_STRING, 4, ".", false));
- assertEquals(TEST_STRING, StringUtil.pad(TEST_STRING, 4, ".", true));
- assertEquals("..." + TEST_STRING, StringUtil.pad(TEST_STRING, TEST_STRING.length() + 3, "..", true));
- }
-
- public void testToDate() {
- long time = System.currentTimeMillis();
- Date now = new Date(time - time % 60000); // Default format seems to have no seconds..
- Date date = StringUtil.toDate(DateFormat.getInstance().format(now));
- assertNotNull(date);
- assertEquals(now, date);
- }
-
- public void testToDateWithFormatString() {
- Calendar cal = new GregorianCalendar();
- cal.clear();
- cal.set(1976, 2, 16); // Month is 0-based
- Date date = StringUtil.toDate("16.03.1976", "dd.MM.yyyy");
- assertNotNull(date);
- assertEquals(cal.getTime(), date);
-
- cal.clear();
- cal.set(2004, 4, 13, 23, 51, 3);
- date = StringUtil.toDate("2004-5-13 23:51 (03)", "yyyy-MM-dd hh:mm (ss)");
- assertNotNull(date);
- assertEquals(cal.getTime(), date);
-
- cal.clear();
- cal.set(Calendar.HOUR, 1);
- cal.set(Calendar.MINUTE, 2);
- cal.set(Calendar.SECOND, 3);
- date = StringUtil.toDate("123", "hms");
- assertNotNull(date);
- assertEquals(cal.getTime(), date);
- }
-
- public void testToDateWithFormat() {
- Calendar cal = new GregorianCalendar();
- cal.clear();
- cal.set(1976, 2, 16); // Month is 0-based
- Date date = StringUtil.toDate("16.03.1976", new SimpleDateFormat("dd.MM.yyyy"));
- assertNotNull(date);
- assertEquals(cal.getTime(), date);
-
- cal.clear();
- cal.set(2004, 4, 13, 23, 51);
- date = StringUtil.toDate("13.5.04 23:51",
- DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, new Locale("no", "NO")));
- assertNotNull(date);
- assertEquals(cal.getTime(), date);
-
- cal.clear();
- cal.set(Calendar.HOUR, 1);
- cal.set(Calendar.MINUTE, 2);
- date = StringUtil.toDate("1:02 am",
- DateFormat.getTimeInstance(DateFormat.SHORT, Locale.US));
- assertNotNull(date);
- assertEquals(cal.getTime(), date);
- }
-
- public void testToTimestamp() {
- Calendar cal = new GregorianCalendar();
- cal.clear();
- cal.set(1976, 2, 16, 21, 28, 4); // Month is 0-based
- Date date = StringUtil.toTimestamp("1976-03-16 21:28:04");
- assertNotNull(date);
- assertTrue(date instanceof Timestamp);
- assertEquals(cal.getTime(), date);
- }
-
- public void testToStringArray() {
- String[] arr = StringUtil.toStringArray(TEST_DELIM_STRING);
- assertNotNull(arr);
- assertEquals(STRING_ARRAY.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(STRING_ARRAY[i], arr[i]);
- }
- }
-
- public void testToStringArrayDelim() {
- String[] arr = StringUtil.toStringArray("-1---2-3--4-5", "---");
- String[] arr2 = {"1", "2", "3", "4", "5"};
- assertNotNull(arr);
- assertEquals(arr2.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(arr2[i], arr[i]);
- }
-
- arr = StringUtil.toStringArray("1, 2, 3; 4 5", ",; ");
- assertNotNull(arr);
- assertEquals(arr2.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(arr2[i], arr[i]);
- }
- }
-
- public void testToIntArray() {
- int[] arr = StringUtil.toIntArray(TEST_INT_DELIM_STRING);
- assertNotNull(arr);
- assertEquals(INT_ARRAY.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(INT_ARRAY[i], arr[i]);
- }
- }
-
- public void testToIntArrayDelim() {
- int[] arr = StringUtil.toIntArray("-1---2-3--4-5", "---");
- int[] arr2 = {1, 2, 3, 4, 5};
- assertNotNull(arr);
- assertEquals(arr2.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(arr2[i], arr[i]);
- }
-
- arr = StringUtil.toIntArray("1, 2, 3; 4 5", ",; ");
- assertNotNull(arr);
- assertEquals(arr2.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(arr2[i], arr[i]);
- }
- }
-
- public void testToIntArrayDelimBase() {
- int[] arr = StringUtil.toIntArray("-1___2_3__F_a", "___", 16);
- int[] arr2 = {-1, 2, 3, 0xf, 0xa};
- assertNotNull(arr);
- assertEquals(arr2.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(arr2[i], arr[i]);
- }
-
- arr = StringUtil.toIntArray("-1, 2, 3; 17 12", ",; ", 8);
- assertNotNull(arr);
- assertEquals(arr2.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(arr2[i], arr[i]);
- }
- }
-
- public void testToLongArray() {
- long[] arr = StringUtil.toLongArray(TEST_INT_DELIM_STRING);
- assertNotNull(arr);
- assertEquals(INT_ARRAY.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(INT_ARRAY[i], arr[i]);
- }
- }
-
- public void testToLongArrayDelim() {
- long[] arr = StringUtil.toLongArray("-12854928752983___2_3__4_5", "___");
- long[] arr2 = {-12854928752983L, 2, 3, 4, 5};
- assertNotNull(arr);
- assertEquals(arr2.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(arr2[i], arr[i]);
- }
-
- arr = StringUtil.toLongArray("-12854928752983, 2, 3; 4 5", ",; ");
- assertNotNull(arr);
- assertEquals(arr2.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(arr2[i], arr[i]);
- }
- }
-
- public void testToDoubleArray() {
- double[] arr = StringUtil.toDoubleArray(TEST_DOUBLE_DELIM_STRING);
- assertNotNull(arr);
- assertEquals(DOUBLE_ARRAY.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(DOUBLE_ARRAY[i], arr[i], 0d);
- }
- }
-
- public void testToDoubleArrayDelim() {
- double[] arr = StringUtil.toDoubleArray("-12854928752983___.2_3__4_5e4", "___");
- double[] arr2 = {-12854928752983L, .2, 3, 4, 5e4};
- assertNotNull(arr);
- assertEquals(arr2.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(arr2[i], arr[i], 0d);
- }
-
- arr = StringUtil.toDoubleArray("-12854928752983, .2, 3; 4 5E4", ",; ");
- assertNotNull(arr);
- assertEquals(arr2.length, arr.length);
- for (int i = 0; i < arr.length; i++) {
- assertEquals(arr2[i], arr[i], 0d);
- }
- }
-
- public void testTestToColor() {
- // Test all constants
- assertEquals(Color.black, StringUtil.toColor("black"));
- assertEquals(Color.black, StringUtil.toColor("BLACK"));
- assertEquals(Color.blue, StringUtil.toColor("blue"));
- assertEquals(Color.blue, StringUtil.toColor("BLUE"));
- assertEquals(Color.cyan, StringUtil.toColor("cyan"));
- assertEquals(Color.cyan, StringUtil.toColor("CYAN"));
- assertEquals(Color.darkGray, StringUtil.toColor("darkGray"));
- assertEquals(Color.darkGray, StringUtil.toColor("DARK_GRAY"));
- assertEquals(Color.gray, StringUtil.toColor("gray"));
- assertEquals(Color.gray, StringUtil.toColor("GRAY"));
- assertEquals(Color.green, StringUtil.toColor("green"));
- assertEquals(Color.green, StringUtil.toColor("GREEN"));
- assertEquals(Color.lightGray, StringUtil.toColor("lightGray"));
- assertEquals(Color.lightGray, StringUtil.toColor("LIGHT_GRAY"));
- assertEquals(Color.magenta, StringUtil.toColor("magenta"));
- assertEquals(Color.magenta, StringUtil.toColor("MAGENTA"));
- assertEquals(Color.orange, StringUtil.toColor("orange"));
- assertEquals(Color.orange, StringUtil.toColor("ORANGE"));
- assertEquals(Color.pink, StringUtil.toColor("pink"));
- assertEquals(Color.pink, StringUtil.toColor("PINK"));
- assertEquals(Color.red, StringUtil.toColor("red"));
- assertEquals(Color.red, StringUtil.toColor("RED"));
- assertEquals(Color.white, StringUtil.toColor("white"));
- assertEquals(Color.white, StringUtil.toColor("WHITE"));
- assertEquals(Color.yellow, StringUtil.toColor("yellow"));
- assertEquals(Color.yellow, StringUtil.toColor("YELLOW"));
-
-// System.out.println(StringUtil.deepToString(Color.yellow));
-// System.out.println(StringUtil.deepToString(Color.pink, true, -1));
-
- // Test HTML/CSS style color
- for (int i = 0; i < 256; i++) {
- int c = i;
- if (i < 0x10) {
- c = i * 16;
- }
- String colorStr = "#" + Integer.toHexString(i) + Integer.toHexString(i) + Integer.toHexString(i);
- String colorStrAlpha = "#" + Integer.toHexString(i) + Integer.toHexString(i) + Integer.toHexString(i) + Integer.toHexString(i);
- assertEquals(new Color(c, c, c), StringUtil.toColor(colorStr));
- assertEquals(new Color(c, c, c, c), StringUtil.toColor(colorStrAlpha));
-
- }
-
- // Test null
- // TODO: Hmmm.. Maybe reconsider this..
- assertNull(StringUtil.toColor(null));
-
- // Test
- try {
- StringUtil.toColor("illegal-color-value");
- fail("toColor with illegal color value should throw IllegalArgumentException.");
- }
- catch (IllegalArgumentException e) {
- assertNotNull(e.getMessage());
- }
- }
-
- public void testToColorString() {
- assertEquals("#ff0000", StringUtil.toColorString(Color.red));
- assertEquals("#00ff00", StringUtil.toColorString(Color.green));
- assertEquals("#0000ff", StringUtil.toColorString(Color.blue));
- assertEquals("#101010", StringUtil.toColorString(new Color(0x10, 0x10, 0x10)));
-
- for (int i = 0; i < 256; i++) {
- String str = (i < 0x10 ? "0" : "") + Integer.toHexString(i);
- assertEquals("#" + str + str + str, StringUtil.toColorString(new Color(i, i, i)));
- }
-
- // Test null
- // TODO: Hmmm.. Maybe reconsider this..
- assertNull(StringUtil.toColorString(null));
- }
-
- public void testIsNumber() {
- assertTrue(StringUtil.isNumber("0"));
- assertTrue(StringUtil.isNumber("12345"));
- assertTrue(StringUtil.isNumber(TEST_INTEGER.toString()));
- assertTrue(StringUtil.isNumber("1234567890123456789012345678901234567890"));
- assertTrue(StringUtil.isNumber(String.valueOf(Long.MAX_VALUE) + String.valueOf(Long.MAX_VALUE)));
- assertFalse(StringUtil.isNumber("abc"));
- assertFalse(StringUtil.isNumber(TEST_STRING));
- }
-
- public void testIsNumberNegative() {
- assertTrue(StringUtil.isNumber("-12345"));
- assertTrue(StringUtil.isNumber('-' + TEST_INTEGER.toString()));
- assertTrue(StringUtil.isNumber("-1234567890123456789012345678901234567890"));
- assertTrue(StringUtil.isNumber('-' + String.valueOf(Long.MAX_VALUE) + String.valueOf(Long.MAX_VALUE)));
- assertFalse(StringUtil.isNumber("-abc"));
- assertFalse(StringUtil.isNumber('-' + TEST_STRING));
- }
-
- public void testCamelToLispNull() {
- try {
- StringUtil.camelToLisp(null);
- fail("should not accept null");
- }
- catch (IllegalArgumentException iae) {
- assertNotNull(iae.getMessage());
- }
- }
- public void testCamelToLispNoConversion() {
- assertEquals("", StringUtil.camelToLisp(""));
- assertEquals("equal", StringUtil.camelToLisp("equal"));
- assertEquals("allready-lisp", StringUtil.camelToLisp("allready-lisp"));
- }
-
- public void testCamelToLispSimple() {
- // Simple tests
- assertEquals("foo-bar", StringUtil.camelToLisp("fooBar"));
- }
-
- public void testCamelToLispCase() {
- // Casing
- assertEquals("my-url", StringUtil.camelToLisp("myURL"));
- assertEquals("another-url", StringUtil.camelToLisp("AnotherURL"));
- }
-
- public void testCamelToLispMulti() {
- // Several words
- assertEquals("http-request-wrapper", StringUtil.camelToLisp("HttpRequestWrapper"));
- String s = StringUtil.camelToLisp("HttpURLConnection");
- assertEquals("http-url-connection", s);
- // Long and short abbre in upper case
- assertEquals("welcome-to-my-world", StringUtil.camelToLisp("WELCOMEToMYWorld"));
- }
-
- public void testCamelToLispLeaveUntouched() {
- // Leave others untouched
- assertEquals("a-slightly-longer-and-more-bumpy-string?.,[]()", StringUtil.camelToLisp("ASlightlyLongerANDMoreBumpyString?.,[]()"));
- }
- public void testCamelToLispNumbers() {
- // Numbers
- // TODO: FixMe
- String s = StringUtil.camelToLisp("my45Caliber");
- assertEquals("my-45-caliber", s);
- assertEquals("hello-12345-world-67890", StringUtil.camelToLisp("Hello12345world67890"));
- assertEquals("hello-12345-my-world-67890-this-time", StringUtil.camelToLisp("HELLO12345MyWorld67890thisTime"));
- assertEquals("hello-12345-world-67890-too", StringUtil.camelToLisp("Hello12345WORLD67890too"));
- }
-
- public void testLispToCamelNull() {
- try {
- StringUtil.lispToCamel(null);
- fail("should not accept null");
- }
- catch (IllegalArgumentException iae) {
- assertNotNull(iae.getMessage());
- }
- }
- public void testLispToCamelNoConversion() {
- assertEquals("", StringUtil.lispToCamel(""));
- assertEquals("equal", StringUtil.lispToCamel("equal"));
- assertEquals("allreadyCamel", StringUtil.lispToCamel("allreadyCamel"));
- }
-
- public void testLispToCamelSimple() {
- // Simple tests
- assertEquals("fooBar", StringUtil.lispToCamel("foo-bar"));
- assertEquals("myUrl", StringUtil.lispToCamel("my-URL"));
- assertEquals("anotherUrl", StringUtil.lispToCamel("ANOTHER-URL"));
- }
-
- public void testLispToCamelCase() {
- // Casing
- assertEquals("Object", StringUtil.lispToCamel("object", true));
- assertEquals("object", StringUtil.lispToCamel("Object", false));
- }
-
- public void testLispToCamelMulti() {
- // Several words
- assertEquals("HttpRequestWrapper", StringUtil.lispToCamel("http-request-wrapper", true));
- }
-
- public void testLispToCamelLeaveUntouched() {
- // Leave others untouched
- assertEquals("ASlightlyLongerAndMoreBumpyString?.,[]()", StringUtil.lispToCamel("a-slightly-longer-and-more-bumpy-string?.,[]()", true));
- }
-
- public void testLispToCamelNumber() {
- // Numbers
- assertEquals("my45Caliber", StringUtil.lispToCamel("my-45-caliber"));
- }
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.lang;
+
+import org.junit.Test;
+
+import java.awt.*;
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+
+import static org.junit.Assert.*;
+
+/**
+ * StringUtilTestCase
+ *
+ * @author Harald Kuhr
+ * @author last modified by $Author: haku $
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/lang/StringUtilTestCase.java#1 $
+ *
+ */
+public class StringUtilTest {
+ final static Object TEST_OBJECT = new Object();
+ final static Integer TEST_INTEGER = 42;
+ final static String TEST_STRING = "TheQuickBrownFox"; // No WS!
+ final static String TEST_SUB_STRING = TEST_STRING.substring(2, 5);
+ final static String TEST_DELIM_STRING = "one,two, three\n four\tfive six";
+ final static String[] STRING_ARRAY = {"one", "two", "three", "four", "five", "six"};
+ final static String TEST_INT_DELIM_STRING = "1,2, 3\n 4\t5 6";
+ final static int[] INT_ARRAY = {1, 2, 3, 4, 5, 6};
+ final static String TEST_DOUBLE_DELIM_STRING = "1.4,2.1, 3\n .4\t-5 6e5";
+ final static double[] DOUBLE_ARRAY = {1.4, 2.1, 3, .4, -5, 6e5};
+ final static String EMPTY_STRING = "";
+ final static String WHITESPACE_STRING = " \t \r \n ";
+
+ @Test
+ public void testValueOfObject() {
+ assertNotNull(StringUtil.valueOf(TEST_OBJECT));
+ assertEquals(StringUtil.valueOf(TEST_OBJECT), TEST_OBJECT.toString());
+ assertEquals(StringUtil.valueOf(TEST_INTEGER), TEST_INTEGER.toString());
+ assertEquals(StringUtil.valueOf(TEST_STRING), TEST_STRING);
+ assertSame(StringUtil.valueOf(TEST_STRING), TEST_STRING);
+
+ assertNull(StringUtil.valueOf(null));
+ }
+
+ @Test
+ public void testToUpperCase() {
+ String str = StringUtil.toUpperCase(TEST_STRING);
+ assertNotNull(str);
+ assertEquals(TEST_STRING.toUpperCase(), str);
+
+ str = StringUtil.toUpperCase(null);
+ assertNull(str);
+ }
+
+ @Test
+ public void testToLowerCase() {
+ String str = StringUtil.toLowerCase(TEST_STRING);
+ assertNotNull(str);
+ assertEquals(TEST_STRING.toLowerCase(), str);
+
+ str = StringUtil.toLowerCase(null);
+ assertNull(str);
+ }
+
+ @Test
+ public void testIsEmpty() {
+ assertTrue(StringUtil.isEmpty((String) null));
+ assertTrue(StringUtil.isEmpty(EMPTY_STRING));
+ assertTrue(StringUtil.isEmpty(WHITESPACE_STRING));
+ assertFalse(StringUtil.isEmpty(TEST_STRING));
+ }
+
+ @Test
+ public void testIsEmptyArray() {
+ assertTrue(StringUtil.isEmpty((String[]) null));
+ assertTrue(StringUtil.isEmpty(new String[]{EMPTY_STRING}));
+ assertTrue(StringUtil.isEmpty(new String[]{EMPTY_STRING, WHITESPACE_STRING}));
+ assertFalse(StringUtil.isEmpty(new String[]{EMPTY_STRING, TEST_STRING}));
+ assertFalse(StringUtil.isEmpty(new String[]{WHITESPACE_STRING, TEST_STRING}));
+ }
+
+ @Test
+ public void testContains() {
+ assertTrue(StringUtil.contains(TEST_STRING, TEST_STRING));
+ assertTrue(StringUtil.contains(TEST_STRING, TEST_SUB_STRING));
+ assertTrue(StringUtil.contains(TEST_STRING, EMPTY_STRING));
+ assertFalse(StringUtil.contains(TEST_STRING, WHITESPACE_STRING));
+ assertFalse(StringUtil.contains(TEST_SUB_STRING, TEST_STRING));
+ assertFalse(StringUtil.contains(EMPTY_STRING, TEST_STRING));
+ assertFalse(StringUtil.contains(WHITESPACE_STRING, TEST_STRING));
+ assertFalse(StringUtil.contains(null, TEST_STRING));
+ assertFalse(StringUtil.contains(null, null));
+ }
+
+ @Test
+ public void testContainsIgnoreCase() {
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_STRING));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase()));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_SUB_STRING));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase()));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, EMPTY_STRING));
+ assertFalse(StringUtil.containsIgnoreCase(TEST_STRING, WHITESPACE_STRING));
+ assertFalse(StringUtil.containsIgnoreCase(TEST_SUB_STRING, TEST_STRING));
+ assertFalse(StringUtil.containsIgnoreCase(EMPTY_STRING, TEST_STRING));
+ assertFalse(StringUtil.containsIgnoreCase(WHITESPACE_STRING, TEST_STRING));
+ assertFalse(StringUtil.containsIgnoreCase(null, TEST_STRING));
+ assertFalse(StringUtil.containsIgnoreCase(null, null));
+ }
+
+ @Test
+ public void testContainsChar() {
+ for (int i = 0; i < TEST_STRING.length(); i++) {
+ assertTrue(StringUtil.contains(TEST_STRING, TEST_STRING.charAt(i)));
+ assertFalse(StringUtil.contains(EMPTY_STRING, TEST_STRING.charAt(i)));
+ assertFalse(StringUtil.contains(WHITESPACE_STRING, TEST_STRING.charAt(i)));
+ assertFalse(StringUtil.contains(null, TEST_STRING.charAt(i)));
+ }
+ for (int i = 0; i < TEST_SUB_STRING.length(); i++) {
+ assertTrue(StringUtil.contains(TEST_STRING, TEST_SUB_STRING.charAt(i)));
+ }
+ for (int i = 0; i < WHITESPACE_STRING.length(); i++) {
+ assertFalse(StringUtil.contains(TEST_STRING, WHITESPACE_STRING.charAt(i)));
+ }
+
+ // Test all alpha-chars
+ for (int i = 'a'; i < 'z'; i++) {
+ if (TEST_STRING.indexOf(i) < 0) {
+ assertFalse(TEST_STRING + " seems to contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), StringUtil.contains(TEST_STRING, i));
+ }
+ else {
+ assertTrue(TEST_STRING + " seems to not contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), StringUtil.contains(TEST_STRING, i));
+ }
+ }
+ }
+
+ @Test
+ public void testContainsIgnoreCaseChar() {
+ // Must contain all chars in string
+ for (int i = 0; i < TEST_STRING.length(); i++) {
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_STRING.charAt(i)));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.charAt(i)));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.charAt(i)));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, Character.toUpperCase(TEST_STRING.charAt(i))));
+ assertFalse(StringUtil.containsIgnoreCase(EMPTY_STRING, TEST_STRING.charAt(i)));
+ assertFalse(StringUtil.containsIgnoreCase(WHITESPACE_STRING, TEST_STRING.charAt(i)));
+ assertFalse(StringUtil.containsIgnoreCase(null, TEST_STRING.charAt(i)));
+ }
+ for (int i = 0; i < TEST_SUB_STRING.length(); i++) {
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_SUB_STRING.charAt(i)));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING.charAt(i)));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING.charAt(i)));
+ assertTrue(StringUtil.containsIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase().charAt(i)));
+ }
+
+ for (int i = 0; i < WHITESPACE_STRING.length(); i++) {
+ assertFalse(StringUtil.containsIgnoreCase(TEST_STRING, WHITESPACE_STRING.charAt(i)));
+ }
+
+ // Test all alpha-chars
+ for (int i = 'a'; i < 'z'; i++) {
+ if ((TEST_STRING.indexOf(i) < 0) && (TEST_STRING.indexOf(Character.toUpperCase((char) i)) < 0)) {
+ assertFalse(TEST_STRING + " seems to contain '" + (char) i + "', at index " + Math.max(TEST_STRING.indexOf(i), TEST_STRING.indexOf(Character.toUpperCase((char) i))), StringUtil.containsIgnoreCase(TEST_STRING, i));
+ }
+ else {
+ assertTrue(TEST_STRING + " seems to not contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), StringUtil.containsIgnoreCase(TEST_STRING, i));
+ }
+ }
+ }
+
+ @Test
+ public void testIndexOfIgnoreCase() {
+ assertEquals(0, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING));
+ assertEquals(0, StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING));
+ assertEquals(0, StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING));
+ assertEquals(0, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase()));
+ assertEquals(0, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase()));
+
+ for (int i = 1; i < TEST_STRING.length(); i++) {
+ assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.substring(i)));
+ assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.substring(i)));
+ assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.substring(i)));
+ assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase().substring(i)));
+ assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase().substring(i)));
+ }
+
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase()));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toLowerCase()));
+
+ for (int i = 1; i < TEST_STRING.length(); i++) {
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING.substring(i), TEST_STRING));
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING.substring(i), TEST_STRING));
+ }
+
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(null, TEST_STRING));
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(null, null));
+ }
+
+ @Test
+ public void testIndexOfIgnoreCasePos() {
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING, 1));
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING, 2));
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING, 3));
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase(), 4));
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase(), 5));
+
+ for (int i = 1; i < TEST_STRING.length(); i++) {
+ assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.substring(i), i - 1));
+ assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.substring(i), i - 1));
+ assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.substring(i), i - 1));
+ assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase().substring(i), i - 1));
+ assertEquals(i, StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase().substring(i), i - 1));
+ }
+
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING, 1));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING, 1));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING, 2));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase(), 1));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toLowerCase(), 2));
+
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(null, TEST_STRING, 234));
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(null, null, -45));
+ }
+
+ @Test
+ public void testLastIndexOfIgnoreCase() {
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING));
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING));
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING));
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase()));
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase()));
+
+ for (int i = 1; i < TEST_STRING.length(); i++) {
+ assertEquals(i, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.substring(i)));
+ assertEquals(i, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.substring(i)));
+ assertEquals(i, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.substring(i)));
+ assertEquals(i, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase().substring(i)));
+ assertEquals(i, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase().substring(i)));
+ }
+
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase()));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toLowerCase()));
+
+ for (int i = 1; i < TEST_STRING.length(); i++) {
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.substring(i), TEST_STRING));
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.substring(i), TEST_STRING));
+ }
+
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(null, TEST_STRING));
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(null, null));
+
+ }
+
+ @Test
+ public void testLastIndexOfIgnoreCasePos() {
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING, 1));
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING, 2));
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING, 3));
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase(), 4));
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase(), 5));
+
+ for (int i = 1; i < TEST_STRING.length(); i++) {
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.substring(0, i), i - 1));
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.substring(0, i), i - 1));
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.substring(0, i), i - 1));
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase().substring(0, i), i - 1));
+ assertEquals(0, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.toLowerCase().substring(0, i), i - 1));
+ }
+
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING, TEST_SUB_STRING.length() + 3));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING, TEST_SUB_STRING.length() + 3));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING, TEST_SUB_STRING.length() + 4));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase(), TEST_SUB_STRING.length() + 3));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toLowerCase(), TEST_SUB_STRING.length() + 4));
+
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(null, TEST_STRING, 234));
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(null, null, -45));
+
+ }
+
+ @Test
+ public void testIndexOfIgnoreCaseChar() {
+ // Must contain all chars in string
+ for (int i = 0; i < TEST_STRING.length(); i++) {
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.charAt(i)));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.charAt(i)));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.charAt(i)));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, Character.toUpperCase(TEST_STRING.charAt(i))));
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(EMPTY_STRING, TEST_STRING.charAt(i)));
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(WHITESPACE_STRING, TEST_STRING.charAt(i)));
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(null, TEST_STRING.charAt(i)));
+ }
+
+ for (int i = 0; i < TEST_SUB_STRING.length(); i++) {
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.charAt(i)));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING.charAt(i)));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING.charAt(i)));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase().charAt(i)));
+ }
+
+ for (int i = 0; i < WHITESPACE_STRING.length(); i++) {
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING, WHITESPACE_STRING.charAt(i)));
+ }
+
+ // Test all alpha-chars
+ for (int i = 'a'; i < 'z'; i++) {
+ if ((TEST_STRING.indexOf(i) < 0) && (TEST_STRING.indexOf(Character.toUpperCase((char) i)) < 0)) {
+ assertEquals(TEST_STRING + " seems to contain '" + (char) i + "', at index " + Math.max(TEST_STRING.indexOf(i), TEST_STRING.indexOf(Character.toUpperCase((char) i))), -1, StringUtil.indexOfIgnoreCase(TEST_STRING, i));
+ }
+ else {
+ assertTrue(TEST_STRING + " seems to not contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), 0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, i));
+ }
+ }
+ }
+
+ @Test
+ public void testIndexOfIgnoreCaseCharPos() {
+ // Must contain all chars in string
+ for (int i = 0; i < TEST_STRING.length(); i++) {
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_STRING.charAt(i), i));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.charAt(i), i));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.charAt(i), i));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, Character.toUpperCase(TEST_STRING.charAt(i)), i));
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(EMPTY_STRING, TEST_STRING.charAt(i), i));
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(WHITESPACE_STRING, TEST_STRING.charAt(i), i));
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(null, TEST_STRING.charAt(i), i));
+ }
+
+ for (int i = 0; i < TEST_SUB_STRING.length(); i++) {
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.charAt(i), i));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING.charAt(i), i));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING.charAt(i), i));
+ assertTrue(0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase().charAt(i), i));
+ }
+
+ for (int i = 0; i < WHITESPACE_STRING.length(); i++) {
+ assertEquals(-1, StringUtil.indexOfIgnoreCase(TEST_STRING, WHITESPACE_STRING.charAt(i), i));
+ }
+
+ // Test all alpha-chars
+ for (int i = 'a'; i < 'z'; i++) {
+ if ((TEST_STRING.indexOf(i) < 0) && (TEST_STRING.indexOf(Character.toUpperCase((char) i)) < 0)) {
+ assertEquals(TEST_STRING + " seems to contain '" + (char) i + "', at index " + Math.max(TEST_STRING.indexOf(i), TEST_STRING.indexOf(Character.toUpperCase((char) i))), -1, StringUtil.indexOfIgnoreCase(TEST_STRING, i, 0));
+ }
+ else {
+ assertTrue(TEST_STRING + " seems to not contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), 0 <= StringUtil.indexOfIgnoreCase(TEST_STRING, i, 0));
+ }
+ }
+ }
+
+ @Test
+ public void testLastIndexOfIgnoreCaseChar() {
+ // Must contain all chars in string
+ for (int i = 0; i < TEST_STRING.length(); i++) {
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.charAt(i)));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.charAt(i)));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.charAt(i)));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, Character.toUpperCase(TEST_STRING.charAt(i))));
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(EMPTY_STRING, TEST_STRING.charAt(i)));
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(WHITESPACE_STRING, TEST_STRING.charAt(i)));
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(null, TEST_STRING.charAt(i)));
+ }
+
+ for (int i = 0; i < TEST_SUB_STRING.length(); i++) {
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.charAt(i)));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING.charAt(i)));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING.charAt(i)));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase().charAt(i)));
+ }
+
+ for (int i = 0; i < WHITESPACE_STRING.length(); i++) {
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, WHITESPACE_STRING.charAt(i)));
+ }
+
+ // Test all alpha-chars
+ for (int i = 'a'; i < 'z'; i++) {
+ if ((TEST_STRING.indexOf(i) < 0) && (TEST_STRING.indexOf(Character.toUpperCase((char) i)) < 0)) {
+ assertEquals(TEST_STRING + " seems to contain '" + (char) i + "', at index " + Math.max(TEST_STRING.indexOf(i), TEST_STRING.indexOf(Character.toUpperCase((char) i))), -1, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, i));
+ }
+ else {
+ assertTrue(TEST_STRING + " seems to not contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), 0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, i));
+ }
+ }
+ }
+
+ @Test
+ public void testLastIndexOfIgnoreCaseCharPos() {
+ // Must contain all chars in string
+ for (int i = 0; i < TEST_STRING.length(); i++) {
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_STRING.charAt(i), i));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_STRING.charAt(i), i));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_STRING.charAt(i), i));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, Character.toUpperCase(TEST_STRING.charAt(i)), i));
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(EMPTY_STRING, TEST_STRING.charAt(i), i));
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(WHITESPACE_STRING, TEST_STRING.charAt(i), i));
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(null, TEST_STRING.charAt(i), i));
+ }
+
+ for (int i = 0; i < TEST_SUB_STRING.length(); i++) {
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.charAt(i), TEST_STRING.length()));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toUpperCase(), TEST_SUB_STRING.charAt(i), TEST_STRING.length()));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING.toLowerCase(), TEST_SUB_STRING.charAt(i), TEST_STRING.length()));
+ assertTrue(0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, TEST_SUB_STRING.toUpperCase().charAt(i), TEST_STRING.length()));
+ }
+
+ for (int i = 0; i < WHITESPACE_STRING.length(); i++) {
+ assertEquals(-1, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, WHITESPACE_STRING.charAt(i), TEST_STRING.length()));
+ }
+
+ // Test all alpha-chars
+ for (int i = 'a'; i < 'z'; i++) {
+ if ((TEST_STRING.indexOf(i) < 0) && (TEST_STRING.indexOf(Character.toUpperCase((char) i)) < 0)) {
+ assertEquals(TEST_STRING + " seems to contain '" + (char) i + "', at index " + Math.max(TEST_STRING.indexOf(i), TEST_STRING.indexOf(Character.toUpperCase((char) i))), -1, StringUtil.lastIndexOfIgnoreCase(TEST_STRING, i, TEST_STRING.length()));
+ }
+ else {
+ assertTrue(TEST_STRING + " seems to not contain '" + (char) i + "', at index " + TEST_STRING.indexOf(i), 0 <= StringUtil.lastIndexOfIgnoreCase(TEST_STRING, i, TEST_STRING.length()));
+ }
+ }
+ }
+
+ @Test
+ public void testLtrim() {
+ assertEquals(TEST_STRING, StringUtil.ltrim(TEST_STRING));
+ assertEquals(TEST_STRING, StringUtil.ltrim(" " + TEST_STRING));
+ assertEquals(TEST_STRING, StringUtil.ltrim(WHITESPACE_STRING + TEST_STRING));
+ assertFalse(TEST_STRING.equals(StringUtil.ltrim(TEST_STRING + WHITESPACE_STRING)));
+ // TODO: Test is not complete
+ }
+
+ @Test
+ public void testRtrim() {
+ assertEquals(TEST_STRING, StringUtil.rtrim(TEST_STRING));
+ assertEquals(TEST_STRING, StringUtil.rtrim(TEST_STRING + " "));
+ assertEquals(TEST_STRING, StringUtil.rtrim(TEST_STRING + WHITESPACE_STRING));
+ assertFalse(TEST_STRING.equals(StringUtil.rtrim(WHITESPACE_STRING + TEST_STRING)));
+ // TODO: Test is not complete
+ }
+
+ @Test
+ public void testReplace() {
+ assertEquals("", StringUtil.replace(TEST_STRING, TEST_STRING, ""));
+ assertEquals("", StringUtil.replace("", "", ""));
+ assertEquals("", StringUtil.replace("", "xyzzy", "xyzzy"));
+ assertEquals(TEST_STRING, StringUtil.replace(TEST_STRING, "", "xyzzy"));
+ assertEquals("aabbdd", StringUtil.replace("aabbccdd", "c", ""));
+ assertEquals("aabbccdd", StringUtil.replace("aabbdd", "bd", "bccd"));
+ // TODO: Test is not complete
+ }
+
+ @Test
+ public void testReplaceIgnoreCase() {
+ assertEquals("", StringUtil.replaceIgnoreCase(TEST_STRING, TEST_STRING.toUpperCase(), ""));
+ assertEquals("", StringUtil.replaceIgnoreCase("", "", ""));
+ assertEquals("", StringUtil.replaceIgnoreCase("", "xyzzy", "xyzzy"));
+ assertEquals(TEST_STRING, StringUtil.replaceIgnoreCase(TEST_STRING, "", "xyzzy"));
+ assertEquals("aabbdd", StringUtil.replaceIgnoreCase("aabbCCdd", "c", ""));
+ assertEquals("aabbdd", StringUtil.replaceIgnoreCase("aabbccdd", "C", ""));
+ assertEquals("aabbccdd", StringUtil.replaceIgnoreCase("aabbdd", "BD", "bccd"));
+ assertEquals("aabbccdd", StringUtil.replaceIgnoreCase("aabBDd", "bd", "bccd"));
+ // TODO: Test is not complete
+ }
+
+ @Test
+ public void testCut() {
+ assertEquals(TEST_STRING, StringUtil.cut(TEST_STRING, TEST_STRING.length(), ".."));
+ assertEquals("This is a test..", StringUtil.cut("This is a test of how this works", 16, ".."));
+ assertEquals("This is a test", StringUtil.cut("This is a test of how this works", 16, null));
+ assertEquals("This is a test", StringUtil.cut("This is a test of how this works", 16, ""));
+ // TODO: Test is not complete
+ }
+
+ @Test
+ public void testCaptialize() {
+ assertNull(StringUtil.capitalize(null));
+ assertEquals(TEST_STRING.toUpperCase(), StringUtil.capitalize(TEST_STRING.toUpperCase()));
+ assertTrue(StringUtil.capitalize("abc").charAt(0) == 'A');
+ }
+
+ @Test
+ public void testCaptializePos() {
+ assertNull(StringUtil.capitalize(null, 45));
+
+ // TODO: Should this throw IllegalArgument or StringIndexOutOfBonds?
+ assertEquals(TEST_STRING, StringUtil.capitalize(TEST_STRING, TEST_STRING.length() + 45));
+
+ for (int i = 0; i < TEST_STRING.length(); i++) {
+ assertTrue(Character.isUpperCase(StringUtil.capitalize(TEST_STRING, i).charAt(i)));
+ }
+ }
+
+ @Test
+ public void testPad() {
+ assertEquals(TEST_STRING + "...", StringUtil.pad(TEST_STRING, TEST_STRING.length() + 3, "..", false));
+ assertEquals(TEST_STRING, StringUtil.pad(TEST_STRING, 4, ".", false));
+ assertEquals(TEST_STRING, StringUtil.pad(TEST_STRING, 4, ".", true));
+ assertEquals("..." + TEST_STRING, StringUtil.pad(TEST_STRING, TEST_STRING.length() + 3, "..", true));
+ }
+
+ @Test
+ public void testToDate() {
+ long time = System.currentTimeMillis();
+ Date now = new Date(time - time % 60000); // Default format seems to have no seconds..
+ Date date = StringUtil.toDate(DateFormat.getInstance().format(now));
+ assertNotNull(date);
+ assertEquals(now, date);
+ }
+
+ @Test
+ public void testToDateWithFormatString() {
+ Calendar cal = new GregorianCalendar();
+ cal.clear();
+ cal.set(1976, 2, 16); // Month is 0-based
+ Date date = StringUtil.toDate("16.03.1976", "dd.MM.yyyy");
+ assertNotNull(date);
+ assertEquals(cal.getTime(), date);
+
+ cal.clear();
+ cal.set(2004, 4, 13, 23, 51, 3);
+ date = StringUtil.toDate("2004-5-13 23:51 (03)", "yyyy-MM-dd hh:mm (ss)");
+ assertNotNull(date);
+ assertEquals(cal.getTime(), date);
+
+ cal.clear();
+ cal.set(Calendar.HOUR, 1);
+ cal.set(Calendar.MINUTE, 2);
+ cal.set(Calendar.SECOND, 3);
+ date = StringUtil.toDate("123", "hms");
+ assertNotNull(date);
+ assertEquals(cal.getTime(), date);
+ }
+
+ @Test
+ public void testToDateWithFormat() {
+ Calendar cal = new GregorianCalendar();
+ cal.clear();
+ cal.set(1976, 2, 16); // Month is 0-based
+ Date date = StringUtil.toDate("16.03.1976", new SimpleDateFormat("dd.MM.yyyy"));
+ assertNotNull(date);
+ assertEquals(cal.getTime(), date);
+
+ cal.clear();
+ cal.set(2004, 4, 13, 23, 51);
+ date = StringUtil.toDate("13.5.04 23:51",
+ DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, new Locale("no", "NO")));
+ assertNotNull(date);
+ assertEquals(cal.getTime(), date);
+
+ cal.clear();
+ cal.set(Calendar.HOUR, 1);
+ cal.set(Calendar.MINUTE, 2);
+ date = StringUtil.toDate("1:02 am",
+ DateFormat.getTimeInstance(DateFormat.SHORT, Locale.US));
+ assertNotNull(date);
+ assertEquals(cal.getTime(), date);
+ }
+
+ @Test
+ public void testToTimestamp() {
+ Calendar cal = new GregorianCalendar();
+ cal.clear();
+ cal.set(1976, 2, 16, 21, 28, 4); // Month is 0-based
+ Date date = StringUtil.toTimestamp("1976-03-16 21:28:04");
+ assertNotNull(date);
+ assertTrue(date instanceof Timestamp);
+ assertEquals(cal.getTime(), date);
+ }
+
+ @Test
+ public void testToStringArray() {
+ String[] arr = StringUtil.toStringArray(TEST_DELIM_STRING);
+ assertNotNull(arr);
+ assertEquals(STRING_ARRAY.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(STRING_ARRAY[i], arr[i]);
+ }
+ }
+
+ @Test
+ public void testToStringArrayDelim() {
+ String[] arr = StringUtil.toStringArray("-1---2-3--4-5", "---");
+ String[] arr2 = {"1", "2", "3", "4", "5"};
+ assertNotNull(arr);
+ assertEquals(arr2.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(arr2[i], arr[i]);
+ }
+
+ arr = StringUtil.toStringArray("1, 2, 3; 4 5", ",; ");
+ assertNotNull(arr);
+ assertEquals(arr2.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(arr2[i], arr[i]);
+ }
+ }
+
+ @Test
+ public void testToIntArray() {
+ int[] arr = StringUtil.toIntArray(TEST_INT_DELIM_STRING);
+ assertNotNull(arr);
+ assertEquals(INT_ARRAY.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(INT_ARRAY[i], arr[i]);
+ }
+ }
+
+ @Test
+ public void testToIntArrayDelim() {
+ int[] arr = StringUtil.toIntArray("-1---2-3--4-5", "---");
+ int[] arr2 = {1, 2, 3, 4, 5};
+ assertNotNull(arr);
+ assertEquals(arr2.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(arr2[i], arr[i]);
+ }
+
+ arr = StringUtil.toIntArray("1, 2, 3; 4 5", ",; ");
+ assertNotNull(arr);
+ assertEquals(arr2.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(arr2[i], arr[i]);
+ }
+ }
+
+ @Test
+ public void testToIntArrayDelimBase() {
+ int[] arr = StringUtil.toIntArray("-1___2_3__F_a", "___", 16);
+ int[] arr2 = {-1, 2, 3, 0xf, 0xa};
+ assertNotNull(arr);
+ assertEquals(arr2.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(arr2[i], arr[i]);
+ }
+
+ arr = StringUtil.toIntArray("-1, 2, 3; 17 12", ",; ", 8);
+ assertNotNull(arr);
+ assertEquals(arr2.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(arr2[i], arr[i]);
+ }
+ }
+
+ @Test
+ public void testToLongArray() {
+ long[] arr = StringUtil.toLongArray(TEST_INT_DELIM_STRING);
+ assertNotNull(arr);
+ assertEquals(INT_ARRAY.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(INT_ARRAY[i], arr[i]);
+ }
+ }
+
+ @Test
+ public void testToLongArrayDelim() {
+ long[] arr = StringUtil.toLongArray("-12854928752983___2_3__4_5", "___");
+ long[] arr2 = {-12854928752983L, 2, 3, 4, 5};
+ assertNotNull(arr);
+ assertEquals(arr2.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(arr2[i], arr[i]);
+ }
+
+ arr = StringUtil.toLongArray("-12854928752983, 2, 3; 4 5", ",; ");
+ assertNotNull(arr);
+ assertEquals(arr2.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(arr2[i], arr[i]);
+ }
+ }
+
+ @Test
+ public void testToDoubleArray() {
+ double[] arr = StringUtil.toDoubleArray(TEST_DOUBLE_DELIM_STRING);
+ assertNotNull(arr);
+ assertEquals(DOUBLE_ARRAY.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(DOUBLE_ARRAY[i], arr[i], 0d);
+ }
+ }
+
+ @Test
+ public void testToDoubleArrayDelim() {
+ double[] arr = StringUtil.toDoubleArray("-12854928752983___.2_3__4_5e4", "___");
+ double[] arr2 = {-12854928752983L, .2, 3, 4, 5e4};
+ assertNotNull(arr);
+ assertEquals(arr2.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(arr2[i], arr[i], 0d);
+ }
+
+ arr = StringUtil.toDoubleArray("-12854928752983, .2, 3; 4 5E4", ",; ");
+ assertNotNull(arr);
+ assertEquals(arr2.length, arr.length);
+ for (int i = 0; i < arr.length; i++) {
+ assertEquals(arr2[i], arr[i], 0d);
+ }
+ }
+
+ @Test
+ public void testTestToColor() {
+ // Test all constants
+ assertEquals(Color.black, StringUtil.toColor("black"));
+ assertEquals(Color.black, StringUtil.toColor("BLACK"));
+ assertEquals(Color.blue, StringUtil.toColor("blue"));
+ assertEquals(Color.blue, StringUtil.toColor("BLUE"));
+ assertEquals(Color.cyan, StringUtil.toColor("cyan"));
+ assertEquals(Color.cyan, StringUtil.toColor("CYAN"));
+ assertEquals(Color.darkGray, StringUtil.toColor("darkGray"));
+ assertEquals(Color.darkGray, StringUtil.toColor("DARK_GRAY"));
+ assertEquals(Color.gray, StringUtil.toColor("gray"));
+ assertEquals(Color.gray, StringUtil.toColor("GRAY"));
+ assertEquals(Color.green, StringUtil.toColor("green"));
+ assertEquals(Color.green, StringUtil.toColor("GREEN"));
+ assertEquals(Color.lightGray, StringUtil.toColor("lightGray"));
+ assertEquals(Color.lightGray, StringUtil.toColor("LIGHT_GRAY"));
+ assertEquals(Color.magenta, StringUtil.toColor("magenta"));
+ assertEquals(Color.magenta, StringUtil.toColor("MAGENTA"));
+ assertEquals(Color.orange, StringUtil.toColor("orange"));
+ assertEquals(Color.orange, StringUtil.toColor("ORANGE"));
+ assertEquals(Color.pink, StringUtil.toColor("pink"));
+ assertEquals(Color.pink, StringUtil.toColor("PINK"));
+ assertEquals(Color.red, StringUtil.toColor("red"));
+ assertEquals(Color.red, StringUtil.toColor("RED"));
+ assertEquals(Color.white, StringUtil.toColor("white"));
+ assertEquals(Color.white, StringUtil.toColor("WHITE"));
+ assertEquals(Color.yellow, StringUtil.toColor("yellow"));
+ assertEquals(Color.yellow, StringUtil.toColor("YELLOW"));
+
+// System.out.println(StringUtil.deepToString(Color.yellow));
+// System.out.println(StringUtil.deepToString(Color.pink, true, -1));
+
+ // Test HTML/CSS style color
+ for (int i = 0; i < 256; i++) {
+ int c = i;
+ if (i < 0x10) {
+ c = i * 16;
+ }
+ String colorStr = "#" + Integer.toHexString(i) + Integer.toHexString(i) + Integer.toHexString(i);
+ String colorStrAlpha = "#" + Integer.toHexString(i) + Integer.toHexString(i) + Integer.toHexString(i) + Integer.toHexString(i);
+ assertEquals(new Color(c, c, c), StringUtil.toColor(colorStr));
+ assertEquals(new Color(c, c, c, c), StringUtil.toColor(colorStrAlpha));
+
+ }
+
+ // Test null
+ // TODO: Hmmm.. Maybe reconsider this..
+ assertNull(StringUtil.toColor(null));
+
+ // Test
+ try {
+ StringUtil.toColor("illegal-color-value");
+ fail("toColor with illegal color value should throw IllegalArgumentException.");
+ }
+ catch (IllegalArgumentException e) {
+ assertNotNull(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testToColorString() {
+ assertEquals("#ff0000", StringUtil.toColorString(Color.red));
+ assertEquals("#00ff00", StringUtil.toColorString(Color.green));
+ assertEquals("#0000ff", StringUtil.toColorString(Color.blue));
+ assertEquals("#101010", StringUtil.toColorString(new Color(0x10, 0x10, 0x10)));
+
+ for (int i = 0; i < 256; i++) {
+ String str = (i < 0x10 ? "0" : "") + Integer.toHexString(i);
+ assertEquals("#" + str + str + str, StringUtil.toColorString(new Color(i, i, i)));
+ }
+
+ // Test null
+ // TODO: Hmmm.. Maybe reconsider this..
+ assertNull(StringUtil.toColorString(null));
+ }
+
+ @Test
+ public void testIsNumber() {
+ assertTrue(StringUtil.isNumber("0"));
+ assertTrue(StringUtil.isNumber("12345"));
+ assertTrue(StringUtil.isNumber(TEST_INTEGER.toString()));
+ assertTrue(StringUtil.isNumber("1234567890123456789012345678901234567890"));
+ assertTrue(StringUtil.isNumber(String.valueOf(Long.MAX_VALUE) + String.valueOf(Long.MAX_VALUE)));
+ assertFalse(StringUtil.isNumber("abc"));
+ assertFalse(StringUtil.isNumber(TEST_STRING));
+ }
+
+ @Test
+ public void testIsNumberNegative() {
+ assertTrue(StringUtil.isNumber("-12345"));
+ assertTrue(StringUtil.isNumber('-' + TEST_INTEGER.toString()));
+ assertTrue(StringUtil.isNumber("-1234567890123456789012345678901234567890"));
+ assertTrue(StringUtil.isNumber('-' + String.valueOf(Long.MAX_VALUE) + String.valueOf(Long.MAX_VALUE)));
+ assertFalse(StringUtil.isNumber("-abc"));
+ assertFalse(StringUtil.isNumber('-' + TEST_STRING));
+ }
+
+ @Test
+ public void testCamelToLispNull() {
+ try {
+ StringUtil.camelToLisp(null);
+ fail("should not accept null");
+ }
+ catch (IllegalArgumentException iae) {
+ assertNotNull(iae.getMessage());
+ }
+ }
+
+ @Test
+ public void testCamelToLispNoConversion() {
+ assertEquals("", StringUtil.camelToLisp(""));
+ assertEquals("equal", StringUtil.camelToLisp("equal"));
+ assertEquals("allready-lisp", StringUtil.camelToLisp("allready-lisp"));
+ }
+
+ @Test
+ public void testCamelToLispSimple() {
+ // Simple tests
+ assertEquals("foo-bar", StringUtil.camelToLisp("fooBar"));
+ }
+
+ @Test
+ public void testCamelToLispCase() {
+ // Casing
+ assertEquals("my-url", StringUtil.camelToLisp("myURL"));
+ assertEquals("another-url", StringUtil.camelToLisp("AnotherURL"));
+ }
+
+ @Test
+ public void testCamelToLispMulti() {
+ // Several words
+ assertEquals("http-request-wrapper", StringUtil.camelToLisp("HttpRequestWrapper"));
+ String s = StringUtil.camelToLisp("HttpURLConnection");
+ assertEquals("http-url-connection", s);
+ // Long and short abbre in upper case
+ assertEquals("welcome-to-my-world", StringUtil.camelToLisp("WELCOMEToMYWorld"));
+ }
+
+ @Test
+ public void testCamelToLispLeaveUntouched() {
+ // Leave others untouched
+ assertEquals("a-slightly-longer-and-more-bumpy-string?.,[]()", StringUtil.camelToLisp("ASlightlyLongerANDMoreBumpyString?.,[]()"));
+ }
+
+ @Test
+ public void testCamelToLispNumbers() {
+ // Numbers
+ // TODO: FixMe
+ String s = StringUtil.camelToLisp("my45Caliber");
+ assertEquals("my-45-caliber", s);
+ assertEquals("hello-12345-world-67890", StringUtil.camelToLisp("Hello12345world67890"));
+ assertEquals("hello-12345-my-world-67890-this-time", StringUtil.camelToLisp("HELLO12345MyWorld67890thisTime"));
+ assertEquals("hello-12345-world-67890-too", StringUtil.camelToLisp("Hello12345WORLD67890too"));
+ }
+
+ @Test
+ public void testLispToCamelNull() {
+ try {
+ StringUtil.lispToCamel(null);
+ fail("should not accept null");
+ }
+ catch (IllegalArgumentException iae) {
+ assertNotNull(iae.getMessage());
+ }
+ }
+
+ @Test
+ public void testLispToCamelNoConversion() {
+ assertEquals("", StringUtil.lispToCamel(""));
+ assertEquals("equal", StringUtil.lispToCamel("equal"));
+ assertEquals("alreadyCamel", StringUtil.lispToCamel("alreadyCamel"));
+ }
+
+ @Test
+ public void testLispToCamelSimple() {
+ // Simple tests
+ assertEquals("fooBar", StringUtil.lispToCamel("foo-bar"));
+ assertEquals("myUrl", StringUtil.lispToCamel("my-URL"));
+ assertEquals("anotherUrl", StringUtil.lispToCamel("ANOTHER-URL"));
+ }
+
+ @Test
+ public void testLispToCamelCase() {
+ // Casing
+ assertEquals("Object", StringUtil.lispToCamel("object", true));
+ assertEquals("object", StringUtil.lispToCamel("Object", false));
+ }
+
+ @Test
+ public void testLispToCamelMulti() {
+ // Several words
+ assertEquals("HttpRequestWrapper", StringUtil.lispToCamel("http-request-wrapper", true));
+ }
+
+ @Test
+ public void testLispToCamelLeaveUntouched() {
+ // Leave others untouched
+ assertEquals("ASlightlyLongerAndMoreBumpyString?.,[]()", StringUtil.lispToCamel("a-slightly-longer-and-more-bumpy-string?.,[]()", true));
+ }
+
+ @Test
+ public void testLispToCamelNumber() {
+ // Numbers
+ assertEquals("my45Caliber", StringUtil.lispToCamel("my-45-caliber"));
+ }
+}
diff --git a/common/common-lang/src/test/java/com/twelvemonkeys/lang/SystemUtilTest.java b/common/common-lang/src/test/java/com/twelvemonkeys/lang/SystemUtilTest.java
index 4405fd9e..5b73f5af 100644
--- a/common/common-lang/src/test/java/com/twelvemonkeys/lang/SystemUtilTest.java
+++ b/common/common-lang/src/test/java/com/twelvemonkeys/lang/SystemUtilTest.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.lang;
diff --git a/common/common-lang/src/test/java/com/twelvemonkeys/lang/ValidateTest.java b/common/common-lang/src/test/java/com/twelvemonkeys/lang/ValidateTest.java
index 760d747b..76fee60c 100644
--- a/common/common-lang/src/test/java/com/twelvemonkeys/lang/ValidateTest.java
+++ b/common/common-lang/src/test/java/com/twelvemonkeys/lang/ValidateTest.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.lang;
diff --git a/common/common-lang/src/test/java/com/twelvemonkeys/util/BeanMapTestCase.java b/common/common-lang/src/test/java/com/twelvemonkeys/util/BeanMapTest.java
similarity index 66%
rename from common/common-lang/src/test/java/com/twelvemonkeys/util/BeanMapTestCase.java
rename to common/common-lang/src/test/java/com/twelvemonkeys/util/BeanMapTest.java
index c33cde2e..b5f49db1 100755
--- a/common/common-lang/src/test/java/com/twelvemonkeys/util/BeanMapTestCase.java
+++ b/common/common-lang/src/test/java/com/twelvemonkeys/util/BeanMapTest.java
@@ -1,146 +1,176 @@
-package com.twelvemonkeys.util;
-
-import java.util.Map;
-import java.beans.IntrospectionException;
-import java.io.Serializable;
-
-/**
- * BeanMapTestCase
- *
- * @todo Extend with BeanMap specific tests
- *
- * @author Harald Kuhr
- * @author last modified by $Author: haku $
- * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/util/BeanMapTestCase.java#2 $
- */
-public class BeanMapTestCase extends MapAbstractTestCase {
-
- public boolean isPutAddSupported() {
- return false;
- }
-
- public boolean isRemoveSupported() {
- return false;
- }
-
- public boolean isSetValueSupported() {
- return true;
- }
-
- public boolean isAllowNullKey() {
- return false;
- }
-
- public Object[] getSampleKeys() {
- return new Object[] {
- "blah", "foo", "bar", "baz", "tmp", "gosh", "golly", "gee"
- };
- }
-
- public Object[] getSampleValues() {
- return new Object[] {
- "blahv", "foov", "barv", "bazv", "tmpv", "goshv", "gollyv", "geev"
- };
- }
-
- public Object[] getNewSampleValues() {
- return new Object[] {
- "newblahv", "newfoov", "newbarv", "newbazv", "newtmpv", "newgoshv", "newgollyv", "newgeev"
- };
- }
-
- public Map makeEmptyMap() {
- try {
- return new BeanMap(new NullBean());
- }
- catch (IntrospectionException e) {
- throw new RuntimeException(e);
- }
- }
-
- public Map makeFullMap() {
- try {
- return new BeanMap(new MyBean());
- }
- catch (IntrospectionException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static class MyBean implements Serializable {
- Object blah = "blahv";
- Object foo = "foov";
- Object bar = "barv";
- Object baz = "bazv";
- Object tmp = "tmpv";
- Object gosh = "goshv";
- Object golly = "gollyv";
- Object gee = "geev";
-
- public Object getBar() {
- return bar;
- }
-
- public void setBar(Object pBar) {
- bar = pBar;
- }
-
- public Object getBaz() {
- return baz;
- }
-
- public void setBaz(Object pBaz) {
- baz = pBaz;
- }
-
- public Object getBlah() {
- return blah;
- }
-
- public void setBlah(Object pBlah) {
- blah = pBlah;
- }
-
- public Object getFoo() {
- return foo;
- }
-
- public void setFoo(Object pFoo) {
- foo = pFoo;
- }
-
- public Object getGee() {
- return gee;
- }
-
- public void setGee(Object pGee) {
- gee = pGee;
- }
-
- public Object getGolly() {
- return golly;
- }
-
- public void setGolly(Object pGolly) {
- golly = pGolly;
- }
-
- public Object getGosh() {
- return gosh;
- }
-
- public void setGosh(Object pGosh) {
- gosh = pGosh;
- }
-
- public Object getTmp() {
- return tmp;
- }
-
- public void setTmp(Object pTmp) {
- tmp = pTmp;
- }
- }
-
- static class NullBean implements Serializable { }
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.twelvemonkeys.util;
+
+import java.beans.IntrospectionException;
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * BeanMapTestCase
+ *
+ * @todo Extend with BeanMap specific tests
+ *
+ * @author Harald Kuhr
+ * @author last modified by $Author: haku $
+ * @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/test/java/com/twelvemonkeys/util/BeanMapTestCase.java#2 $
+ */
+public class BeanMapTest extends MapAbstractTest {
+
+ public boolean isPutAddSupported() {
+ return false;
+ }
+
+ public boolean isRemoveSupported() {
+ return false;
+ }
+
+ public boolean isSetValueSupported() {
+ return true;
+ }
+
+ public boolean isAllowNullKey() {
+ return false;
+ }
+
+ public Object[] getSampleKeys() {
+ return new Object[] {
+ "blah", "foo", "bar", "baz", "tmp", "gosh", "golly", "gee"
+ };
+ }
+
+ public Object[] getSampleValues() {
+ return new Object[] {
+ "blahv", "foov", "barv", "bazv", "tmpv", "goshv", "gollyv", "geev"
+ };
+ }
+
+ public Object[] getNewSampleValues() {
+ return new Object[] {
+ "newblahv", "newfoov", "newbarv", "newbazv", "newtmpv", "newgoshv", "newgollyv", "newgeev"
+ };
+ }
+
+ public Map makeEmptyMap() {
+ try {
+ return new BeanMap(new NullBean());
+ }
+ catch (IntrospectionException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Map makeFullMap() {
+ try {
+ return new BeanMap(new MyBean());
+ }
+ catch (IntrospectionException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static class MyBean implements Serializable {
+ Object blah = "blahv";
+ Object foo = "foov";
+ Object bar = "barv";
+ Object baz = "bazv";
+ Object tmp = "tmpv";
+ Object gosh = "goshv";
+ Object golly = "gollyv";
+ Object gee = "geev";
+
+ public Object getBar() {
+ return bar;
+ }
+
+ public void setBar(Object pBar) {
+ bar = pBar;
+ }
+
+ public Object getBaz() {
+ return baz;
+ }
+
+ public void setBaz(Object pBaz) {
+ baz = pBaz;
+ }
+
+ public Object getBlah() {
+ return blah;
+ }
+
+ public void setBlah(Object pBlah) {
+ blah = pBlah;
+ }
+
+ public Object getFoo() {
+ return foo;
+ }
+
+ public void setFoo(Object pFoo) {
+ foo = pFoo;
+ }
+
+ public Object getGee() {
+ return gee;
+ }
+
+ public void setGee(Object pGee) {
+ gee = pGee;
+ }
+
+ public Object getGolly() {
+ return golly;
+ }
+
+ public void setGolly(Object pGolly) {
+ golly = pGolly;
+ }
+
+ public Object getGosh() {
+ return gosh;
+ }
+
+ public void setGosh(Object pGosh) {
+ gosh = pGosh;
+ }
+
+ public Object getTmp() {
+ return tmp;
+ }
+
+ public void setTmp(Object pTmp) {
+ tmp = pTmp;
+ }
+ }
+
+ static class NullBean implements Serializable { }
+}
diff --git a/common/common-lang/src/test/java/com/twelvemonkeys/util/CollectionAbstractTestCase.java b/common/common-lang/src/test/java/com/twelvemonkeys/util/CollectionAbstractTest.java
similarity index 96%
rename from common/common-lang/src/test/java/com/twelvemonkeys/util/CollectionAbstractTestCase.java
rename to common/common-lang/src/test/java/com/twelvemonkeys/util/CollectionAbstractTest.java
index 4bb26738..e2f08d86 100755
--- a/common/common-lang/src/test/java/com/twelvemonkeys/util/CollectionAbstractTestCase.java
+++ b/common/common-lang/src/test/java/com/twelvemonkeys/util/CollectionAbstractTest.java
@@ -1,1308 +1,1359 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation
- *
- * Licensed 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 com.twelvemonkeys.util;
-
-import java.lang.reflect.Array;
-import java.util.*;
-
-/**
- * Abstract test class for {@link java.util.Collection} methods and contracts.
- *
- * You should create a concrete subclass of this class to test any custom
- * {@link Collection} implementation. At minimum, you'll have to
- * implement the {@link #makeCollection()} method. You might want to
- * override some of the additional public methods as well:
- *
- * Element Population Methods
- *
- * Override these if your collection restricts what kind of elements are
- * allowed (for instance, if {@code null} is not permitted):
- *
- *
{@link #getFullElements()}
- *
{@link #getOtherElements()}
- *
- *
- * Supported Operation Methods
- *
- * Override these if your collection doesn't support certain operations:
- *
- *
{@link #isAddSupported()}
- *
{@link #isRemoveSupported()}
- *
{@link #areEqualElementsDistinguishable()}
- *
{@link #isNullSupported()}
- *
{@link #isFailFastSupported()}
- *
- *
- * Fixture Methods
- *
- * Fixtures are used to verify that the the operation results in correct state
- * for the collection. Basically, the operation is performed against your
- * collection implementation, and an identical operation is performed against a
- * confirmed collection implementation. A confirmed collection
- * implementation is something like {@code java.util.ArrayList}, which is
- * known to conform exactly to its collection interface's contract. After the
- * operation takes place on both your collection implementation and the
- * confirmed collection implementation, the two collections are compared to see
- * if their state is identical. The comparison is usually much more involved
- * than a simple {@code equals} test. This verification is used to ensure
- * proper modifications are made along with ensuring that the collection does
- * not change when read-only modifications are made.
- *
- * The {@link #collection} field holds an instance of your collection
- * implementation; the {@link #confirmed} field holds an instance of the
- * confirmed collection implementation. The {@link #resetEmpty()} and
- * {@link #resetFull()} methods set these fields to empty or full collections,
- * so that tests can proceed from a known state.
- *
- * After a modification operation to both {@link #collection} and
- * {@link #confirmed}, the {@link #verifyAll()} method is invoked to compare
- * the results. You may want to override {@link # verifyAll ()} to perform
- * additional verifications. For instance, when testing the collection
- * views of a map, {@link AbstractTestMap} would override {@link # verifyAll ()} to make
- * sure the map is changed after the collection view is changed.
- *
- * If you're extending this class directly, you will have to provide
- * implementations for the following:
- *
- *
{@link #makeConfirmedCollection()}
- *
{@link #makeConfirmedFullCollection()}
- *
- *
- * Those methods should provide a confirmed collection implementation
- * that's compatible with your collection implementation.
- *
- * If you're extending {@link AbstractTestList}, {@link SetAbstractTestCase},
- * or {@link AbstractTestBag}, you probably don't have to worry about the
- * above methods, because those three classes already override the methods
- * to provide standard JDK confirmed collections.
- *
- * Other notes
- *
- * If your {@link Collection} fails one of these tests by design,
- * you may still use this base set of cases. Simply override the
- * test case (method) your {@link Collection} fails.
- *
- * @version $Revision: #2 $ $Date: 2008/07/15 $
- *
- * @author Rodney Waldhoff
- * @author Paul Jack
- * @author Michael A. Smith
- * @author Neil O'Toole
- * @author Stephen Colebourne
- */
-public abstract class CollectionAbstractTestCase extends ObjectAbstractTestCase {
-
- //
- // NOTE:
- //
- // Collection doesn't define any semantics for equals, and recommends you
- // use reference-based default behavior of Object.equals. (And a test for
- // that already exists in ObjectAbstractTestCase). Tests for equality of lists, sets
- // and bags will have to be written in test subclasses. Thus, there is no
- // tests on Collection.equals nor any for Collection.hashCode.
- //
-
-
- // These fields are used by reset() and verifyAll(), and any test
- // method that tests a modification.
-
- /**
- * A collection instance that will be used for testing.
- */
- public Collection collection;
-
- /**
- * Confirmed collection. This is an instance of a collection that is
- * confirmed to conform exactly to the java.util.Collection contract.
- * Modification operations are tested by performing a mod on your
- * collection, performing the exact same mod on an equivalent confirmed
- * collection, and then calling verifyAll() to make sure your collection
- * still matches the confirmed collection.
- */
- public Collection confirmed;
-
- //-----------------------------------------------------------------------
- /**
- * Specifies whether equal elements in the collection are, in fact,
- * distinguishable with information not readily available. That is, if a
- * particular value is to be removed from the collection, then there is
- * one and only one value that can be removed, even if there are other
- * elements which are equal to it.
- *
- *
In most collection cases, elements are not distinguishable (equal is
- * equal), thus this method defaults to return false. In some cases,
- * however, they are. For example, the collection returned from the map's
- * values() collection view are backed by the map, so while there may be
- * two values that are equal, their associated keys are not. Since the
- * keys are distinguishable, the values are.
- *
- *
This flag is used to skip some verifications for iterator.remove()
- * where it is impossible to perform an equivalent modification on the
- * confirmed collection because it is not possible to determine which
- * value in the confirmed collection to actually remove. Tests that
- * override the default (i.e. where equal elements are distinguishable),
- * should provide additional tests on iterator.remove() to make sure the
- * proper elements are removed when remove() is called on the iterator.
- **/
- public boolean areEqualElementsDistinguishable() {
- return false;
- }
-
- /**
- * Returns true if the collections produced by
- * {@link #makeCollection()} and {@link #makeFullCollection()}
- * support the {@code add} and {@code addAll}
- * operations.
- * Default implementation returns true. Override if your collection
- * class does not support add or addAll.
- */
- public boolean isAddSupported() {
- return true;
- }
-
- /**
- * Returns true if the collections produced by
- * {@link #makeCollection()} and {@link #makeFullCollection()}
- * support the {@code remove}, {@code removeAll},
- * {@code retainAll}, {@code clear} and
- * {@code iterator().remove()} methods.
- * Default implementation returns true. Override if your collection
- * class does not support removal operations.
- */
- public boolean isRemoveSupported() {
- return true;
- }
-
- /**
- * Returns true to indicate that the collection supports holding null.
- * The default implementation returns true;
- */
- public boolean isNullSupported() {
- return true;
- }
-
- /**
- * Returns true to indicate that the collection supports fail fast iterators.
- * The default implementation returns true;
- */
- public boolean isFailFastSupported() {
- return false;
- }
-
- /**
- * Returns true to indicate that the collection supports equals() comparisons.
- * This implementation returns false;
- */
- public boolean isEqualsCheckable() {
- return false;
- }
-
- //-----------------------------------------------------------------------
- /**
- * Verifies that {@link #collection} and {@link #confirmed} have
- * identical state.
- */
- public void verifyAll() {
- int confirmedSize = confirmed.size();
- assertEquals("Collection size should match confirmed collection's",
- confirmedSize, collection.size());
- assertEquals("Collection isEmpty() result should match confirmed " +
- " collection's",
- confirmed.isEmpty(), collection.isEmpty());
-
- // verify the collections are the same by attempting to match each
- // object in the collection and confirmed collection. To account for
- // duplicates and differing orders, each confirmed element is copied
- // into an array and a flag is maintained for each element to determine
- // whether it has been matched once and only once. If all elements in
- // the confirmed collection are matched once and only once and there
- // aren't any elements left to be matched in the collection,
- // verification is a success.
-
- // copy each collection value into an array
- Object[] confirmedValues = new Object[confirmedSize];
-
- Iterator iter;
-
- iter = confirmed.iterator();
- int pos = 0;
- while(iter.hasNext()) {
- confirmedValues[pos++] = iter.next();
- }
-
- // allocate an array of boolean flags for tracking values that have
- // been matched once and only once.
- boolean[] matched = new boolean[confirmedSize];
-
- // now iterate through the values of the collection and try to match
- // the value with one in the confirmed array.
- iter = collection.iterator();
- while(iter.hasNext()) {
- Object o = iter.next();
- boolean match = false;
- for(int i = 0; i < confirmedSize; i++) {
- if(matched[i]) {
- // skip values already matched
- continue;
- }
- if(o == confirmedValues[i] ||
- (o != null && o.equals(confirmedValues[i]))) {
- // values matched
- matched[i] = true;
- match = true;
- break;
- }
- }
- // no match found!
- if(!match) {
- fail("Collection should not contain a value that the " +
- "confirmed collection does not have: " + o +
- "\nTest: " + collection + "\nReal: " + confirmed);
- }
- }
-
- // make sure there aren't any unmatched values
- for(int i = 0; i < confirmedSize; i++) {
- if(!matched[i]) {
- // the collection didn't match all the confirmed values
- fail("Collection should contain all values that are in the confirmed collection" +
- "\nTest: " + collection + "\nReal: " + confirmed);
- }
- }
- }
-
- //-----------------------------------------------------------------------
- /**
- * Resets the {@link #collection} and {@link #confirmed} fields to empty
- * collections. Invoke this method before performing a modification
- * test.
- */
- public void resetEmpty() {
- this.collection = makeCollection();
- this.confirmed = makeConfirmedCollection();
- }
-
- /**
- * Resets the {@link #collection} and {@link #confirmed} fields to full
- * collections. Invoke this method before performing a modification
- * test.
- */
- public void resetFull() {
- this.collection = makeFullCollection();
- this.confirmed = makeConfirmedFullCollection();
- }
-
- //-----------------------------------------------------------------------
- /**
- * Returns a confirmed empty collection.
- * For instance, an {@link java.util.ArrayList} for lists or a
- * {@link java.util.HashSet} for sets.
- *
- * @return a confirmed empty collection
- */
- public abstract Collection makeConfirmedCollection();
-
- /**
- * Returns a confirmed full collection.
- * For instance, an {@link java.util.ArrayList} for lists or a
- * {@link java.util.HashSet} for sets. The returned collection
- * should contain the elements returned by {@link #getFullElements()}.
- *
- * @return a confirmed full collection
- */
- public abstract Collection makeConfirmedFullCollection();
-
- /**
- * Return a new, empty {@link Collection} to be used for testing.
- */
- public abstract Collection makeCollection();
-
- /**
- * Returns a full collection to be used for testing. The collection
- * returned by this method should contain every element returned by
- * {@link #getFullElements()}. The default implementation, in fact,
- * simply invokes {@code addAll} on an empty collection with
- * the results of {@link #getFullElements()}. Override this default
- * if your collection doesn't support addAll.
- */
- public Collection makeFullCollection() {
- Collection c = makeCollection();
- c.addAll(Arrays.asList(getFullElements()));
- return c;
- }
-
- /**
- * Returns an empty collection for Object tests.
- */
- public Object makeObject() {
- return makeCollection();
- }
-
- /**
- * Creates a new Map Entry that is independent of the first and the map.
- */
- public Map.Entry cloneMapEntry(Map.Entry entry) {
- HashMap map = new HashMap();
- map.put(entry.getKey(), entry.getValue());
- return (Map.Entry) map.entrySet().iterator().next();
- }
-
- //-----------------------------------------------------------------------
- /**
- * Returns an array of objects that are contained in a collection
- * produced by {@link #makeFullCollection()}. Every element in the
- * returned array must be an element in a full collection.
- * The default implementation returns a heterogenous array of
- * objects with some duplicates. null is added if allowed.
- * Override if you require specific testing elements. Note that if you
- * override {@link #makeFullCollection()}, you must override
- * this method to reflect the contents of a full collection.
- */
- public Object[] getFullElements() {
- if (isNullSupported()) {
- ArrayList list = new ArrayList();
- list.addAll(Arrays.asList(getFullNonNullElements()));
- list.add(4, null);
- return list.toArray();
- } else {
- return (Object[]) getFullNonNullElements().clone();
- }
- }
-
- /**
- * Returns an array of elements that are not contained in a
- * full collection. Every element in the returned array must
- * not exist in a collection returned by {@link #makeFullCollection()}.
- * The default implementation returns a heterogenous array of elements
- * without null. Note that some of the tests add these elements
- * to an empty or full collection, so if your collection restricts
- * certain kinds of elements, you should override this method.
- */
- public Object[] getOtherElements() {
- return getOtherNonNullElements();
- }
-
- //-----------------------------------------------------------------------
- /**
- * Returns a list of elements suitable for return by
- * {@link #getFullElements()}. The array returned by this method
- * does not include null, but does include a variety of objects
- * of different types. Override getFullElements to return
- * the results of this method if your collection does not support
- * the null element.
- */
- public Object[] getFullNonNullElements() {
- return new Object[] {
- new String(""),
- new String("One"),
- new Integer(2),
- "Three",
- new Integer(4),
- "One",
- new Double(5),
- new Float(6),
- "Seven",
- "Eight",
- new String("Nine"),
- new Integer(10),
- new Short((short)11),
- new Long(12),
- "Thirteen",
- "14",
- "15",
- new Byte((byte)16)
- };
- }
-
- /**
- * Returns the default list of objects returned by
- * {@link #getOtherElements()}. Includes many objects
- * of different types.
- */
- public Object[] getOtherNonNullElements() {
- return new Object[] {
- new Integer(0),
- new Float(0),
- new Double(0),
- "Zero",
- new Short((short)0),
- new Byte((byte)0),
- new Long(0),
- new Character('\u0000'),
- "0"
- };
- }
-
- /**
- * Returns a list of string elements suitable for return by
- * {@link #getFullElements()}. Override getFullElements to return
- * the results of this method if your collection does not support
- * heterogenous elements or the null element.
- */
- public Object[] getFullNonNullStringElements() {
- return new Object[] {
- "If","the","dull","substance","of","my","flesh","were","thought",
- "Injurious","distance","could","not","stop","my","way",
- };
- }
-
- /**
- * Returns a list of string elements suitable for return by
- * {@link #getOtherElements()}. Override getOtherElements to return
- * the results of this method if your collection does not support
- * heterogenous elements or the null element.
- */
- public Object[] getOtherNonNullStringElements() {
- return new Object[] {
- "For","then","despite",/* of */"space","I","would","be","brought",
- "From","limits","far","remote","where","thou","dost","stay"
- };
- }
-
- // Tests
- //-----------------------------------------------------------------------
- /**
- * Tests {@link Collection#add(Object)}.
- */
- public void testCollectionAdd() {
- if (!isAddSupported()) return;
-
- Object[] elements = getFullElements();
- for (int i = 0; i < elements.length; i++) {
- resetEmpty();
- boolean r = collection.add(elements[i]);
- confirmed.add(elements[i]);
- verifyAll();
- assertTrue("Empty collection changed after add", r);
- assertEquals("Collection size is 1 after first add", 1, collection.size());
- }
-
- resetEmpty();
- int size = 0;
- for (int i = 0; i < elements.length; i++) {
- boolean r = collection.add(elements[i]);
- confirmed.add(elements[i]);
- verifyAll();
- if (r) size++;
- assertEquals("Collection size should grow after add",
- size, collection.size());
- assertTrue("Collection should contain added element",
- collection.contains(elements[i]));
- }
- }
-
-
- /**
- * Tests {@link Collection#addAll(Collection)}.
- */
- public void testCollectionAddAll() {
- if (!isAddSupported()) return;
-
- resetEmpty();
- Object[] elements = getFullElements();
- boolean r = collection.addAll(Arrays.asList(elements));
- confirmed.addAll(Arrays.asList(elements));
- verifyAll();
- assertTrue("Empty collection should change after addAll", r);
- for (int i = 0; i < elements.length; i++) {
- assertTrue("Collection should contain added element",
- collection.contains(elements[i]));
- }
-
- resetFull();
- int size = collection.size();
- elements = getOtherElements();
- r = collection.addAll(Arrays.asList(elements));
- confirmed.addAll(Arrays.asList(elements));
- verifyAll();
- assertTrue("Full collection should change after addAll", r);
- for (int i = 0; i < elements.length; i++) {
- assertTrue("Full collection should contain added element",
- collection.contains(elements[i]));
- }
- assertEquals("Size should increase after addAll",
- size + elements.length, collection.size());
-
- resetFull();
- size = collection.size();
- r = collection.addAll(Arrays.asList(getFullElements()));
- confirmed.addAll(Arrays.asList(getFullElements()));
- verifyAll();
- if (r) {
- assertTrue("Size should increase if addAll returns true",
- size < collection.size());
- } else {
- assertEquals("Size should not change if addAll returns false",
- size, collection.size());
- }
- }
-
-
- /**
- * If {@link #isAddSupported()} returns false, tests that add operations
- * raise UnsupportedOperationException.
- */
- public void testUnsupportedAdd() {
- if (isAddSupported()) return;
-
- resetEmpty();
- try {
- collection.add(new Object());
- fail("Emtpy collection should not support add.");
- } catch (UnsupportedOperationException e) {
- // expected
- }
- // make sure things didn't change even if the expected exception was
- // thrown.
- verifyAll();
-
- try {
- collection.addAll(Arrays.asList(getFullElements()));
- fail("Emtpy collection should not support addAll.");
- } catch (UnsupportedOperationException e) {
- // expected
- }
- // make sure things didn't change even if the expected exception was
- // thrown.
- verifyAll();
-
- resetFull();
- try {
- collection.add(new Object());
- fail("Full collection should not support add.");
- } catch (UnsupportedOperationException e) {
- // expected
- }
- // make sure things didn't change even if the expected exception was
- // thrown.
- verifyAll();
-
- try {
- collection.addAll(Arrays.asList(getOtherElements()));
- fail("Full collection should not support addAll.");
- } catch (UnsupportedOperationException e) {
- // expected
- }
- // make sure things didn't change even if the expected exception was
- // thrown.
- verifyAll();
- }
-
-
- /**
- * Test {@link Collection#clear()}.
- */
- public void testCollectionClear() {
- if (!isRemoveSupported()) return;
-
- resetEmpty();
- collection.clear(); // just to make sure it doesn't raise anything
- verifyAll();
-
- resetFull();
- collection.clear();
- confirmed.clear();
- verifyAll();
- }
-
-
- /**
- * Tests {@link Collection#contains(Object)}.
- */
- public void testCollectionContains() {
- Object[] elements;
-
- resetEmpty();
- elements = getFullElements();
- for(int i = 0; i < elements.length; i++) {
- assertTrue("Empty collection shouldn't contain element[" + i + "]",
- !collection.contains(elements[i]));
- }
- // make sure calls to "contains" don't change anything
- verifyAll();
-
- elements = getOtherElements();
- for(int i = 0; i < elements.length; i++) {
- assertTrue("Empty collection shouldn't contain element[" + i + "]",
- !collection.contains(elements[i]));
- }
- // make sure calls to "contains" don't change anything
- verifyAll();
-
- resetFull();
- elements = getFullElements();
- for(int i = 0; i < elements.length; i++) {
- assertTrue("Full collection should contain element[" + i + "]",
- collection.contains(elements[i]));
- }
- // make sure calls to "contains" don't change anything
- verifyAll();
-
- resetFull();
- elements = getOtherElements();
- for(int i = 0; i < elements.length; i++) {
- assertTrue("Full collection shouldn't contain element",
- !collection.contains(elements[i]));
- }
- }
-
-
- /**
- * Tests {@link Collection#containsAll(Collection)}.
- */
- public void testCollectionContainsAll() {
- resetEmpty();
- Collection col = new HashSet();
- assertTrue("Every Collection should contain all elements of an " +
- "empty Collection.", collection.containsAll(col));
- col.addAll(Arrays.asList(getOtherElements()));
- assertTrue("Empty Collection shouldn't contain all elements of " +
- "a non-empty Collection.", !collection.containsAll(col));
- // make sure calls to "containsAll" don't change anything
- verifyAll();
-
- resetFull();
- assertTrue("Full collection shouldn't contain other elements",
- !collection.containsAll(col));
-
- col.clear();
- col.addAll(Arrays.asList(getFullElements()));
- assertTrue("Full collection should containAll full elements",
- collection.containsAll(col));
- // make sure calls to "containsAll" don't change anything
- verifyAll();
-
- int min = (getFullElements().length < 2 ? 0 : 2);
- int max = (getFullElements().length == 1 ? 1 :
- (getFullElements().length <= 5 ? getFullElements().length - 1 : 5));
- col = Arrays.asList(getFullElements()).subList(min, max);
- assertTrue("Full collection should containAll partial full " +
- "elements", collection.containsAll(col));
- assertTrue("Full collection should containAll itself",
- collection.containsAll(collection));
- // make sure calls to "containsAll" don't change anything
- verifyAll();
-
- col = new ArrayList();
- col.addAll(Arrays.asList(getFullElements()));
- col.addAll(Arrays.asList(getFullElements()));
- assertTrue("Full collection should containAll duplicate full " +
- "elements", collection.containsAll(col));
-
- // make sure calls to "containsAll" don't change anything
- verifyAll();
- }
-
- /**
- * Tests {@link Collection#isEmpty()}.
- */
- public void testCollectionIsEmpty() {
- resetEmpty();
- assertEquals("New Collection should be empty.",
- true, collection.isEmpty());
- // make sure calls to "isEmpty() don't change anything
- verifyAll();
-
- resetFull();
- assertEquals("Full collection shouldn't be empty",
- false, collection.isEmpty());
- // make sure calls to "isEmpty() don't change anything
- verifyAll();
- }
-
-
- /**
- * Tests the read-only functionality of {@link Collection#iterator()}.
- */
- public void testCollectionIterator() {
- resetEmpty();
- Iterator it1 = collection.iterator();
- assertEquals("Iterator for empty Collection shouldn't have next.",
- false, it1.hasNext());
- try {
- it1.next();
- fail("Iterator at end of Collection should throw " +
- "NoSuchElementException when next is called.");
- } catch(NoSuchElementException e) {
- // expected
- }
- // make sure nothing has changed after non-modification
- verifyAll();
-
- resetFull();
- it1 = collection.iterator();
- for (int i = 0; i < collection.size(); i++) {
- assertTrue("Iterator for full collection should haveNext",
- it1.hasNext());
- it1.next();
- }
- assertTrue("Iterator should be finished", !it1.hasNext());
-
- ArrayList list = new ArrayList();
- it1 = collection.iterator();
- for (int i = 0; i < collection.size(); i++) {
- Object next = it1.next();
- assertTrue("Collection should contain element returned by " +
- "its iterator", collection.contains(next));
- list.add(next);
- }
- try {
- it1.next();
- fail("iterator.next() should raise NoSuchElementException " +
- "after it finishes");
- } catch (NoSuchElementException e) {
- // expected
- }
- // make sure nothing has changed after non-modification
- verifyAll();
- }
-
-
- /**
- * Tests removals from {@link Collection#iterator()}.
- */
- public void testCollectionIteratorRemove() {
- if (!isRemoveSupported()) return;
-
- resetEmpty();
- try {
- collection.iterator().remove();
- fail("New iterator.remove should raise IllegalState");
- } catch (IllegalStateException e) {
- // expected
- }
- verifyAll();
-
- try {
- Iterator iter = collection.iterator();
- iter.hasNext();
- iter.remove();
- fail("New iterator.remove should raise IllegalState " +
- "even after hasNext");
- } catch (IllegalStateException e) {
- // expected
- }
- verifyAll();
-
- resetFull();
- int size = collection.size();
- Iterator iter = collection.iterator();
- while (iter.hasNext()) {
- Object o = iter.next();
- // TreeMap reuses the Map Entry, so the verify below fails
- // Clone it here if necessary
- if (o instanceof Map.Entry) {
- o = cloneMapEntry((Map.Entry) o);
- }
- iter.remove();
-
- // if the elements aren't distinguishable, we can just remove a
- // matching element from the confirmed collection and verify
- // contents are still the same. Otherwise, we don't have the
- // ability to distinguish the elements and determine which to
- // remove from the confirmed collection (in which case, we don't
- // verify because we don't know how).
- //
- // see areEqualElementsDistinguishable()
- if(!areEqualElementsDistinguishable()) {
- confirmed.remove(o);
- verifyAll();
- }
-
- size--;
- assertEquals("Collection should shrink by one after " +
- "iterator.remove", size, collection.size());
- }
- assertTrue("Collection should be empty after iterator purge",
- collection.isEmpty());
-
- resetFull();
- iter = collection.iterator();
- iter.next();
- iter.remove();
- try {
- iter.remove();
- fail("Second iter.remove should raise IllegalState");
- } catch (IllegalStateException e) {
- // expected
- }
- }
-
-
- /**
- * Tests {@link Collection#remove(Object)}.
- */
- public void testCollectionRemove() {
- if (!isRemoveSupported()) return;
-
- resetEmpty();
- Object[] elements = getFullElements();
- for (int i = 0; i < elements.length; i++) {
- assertTrue("Shouldn't remove nonexistent element",
- !collection.remove(elements[i]));
- verifyAll();
- }
-
- Object[] other = getOtherElements();
-
- resetFull();
- for (int i = 0; i < other.length; i++) {
- assertTrue("Shouldn't remove nonexistent other element",
- !collection.remove(other[i]));
- verifyAll();
- }
-
- int size = collection.size();
- for (int i = 0; i < elements.length; i++) {
- resetFull();
- assertTrue("Collection should remove extant element: " + elements[i],
- collection.remove(elements[i]));
-
- // if the elements aren't distinguishable, we can just remove a
- // matching element from the confirmed collection and verify
- // contents are still the same. Otherwise, we don't have the
- // ability to distinguish the elements and determine which to
- // remove from the confirmed collection (in which case, we don't
- // verify because we don't know how).
- //
- // see areEqualElementsDistinguishable()
- if(!areEqualElementsDistinguishable()) {
- confirmed.remove(elements[i]);
- verifyAll();
- }
-
- assertEquals("Collection should shrink after remove",
- size - 1, collection.size());
- }
- }
-
-
- /**
- * Tests {@link Collection#removeAll(Collection)}.
- */
- public void testCollectionRemoveAll() {
- if (!isRemoveSupported()) return;
-
- resetEmpty();
- assertTrue("Emtpy collection removeAll should return false for " +
- "empty input",
- !collection.removeAll(Collections.EMPTY_SET));
- verifyAll();
-
- assertTrue("Emtpy collection removeAll should return false for " +
- "nonempty input",
- !collection.removeAll(new ArrayList(collection)));
- verifyAll();
-
- resetFull();
- assertTrue("Full collection removeAll should return false for " +
- "empty input",
- !collection.removeAll(Collections.EMPTY_SET));
- verifyAll();
-
- assertTrue("Full collection removeAll should return false for other elements",
- !collection.removeAll(Arrays.asList(getOtherElements())));
- verifyAll();
-
- assertTrue("Full collection removeAll should return true for full elements",
- collection.removeAll(new HashSet(collection)));
- confirmed.removeAll(new HashSet(confirmed));
- verifyAll();
-
- resetFull();
- int size = collection.size();
- int min = (getFullElements().length < 2 ? 0 : 2);
- int max = (getFullElements().length == 1 ? 1 :
- (getFullElements().length <= 5 ? getFullElements().length - 1 : 5));
- Collection all = Arrays.asList(getFullElements()).subList(min, max);
- assertTrue("Full collection removeAll should work",
- collection.removeAll(all));
- confirmed.removeAll(all);
- verifyAll();
-
- assertTrue("Collection should shrink after removeAll",
- collection.size() < size);
- Iterator iter = all.iterator();
- while (iter.hasNext()) {
- assertTrue("Collection shouldn't contain removed element",
- !collection.contains(iter.next()));
- }
- }
-
-
- /**
- * Tests {@link Collection#retainAll(Collection)}.
- */
- public void testCollectionRetainAll() {
- if (!isRemoveSupported()) return;
-
- resetEmpty();
- List elements = Arrays.asList(getFullElements());
- List other = Arrays.asList(getOtherElements());
-
- assertTrue("Empty retainAll() should return false",
- !collection.retainAll(Collections.EMPTY_SET));
- verifyAll();
-
- assertTrue("Empty retainAll() should return false",
- !collection.retainAll(elements));
- verifyAll();
-
- resetFull();
- assertTrue("Collection should change from retainAll empty",
- collection.retainAll(Collections.EMPTY_SET));
- confirmed.retainAll(Collections.EMPTY_SET);
- verifyAll();
-
- resetFull();
- assertTrue("Collection changed from retainAll other",
- collection.retainAll(other));
- confirmed.retainAll(other);
- verifyAll();
-
- resetFull();
- int size = collection.size();
- assertTrue("Collection shouldn't change from retainAll elements",
- !collection.retainAll(elements));
- verifyAll();
- assertEquals("Collection size shouldn't change", size,
- collection.size());
-
- if (getFullElements().length > 1) {
- resetFull();
- size = collection.size();
- int min = (getFullElements().length < 2 ? 0 : 2);
- int max = (getFullElements().length <= 5 ? getFullElements().length - 1 : 5);
- assertTrue("Collection should changed by partial retainAll",
- collection.retainAll(elements.subList(min, max)));
- confirmed.retainAll(elements.subList(min, max));
- verifyAll();
-
- Iterator iter = collection.iterator();
- while (iter.hasNext()) {
- assertTrue("Collection only contains retained element",
- elements.subList(min, max).contains(iter.next()));
- }
- }
-
- resetFull();
- HashSet set = new HashSet(elements);
- size = collection.size();
- assertTrue("Collection shouldn't change from retainAll without " +
- "duplicate elements", !collection.retainAll(set));
- verifyAll();
- assertEquals("Collection size didn't change from nonduplicate " +
- "retainAll", size, collection.size());
- }
-
-
- /**
- * Tests {@link Collection#size()}.
- */
- public void testCollectionSize() {
- resetEmpty();
- assertEquals("Size of new Collection is 0.", 0, collection.size());
-
- resetFull();
- assertTrue("Size of full collection should be greater than zero",
- collection.size() > 0);
- }
-
-
- /**
- * Tests {@link Collection#toArray()}.
- */
- public void testCollectionToArray() {
- resetEmpty();
- assertEquals("Empty Collection should return empty array for toArray",
- 0, collection.toArray().length);
-
- resetFull();
- Object[] array = collection.toArray();
- assertEquals("Full collection toArray should be same size as " +
- "collection", array.length, collection.size());
- Object[] confirmedArray = confirmed.toArray();
- assertEquals("length of array from confirmed collection should " +
- "match the length of the collection's array",
- confirmedArray.length, array.length);
- boolean[] matched = new boolean[array.length];
-
- for (int i = 0; i < array.length; i++) {
- assertTrue("Collection should contain element in toArray",
- collection.contains(array[i]));
-
- boolean match = false;
- // find a match in the confirmed array
- for(int j = 0; j < array.length; j++) {
- // skip already matched
- if(matched[j]) continue;
- if(array[i] == confirmedArray[j] ||
- (array[i] != null && array[i].equals(confirmedArray[j]))) {
- matched[j] = true;
- match = true;
- break;
- }
- }
- if(!match) {
- fail("element " + i + " in returned array should be found " +
- "in the confirmed collection's array");
- }
- }
- for(int i = 0; i < matched.length; i++) {
- assertEquals("Collection should return all its elements in " +
- "toArray", true, matched[i]);
- }
- }
-
-
- /**
- * Tests {@link Collection#toArray(Object[])}.
- */
- public void testCollectionToArray2() {
- resetEmpty();
- Object[] a = new Object[] { new Object(), null, null };
- Object[] array = collection.toArray(a);
- assertEquals("Given array shouldn't shrink", array, a);
- assertEquals("Last element should be set to null", a[0], null);
- verifyAll();
-
- resetFull();
- try {
- array = collection.toArray(new Void[0]);
- fail("toArray(new Void[0]) should raise ArrayStore");
- } catch (ArrayStoreException e) {
- // expected
- }
- verifyAll();
-
- try {
- array = collection.toArray(null);
- fail("toArray(null) should raise NPE");
- } catch (NullPointerException e) {
- // expected
- }
- verifyAll();
-
- array = collection.toArray(new Object[0]);
- a = collection.toArray();
- assertEquals("toArrays should be equal",
- Arrays.asList(array), Arrays.asList(a));
-
- // Figure out if they're all the same class
- // TODO: It'd be nicer to detect a common superclass
- HashSet classes = new HashSet();
- for (int i = 0; i < array.length; i++) {
- classes.add((array[i] == null) ? null : array[i].getClass());
- }
- if (classes.size() > 1) return;
-
- Class cl = (Class)classes.iterator().next();
- if (Map.Entry.class.isAssignableFrom(cl)) { // check needed for protective cases like Predicated/Unmod map entrySet
- cl = Map.Entry.class;
- }
- a = (Object[])Array.newInstance(cl, 0);
- array = collection.toArray(a);
- assertEquals("toArray(Object[]) should return correct array type",
- a.getClass(), array.getClass());
- assertEquals("type-specific toArrays should be equal",
- Arrays.asList(array),
- Arrays.asList(collection.toArray()));
- verifyAll();
- }
-
-
- /**
- * Tests {@code toString} on a collection.
- */
- public void testCollectionToString() {
- resetEmpty();
- assertTrue("toString shouldn't return null",
- collection.toString() != null);
-
- resetFull();
- assertTrue("toString shouldn't return null",
- collection.toString() != null);
- }
-
-
- /**
- * If isRemoveSupported() returns false, tests to see that remove
- * operations raise an UnsupportedOperationException.
- */
- public void testUnsupportedRemove() {
- if (isRemoveSupported()) return;
-
- resetEmpty();
- try {
- collection.clear();
- fail("clear should raise UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
- // expected
- }
- verifyAll();
-
- try {
- collection.remove(null);
- fail("remove should raise UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
- // expected
- }
- verifyAll();
-
- try {
- collection.removeAll(null);
- fail("removeAll should raise UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
- // expected
- }
- verifyAll();
-
- try {
- collection.retainAll(null);
- fail("removeAll should raise UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
- // expected
- }
- verifyAll();
-
- resetFull();
- try {
- Iterator iterator = collection.iterator();
- iterator.next();
- iterator.remove();
- fail("iterator.remove should raise UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
- // expected
- }
- verifyAll();
-
- }
-
-
- /**
- * Tests that the collection's iterator is fail-fast.
- */
- public void testCollectionIteratorFailFast() {
- if (!isFailFastSupported()) return;
-
- if (isAddSupported()) {
- resetFull();
- try {
- Iterator iter = collection.iterator();
- Object o = getOtherElements()[0];
- collection.add(o);
- confirmed.add(o);
- iter.next();
- fail("next after add should raise ConcurrentModification");
- } catch (ConcurrentModificationException e) {
- // expected
- }
- verifyAll();
-
- resetFull();
- try {
- Iterator iter = collection.iterator();
- collection.addAll(Arrays.asList(getOtherElements()));
- confirmed.addAll(Arrays.asList(getOtherElements()));
- iter.next();
- fail("next after addAll should raise ConcurrentModification");
- } catch (ConcurrentModificationException e) {
- // expected
- }
- verifyAll();
- }
-
- if (!isRemoveSupported()) return;
-
- resetFull();
- try {
- Iterator iter = collection.iterator();
- collection.clear();
- iter.next();
- fail("next after clear should raise ConcurrentModification");
- } catch (ConcurrentModificationException e) {
- // expected
- } catch (NoSuchElementException e) {
- // (also legal given spec)
- }
-
- resetFull();
- try {
- Iterator iter = collection.iterator();
- collection.remove(getFullElements()[0]);
- iter.next();
- fail("next after remove should raise ConcurrentModification");
- } catch (ConcurrentModificationException e) {
- // expected
- }
-
- resetFull();
- try {
- Iterator iter = collection.iterator();
- List sublist = Arrays.asList(getFullElements()).subList(2,5);
- collection.removeAll(sublist);
- iter.next();
- fail("next after removeAll should raise ConcurrentModification");
- } catch (ConcurrentModificationException e) {
- // expected
- }
-
- resetFull();
- try {
- Iterator iter = collection.iterator();
- List sublist = Arrays.asList(getFullElements()).subList(2,5);
- collection.retainAll(sublist);
- iter.next();
- fail("next after retainAll should raise ConcurrentModification");
- } catch (ConcurrentModificationException e) {
- // expected
- }
- }
-
- /*
- public void testSerializeDeserializeThenCompare() throws Exception {
- Object obj = makeCollection();
- if (obj instanceof Serializable && isTestSerialization()) {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(buffer);
- out.writeObject(obj);
- out.close();
-
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
- Object dest = in.readObject();
- in.close();
- if (isEqualsCheckable()) {
- assertEquals("obj != deserialize(serialize(obj)) - EMPTY Collection", obj, dest);
- }
- }
- obj = makeFullCollection();
- if (obj instanceof Serializable && isTestSerialization()) {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(buffer);
- out.writeObject(obj);
- out.close();
-
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
- Object dest = in.readObject();
- in.close();
- if (isEqualsCheckable()) {
- assertEquals("obj != deserialize(serialize(obj)) - FULL Collection", obj, dest);
- }
- }
- }
- */
-
-}
+/*
+ * Copyright (c) 2008, Harald Kuhr
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed 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 com.twelvemonkeys.util;
+
+import org.junit.Test;
+
+import java.lang.reflect.Array;
+import java.util.*;
+
+import static org.junit.Assert.*;
+
+/**
+ * Abstract test class for {@link java.util.Collection} methods and contracts.
+ *
+ * You should create a concrete subclass of this class to test any custom
+ * {@link Collection} implementation. At minimum, you'll have to
+ * implement the {@link #makeCollection()} method. You might want to
+ * override some of the additional public methods as well:
+ *
+ * Element Population Methods
+ *
+ * Override these if your collection restricts what kind of elements are
+ * allowed (for instance, if {@code null} is not permitted):
+ *
+ *
{@link #getFullElements()}
+ *
{@link #getOtherElements()}
+ *
+ *
+ * Supported Operation Methods
+ *
+ * Override these if your collection doesn't support certain operations:
+ *
+ *
{@link #isAddSupported()}
+ *
{@link #isRemoveSupported()}
+ *
{@link #areEqualElementsDistinguishable()}
+ *
{@link #isNullSupported()}
+ *
{@link #isFailFastSupported()}
+ *
+ *
+ * Fixture Methods
+ *
+ * Fixtures are used to verify that the the operation results in correct state
+ * for the collection. Basically, the operation is performed against your
+ * collection implementation, and an identical operation is performed against a
+ * confirmed collection implementation. A confirmed collection
+ * implementation is something like {@code java.util.ArrayList}, which is
+ * known to conform exactly to its collection interface's contract. After the
+ * operation takes place on both your collection implementation and the
+ * confirmed collection implementation, the two collections are compared to see
+ * if their state is identical. The comparison is usually much more involved
+ * than a simple {@code equals} test. This verification is used to ensure
+ * proper modifications are made along with ensuring that the collection does
+ * not change when read-only modifications are made.
+ *
+ * The {@link #collection} field holds an instance of your collection
+ * implementation; the {@link #confirmed} field holds an instance of the
+ * confirmed collection implementation. The {@link #resetEmpty()} and
+ * {@link #resetFull()} methods set these fields to empty or full collections,
+ * so that tests can proceed from a known state.
+ *
+ * After a modification operation to both {@link #collection} and
+ * {@link #confirmed}, the {@link #verifyAll()} method is invoked to compare
+ * the results. You may want to override {@link # verifyAll ()} to perform
+ * additional verifications. For instance, when testing the collection
+ * views of a map, {@link AbstractTestMap} would override {@link # verifyAll ()} to make
+ * sure the map is changed after the collection view is changed.
+ *
+ * If you're extending this class directly, you will have to provide
+ * implementations for the following:
+ *
+ *
{@link #makeConfirmedCollection()}
+ *
{@link #makeConfirmedFullCollection()}
+ *
+ *
+ * Those methods should provide a confirmed collection implementation
+ * that's compatible with your collection implementation.
+ *
+ * If you're extending {@link AbstractTestList}, {@link SetAbstractTest},
+ * or {@link AbstractTestBag}, you probably don't have to worry about the
+ * above methods, because those three classes already override the methods
+ * to provide standard JDK confirmed collections.
+ *
+ * Other notes
+ *
+ * If your {@link Collection} fails one of these tests by design,
+ * you may still use this base set of cases. Simply override the
+ * test case (method) your {@link Collection} fails.
+ *
+ * @version $Revision: #2 $ $Date: 2008/07/15 $
+ *
+ * @author Rodney Waldhoff
+ * @author Paul Jack
+ * @author Michael A. Smith
+ * @author Neil O'Toole
+ * @author Stephen Colebourne
+ */
+public abstract class CollectionAbstractTest extends ObjectAbstractTest {
+
+ //
+ // NOTE:
+ //
+ // Collection doesn't define any semantics for equals, and recommends you
+ // use reference-based default behavior of Object.equals. (And a test for
+ // that already exists in ObjectAbstractTestCase). Tests for equality of lists, sets
+ // and bags will have to be written in test subclasses. Thus, there is no
+ // tests on Collection.equals nor any for Collection.hashCode.
+ //
+
+
+ // These fields are used by reset() and verifyAll(), and any test
+ // method that tests a modification.
+
+ /**
+ * A collection instance that will be used for testing.
+ */
+ public Collection collection;
+
+ /**
+ * Confirmed collection. This is an instance of a collection that is
+ * confirmed to conform exactly to the java.util.Collection contract.
+ * Modification operations are tested by performing a mod on your
+ * collection, performing the exact same mod on an equivalent confirmed
+ * collection, and then calling verifyAll() to make sure your collection
+ * still matches the confirmed collection.
+ */
+ public Collection confirmed;
+
+ //-----------------------------------------------------------------------
+ /**
+ * Specifies whether equal elements in the collection are, in fact,
+ * distinguishable with information not readily available. That is, if a
+ * particular value is to be removed from the collection, then there is
+ * one and only one value that can be removed, even if there are other
+ * elements which are equal to it.
+ *
+ *
In most collection cases, elements are not distinguishable (equal is
+ * equal), thus this method defaults to return false. In some cases,
+ * however, they are. For example, the collection returned from the map's
+ * values() collection view are backed by the map, so while there may be
+ * two values that are equal, their associated keys are not. Since the
+ * keys are distinguishable, the values are.
+ *
+ *
This flag is used to skip some verifications for iterator.remove()
+ * where it is impossible to perform an equivalent modification on the
+ * confirmed collection because it is not possible to determine which
+ * value in the confirmed collection to actually remove. Tests that
+ * override the default (i.e. where equal elements are distinguishable),
+ * should provide additional tests on iterator.remove() to make sure the
+ * proper elements are removed when remove() is called on the iterator.
+ **/
+ public boolean areEqualElementsDistinguishable() {
+ return false;
+ }
+
+ /**
+ * Returns true if the collections produced by
+ * {@link #makeCollection()} and {@link #makeFullCollection()}
+ * support the {@code add} and {@code addAll}
+ * operations.
+ * Default implementation returns true. Override if your collection
+ * class does not support add or addAll.
+ */
+ public boolean isAddSupported() {
+ return true;
+ }
+
+ /**
+ * Returns true if the collections produced by
+ * {@link #makeCollection()} and {@link #makeFullCollection()}
+ * support the {@code remove}, {@code removeAll},
+ * {@code retainAll}, {@code clear} and
+ * {@code iterator().remove()} methods.
+ * Default implementation returns true. Override if your collection
+ * class does not support removal operations.
+ */
+ public boolean isRemoveSupported() {
+ return true;
+ }
+
+ /**
+ * Returns true to indicate that the collection supports holding null.
+ * The default implementation returns true;
+ */
+ public boolean isNullSupported() {
+ return true;
+ }
+
+ /**
+ * Returns true to indicate that the collection supports fail fast iterators.
+ * The default implementation returns true;
+ */
+ public boolean isFailFastSupported() {
+ return false;
+ }
+
+ /**
+ * Returns true to indicate that the collection supports equals() comparisons.
+ * This implementation returns false;
+ */
+ public boolean isEqualsCheckable() {
+ return false;
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Verifies that {@link #collection} and {@link #confirmed} have
+ * identical state.
+ */
+ public void verifyAll() {
+ int confirmedSize = confirmed.size();
+ assertEquals("Collection size should match confirmed collection's",
+ confirmedSize, collection.size());
+ assertEquals("Collection isEmpty() result should match confirmed " +
+ " collection's",
+ confirmed.isEmpty(), collection.isEmpty());
+
+ // verify the collections are the same by attempting to match each
+ // object in the collection and confirmed collection. To account for
+ // duplicates and differing orders, each confirmed element is copied
+ // into an array and a flag is maintained for each element to determine
+ // whether it has been matched once and only once. If all elements in
+ // the confirmed collection are matched once and only once and there
+ // aren't any elements left to be matched in the collection,
+ // verification is a success.
+
+ // copy each collection value into an array
+ Object[] confirmedValues = new Object[confirmedSize];
+
+ Iterator iter;
+
+ iter = confirmed.iterator();
+ int pos = 0;
+ while(iter.hasNext()) {
+ confirmedValues[pos++] = iter.next();
+ }
+
+ // allocate an array of boolean flags for tracking values that have
+ // been matched once and only once.
+ boolean[] matched = new boolean[confirmedSize];
+
+ // now iterate through the values of the collection and try to match
+ // the value with one in the confirmed array.
+ iter = collection.iterator();
+ while(iter.hasNext()) {
+ Object o = iter.next();
+ boolean match = false;
+ for(int i = 0; i < confirmedSize; i++) {
+ if(matched[i]) {
+ // skip values already matched
+ continue;
+ }
+ if(o == confirmedValues[i] ||
+ (o != null && o.equals(confirmedValues[i]))) {
+ // values matched
+ matched[i] = true;
+ match = true;
+ break;
+ }
+ }
+ // no match found!
+ if(!match) {
+ fail("Collection should not contain a value that the " +
+ "confirmed collection does not have: " + o +
+ "\nTest: " + collection + "\nReal: " + confirmed);
+ }
+ }
+
+ // make sure there aren't any unmatched values
+ for(int i = 0; i < confirmedSize; i++) {
+ if(!matched[i]) {
+ // the collection didn't match all the confirmed values
+ fail("Collection should contain all values that are in the confirmed collection" +
+ "\nTest: " + collection + "\nReal: " + confirmed);
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Resets the {@link #collection} and {@link #confirmed} fields to empty
+ * collections. Invoke this method before performing a modification
+ * test.
+ */
+ public void resetEmpty() {
+ this.collection = makeCollection();
+ this.confirmed = makeConfirmedCollection();
+ }
+
+ /**
+ * Resets the {@link #collection} and {@link #confirmed} fields to full
+ * collections. Invoke this method before performing a modification
+ * test.
+ */
+ public void resetFull() {
+ this.collection = makeFullCollection();
+ this.confirmed = makeConfirmedFullCollection();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a confirmed empty collection.
+ * For instance, an {@link java.util.ArrayList} for lists or a
+ * {@link java.util.HashSet} for sets.
+ *
+ * @return a confirmed empty collection
+ */
+ public abstract Collection makeConfirmedCollection();
+
+ /**
+ * Returns a confirmed full collection.
+ * For instance, an {@link java.util.ArrayList} for lists or a
+ * {@link java.util.HashSet} for sets. The returned collection
+ * should contain the elements returned by {@link #getFullElements()}.
+ *
+ * @return a confirmed full collection
+ */
+ public abstract Collection makeConfirmedFullCollection();
+
+ /**
+ * Return a new, empty {@link Collection} to be used for testing.
+ */
+ public abstract Collection makeCollection();
+
+ /**
+ * Returns a full collection to be used for testing. The collection
+ * returned by this method should contain every element returned by
+ * {@link #getFullElements()}. The default implementation, in fact,
+ * simply invokes {@code addAll} on an empty collection with
+ * the results of {@link #getFullElements()}. Override this default
+ * if your collection doesn't support addAll.
+ */
+ public Collection makeFullCollection() {
+ Collection c = makeCollection();
+ c.addAll(Arrays.asList(getFullElements()));
+ return c;
+ }
+
+ /**
+ * Returns an empty collection for Object tests.
+ */
+ public Object makeObject() {
+ return makeCollection();
+ }
+
+ /**
+ * Creates a new Map Entry that is independent of the first and the map.
+ */
+ public Map.Entry cloneMapEntry(Map.Entry entry) {
+ HashMap map = new HashMap();
+ map.put(entry.getKey(), entry.getValue());
+ return (Map.Entry) map.entrySet().iterator().next();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns an array of objects that are contained in a collection
+ * produced by {@link #makeFullCollection()}. Every element in the
+ * returned array must be an element in a full collection.
+ * The default implementation returns a heterogenous array of
+ * objects with some duplicates. null is added if allowed.
+ * Override if you require specific testing elements. Note that if you
+ * override {@link #makeFullCollection()}, you must override
+ * this method to reflect the contents of a full collection.
+ */
+ public Object[] getFullElements() {
+ if (isNullSupported()) {
+ ArrayList list = new ArrayList();
+ list.addAll(Arrays.asList(getFullNonNullElements()));
+ list.add(4, null);
+ return list.toArray();
+ } else {
+ return (Object[]) getFullNonNullElements().clone();
+ }
+ }
+
+ /**
+ * Returns an array of elements that are not contained in a
+ * full collection. Every element in the returned array must
+ * not exist in a collection returned by {@link #makeFullCollection()}.
+ * The default implementation returns a heterogenous array of elements
+ * without null. Note that some of the tests add these elements
+ * to an empty or full collection, so if your collection restricts
+ * certain kinds of elements, you should override this method.
+ */
+ public Object[] getOtherElements() {
+ return getOtherNonNullElements();
+ }
+
+ //-----------------------------------------------------------------------
+ /**
+ * Returns a list of elements suitable for return by
+ * {@link #getFullElements()}. The array returned by this method
+ * does not include null, but does include a variety of objects
+ * of different types. Override getFullElements to return
+ * the results of this method if your collection does not support
+ * the null element.
+ */
+ public Object[] getFullNonNullElements() {
+ return new Object[] {
+ new String(""),
+ new String("One"),
+ new Integer(2),
+ "Three",
+ new Integer(4),
+ "One",
+ new Double(5),
+ new Float(6),
+ "Seven",
+ "Eight",
+ new String("Nine"),
+ new Integer(10),
+ new Short((short)11),
+ new Long(12),
+ "Thirteen",
+ "14",
+ "15",
+ new Byte((byte)16)
+ };
+ }
+
+ /**
+ * Returns the default list of objects returned by
+ * {@link #getOtherElements()}. Includes many objects
+ * of different types.
+ */
+ public Object[] getOtherNonNullElements() {
+ return new Object[] {
+ new Integer(0),
+ new Float(0),
+ new Double(0),
+ "Zero",
+ new Short((short)0),
+ new Byte((byte)0),
+ new Long(0),
+ new Character('\u0000'),
+ "0"
+ };
+ }
+
+ /**
+ * Returns a list of string elements suitable for return by
+ * {@link #getFullElements()}. Override getFullElements to return
+ * the results of this method if your collection does not support
+ * heterogenous elements or the null element.
+ */
+ public Object[] getFullNonNullStringElements() {
+ return new Object[] {
+ "If","the","dull","substance","of","my","flesh","were","thought",
+ "Injurious","distance","could","not","stop","my","way",
+ };
+ }
+
+ /**
+ * Returns a list of string elements suitable for return by
+ * {@link #getOtherElements()}. Override getOtherElements to return
+ * the results of this method if your collection does not support
+ * heterogenous elements or the null element.
+ */
+ public Object[] getOtherNonNullStringElements() {
+ return new Object[] {
+ "For","then","despite",/* of */"space","I","would","be","brought",
+ "From","limits","far","remote","where","thou","dost","stay"
+ };
+ }
+
+ // Tests
+ //-----------------------------------------------------------------------
+ /**
+ * Tests {@link Collection#add(Object)}.
+ */
+ @Test
+ public void testCollectionAdd() {
+ if (!isAddSupported()) return;
+
+ Object[] elements = getFullElements();
+ for (int i = 0; i < elements.length; i++) {
+ resetEmpty();
+ boolean r = collection.add(elements[i]);
+ confirmed.add(elements[i]);
+ verifyAll();
+ assertTrue("Empty collection changed after add", r);
+ assertEquals("Collection size is 1 after first add", 1, collection.size());
+ }
+
+ resetEmpty();
+ int size = 0;
+ for (int i = 0; i < elements.length; i++) {
+ boolean r = collection.add(elements[i]);
+ confirmed.add(elements[i]);
+ verifyAll();
+ if (r) size++;
+ assertEquals("Collection size should grow after add",
+ size, collection.size());
+ assertTrue("Collection should contain added element",
+ collection.contains(elements[i]));
+ }
+ }
+
+
+ /**
+ * Tests {@link Collection#addAll(Collection)}.
+ */
+ @Test
+ public void testCollectionAddAll() {
+ if (!isAddSupported()) return;
+
+ resetEmpty();
+ Object[] elements = getFullElements();
+ boolean r = collection.addAll(Arrays.asList(elements));
+ confirmed.addAll(Arrays.asList(elements));
+ verifyAll();
+ assertTrue("Empty collection should change after addAll", r);
+ for (int i = 0; i < elements.length; i++) {
+ assertTrue("Collection should contain added element",
+ collection.contains(elements[i]));
+ }
+
+ resetFull();
+ int size = collection.size();
+ elements = getOtherElements();
+ r = collection.addAll(Arrays.asList(elements));
+ confirmed.addAll(Arrays.asList(elements));
+ verifyAll();
+ assertTrue("Full collection should change after addAll", r);
+ for (int i = 0; i < elements.length; i++) {
+ assertTrue("Full collection should contain added element",
+ collection.contains(elements[i]));
+ }
+ assertEquals("Size should increase after addAll",
+ size + elements.length, collection.size());
+
+ resetFull();
+ size = collection.size();
+ r = collection.addAll(Arrays.asList(getFullElements()));
+ confirmed.addAll(Arrays.asList(getFullElements()));
+ verifyAll();
+ if (r) {
+ assertTrue("Size should increase if addAll returns true",
+ size < collection.size());
+ } else {
+ assertEquals("Size should not change if addAll returns false",
+ size, collection.size());
+ }
+ }
+
+
+ /**
+ * If {@link #isAddSupported()} returns false, tests that add operations
+ * raise UnsupportedOperationException.
+ */
+ @Test
+ public void testUnsupportedAdd() {
+ if (isAddSupported()) return;
+
+ resetEmpty();
+ try {
+ collection.add(new Object());
+ fail("Emtpy collection should not support add.");
+ } catch (UnsupportedOperationException e) {
+ // expected
+ }
+ // make sure things didn't change even if the expected exception was
+ // thrown.
+ verifyAll();
+
+ try {
+ collection.addAll(Arrays.asList(getFullElements()));
+ fail("Emtpy collection should not support addAll.");
+ } catch (UnsupportedOperationException e) {
+ // expected
+ }
+ // make sure things didn't change even if the expected exception was
+ // thrown.
+ verifyAll();
+
+ resetFull();
+ try {
+ collection.add(new Object());
+ fail("Full collection should not support add.");
+ } catch (UnsupportedOperationException e) {
+ // expected
+ }
+ // make sure things didn't change even if the expected exception was
+ // thrown.
+ verifyAll();
+
+ try {
+ collection.addAll(Arrays.asList(getOtherElements()));
+ fail("Full collection should not support addAll.");
+ } catch (UnsupportedOperationException e) {
+ // expected
+ }
+ // make sure things didn't change even if the expected exception was
+ // thrown.
+ verifyAll();
+ }
+
+
+ /**
+ * Test {@link Collection#clear()}.
+ */
+ @Test
+ public void testCollectionClear() {
+ if (!isRemoveSupported()) return;
+
+ resetEmpty();
+ collection.clear(); // just to make sure it doesn't raise anything
+ verifyAll();
+
+ resetFull();
+ collection.clear();
+ confirmed.clear();
+ verifyAll();
+ }
+
+
+ /**
+ * Tests {@link Collection#contains(Object)}.
+ */
+ public void testCollectionContains() {
+ Object[] elements;
+
+ resetEmpty();
+ elements = getFullElements();
+ for(int i = 0; i < elements.length; i++) {
+ assertTrue("Empty collection shouldn't contain element[" + i + "]",
+ !collection.contains(elements[i]));
+ }
+ // make sure calls to "contains" don't change anything
+ verifyAll();
+
+ elements = getOtherElements();
+ for(int i = 0; i < elements.length; i++) {
+ assertTrue("Empty collection shouldn't contain element[" + i + "]",
+ !collection.contains(elements[i]));
+ }
+ // make sure calls to "contains" don't change anything
+ verifyAll();
+
+ resetFull();
+ elements = getFullElements();
+ for(int i = 0; i < elements.length; i++) {
+ assertTrue("Full collection should contain element[" + i + "]",
+ collection.contains(elements[i]));
+ }
+ // make sure calls to "contains" don't change anything
+ verifyAll();
+
+ resetFull();
+ elements = getOtherElements();
+ for(int i = 0; i < elements.length; i++) {
+ assertTrue("Full collection shouldn't contain element",
+ !collection.contains(elements[i]));
+ }
+ }
+
+
+ /**
+ * Tests {@link Collection#containsAll(Collection)}.
+ */
+ @Test
+ public void testCollectionContainsAll() {
+ resetEmpty();
+ Collection col = new HashSet();
+ assertTrue("Every Collection should contain all elements of an " +
+ "empty Collection.", collection.containsAll(col));
+ col.addAll(Arrays.asList(getOtherElements()));
+ assertTrue("Empty Collection shouldn't contain all elements of " +
+ "a non-empty Collection.", !collection.containsAll(col));
+ // make sure calls to "containsAll" don't change anything
+ verifyAll();
+
+ resetFull();
+ assertTrue("Full collection shouldn't contain other elements",
+ !collection.containsAll(col));
+
+ col.clear();
+ col.addAll(Arrays.asList(getFullElements()));
+ assertTrue("Full collection should containAll full elements",
+ collection.containsAll(col));
+ // make sure calls to "containsAll" don't change anything
+ verifyAll();
+
+ int min = (getFullElements().length < 2 ? 0 : 2);
+ int max = (getFullElements().length == 1 ? 1 :
+ (getFullElements().length <= 5 ? getFullElements().length - 1 : 5));
+ col = Arrays.asList(getFullElements()).subList(min, max);
+ assertTrue("Full collection should containAll partial full " +
+ "elements", collection.containsAll(col));
+ assertTrue("Full collection should containAll itself",
+ collection.containsAll(collection));
+ // make sure calls to "containsAll" don't change anything
+ verifyAll();
+
+ col = new ArrayList();
+ col.addAll(Arrays.asList(getFullElements()));
+ col.addAll(Arrays.asList(getFullElements()));
+ assertTrue("Full collection should containAll duplicate full " +
+ "elements", collection.containsAll(col));
+
+ // make sure calls to "containsAll" don't change anything
+ verifyAll();
+ }
+
+ /**
+ * Tests {@link Collection#isEmpty()}.
+ */
+ @Test
+ public void testCollectionIsEmpty() {
+ resetEmpty();
+ assertEquals("New Collection should be empty.",
+ true, collection.isEmpty());
+ // make sure calls to "isEmpty() don't change anything
+ verifyAll();
+
+ resetFull();
+ assertEquals("Full collection shouldn't be empty",
+ false, collection.isEmpty());
+ // make sure calls to "isEmpty() don't change anything
+ verifyAll();
+ }
+
+
+ /**
+ * Tests the read-only functionality of {@link Collection#iterator()}.
+ */
+ @Test
+ public void testCollectionIterator() {
+ resetEmpty();
+ Iterator it1 = collection.iterator();
+ assertEquals("Iterator for empty Collection shouldn't have next.",
+ false, it1.hasNext());
+ try {
+ it1.next();
+ fail("Iterator at end of Collection should throw " +
+ "NoSuchElementException when next is called.");
+ } catch(NoSuchElementException e) {
+ // expected
+ }
+ // make sure nothing has changed after non-modification
+ verifyAll();
+
+ resetFull();
+ it1 = collection.iterator();
+ for (int i = 0; i < collection.size(); i++) {
+ assertTrue("Iterator for full collection should haveNext",
+ it1.hasNext());
+ it1.next();
+ }
+ assertTrue("Iterator should be finished", !it1.hasNext());
+
+ ArrayList list = new ArrayList();
+ it1 = collection.iterator();
+ for (int i = 0; i < collection.size(); i++) {
+ Object next = it1.next();
+ assertTrue("Collection should contain element returned by " +
+ "its iterator", collection.contains(next));
+ list.add(next);
+ }
+ try {
+ it1.next();
+ fail("iterator.next() should raise NoSuchElementException " +
+ "after it finishes");
+ } catch (NoSuchElementException e) {
+ // expected
+ }
+ // make sure nothing has changed after non-modification
+ verifyAll();
+ }
+
+
+ /**
+ * Tests removals from {@link Collection#iterator()}.
+ */
+ @Test
+ public void testCollectionIteratorRemove() {
+ if (!isRemoveSupported()) return;
+
+ resetEmpty();
+ try {
+ collection.iterator().remove();
+ fail("New iterator.remove should raise IllegalState");
+ } catch (IllegalStateException e) {
+ // expected
+ }
+ verifyAll();
+
+ try {
+ Iterator iter = collection.iterator();
+ iter.hasNext();
+ iter.remove();
+ fail("New iterator.remove should raise IllegalState " +
+ "even after hasNext");
+ } catch (IllegalStateException e) {
+ // expected
+ }
+ verifyAll();
+
+ resetFull();
+ int size = collection.size();
+ Iterator iter = collection.iterator();
+ while (iter.hasNext()) {
+ Object o = iter.next();
+ // TreeMap reuses the Map Entry, so the verify below fails
+ // Clone it here if necessary
+ if (o instanceof Map.Entry) {
+ o = cloneMapEntry((Map.Entry) o);
+ }
+ iter.remove();
+
+ // if the elements aren't distinguishable, we can just remove a
+ // matching element from the confirmed collection and verify
+ // contents are still the same. Otherwise, we don't have the
+ // ability to distinguish the elements and determine which to
+ // remove from the confirmed collection (in which case, we don't
+ // verify because we don't know how).
+ //
+ // see areEqualElementsDistinguishable()
+ if(!areEqualElementsDistinguishable()) {
+ confirmed.remove(o);
+ verifyAll();
+ }
+
+ size--;
+ assertEquals("Collection should shrink by one after " +
+ "iterator.remove", size, collection.size());
+ }
+ assertTrue("Collection should be empty after iterator purge",
+ collection.isEmpty());
+
+ resetFull();
+ iter = collection.iterator();
+ iter.next();
+ iter.remove();
+ try {
+ iter.remove();
+ fail("Second iter.remove should raise IllegalState");
+ } catch (IllegalStateException e) {
+ // expected
+ }
+ }
+
+
+ /**
+ * Tests {@link Collection#remove(Object)}.
+ */
+ @Test
+ public void testCollectionRemove() {
+ if (!isRemoveSupported()) return;
+
+ resetEmpty();
+ Object[] elements = getFullElements();
+ for (int i = 0; i < elements.length; i++) {
+ assertTrue("Shouldn't remove nonexistent element",
+ !collection.remove(elements[i]));
+ verifyAll();
+ }
+
+ Object[] other = getOtherElements();
+
+ resetFull();
+ for (int i = 0; i < other.length; i++) {
+ assertTrue("Shouldn't remove nonexistent other element",
+ !collection.remove(other[i]));
+ verifyAll();
+ }
+
+ int size = collection.size();
+ for (int i = 0; i < elements.length; i++) {
+ resetFull();
+ assertTrue("Collection should remove extant element: " + elements[i],
+ collection.remove(elements[i]));
+
+ // if the elements aren't distinguishable, we can just remove a
+ // matching element from the confirmed collection and verify
+ // contents are still the same. Otherwise, we don't have the
+ // ability to distinguish the elements and determine which to
+ // remove from the confirmed collection (in which case, we don't
+ // verify because we don't know how).
+ //
+ // see areEqualElementsDistinguishable()
+ if(!areEqualElementsDistinguishable()) {
+ confirmed.remove(elements[i]);
+ verifyAll();
+ }
+
+ assertEquals("Collection should shrink after remove",
+ size - 1, collection.size());
+ }
+ }
+
+
+ /**
+ * Tests {@link Collection#removeAll(Collection)}.
+ */
+ @Test
+ public void testCollectionRemoveAll() {
+ if (!isRemoveSupported()) return;
+
+ resetEmpty();
+ assertTrue("Emtpy collection removeAll should return false for " +
+ "empty input",
+ !collection.removeAll(Collections.EMPTY_SET));
+ verifyAll();
+
+ assertTrue("Emtpy collection removeAll should return false for " +
+ "nonempty input",
+ !collection.removeAll(new ArrayList(collection)));
+ verifyAll();
+
+ resetFull();
+ assertTrue("Full collection removeAll should return false for " +
+ "empty input",
+ !collection.removeAll(Collections.EMPTY_SET));
+ verifyAll();
+
+ assertTrue("Full collection removeAll should return false for other elements",
+ !collection.removeAll(Arrays.asList(getOtherElements())));
+ verifyAll();
+
+ assertTrue("Full collection removeAll should return true for full elements",
+ collection.removeAll(new HashSet(collection)));
+ confirmed.removeAll(new HashSet(confirmed));
+ verifyAll();
+
+ resetFull();
+ int size = collection.size();
+ int min = (getFullElements().length < 2 ? 0 : 2);
+ int max = (getFullElements().length == 1 ? 1 :
+ (getFullElements().length <= 5 ? getFullElements().length - 1 : 5));
+ Collection all = Arrays.asList(getFullElements()).subList(min, max);
+ assertTrue("Full collection removeAll should work",
+ collection.removeAll(all));
+ confirmed.removeAll(all);
+ verifyAll();
+
+ assertTrue("Collection should shrink after removeAll",
+ collection.size() < size);
+ Iterator iter = all.iterator();
+ while (iter.hasNext()) {
+ assertTrue("Collection shouldn't contain removed element",
+ !collection.contains(iter.next()));
+ }
+ }
+
+
+ /**
+ * Tests {@link Collection#retainAll(Collection)}.
+ */
+ @Test
+ public void testCollectionRetainAll() {
+ if (!isRemoveSupported()) return;
+
+ resetEmpty();
+ List elements = Arrays.asList(getFullElements());
+ List other = Arrays.asList(getOtherElements());
+
+ assertTrue("Empty retainAll() should return false",
+ !collection.retainAll(Collections.EMPTY_SET));
+ verifyAll();
+
+ assertTrue("Empty retainAll() should return false",
+ !collection.retainAll(elements));
+ verifyAll();
+
+ resetFull();
+ assertTrue("Collection should change from retainAll empty",
+ collection.retainAll(Collections.EMPTY_SET));
+ confirmed.retainAll(Collections.EMPTY_SET);
+ verifyAll();
+
+ resetFull();
+ assertTrue("Collection changed from retainAll other",
+ collection.retainAll(other));
+ confirmed.retainAll(other);
+ verifyAll();
+
+ resetFull();
+ int size = collection.size();
+ assertTrue("Collection shouldn't change from retainAll elements",
+ !collection.retainAll(elements));
+ verifyAll();
+ assertEquals("Collection size shouldn't change", size,
+ collection.size());
+
+ if (getFullElements().length > 1) {
+ resetFull();
+ size = collection.size();
+ int min = (getFullElements().length < 2 ? 0 : 2);
+ int max = (getFullElements().length <= 5 ? getFullElements().length - 1 : 5);
+ assertTrue("Collection should changed by partial retainAll",
+ collection.retainAll(elements.subList(min, max)));
+ confirmed.retainAll(elements.subList(min, max));
+ verifyAll();
+
+ Iterator iter = collection.iterator();
+ while (iter.hasNext()) {
+ assertTrue("Collection only contains retained element",
+ elements.subList(min, max).contains(iter.next()));
+ }
+ }
+
+ resetFull();
+ HashSet set = new HashSet(elements);
+ size = collection.size();
+ assertTrue("Collection shouldn't change from retainAll without " +
+ "duplicate elements", !collection.retainAll(set));
+ verifyAll();
+ assertEquals("Collection size didn't change from nonduplicate " +
+ "retainAll", size, collection.size());
+ }
+
+
+ /**
+ * Tests {@link Collection#size()}.
+ */
+ @Test
+ public void testCollectionSize() {
+ resetEmpty();
+ assertEquals("Size of new Collection is 0.", 0, collection.size());
+
+ resetFull();
+ assertTrue("Size of full collection should be greater than zero",
+ collection.size() > 0);
+ }
+
+
+ /**
+ * Tests {@link Collection#toArray()}.
+ */
+ public void testCollectionToArray() {
+ resetEmpty();
+ assertEquals("Empty Collection should return empty array for toArray",
+ 0, collection.toArray().length);
+
+ resetFull();
+ Object[] array = collection.toArray();
+ assertEquals("Full collection toArray should be same size as " +
+ "collection", array.length, collection.size());
+ Object[] confirmedArray = confirmed.toArray();
+ assertEquals("length of array from confirmed collection should " +
+ "match the length of the collection's array",
+ confirmedArray.length, array.length);
+ boolean[] matched = new boolean[array.length];
+
+ for (int i = 0; i < array.length; i++) {
+ assertTrue("Collection should contain element in toArray",
+ collection.contains(array[i]));
+
+ boolean match = false;
+ // find a match in the confirmed array
+ for(int j = 0; j < array.length; j++) {
+ // skip already matched
+ if(matched[j]) continue;
+ if(array[i] == confirmedArray[j] ||
+ (array[i] != null && array[i].equals(confirmedArray[j]))) {
+ matched[j] = true;
+ match = true;
+ break;
+ }
+ }
+ if(!match) {
+ fail("element " + i + " in returned array should be found " +
+ "in the confirmed collection's array");
+ }
+ }
+ for(int i = 0; i < matched.length; i++) {
+ assertEquals("Collection should return all its elements in " +
+ "toArray", true, matched[i]);
+ }
+ }
+
+
+ /**
+ * Tests {@link Collection#toArray(Object[])}.
+ */
+ @Test
+ public void testCollectionToArray2() {
+ resetEmpty();
+ Object[] a = new Object[] { new Object(), null, null };
+ Object[] array = collection.toArray(a);
+ assertEquals("Given array shouldn't shrink", array, a);
+ assertEquals("Last element should be set to null", a[0], null);
+ verifyAll();
+
+ resetFull();
+ try {
+ array = collection.toArray(new Void[0]);
+ fail("toArray(new Void[0]) should raise ArrayStore");
+ } catch (ArrayStoreException e) {
+ // expected
+ }
+ verifyAll();
+
+ try {
+ array = collection.toArray(null);
+ fail("toArray(null) should raise NPE");
+ } catch (NullPointerException e) {
+ // expected
+ }
+ verifyAll();
+
+ array = collection.toArray(new Object[0]);
+ a = collection.toArray();
+ assertEquals("toArrays should be equal",
+ Arrays.asList(array), Arrays.asList(a));
+
+ // Figure out if they're all the same class
+ // TODO: It'd be nicer to detect a common superclass
+ HashSet classes = new HashSet();
+ for (int i = 0; i < array.length; i++) {
+ classes.add((array[i] == null) ? null : array[i].getClass());
+ }
+ if (classes.size() > 1) return;
+
+ Class cl = (Class)classes.iterator().next();
+ if (Map.Entry.class.isAssignableFrom(cl)) { // check needed for protective cases like Predicated/Unmod map entrySet
+ cl = Map.Entry.class;
+ }
+ a = (Object[])Array.newInstance(cl, 0);
+ array = collection.toArray(a);
+ assertEquals("toArray(Object[]) should return correct array type",
+ a.getClass(), array.getClass());
+ assertEquals("type-specific toArrays should be equal",
+ Arrays.asList(array),
+ Arrays.asList(collection.toArray()));
+ verifyAll();
+ }
+
+
+ /**
+ * Tests {@code toString} on a collection.
+ */
+ @Test
+ public void testCollectionToString() {
+ resetEmpty();
+ assertTrue("toString shouldn't return null",
+ collection.toString() != null);
+
+ resetFull();
+ assertTrue("toString shouldn't return null",
+ collection.toString() != null);
+ }
+
+
+ /**
+ * If isRemoveSupported() returns false, tests to see that remove
+ * operations raise an UnsupportedOperationException.
+ */
+ @Test
+ public void testUnsupportedRemove() {
+ if (isRemoveSupported()) return;
+
+ resetEmpty();
+ try {
+ collection.clear();
+ fail("clear should raise UnsupportedOperationException");
+ } catch (UnsupportedOperationException e) {
+ // expected
+ }
+ verifyAll();
+
+ try {
+ collection.remove(null);
+ fail("remove should raise UnsupportedOperationException");
+ } catch (UnsupportedOperationException e) {
+ // expected
+ }
+ verifyAll();
+
+ try {
+ collection.removeAll(null);
+ fail("removeAll should raise UnsupportedOperationException");
+ } catch (UnsupportedOperationException e) {
+ // expected
+ }
+ verifyAll();
+
+ try {
+ collection.retainAll(null);
+ fail("removeAll should raise UnsupportedOperationException");
+ } catch (UnsupportedOperationException e) {
+ // expected
+ }
+ verifyAll();
+
+ resetFull();
+ try {
+ Iterator iterator = collection.iterator();
+ iterator.next();
+ iterator.remove();
+ fail("iterator.remove should raise UnsupportedOperationException");
+ } catch (UnsupportedOperationException e) {
+ // expected
+ }
+ verifyAll();
+
+ }
+
+
+ /**
+ * Tests that the collection's iterator is fail-fast.
+ */
+ @Test
+ public void testCollectionIteratorFailFast() {
+ if (!isFailFastSupported()) return;
+
+ if (isAddSupported()) {
+ resetFull();
+ try {
+ Iterator iter = collection.iterator();
+ Object o = getOtherElements()[0];
+ collection.add(o);
+ confirmed.add(o);
+ iter.next();
+ fail("next after add should raise ConcurrentModification");
+ } catch (ConcurrentModificationException e) {
+ // expected
+ }
+ verifyAll();
+
+ resetFull();
+ try {
+ Iterator iter = collection.iterator();
+ collection.addAll(Arrays.asList(getOtherElements()));
+ confirmed.addAll(Arrays.asList(getOtherElements()));
+ iter.next();
+ fail("next after addAll should raise ConcurrentModification");
+ } catch (ConcurrentModificationException e) {
+ // expected
+ }
+ verifyAll();
+ }
+
+ if (!isRemoveSupported()) return;
+
+ resetFull();
+ try {
+ Iterator iter = collection.iterator();
+ collection.clear();
+ iter.next();
+ fail("next after clear should raise ConcurrentModification");
+ } catch (ConcurrentModificationException e) {
+ // expected
+ } catch (NoSuchElementException e) {
+ // (also legal given spec)
+ }
+
+ resetFull();
+ try {
+ Iterator iter = collection.iterator();
+ collection.remove(getFullElements()[0]);
+ iter.next();
+ fail("next after remove should raise ConcurrentModification");
+ } catch (ConcurrentModificationException e) {
+ // expected
+ }
+
+ resetFull();
+ try {
+ Iterator iter = collection.iterator();
+ List sublist = Arrays.asList(getFullElements()).subList(2,5);
+ collection.removeAll(sublist);
+ iter.next();
+ fail("next after removeAll should raise ConcurrentModification");
+ } catch (ConcurrentModificationException e) {
+ // expected
+ }
+
+ resetFull();
+ try {
+ Iterator iter = collection.iterator();
+ List sublist = Arrays.asList(getFullElements()).subList(2,5);
+ collection.retainAll(sublist);
+ iter.next();
+ fail("next after retainAll should raise ConcurrentModification");
+ } catch (ConcurrentModificationException e) {
+ // expected
+ }
+ }
+
+ /*
+ @Test
+ public void testSerializeDeserializeThenCompare() throws Exception {
+ Object obj = makeCollection();
+ if (obj instanceof Serializable && isTestSerialization()) {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(buffer);
+ out.writeObject(obj);
+ out.close();
+
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
+ Object dest = in.readObject();
+ in.close();
+ if (isEqualsCheckable()) {
+ assertEquals("obj != deserialize(serialize(obj)) - EMPTY Collection", obj, dest);
+ }
+ }
+ obj = makeFullCollection();
+ if (obj instanceof Serializable && isTestSerialization()) {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(buffer);
+ out.writeObject(obj);
+ out.close();
+
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
+ Object dest = in.readObject();
+ in.close();
+ if (isEqualsCheckable()) {
+ assertEquals("obj != deserialize(serialize(obj)) - FULL Collection", obj, dest);
+ }
+ }
+ }
+ */
+
+}
diff --git a/common/common-lang/src/test/java/com/twelvemonkeys/util/CollectionUtilTest.java b/common/common-lang/src/test/java/com/twelvemonkeys/util/CollectionUtilTest.java
index 948cdbc2..ca3ae856 100644
--- a/common/common-lang/src/test/java/com/twelvemonkeys/util/CollectionUtilTest.java
+++ b/common/common-lang/src/test/java/com/twelvemonkeys/util/CollectionUtilTest.java
@@ -4,26 +4,28 @@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name "TwelveMonkeys" nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.twelvemonkeys.util;
@@ -34,7 +36,6 @@ import org.junit.Test;
import java.util.*;
import static org.junit.Assert.*;
-import static org.junit.Assert.assertEquals;
/**
* CollectionUtilTest
diff --git a/common/common-lang/src/test/java/com/twelvemonkeys/util/LRUMapTestCase.java b/common/common-lang/src/test/java/com/twelvemonkeys/util/LRUMapTest.java
similarity index 76%
rename from common/common-lang/src/test/java/com/twelvemonkeys/util/LRUMapTestCase.java
rename to common/common-lang/src/test/java/com/twelvemonkeys/util/LRUMapTest.java
index 91d0f564..bfe47d1c 100755
--- a/common/common-lang/src/test/java/com/twelvemonkeys/util/LRUMapTestCase.java
+++ b/common/common-lang/src/test/java/com/twelvemonkeys/util/LRUMapTest.java
@@ -1,181 +1,221 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation
- *
- * Licensed 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 com.twelvemonkeys.util;
-
-import java.util.*;
-
-/**
- * Tests LRUMap.
- *
- * @version $Revision: #2 $ $Date: 2008/07/15 $
- *
- * @author James Strachan
- * @author Morgan Delagrange
- * @author Stephen Colebourne
- */
-public class LRUMapTestCase extends LinkedMapTestCase {
-
- public boolean isGetStructuralModify() {
- return true;
- }
-
- //-----------------------------------------------------------------------
- public Map makeEmptyMap() {
- return new LRUMap();
- }
-
- //-----------------------------------------------------------------------
- public void testRemoveLRU() {
- LRUMap map2 = new LRUMap(3);
- map2.put(1,"foo");
- map2.put(2,"foo");
- map2.put(3,"foo");
- map2.put(4,"foo"); // removes 1 since max size exceeded
- map2.removeLRU(); // should be Integer(2)
-
- assertTrue("Second to last value should exist",map2.get(new Integer(3)).equals("foo"));
- assertTrue("First value inserted should not exist", map2.get(new Integer(1)) == null);
- }
-
- public void testMultiplePuts() {
- LRUMap map2 = new LRUMap(2);
- map2.put(1,"foo");
- map2.put(2,"bar");
- map2.put(3,"foo");
- map2.put(4,"bar");
-
- assertTrue("last value should exist",map2.get(new Integer(4)).equals("bar"));
- assertTrue("LRU should not exist", map2.get(new Integer(1)) == null);
- }
-
- /**
- * Confirm that putAll(Map) does not cause the LRUMap
- * to exceed its maxiumum size.
- */
- public void testPutAll() {
- LRUMap map2 = new LRUMap(3);
- map2.put(1,"foo");
- map2.put(2,"foo");
- map2.put(3,"foo");
-
- HashMap hashMap = new HashMap();
- hashMap.put(4,"foo");
-
- map2.putAll(hashMap);
-
- assertTrue("max size is 3, but actual size is " + map2.size(),
- map2.size() == 3);
- assertTrue("map should contain the Integer(4) object",
- map2.containsKey(new Integer(4)));
- }
-
- /**
- * Test that the size of the map is reduced immediately
- * when setMaximumSize(int) is called
- */
- public void testSetMaximumSize() {
- LRUMap map = new LRUMap(6);
- map.put("1","1");
- map.put("2","2");
- map.put("3","3");
- map.put("4","4");
- map.put("5","5");
- map.put("6","6");
- map.setMaxSize(3);
-
- assertTrue("map should have size = 3, but actually = " + map.size(),
- map.size() == 3);
- }
-
- public void testGetPromotion() {
- LRUMap map = new LRUMap(3);
- map.put("1","1");
- map.put("2","2");
- map.put("3","3");
- // LRU is now 1 (then 2 then 3)
-
- // promote 1 to top
- // eviction order is now 2,3,1
- map.get("1");
-
- // add another value, forcing a remove
- // 2 should be evicted (then 3,1,4)
- map.put("4","4");
-
- Iterator keyIterator = map.keySet().iterator();
- Object[] keys = new Object[3];
- for (int i = 0; keyIterator.hasNext() ; ++i) {
- keys[i] = keyIterator.next();
- }
-
- assertTrue("first evicted should be 3, was " + keys[0], keys[0].equals("3"));
- assertTrue("second evicted should be 1, was " + keys[1], keys[1].equals("1"));
- assertTrue("third evicted should be 4, was " + keys[2], keys[2].equals("4"));
-
- }
-
- /**
- * You should be able to subclass LRUMap and perform a
- * custom action when items are removed automatically
- * by the LRU algorithm (the removeLRU() method).
- */
- public void testLRUSubclass() {
- LRUCounter counter = new LRUCounter(3);
- // oldest <--> newest
- // 1
- counter.put("1","foo");
- // 1 2
- counter.put("2","foo");
- // 1 2 3
- counter.put("3","foo");
- // 2 3 1
- counter.put("1","foo");
- // 3 1 4 (2 goes out)
- counter.put("4","foo");
- // 1 4 5 (3 goes out)
- counter.put("5","foo");
- // 4 5 2 (1 goes out)
- counter.put("2","foo");
- // 4 2
- counter.remove("5");
-
- assertTrue("size should be 2, but was " + counter.size(), counter.size() == 2);
- assertTrue("removedCount should be 3 but was " + counter.removedCount,
- counter.removedCount == 3);
-
- assertTrue("first removed was '2'",counter.list.get(0).equals("2"));
- assertTrue("second removed was '3'",counter.list.get(1).equals("3"));
- assertTrue("third removed was '1'",counter.list.get(2).equals("1"));
-
- //assertTrue("oldest key is '4'",counter.get(0).equals("4"));
- //assertTrue("newest key is '2'",counter.get(1).equals("2"));
- }
-
- private class LRUCounter extends LRUMap {
- int removedCount = 0;
- List