1 package org.objectweb.celtix.tools.common.toolspec.parser; 2 3 4 import java.util.*; 5 6 7 public class BadUsageException extends Exception { 8 public static final long serialVersionUID = 1L; 9 private final String usage; 10 private final ErrorVisitor errors; 11 12 public BadUsageException() { 13 this("(unknown)", null); 14 } 15 16 public BadUsageException(ErrorVisitor err) { 17 this("(unknown)", err); 18 } 19 20 public BadUsageException(String use, ErrorVisitor err) { 21 super("Usage: " + use); 22 this.usage = use; 23 this.errors = err; 24 } 25 26 public Collection getErrors() { 27 return errors.getErrors(); 28 } 29 30 public String getMessage() { 31 StringBuffer sb = new StringBuffer (); 32 33 if (errors != null) { 34 sb.append(errors.toString()); 35 } 36 return sb.toString(); 37 } 38 39 public String getUsage() { 40 return usage; 41 } 42 43 } 44 | Popular Tags |