EOLs fixed... again
diff --git a/src/test/java/org/yaml/snakeyaml/array/BooleanArr.java b/src/test/java/org/yaml/snakeyaml/array/BooleanArr.java
index a0a089f..e465950 100644
--- a/src/test/java/org/yaml/snakeyaml/array/BooleanArr.java
+++ b/src/test/java/org/yaml/snakeyaml/array/BooleanArr.java
@@ -1,41 +1,41 @@
-/**
- * Copyright (c) 2008, http://www.snakeyaml.org
- *
- * 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 org.yaml.snakeyaml.array;
-
-import java.util.Arrays;
-
-public class BooleanArr {
- private boolean[] bools;
-
- public BooleanArr() {
- }
-
- public BooleanArr(boolean[] bools) {
- this.bools = bools;
- }
-
- public String toString() {
- return Arrays.toString(bools);
- }
-
- public boolean[] getBools() {
- return bools;
- }
-
- public void setBools(boolean[] bools) {
- this.bools = bools;
- }
-}
+/**
+ * Copyright (c) 2008, http://www.snakeyaml.org
+ *
+ * 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 org.yaml.snakeyaml.array;
+
+import java.util.Arrays;
+
+public class BooleanArr {
+ private boolean[] bools;
+
+ public BooleanArr() {
+ }
+
+ public BooleanArr(boolean[] bools) {
+ this.bools = bools;
+ }
+
+ public String toString() {
+ return Arrays.toString(bools);
+ }
+
+ public boolean[] getBools() {
+ return bools;
+ }
+
+ public void setBools(boolean[] bools) {
+ this.bools = bools;
+ }
+}
diff --git a/src/test/java/org/yaml/snakeyaml/array/ByteArr.java b/src/test/java/org/yaml/snakeyaml/array/ByteArr.java
index 8dd75cd..bf8aac5 100644
--- a/src/test/java/org/yaml/snakeyaml/array/ByteArr.java
+++ b/src/test/java/org/yaml/snakeyaml/array/ByteArr.java
@@ -1,42 +1,42 @@
-/**
- * Copyright (c) 2008, http://www.snakeyaml.org
- *
- * 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 org.yaml.snakeyaml.array;
-
-import java.util.Arrays;
-
-public class ByteArr {
-
- private byte[] bytes;
-
- public ByteArr() {
- }
-
- public ByteArr(byte[] bytes) {
- this.bytes = bytes;
- }
-
- public String toString() {
- return Arrays.toString(bytes);
- }
-
- public byte[] getBytes() {
- return bytes;
- }
-
- public void setBytes(byte[] bytes) {
- this.bytes = bytes;
- }
-}
+/**
+ * Copyright (c) 2008, http://www.snakeyaml.org
+ *
+ * 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 org.yaml.snakeyaml.array;
+
+import java.util.Arrays;
+
+public class ByteArr {
+
+ private byte[] bytes;
+
+ public ByteArr() {
+ }
+
+ public ByteArr(byte[] bytes) {
+ this.bytes = bytes;
+ }
+
+ public String toString() {
+ return Arrays.toString(bytes);
+ }
+
+ public byte[] getBytes() {
+ return bytes;
+ }
+
+ public void setBytes(byte[] bytes) {
+ this.bytes = bytes;
+ }
+}
diff --git a/src/test/java/org/yaml/snakeyaml/array/CharArr.java b/src/test/java/org/yaml/snakeyaml/array/CharArr.java
index 0bd366c..7f309ee 100644
--- a/src/test/java/org/yaml/snakeyaml/array/CharArr.java
+++ b/src/test/java/org/yaml/snakeyaml/array/CharArr.java
@@ -1,41 +1,41 @@
-/**
- * Copyright (c) 2008, http://www.snakeyaml.org
- *
- * 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 org.yaml.snakeyaml.array;
-
-import java.util.Arrays;
-
-public class CharArr {
- private char[] chars;
-
- public CharArr() {
- }
-
- public CharArr(char[] chars) {
- this.chars = chars;
- }
-
- public String toString() {
- return Arrays.toString(chars);
- }
-
- public char[] getChars() {
- return chars;
- }
-
- public void setChars(char[] chars) {
- this.chars = chars;
- }
-}
+/**
+ * Copyright (c) 2008, http://www.snakeyaml.org
+ *
+ * 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 org.yaml.snakeyaml.array;
+
+import java.util.Arrays;
+
+public class CharArr {
+ private char[] chars;
+
+ public CharArr() {
+ }
+
+ public CharArr(char[] chars) {
+ this.chars = chars;
+ }
+
+ public String toString() {
+ return Arrays.toString(chars);
+ }
+
+ public char[] getChars() {
+ return chars;
+ }
+
+ public void setChars(char[] chars) {
+ this.chars = chars;
+ }
+}
diff --git a/src/test/java/org/yaml/snakeyaml/array/DoubleArr.java b/src/test/java/org/yaml/snakeyaml/array/DoubleArr.java
index 544dc1d..6b134a3 100644
--- a/src/test/java/org/yaml/snakeyaml/array/DoubleArr.java
+++ b/src/test/java/org/yaml/snakeyaml/array/DoubleArr.java
@@ -1,41 +1,41 @@
-/**
- * Copyright (c) 2008, http://www.snakeyaml.org
- *
- * 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 org.yaml.snakeyaml.array;
-
-import java.util.Arrays;
-
-public class DoubleArr {
- private double[] doubles;
-
- public DoubleArr() {
- }
-
- public DoubleArr(double[] doubles) {
- this.doubles = doubles;
- }
-
- public String toString() {
- return Arrays.toString(doubles);
- }
-
- public double[] getDoubles() {
- return doubles;
- }
-
- public void setDoubles(double[] doubles) {
- this.doubles = doubles;
- }
-}
+/**
+ * Copyright (c) 2008, http://www.snakeyaml.org
+ *
+ * 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 org.yaml.snakeyaml.array;
+
+import java.util.Arrays;
+
+public class DoubleArr {
+ private double[] doubles;
+
+ public DoubleArr() {
+ }
+
+ public DoubleArr(double[] doubles) {
+ this.doubles = doubles;
+ }
+
+ public String toString() {
+ return Arrays.toString(doubles);
+ }
+
+ public double[] getDoubles() {
+ return doubles;
+ }
+
+ public void setDoubles(double[] doubles) {
+ this.doubles = doubles;
+ }
+}
diff --git a/src/test/java/org/yaml/snakeyaml/array/FloatArr.java b/src/test/java/org/yaml/snakeyaml/array/FloatArr.java
index 85122e9..01f5338 100644
--- a/src/test/java/org/yaml/snakeyaml/array/FloatArr.java
+++ b/src/test/java/org/yaml/snakeyaml/array/FloatArr.java
@@ -1,41 +1,41 @@
-/**
- * Copyright (c) 2008, http://www.snakeyaml.org
- *
- * 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 org.yaml.snakeyaml.array;
-
-import java.util.Arrays;
-
-public class FloatArr {
- private float[] floats;
-
- public FloatArr() {
- }
-
- public FloatArr(float[] floats) {
- this.floats = floats;
- }
-
- public String toString() {
- return Arrays.toString(floats);
- }
-
- public float[] getFloats() {
- return floats;
- }
-
- public void setFloats(float[] floats) {
- this.floats = floats;
- }
-}
+/**
+ * Copyright (c) 2008, http://www.snakeyaml.org
+ *
+ * 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 org.yaml.snakeyaml.array;
+
+import java.util.Arrays;
+
+public class FloatArr {
+ private float[] floats;
+
+ public FloatArr() {
+ }
+
+ public FloatArr(float[] floats) {
+ this.floats = floats;
+ }
+
+ public String toString() {
+ return Arrays.toString(floats);
+ }
+
+ public float[] getFloats() {
+ return floats;
+ }
+
+ public void setFloats(float[] floats) {
+ this.floats = floats;
+ }
+}
diff --git a/src/test/java/org/yaml/snakeyaml/array/IntArr.java b/src/test/java/org/yaml/snakeyaml/array/IntArr.java
index 9ffe562..8ed8e2a 100644
--- a/src/test/java/org/yaml/snakeyaml/array/IntArr.java
+++ b/src/test/java/org/yaml/snakeyaml/array/IntArr.java
@@ -1,41 +1,41 @@
-/**
- * Copyright (c) 2008, http://www.snakeyaml.org
- *
- * 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 org.yaml.snakeyaml.array;
-
-import java.util.Arrays;
-
-public class IntArr {
- private int[] ints;
-
- public IntArr() {
- }
-
- public IntArr(int[] ints) {
- this.ints = ints;
- }
-
- public String toString() {
- return Arrays.toString(ints);
- }
-
- public int[] getInts() {
- return ints;
- }
-
- public void setInts(int[] ints) {
- this.ints = ints;
- }
-}
+/**
+ * Copyright (c) 2008, http://www.snakeyaml.org
+ *
+ * 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 org.yaml.snakeyaml.array;
+
+import java.util.Arrays;
+
+public class IntArr {
+ private int[] ints;
+
+ public IntArr() {
+ }
+
+ public IntArr(int[] ints) {
+ this.ints = ints;
+ }
+
+ public String toString() {
+ return Arrays.toString(ints);
+ }
+
+ public int[] getInts() {
+ return ints;
+ }
+
+ public void setInts(int[] ints) {
+ this.ints = ints;
+ }
+}
diff --git a/src/test/java/org/yaml/snakeyaml/array/LongArr.java b/src/test/java/org/yaml/snakeyaml/array/LongArr.java
index 6911f59..c20adfe 100644
--- a/src/test/java/org/yaml/snakeyaml/array/LongArr.java
+++ b/src/test/java/org/yaml/snakeyaml/array/LongArr.java
@@ -1,41 +1,41 @@
-/**
- * Copyright (c) 2008, http://www.snakeyaml.org
- *
- * 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 org.yaml.snakeyaml.array;
-
-import java.util.Arrays;
-
-public class LongArr {
- private long[] longs;
-
- public LongArr() {
- }
-
- public LongArr(long[] longs) {
- this.longs = longs;
- }
-
- public String toString() {
- return Arrays.toString(longs);
- }
-
- public long[] getLongs() {
- return longs;
- }
-
- public void setLongs(long[] longs) {
- this.longs = longs;
- }
-}
+/**
+ * Copyright (c) 2008, http://www.snakeyaml.org
+ *
+ * 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 org.yaml.snakeyaml.array;
+
+import java.util.Arrays;
+
+public class LongArr {
+ private long[] longs;
+
+ public LongArr() {
+ }
+
+ public LongArr(long[] longs) {
+ this.longs = longs;
+ }
+
+ public String toString() {
+ return Arrays.toString(longs);
+ }
+
+ public long[] getLongs() {
+ return longs;
+ }
+
+ public void setLongs(long[] longs) {
+ this.longs = longs;
+ }
+}
diff --git a/src/test/java/org/yaml/snakeyaml/array/PrimitiveArrayTest.java b/src/test/java/org/yaml/snakeyaml/array/PrimitiveArrayTest.java
index 515ca12..09b1d53 100644
--- a/src/test/java/org/yaml/snakeyaml/array/PrimitiveArrayTest.java
+++ b/src/test/java/org/yaml/snakeyaml/array/PrimitiveArrayTest.java
@@ -1,255 +1,255 @@
-/**
- * Copyright (c) 2008, http://www.snakeyaml.org
- *
- * 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 org.yaml.snakeyaml.array;
-
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.junit.Assert;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.constructor.ConstructorException;
-import org.yaml.snakeyaml.error.YAMLException;
-
-public class PrimitiveArrayTest extends TestCase {
-
- private final String pkg = "!!org.yaml.snakeyaml.array";
-
- private final byte[] bytes = new byte[] { 1, 2, 3 };
- private final short[] shorts = new short[] { 300, 301, 302 };
- private final int[] ints = new int[] { 40000, 40001, 40002 };
- private final long[] longs = new long[] { 5000000000L, 5000000001L };
- private final float[] floats = new float[] { 0.1f, 3.1415f };
- private final double[] doubles = new double[] { 50.0001, 2150.0002 };
- private final char[] chars = new char[] { 'a', 'b', 'c', 'd', 'e' };
- private final boolean[] bools = new boolean[] { true, false };
-
- public void testValidConstructor() {
- String testInput = "- " + pkg + ".ByteArr [ " + Arrays.toString(bytes) + " ]\n" + "- "
- + pkg + ".ShortArr [ " + Arrays.toString(shorts) + " ]\n" + "- " + pkg
- + ".IntArr [ " + Arrays.toString(ints) + " ]\n" + "- " + pkg + ".LongArr [ "
- + Arrays.toString(longs) + " ]\n" + "- " + pkg + ".FloatArr [ "
- + Arrays.toString(floats) + " ]\n" + "- " + pkg + ".DoubleArr [ "
- + Arrays.toString(doubles) + " ]\n" + "- " + pkg + ".CharArr [ "
- + Arrays.toString(chars) + " ]\n" + "- " + pkg + ".BooleanArr [ "
- + Arrays.toString(bools) + " ]\n";
-
- Yaml yaml = new Yaml();
- List<Object> wrappers = (List<Object>) yaml.load(testInput);
-
- Assert.assertArrayEquals(bytes, ((ByteArr) wrappers.get(0)).getBytes());
- Assert.assertArrayEquals(shorts, ((ShortArr) wrappers.get(1)).getShorts());
- Assert.assertArrayEquals(ints, ((IntArr) wrappers.get(2)).getInts());
- Assert.assertArrayEquals(longs, ((LongArr) wrappers.get(3)).getLongs());
- Assert.assertArrayEquals(floats, ((FloatArr) wrappers.get(4)).getFloats(), 0.001f);
- Assert.assertArrayEquals(doubles, ((DoubleArr) wrappers.get(5)).getDoubles(), 0.001);
- Assert.assertArrayEquals(chars, ((CharArr) wrappers.get(6)).getChars());
- assertArrayEquals(bools, ((BooleanArr) wrappers.get(7)).getBools());
- }
-
- /*
- * For some reason, every other assertArrayEquals specialization is provided
- * by org.junit.Assert, but not this one.
- */
- private void assertArrayEquals(boolean[] expected, boolean[] actuals) {
- assertEquals("Arrays differ in length", expected.length, actuals.length);
- for (int i = 0; i < expected.length; ++i) {
- if (expected[i] != actuals[i]) {
- fail("Arrays first differ at " + i + "; expected " + expected[i] + " but got "
- + actuals[i]);
- }
- }
- }
-
- private void tryInvalid(String t, Class<?> expectedException) {
- Yaml yaml = new Yaml();
- try {
- Object loaded = yaml.load(t);
- fail("Expected " + expectedException.getCanonicalName() + " but loaded = \"" + loaded
- + "\"");
- } catch (YAMLException e) {
- assertEquals(expectedException, e.getCause().getClass());
- }
- }
-
- public void testInvalidConstructors() {
- // Loading a character as any primitive other than 'char' is a
- // NumberFormatException
- tryInvalid(pkg + ".ByteArr [ [ 'a' ] ]", NumberFormatException.class);
- tryInvalid(pkg + ".ShortArr [ [ 'a' ] ]", NumberFormatException.class);
- tryInvalid(pkg + ".IntArr [ [ 'a' ] ]", NumberFormatException.class);
- tryInvalid(pkg + ".LongArr [ [ 'a' ] ]", NumberFormatException.class);
- tryInvalid(pkg + ".FloatArr [ [ 'a' ] ]", NumberFormatException.class);
- tryInvalid(pkg + ".DoubleArr [ [ 'a' ] ]", NumberFormatException.class);
-
- // Exception: because of how boolean construction works, constructing a
- // boolean from 'a'
- // results in null.
- tryInvalid(pkg + ".BooleanArr [ [ 'a' ] ]", NullPointerException.class);
-
- // Loading a floating-point number as a character is a YAMLException
- tryInvalid(pkg + ".CharArr [ [ 1.2 ] ]", YAMLException.class);
-
- // Loading a String as a Character is a YAMLException
- tryInvalid(pkg + ".CharArr [ [ 'abcd' ] ]", YAMLException.class);
-
- }
-
- public void testTruncation() {
- // Loading floating-point numbers as integer types is disallowed,
- // because that's a number-format problem.
- tryInvalid(pkg + ".ByteArr [ [ 3.14 ] ]", NumberFormatException.class);
- tryInvalid(pkg + ".ShortArr [ [ 3.14 ] ]", NumberFormatException.class);
- tryInvalid(pkg + ".IntArr [ [ 3.14 ] ]", NumberFormatException.class);
- tryInvalid(pkg + ".LongArr [ [ 3.14 ] ]", NumberFormatException.class);
- }
-
- public void testPromotion() {
- Yaml yaml = new Yaml();
-
- // Loading integer numbers as floating-point types is allowed...
- Assert.assertArrayEquals(new float[] { 3, 5 },
- ((FloatArr) yaml.load(pkg + ".FloatArr [ [ 3, 5 ] ] ")).getFloats(), 0.001f);
-
- Assert.assertArrayEquals(new double[] { 3, 5 },
- ((DoubleArr) yaml.load(pkg + ".DoubleArr [ [ 3, 5 ] ] ")).getDoubles(), 0.001f);
- }
-
- public void testStringCharArray() {
- Yaml yaml = new Yaml();
-
- try {
- yaml.load(pkg + ".CharArr [ [ abcd ] ]");
- fail("Expected exception.");
- } catch (Exception e) {
- assertEquals(ConstructorException.class, e.getClass());
- assertEquals("Invalid node Character: 'abcd'; length: 4", e.getCause().getMessage());
- }
- }
-
- private static Object cycle(Object in) {
- Yaml yaml = new Yaml();
- String dumped = yaml.dump(in);
- // System.out.println ( dumped );
- return yaml.load(dumped);
- }
-
- /**
- * All kinds of primitive arrays should be able to cycle from (Java array)
- * to (YAML string) to (Java array) again, and they should be exactly the
- * same before and after.
- */
- public void testCycle() {
- ByteArr byteArr = new ByteArr(bytes);
- Assert.assertArrayEquals(byteArr.getBytes(), ((ByteArr) cycle(byteArr)).getBytes());
-
- ShortArr shortArr = new ShortArr(shorts);
- Assert.assertArrayEquals(shortArr.getShorts(), ((ShortArr) cycle(shortArr)).getShorts());
-
- IntArr intArr = new IntArr(ints);
- Assert.assertArrayEquals(intArr.getInts(), ((IntArr) cycle(intArr)).getInts());
-
- LongArr longArr = new LongArr(longs);
- Assert.assertArrayEquals(longArr.getLongs(), ((LongArr) cycle(longArr)).getLongs());
-
- FloatArr floatArr = new FloatArr(floats);
- Assert.assertArrayEquals(floatArr.getFloats(), ((FloatArr) cycle(floatArr)).getFloats(),
- 0.001f);
-
- DoubleArr doubleArr = new DoubleArr(doubles);
- Assert.assertArrayEquals(doubleArr.getDoubles(),
- ((DoubleArr) cycle(doubleArr)).getDoubles(), 0.001);
-
- CharArr charArr = new CharArr(chars);
- Assert.assertArrayEquals(charArr.getChars(), ((CharArr) cycle(charArr)).getChars());
-
- BooleanArr boolArr = new BooleanArr(bools);
- assertArrayEquals(boolArr.getBools(), ((BooleanArr) cycle(boolArr)).getBools());
- }
-
- public void testMultiDimensional() {
- Array2D two = new Array2D();
- two.setLongs(new long[][] { { 1, 2, 3 }, { 4, 5, 6 } });
- assertTrue(Arrays.deepEquals(two.getLongs(), ((Array2D) cycle(two)).getLongs()));
-
- Array3D three = new Array3D();
- three.setLongs(new long[][][] { { { 1, 2, 3, 4 }, { 5, 6, 7, 8 } },
- { { 9, 10, 11, 12 }, { 13, 14, 15, 16 } } });
- assertTrue(Arrays.deepEquals(three.getLongs(), ((Array3D) cycle(three)).getLongs()));
-
- // Object with an array of Objects which each have an array of
- // primitives.
- ArrayLongArr four = new ArrayLongArr();
- four.setContents(new LongArr[] { new LongArr(new long[] { 1, 2, 3, 4 }),
- new LongArr(new long[] { 5, 6, 7, 8 }) });
- Object result = cycle(four);
- assertEquals(four, (ArrayLongArr) result);
- }
-
- public static class Array2D {
- private long[][] longs;
-
- public long[][] getLongs() {
- return longs;
- }
-
- public void setLongs(long[][] longs) {
- this.longs = longs;
- }
- }
-
- public static class Array3D {
- private long[][][] longs;
-
- public long[][][] getLongs() {
- return longs;
- }
-
- public void setLongs(long[][][] longs) {
- this.longs = longs;
- }
- }
-
- public static class ArrayLongArr {
- private LongArr[] contents;
-
- public LongArr[] getContents() {
- return contents;
- }
-
- public void setContents(LongArr[] contents) {
- this.contents = contents;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof ArrayLongArr))
- return false;
-
- ArrayLongArr other = ((ArrayLongArr) obj);
- if (contents.length != other.getContents().length)
- return false;
- for (int i = 0; i < contents.length; ++i) {
- if (!Arrays.equals(contents[i].getLongs(), other.getContents()[i].getLongs())) {
- return false;
- }
- }
-
- return true;
- }
- }
-}
+/**
+ * Copyright (c) 2008, http://www.snakeyaml.org
+ *
+ * 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 org.yaml.snakeyaml.array;
+
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.junit.Assert;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.ConstructorException;
+import org.yaml.snakeyaml.error.YAMLException;
+
+public class PrimitiveArrayTest extends TestCase {
+
+ private final String pkg = "!!org.yaml.snakeyaml.array";
+
+ private final byte[] bytes = new byte[] { 1, 2, 3 };
+ private final short[] shorts = new short[] { 300, 301, 302 };
+ private final int[] ints = new int[] { 40000, 40001, 40002 };
+ private final long[] longs = new long[] { 5000000000L, 5000000001L };
+ private final float[] floats = new float[] { 0.1f, 3.1415f };
+ private final double[] doubles = new double[] { 50.0001, 2150.0002 };
+ private final char[] chars = new char[] { 'a', 'b', 'c', 'd', 'e' };
+ private final boolean[] bools = new boolean[] { true, false };
+
+ public void testValidConstructor() {
+ String testInput = "- " + pkg + ".ByteArr [ " + Arrays.toString(bytes) + " ]\n" + "- "
+ + pkg + ".ShortArr [ " + Arrays.toString(shorts) + " ]\n" + "- " + pkg
+ + ".IntArr [ " + Arrays.toString(ints) + " ]\n" + "- " + pkg + ".LongArr [ "
+ + Arrays.toString(longs) + " ]\n" + "- " + pkg + ".FloatArr [ "
+ + Arrays.toString(floats) + " ]\n" + "- " + pkg + ".DoubleArr [ "
+ + Arrays.toString(doubles) + " ]\n" + "- " + pkg + ".CharArr [ "
+ + Arrays.toString(chars) + " ]\n" + "- " + pkg + ".BooleanArr [ "
+ + Arrays.toString(bools) + " ]\n";
+
+ Yaml yaml = new Yaml();
+ List<Object> wrappers = (List<Object>) yaml.load(testInput);
+
+ Assert.assertArrayEquals(bytes, ((ByteArr) wrappers.get(0)).getBytes());
+ Assert.assertArrayEquals(shorts, ((ShortArr) wrappers.get(1)).getShorts());
+ Assert.assertArrayEquals(ints, ((IntArr) wrappers.get(2)).getInts());
+ Assert.assertArrayEquals(longs, ((LongArr) wrappers.get(3)).getLongs());
+ Assert.assertArrayEquals(floats, ((FloatArr) wrappers.get(4)).getFloats(), 0.001f);
+ Assert.assertArrayEquals(doubles, ((DoubleArr) wrappers.get(5)).getDoubles(), 0.001);
+ Assert.assertArrayEquals(chars, ((CharArr) wrappers.get(6)).getChars());
+ assertArrayEquals(bools, ((BooleanArr) wrappers.get(7)).getBools());
+ }
+
+ /*
+ * For some reason, every other assertArrayEquals specialization is provided
+ * by org.junit.Assert, but not this one.
+ */
+ private void assertArrayEquals(boolean[] expected, boolean[] actuals) {
+ assertEquals("Arrays differ in length", expected.length, actuals.length);
+ for (int i = 0; i < expected.length; ++i) {
+ if (expected[i] != actuals[i]) {
+ fail("Arrays first differ at " + i + "; expected " + expected[i] + " but got "
+ + actuals[i]);
+ }
+ }
+ }
+
+ private void tryInvalid(String t, Class<?> expectedException) {
+ Yaml yaml = new Yaml();
+ try {
+ Object loaded = yaml.load(t);
+ fail("Expected " + expectedException.getCanonicalName() + " but loaded = \"" + loaded
+ + "\"");
+ } catch (YAMLException e) {
+ assertEquals(expectedException, e.getCause().getClass());
+ }
+ }
+
+ public void testInvalidConstructors() {
+ // Loading a character as any primitive other than 'char' is a
+ // NumberFormatException
+ tryInvalid(pkg + ".ByteArr [ [ 'a' ] ]", NumberFormatException.class);
+ tryInvalid(pkg + ".ShortArr [ [ 'a' ] ]", NumberFormatException.class);
+ tryInvalid(pkg + ".IntArr [ [ 'a' ] ]", NumberFormatException.class);
+ tryInvalid(pkg + ".LongArr [ [ 'a' ] ]", NumberFormatException.class);
+ tryInvalid(pkg + ".FloatArr [ [ 'a' ] ]", NumberFormatException.class);
+ tryInvalid(pkg + ".DoubleArr [ [ 'a' ] ]", NumberFormatException.class);
+
+ // Exception: because of how boolean construction works, constructing a
+ // boolean from 'a'
+ // results in null.
+ tryInvalid(pkg + ".BooleanArr [ [ 'a' ] ]", NullPointerException.class);
+
+ // Loading a floating-point number as a character is a YAMLException
+ tryInvalid(pkg + ".CharArr [ [ 1.2 ] ]", YAMLException.class);
+
+ // Loading a String as a Character is a YAMLException
+ tryInvalid(pkg + ".CharArr [ [ 'abcd' ] ]", YAMLException.class);
+
+ }
+
+ public void testTruncation() {
+ // Loading floating-point numbers as integer types is disallowed,
+ // because that's a number-format problem.
+ tryInvalid(pkg + ".ByteArr [ [ 3.14 ] ]", NumberFormatException.class);
+ tryInvalid(pkg + ".ShortArr [ [ 3.14 ] ]", NumberFormatException.class);
+ tryInvalid(pkg + ".IntArr [ [ 3.14 ] ]", NumberFormatException.class);
+ tryInvalid(pkg + ".LongArr [ [ 3.14 ] ]", NumberFormatException.class);
+ }
+
+ public void testPromotion() {
+ Yaml yaml = new Yaml();
+
+ // Loading integer numbers as floating-point types is allowed...
+ Assert.assertArrayEquals(new float[] { 3, 5 },
+ ((FloatArr) yaml.load(pkg + ".FloatArr [ [ 3, 5 ] ] ")).getFloats(), 0.001f);
+
+ Assert.assertArrayEquals(new double[] { 3, 5 },
+ ((DoubleArr) yaml.load(pkg + ".DoubleArr [ [ 3, 5 ] ] ")).getDoubles(), 0.001f);
+ }
+
+ public void testStringCharArray() {
+ Yaml yaml = new Yaml();
+
+ try {
+ yaml.load(pkg + ".CharArr [ [ abcd ] ]");
+ fail("Expected exception.");
+ } catch (Exception e) {
+ assertEquals(ConstructorException.class, e.getClass());
+ assertEquals("Invalid node Character: 'abcd'; length: 4", e.getCause().getMessage());
+ }
+ }
+
+ private static Object cycle(Object in) {
+ Yaml yaml = new Yaml();
+ String dumped = yaml.dump(in);
+ // System.out.println ( dumped );
+ return yaml.load(dumped);
+ }
+
+ /**
+ * All kinds of primitive arrays should be able to cycle from (Java array)
+ * to (YAML string) to (Java array) again, and they should be exactly the
+ * same before and after.
+ */
+ public void testCycle() {
+ ByteArr byteArr = new ByteArr(bytes);
+ Assert.assertArrayEquals(byteArr.getBytes(), ((ByteArr) cycle(byteArr)).getBytes());
+
+ ShortArr shortArr = new ShortArr(shorts);
+ Assert.assertArrayEquals(shortArr.getShorts(), ((ShortArr) cycle(shortArr)).getShorts());
+
+ IntArr intArr = new IntArr(ints);
+ Assert.assertArrayEquals(intArr.getInts(), ((IntArr) cycle(intArr)).getInts());
+
+ LongArr longArr = new LongArr(longs);
+ Assert.assertArrayEquals(longArr.getLongs(), ((LongArr) cycle(longArr)).getLongs());
+
+ FloatArr floatArr = new FloatArr(floats);
+ Assert.assertArrayEquals(floatArr.getFloats(), ((FloatArr) cycle(floatArr)).getFloats(),
+ 0.001f);
+
+ DoubleArr doubleArr = new DoubleArr(doubles);
+ Assert.assertArrayEquals(doubleArr.getDoubles(),
+ ((DoubleArr) cycle(doubleArr)).getDoubles(), 0.001);
+
+ CharArr charArr = new CharArr(chars);
+ Assert.assertArrayEquals(charArr.getChars(), ((CharArr) cycle(charArr)).getChars());
+
+ BooleanArr boolArr = new BooleanArr(bools);
+ assertArrayEquals(boolArr.getBools(), ((BooleanArr) cycle(boolArr)).getBools());
+ }
+
+ public void testMultiDimensional() {
+ Array2D two = new Array2D();
+ two.setLongs(new long[][] { { 1, 2, 3 }, { 4, 5, 6 } });
+ assertTrue(Arrays.deepEquals(two.getLongs(), ((Array2D) cycle(two)).getLongs()));
+
+ Array3D three = new Array3D();
+ three.setLongs(new long[][][] { { { 1, 2, 3, 4 }, { 5, 6, 7, 8 } },
+ { { 9, 10, 11, 12 }, { 13, 14, 15, 16 } } });
+ assertTrue(Arrays.deepEquals(three.getLongs(), ((Array3D) cycle(three)).getLongs()));
+
+ // Object with an array of Objects which each have an array of
+ // primitives.
+ ArrayLongArr four = new ArrayLongArr();
+ four.setContents(new LongArr[] { new LongArr(new long[] { 1, 2, 3, 4 }),
+ new LongArr(new long[] { 5, 6, 7, 8 }) });
+ Object result = cycle(four);
+ assertEquals(four, (ArrayLongArr) result);
+ }
+
+ public static class Array2D {
+ private long[][] longs;
+
+ public long[][] getLongs() {
+ return longs;
+ }
+
+ public void setLongs(long[][] longs) {
+ this.longs = longs;
+ }
+ }
+
+ public static class Array3D {
+ private long[][][] longs;
+
+ public long[][][] getLongs() {
+ return longs;
+ }
+
+ public void setLongs(long[][][] longs) {
+ this.longs = longs;
+ }
+ }
+
+ public static class ArrayLongArr {
+ private LongArr[] contents;
+
+ public LongArr[] getContents() {
+ return contents;
+ }
+
+ public void setContents(LongArr[] contents) {
+ this.contents = contents;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof ArrayLongArr))
+ return false;
+
+ ArrayLongArr other = ((ArrayLongArr) obj);
+ if (contents.length != other.getContents().length)
+ return false;
+ for (int i = 0; i < contents.length; ++i) {
+ if (!Arrays.equals(contents[i].getLongs(), other.getContents()[i].getLongs())) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/src/test/java/org/yaml/snakeyaml/array/ShortArr.java b/src/test/java/org/yaml/snakeyaml/array/ShortArr.java
index 3e84640..bd09bbf 100644
--- a/src/test/java/org/yaml/snakeyaml/array/ShortArr.java
+++ b/src/test/java/org/yaml/snakeyaml/array/ShortArr.java
@@ -1,41 +1,41 @@
-/**
- * Copyright (c) 2008, http://www.snakeyaml.org
- *
- * 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 org.yaml.snakeyaml.array;
-
-import java.util.Arrays;
-
-public class ShortArr {
- private short[] shorts;
-
- public ShortArr() {
- }
-
- public ShortArr(short[] shorts) {
- this.shorts = shorts;
- }
-
- public String toString() {
- return Arrays.toString(shorts);
- }
-
- public short[] getShorts() {
- return shorts;
- }
-
- public void setShorts(short[] shorts) {
- this.shorts = shorts;
- }
-}
+/**
+ * Copyright (c) 2008, http://www.snakeyaml.org
+ *
+ * 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 org.yaml.snakeyaml.array;
+
+import java.util.Arrays;
+
+public class ShortArr {
+ private short[] shorts;
+
+ public ShortArr() {
+ }
+
+ public ShortArr(short[] shorts) {
+ this.shorts = shorts;
+ }
+
+ public String toString() {
+ return Arrays.toString(shorts);
+ }
+
+ public short[] getShorts() {
+ return shorts;
+ }
+
+ public void setShorts(short[] shorts) {
+ this.shorts = shorts;
+ }
+}
diff --git a/src/test/java/org/yaml/snakeyaml/issues/issue150/Car.java b/src/test/java/org/yaml/snakeyaml/issues/issue150/Car.java
index d69fc39..1973d9d 100644
--- a/src/test/java/org/yaml/snakeyaml/issues/issue150/Car.java
+++ b/src/test/java/org/yaml/snakeyaml/issues/issue150/Car.java
@@ -1,47 +1,47 @@
-/**
- * Copyright (c) 2008, http://www.snakeyaml.org
- *
- * 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 org.yaml.snakeyaml.issues.issue150;
-
-import java.util.Collection;
-
-/**
- *
- * @author tturki
- *
- */
-public class Car {
- private String plate;
- private Collection<Wheel> wheels;
-
- public Car() {
- }
-
- public String getPlate() {
- return plate;
- }
-
- public void setPlate(String plate) {
- this.plate = plate;
- }
-
- public Collection<Wheel> getWheels() {
- return wheels;
- }
-
- public void setWheels(Collection<Wheel> wheels) {
- this.wheels = wheels;
- }
+/**
+ * Copyright (c) 2008, http://www.snakeyaml.org
+ *
+ * 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 org.yaml.snakeyaml.issues.issue150;
+
+import java.util.Collection;
+
+/**
+ *
+ * @author tturki
+ *
+ */
+public class Car {
+ private String plate;
+ private Collection<Wheel> wheels;
+
+ public Car() {
+ }
+
+ public String getPlate() {
+ return plate;
+ }
+
+ public void setPlate(String plate) {
+ this.plate = plate;
+ }
+
+ public Collection<Wheel> getWheels() {
+ return wheels;
+ }
+
+ public void setWheels(Collection<Wheel> wheels) {
+ this.wheels = wheels;
+ }
}
\ No newline at end of file
diff --git a/src/test/java/org/yaml/snakeyaml/issues/issue150/Wheel.java b/src/test/java/org/yaml/snakeyaml/issues/issue150/Wheel.java
index bebafe7..bae1637 100644
--- a/src/test/java/org/yaml/snakeyaml/issues/issue150/Wheel.java
+++ b/src/test/java/org/yaml/snakeyaml/issues/issue150/Wheel.java
@@ -1,31 +1,31 @@
-/**
- * Copyright (c) 2008, http://www.snakeyaml.org
- *
- * 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 org.yaml.snakeyaml.issues.issue150;
-
-public class Wheel {
- private Integer id;
-
- public Wheel() {
- }
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
+/**
+ * Copyright (c) 2008, http://www.snakeyaml.org
+ *
+ * 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 org.yaml.snakeyaml.issues.issue150;
+
+public class Wheel {
+ private Integer id;
+
+ public Wheel() {
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
}
\ No newline at end of file
diff --git a/src/test/java/org/yaml/snakeyaml/issues/issue188/ErrorMessageTest.java b/src/test/java/org/yaml/snakeyaml/issues/issue188/ErrorMessageTest.java
index a4548e8..fa17b68 100644
--- a/src/test/java/org/yaml/snakeyaml/issues/issue188/ErrorMessageTest.java
+++ b/src/test/java/org/yaml/snakeyaml/issues/issue188/ErrorMessageTest.java
@@ -1,35 +1,35 @@
-/**
- * Copyright (c) 2008, http://www.snakeyaml.org
- *
- * 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 org.yaml.snakeyaml.issues.issue188;
-
-import junit.framework.TestCase;
-
-import org.yaml.snakeyaml.Yaml;
-
-public class ErrorMessageTest extends TestCase {
-
- public void testErrorMessage() throws Exception {
-
- try {
- Yaml yaml = new Yaml();
- String doc = "templates:\n" + " master:\n" + " type: Compute : invalid123";
- yaml.load(doc);
- fail();
- } catch (Exception e) {
- assertFalse(e.getMessage(), e.getMessage().contains("null"));
- }
- }
-}
+/**
+ * Copyright (c) 2008, http://www.snakeyaml.org
+ *
+ * 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 org.yaml.snakeyaml.issues.issue188;
+
+import junit.framework.TestCase;
+
+import org.yaml.snakeyaml.Yaml;
+
+public class ErrorMessageTest extends TestCase {
+
+ public void testErrorMessage() throws Exception {
+
+ try {
+ Yaml yaml = new Yaml();
+ String doc = "templates:\n" + " master:\n" + " type: Compute : invalid123";
+ yaml.load(doc);
+ fail();
+ } catch (Exception e) {
+ assertFalse(e.getMessage(), e.getMessage().contains("null"));
+ }
+ }
+}
diff --git a/src/test/resources/issues/issue149-losing-directives-2.yaml b/src/test/resources/issues/issue149-losing-directives-2.yaml
index cedfd44..3c61376 100644
--- a/src/test/resources/issues/issue149-losing-directives-2.yaml
+++ b/src/test/resources/issues/issue149-losing-directives-2.yaml
@@ -1,10 +1,10 @@
-%YAML 1.1
-%TAG !u! tag:ualberta.ca,2012:
---- !u!29 &1
-property1: 0
-property2: aaa
-...
-%TAG !second! tag:ualberta.ca,2012:
---- !second!29 &2
-property1: 3
-property2: bbb
+%YAML 1.1
+%TAG !u! tag:ualberta.ca,2012:
+--- !u!29 &1
+property1: 0
+property2: aaa
+...
+%TAG !second! tag:ualberta.ca,2012:
+--- !second!29 &2
+property1: 3
+property2: bbb
diff --git a/src/test/resources/issues/issue149-losing-directives.yaml b/src/test/resources/issues/issue149-losing-directives.yaml
index 649eac5..db0885c 100644
--- a/src/test/resources/issues/issue149-losing-directives.yaml
+++ b/src/test/resources/issues/issue149-losing-directives.yaml
@@ -1,9 +1,9 @@
-%YAML 1.1
-%TAG !u! tag:ualberta.ca,2012:
---- !u!29 &1
-property1: 0
-property2: aaa
-
---- !u!29 &2
-property1: 3
-property2: bbb
+%YAML 1.1
+%TAG !u! tag:ualberta.ca,2012:
+--- !u!29 &1
+property1: 0
+property2: aaa
+
+--- !u!29 &2
+property1: 3
+property2: bbb
diff --git a/src/test/resources/issues/issue149-one-document.yaml b/src/test/resources/issues/issue149-one-document.yaml
index 2c4d172..cd45999 100644
--- a/src/test/resources/issues/issue149-one-document.yaml
+++ b/src/test/resources/issues/issue149-one-document.yaml
@@ -1,7 +1,7 @@
-%YAML 1.1
-%TAG !u! tag:ualberta.ca,2012:
---- !u!29 &1
-property1: 0
-property2: aaa
-
-
+%YAML 1.1
+%TAG !u! tag:ualberta.ca,2012:
+--- !u!29 &1
+property1: 0
+property2: aaa
+
+