From 0d3c1f9f58f52355a38c363554f0c05430078bef Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Fri, 26 Dec 2008 20:01:26 +0000 Subject: Display all messages when using test method. --- .../carbonado/info/StorableIntrospector.java | 44 +++++++++++++--------- 1 file changed, 27 insertions(+), 17 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java b/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java index 5bcce2f..ce3a24e 100644 --- a/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java +++ b/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java @@ -93,13 +93,20 @@ public class StorableIntrospector { * exception is thrown. * * @param args names of classes to examine - * @throws MalformedTypeException if Storable type is invalid */ public static void main(String[] args) throws Exception { for (String arg : args) { Class clazz = Class.forName(arg); - System.out.println("Examining " + clazz.getName()); - examine(clazz); + System.out.println("Examining: " + clazz.getName()); + try { + examine(clazz); + System.out.println("Passed"); + } catch (MalformedTypeException e) { + System.out.println("Malformed type: " + e.getMalformedType().getName()); + for (String message : e.getMessages()) { + System.out.println(message); + } + } } } @@ -694,21 +701,24 @@ public class StorableIntrospector { // Only include errors on unimplementable methods if there are no other // errors. This prevents producing errors caused by other errors. - Iterator iter = methods.values().iterator(); - while (iter.hasNext()) { - Method m = iter.next(); - int methodModifiers = m.getModifiers(); - if (Modifier.isAbstract(methodModifiers )) { - if (!Modifier.isPublic(methodModifiers) && !Modifier.isProtected(methodModifiers)) - { - errorMessages.add("Abstract method cannot be defined (neither public or " + - "protected): " + m); - } else { - errorMessages.add - ("Abstract method cannot be defined (not a bean property): " + m); + if (errorMessages.size() == 0) { + Iterator iter = methods.values().iterator(); + while (iter.hasNext()) { + Method m = iter.next(); + int methodModifiers = m.getModifiers(); + if (Modifier.isAbstract(methodModifiers )) { + if (!Modifier.isPublic(methodModifiers) && + !Modifier.isProtected(methodModifiers)) + { + errorMessages.add("Abstract method cannot be defined (neither public or " + + "protected): " + m); + } else { + errorMessages.add + ("Abstract method cannot be defined (not a bean property): " + m); + } + // We've reported the error, nothing more to say about it + iter.remove(); } - // We've reported the error, nothing more to say about it - iter.remove(); } } -- cgit v1.2.3