1.1 --- a/src/share/classes/com/sun/tools/javah/TypeSignature.java Tue Oct 12 13:15:46 2010 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javah/TypeSignature.java Tue Oct 12 13:19:47 2010 -0700 1.3 @@ -51,7 +51,13 @@ 1.4 * @author Sucheta Dambalkar 1.5 */ 1.6 1.7 -public class TypeSignature{ 1.8 +public class TypeSignature { 1.9 + static class SignatureException extends Exception { 1.10 + private static final long serialVersionUID = 1L; 1.11 + SignatureException(String reason) { 1.12 + super(reason); 1.13 + } 1.14 + } 1.15 1.16 Elements elems; 1.17 1.18 @@ -78,14 +84,15 @@ 1.19 /* 1.20 * Returns the type signature of a field according to JVM specs 1.21 */ 1.22 - public String getTypeSignature(String javasignature){ 1.23 + public String getTypeSignature(String javasignature) throws SignatureException { 1.24 return getParamJVMSignature(javasignature); 1.25 } 1.26 1.27 /* 1.28 * Returns the type signature of a method according to JVM specs 1.29 */ 1.30 - public String getTypeSignature(String javasignature, TypeMirror returnType){ 1.31 + public String getTypeSignature(String javasignature, TypeMirror returnType) 1.32 + throws SignatureException { 1.33 String signature = null; //Java type signature. 1.34 String typeSignature = null; //Internal type signature. 1.35 List<String> params = new ArrayList<String>(); //List of parameters. 1.36 @@ -166,7 +173,7 @@ 1.37 /* 1.38 * Returns internal signature of a parameter. 1.39 */ 1.40 - private String getParamJVMSignature(String paramsig) { 1.41 + private String getParamJVMSignature(String paramsig) throws SignatureException { 1.42 String paramJVMSig = ""; 1.43 String componentType =""; 1.44 1.45 @@ -197,7 +204,7 @@ 1.46 /* 1.47 * Returns internal signature of a component. 1.48 */ 1.49 - private String getComponentType(String componentType){ 1.50 + private String getComponentType(String componentType) throws SignatureException { 1.51 1.52 String JVMSig = ""; 1.53 1.54 @@ -216,8 +223,7 @@ 1.55 TypeElement classNameDoc = elems.getTypeElement(componentType); 1.56 1.57 if(classNameDoc == null){ 1.58 - System.out.println("Invalid class type for " + componentType); 1.59 - new Exception().printStackTrace(); 1.60 + throw new SignatureException(componentType); 1.61 }else { 1.62 String classname = classNameDoc.getQualifiedName().toString(); 1.63 String newclassname = classname.replace('.', '/');