Fix 65: add checks for null arguments for JavaBeanDumper
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 748883e..05af9c8 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -7,6 +7,9 @@
 	</properties>

 	<body>

 		<release version="1.7" date="in Mercurial" description="development">

+		    <action dev="py4fun" type="fix" issue="65" due-to="lerch.johannes">

+                Fix: add checks for null arguments for JavaBeanDumper (2010-04-27)

+            </action>

 		    <action dev="py4fun" type="add">

                 Add a test to see how stack trace is serialised (2010-04-27)

             </action>

diff --git a/src/main/java/org/yaml/snakeyaml/introspector/MethodProperty.java b/src/main/java/org/yaml/snakeyaml/introspector/MethodProperty.java
index 3f9362d..165cb28 100644
--- a/src/main/java/org/yaml/snakeyaml/introspector/MethodProperty.java
+++ b/src/main/java/org/yaml/snakeyaml/introspector/MethodProperty.java
@@ -48,8 +48,7 @@
                 ParameterizedType grt = (ParameterizedType) property.getReadMethod()
                         .getGenericReturnType();
                 Type[] result = grt.getActualTypeArguments();
-                if (result == null || (result[0] instanceof TypeVariable)
-                        || (result[0] instanceof ParameterizedType)) {
+                if (result[0] instanceof TypeVariable || result[0] instanceof ParameterizedType) {
                     return null;
                 } else {
                     return result;
diff --git a/src/test/java/examples/resolver/CustomResolverTest.java b/src/test/java/examples/resolver/CustomResolverTest.java
index 3211ee3..868dd54 100644
--- a/src/test/java/examples/resolver/CustomResolverTest.java
+++ b/src/test/java/examples/resolver/CustomResolverTest.java
@@ -51,18 +51,4 @@
         assertTrue(map2.toString(), map2.containsKey(new Double(1.0)));

     }

 

-    public void testResolverSimpleInt() {

-        Map<Object, Object> map = new HashMap<Object, Object>();

-        map.put("run_ID", "2010_03_31_101");

-        Yaml yaml = new Yaml(new Loader(), new Dumper(new DumperOptions()), new CustomIntResolver());

-        String output = yaml.dump(map);

-        // load

-        assertEquals("{run_ID: 2010_03_31_101}\n", output);

-        Map<Object, Object> parsed = (Map<Object, Object>) yaml.load(output);

-        assertEquals(map, parsed);

-        // check standard resolver

-        assertEquals("Standard resolver should quote the string", "{run_ID: '2010_03_31_101'}\n",

-                new Yaml().dump(map));

-    }

-

 }

diff --git a/src/test/java/org/yaml/snakeyaml/representer/DumpStackTraceTest.java b/src/test/java/org/yaml/snakeyaml/representer/DumpStackTraceTest.java
index 8ac8e47..cc09db4 100644
--- a/src/test/java/org/yaml/snakeyaml/representer/DumpStackTraceTest.java
+++ b/src/test/java/org/yaml/snakeyaml/representer/DumpStackTraceTest.java
@@ -1,3 +1,19 @@
+/**

+ * Copyright (c) 2008-2010 Andrey Somov

+ *

+ * 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.representer;

 

 import junit.framework.TestCase;

diff --git a/src/test/java/org/yaml/snakeyaml/types/BoolTagTest.java b/src/test/java/org/yaml/snakeyaml/types/BoolTagTest.java
index ad93fd7..f1facc4 100644
--- a/src/test/java/org/yaml/snakeyaml/types/BoolTagTest.java
+++ b/src/test/java/org/yaml/snakeyaml/types/BoolTagTest.java
@@ -118,6 +118,8 @@
             this.representers.put(Boolean.class, new RepresentBool());

         }

 

+        // possible values are here http://yaml.org/type/bool.html

+        // y, Y, n, N should not be used

         private class RepresentBool implements Represent {

             public Node representData(Object data) {

                 String v;

diff --git a/src/test/java/org/yaml/snakeyaml/types/NullTagTest.java b/src/test/java/org/yaml/snakeyaml/types/NullTagTest.java
index 83c2c51..c5f981b 100644
--- a/src/test/java/org/yaml/snakeyaml/types/NullTagTest.java
+++ b/src/test/java/org/yaml/snakeyaml/types/NullTagTest.java
@@ -127,11 +127,14 @@
     private class NullRepresenter extends Representer {

         public NullRepresenter() {

             super();

+            // null representer is exceptional and it is stored as an instance

+            // variable.

             this.nullRepresenter = new RepresentNull();

         }

 

         private class RepresentNull implements Represent {

             public Node representData(Object data) {

+                // possible values are here http://yaml.org/type/null.html

                 return representScalar(Tag.NULL, "");

             }

         }