Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 44680 invoked from network); 13 Jan 2007 12:02:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jan 2007 12:02:18 -0000 Received: (qmail 72290 invoked by uid 500); 13 Jan 2007 12:02:24 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 72271 invoked by uid 500); 13 Jan 2007 12:02:24 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 72262 invoked by uid 99); 13 Jan 2007 12:02:24 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Jan 2007 04:02:24 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Jan 2007 04:02:17 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id B09CC1A981A; Sat, 13 Jan 2007 04:01:15 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r495876 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/RenderingHints.java test/api/java/common/org/apache/harmony/awt/tests/java/awt/RenderingHintsTest.java Date: Sat, 13 Jan 2007 12:01:15 -0000 To: commits@harmony.apache.org From: hindessm@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070113120115.B09CC1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: hindessm Date: Sat Jan 13 04:01:14 2007 New Revision: 495876 URL: http://svn.apache.org/viewvc?view=rev&rev=495876 Log: Applied patch from "[#HARMONY-2517] [classlib][awt] Compatibility: java.awt.RenderingHints(Map<RenderingHints.Key,?> init) constructor throws NPE on Harmony while it works silently on RI". Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/tests/java/awt/RenderingHintsTest.java (with props) Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/RenderingHints.java Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/RenderingHints.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/RenderingHints.java?view=diff&rev=495876&r1=495875&r2=495876 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/RenderingHints.java (original) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/RenderingHints.java Sat Jan 13 04:01:14 2007 @@ -124,12 +124,14 @@ } else { Set entries = m.entrySet(); - Iterator it = entries.iterator(); - while (it.hasNext()) { - Map.Entry entry = (Map.Entry) it.next(); - Key key = (Key) entry.getKey(); - Object val = entry.getValue(); - put(key, val); + if (entries != null){ + Iterator it = entries.iterator(); + while (it.hasNext()) { + Map.Entry entry = (Map.Entry) it.next(); + Key key = (Key) entry.getKey(); + Object val = entry.getValue(); + put(key, val); + } } } } Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/tests/java/awt/RenderingHintsTest.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/tests/java/awt/RenderingHintsTest.java?view=auto&rev=495876 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/tests/java/awt/RenderingHintsTest.java (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/tests/java/awt/RenderingHintsTest.java Sat Jan 13 04:01:14 2007 @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.harmony.awt.tests.java.awt; + +import java.awt.RenderingHints; +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +import junit.framework.TestCase; + +public class RenderingHintsTest extends TestCase { + + public void testConstructor_Null_Map() { + // Regression test HARMONY-2517 + Map localMap = new dummyMap(); + RenderingHints rh = new RenderingHints(localMap); + assertTrue(rh.isEmpty()); + } + + private class dummyMap implements Map { + public void clear() { + return; + } + + public boolean containsKey(Object p0) { + return false; + } + + public boolean containsValue(Object p0) { + return false; + } + + public Set> entrySet() { + return null; + } + + public boolean equals(Object p0) { + return false; + } + + public Object get(Object p0) { + return null; + } + + public int hashCode() { + return 0; + } + + public boolean isEmpty() { + return false; + } + + public Set keySet() { + return null; + } + + public Object put(RenderingHints.Key p0, Object p1) { + return null; + } + + public void putAll(Map p0) { + return; + } + + public Object remove(Object p0) { + return null; + } + + public int size() { + return 0; + } + + public Collection values() { + return null; + } + } + +} + Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/tests/java/awt/RenderingHintsTest.java ------------------------------------------------------------------------------ svn:eol-style = native