From af9167398f375fed76bbdb9a35574b46df68c2b8 Mon Sep 17 00:00:00 2001 From: Mike Duigou Date: Mon, 21 Mar 2011 11:31:54 -0700 Subject: [PATCH] 7029491: fix broken test file committed with CR 5045147 An incorrect file was committed with CR 5045147. This commit corrects that error and also applies minor review suggestions. Reviewed-by: alanb --- .../{cr5045147.java => EmptyMapAndNulls.java} | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) rename jdk/test/java/util/TreeMap/{cr5045147.java => EmptyMapAndNulls.java} (80%) diff --git a/jdk/test/java/util/TreeMap/cr5045147.java b/jdk/test/java/util/TreeMap/EmptyMapAndNulls.java similarity index 80% rename from jdk/test/java/util/TreeMap/cr5045147.java rename to jdk/test/java/util/TreeMap/EmptyMapAndNulls.java index b9e2a8b0f9f..1642f74f1bc 100644 --- a/jdk/test/java/util/TreeMap/cr5045147.java +++ b/jdk/test/java/util/TreeMap/EmptyMapAndNulls.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,17 +33,18 @@ import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.lang.reflect.*; -public class cr5045147 { +public class EmptyMapAndNulls { + @SuppressWarnings("rawtypes") static void realMain(String[] args) throws Throwable { // No comparator Map comparable = new TreeMap<>(); - // insert null into empty map (504517 failure) + // insert null into empty map (5045147 failure) try { comparable.put(null, "anything"); fail("null shouldn't be accepted"); - } catch(NullPointerExecption failed) { + } catch (NullPointerException failed) { pass(); } @@ -51,7 +52,7 @@ public class cr5045147 { try { comparable.put("test", "anything"); pass(); - } catch(NullPointerExecption failed) { + } catch (NullPointerException failed) { fail(); } @@ -59,17 +60,18 @@ public class cr5045147 { try { comparable.put(null, "anything"); fail("null shouldn't be accepted"); - } catch(NullPointerExecption failed) { + } catch (NullPointerException failed) { pass(); } - Map comparator = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + // Comparator (String.CASE_INSENSITIVE_ORDER). Intentionally a raw type. + Map comparator = new TreeMap(String.CASE_INSENSITIVE_ORDER); - // insert null into empty map (504517 failure) + // insert null into empty map (5045147 failure) try { comparator.put(null, "anything"); fail("null shouldn't be accepted"); - } catch(NullPointerExecption failed) { + } catch (NullPointerException failed) { pass(); } @@ -77,7 +79,7 @@ public class cr5045147 { try { comparator.put("test", "anything"); pass(); - } catch(NullPointerExecption failed) { + } catch (NullPointerException failed) { fail(); } @@ -85,17 +87,17 @@ public class cr5045147 { try { comparator.put(null, "anything"); fail("null shouldn't be accepted"); - } catch(NullPointerExecption failed) { + } catch (NullPointerException failed) { pass(); } comparator.clear(); - // insert non-String into empty map (504517 failure) + // insert non-String into empty map (5045147 failure) try { comparator.put(new Object(), "anything"); fail("Object shouldn't be accepted"); - } catch(ClassCastExecption failed) { + } catch (ClassCastException failed) { pass(); }