Merge "Throw an NPE in a more obvious manner."
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/jar/AttributesTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/jar/AttributesTest.java
index dee7e7e..15f6851 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/jar/AttributesTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/jar/AttributesTest.java
@@ -163,30 +163,6 @@
     }
 
     /**
-     * java.util.jar.Attributes#putAll(java.util.Map)
-     */
-    public void test_putAllLjava_util_Map2() {
-        // Regression for HARMONY-464
-        try {
-            new Attributes().putAll((Map) null);
-            fail("ClassCastException expected");
-        } catch (ClassCastException e) {
-        }
-        // verify that special care for null is done in the Attributes.putAll()
-        // method
-        try {
-            new Attributes() {
-                @Override
-                public void putAll(Map<?, ?> attrib) {
-                    map.putAll(attrib);
-                }
-            }.putAll((Map<?, ?>) null);
-            fail("NullPointerException expected");
-        } catch (NullPointerException e) {
-        }
-    }
-
-    /**
      * java.util.jar.Attributes#remove(java.lang.Object)
      */
     public void test_removeLjava_lang_Object() {
diff --git a/luni/src/main/java/java/util/jar/Attributes.java b/luni/src/main/java/java/util/jar/Attributes.java
index 21ca7ea..483621b 100644
--- a/luni/src/main/java/java/util/jar/Attributes.java
+++ b/luni/src/main/java/java/util/jar/Attributes.java
@@ -307,9 +307,14 @@
      *            Attributes}).
      */
     public void putAll(Map<?, ?> attrib) {
-        if (attrib == null || !(attrib instanceof Attributes)) {
+        if (attrib == null) {
+            throw new NullPointerException("attrib == null");
+        }
+
+        if (!(attrib instanceof Attributes)) {
             throw new ClassCastException(attrib.getClass().getName() + " not an Attributes");
         }
+
         this.map.putAll(attrib);
     }