1 23 24 package com.sun.enterprise.tools.verifier.tests.util; 25 26 import com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompiler; 27 import com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl; 28 import com.sun.enterprise.tools.verifier.StringManagerHelper; 29 import com.sun.enterprise.util.LocalStringManagerImpl; 30 31 import java.util.*; 32 import java.io.File ; 33 34 39 public class ArchiveClassesLoadableHelper { 40 46 public static String getFailedResult(ClosureCompiler cc){ 47 StringBuilder sb = new StringBuilder (); 48 sb.append("\n"); 49 for (Object o : cc.getFailed().entrySet()) { 50 Map.Entry<String , List<String >> referencingPathToFailedList = 51 (Map.Entry<String , List<String >>)o; 52 LocalStringManagerImpl smh = StringManagerHelper.getLocalStringsManager(); 53 String classes = "Failed to find following classes:"; 54 if (smh != null) { 55 classes = smh.getLocalString( 56 ArchiveClassesLoadableHelper.class.getName() + ".classes", 57 classes); 58 } 59 sb.append(classes).append("\n["); 60 for (Iterator<String > iii = referencingPathToFailedList.getValue().iterator(); 61 iii.hasNext();) { 62 sb.append("\n\t").append(iii.next()); 63 if(iii.hasNext()) sb.append(","); 64 } 65 sb.append("\n]"); 66 String referencingPath = referencingPathToFailedList.getKey(); 67 if(referencingPath.length()==0) continue; String ref = "referenced in the following call stack :\n"; 69 String reference = "at"; 70 if (smh != null) { 71 ref = smh.getLocalString( 72 ArchiveClassesLoadableHelper.class.getName() + ".ref", 73 ref); 74 reference = smh.getLocalString( 75 ArchiveClassesLoadableHelper.class.getName() + ".reference", 76 reference); 77 } 78 StringTokenizer st = new StringTokenizer(referencingPath, File.separator); 79 Stack<String > referencingClassStack = new Stack<String >(); 80 while(st.hasMoreTokens()) { 81 referencingClassStack.push(st.nextToken()); 82 } 83 if(!referencingClassStack.isEmpty()) 84 sb.append("\n\n"+ref); 85 while(!referencingClassStack.isEmpty()){ 86 sb.append("\n\t").append(reference).append(" "); 87 sb.append(referencingClassStack.pop()); 88 } 89 sb.append("\n\n"); 90 } 91 return sb.toString(); 92 } 93 } 94 95 | Popular Tags |