org.eclipse.pde.api.tools_1.0.301.v20111129-2053

report.counts.total_illegal_method_count += 1;
        }
        break;
      case 5: 
        switch (visibility)
        {
        case 1: 
          currentmember.counts.total_api_field_count += 1;
          currenttype.counts.total_api_field_count += 1;
          currentreferee.counts.total_api_field_count += 1;
          currentreport.counts.total_api_field_count += 1;
          break;
        case 2: 
          currentmember.counts.total_private_field_count += 1;
          currenttype.counts.total_private_field_count += 1;
          currentreferee.counts.total_private_field_count += 1;
          currentreport.counts.total_private_field_count += 1;
          break;
        case 8: 
          currentmember.counts.total_permissable_field_count += 1;
          currenttype.counts.total_permissable_field_count += 1;
          currentreferee.counts.total_permissable_field_count += 1;
          currentreport.counts.total_permissable_field_count += 1;
          break;
        case 5: 
          currentmember.counts.total_fragment_permissible_field_count += 1;
          currenttype.counts.total_fragment_permissible_field_count += 1;
          currentreferee.counts.total_fragment_permissible_field_count += 1;
          currentreport.counts.total_fragment_permissible_field_count += 1;
          break;
        case 22: 
          currentmember.counts.total_illegal_field_count += 1;
          currenttype.counts.total_illegal_field_count += 1;
          currentreferee.counts.total_illegal_field_count += 1;
          currentreport.counts.total_illegal_field_count += 1;
        }
        break;
      }
    }
  }
  
  static Comparator compare = new Comparator()
  {
    public int compare(Object o1, Object o2)
    {
      if (((o1 instanceof String)) && ((o2 instanceof String))) {
        return ((String)o1).compareTo((String)o2);
      }
      if (((o1 instanceof UseReportConverter.Type)) && ((o2 instanceof UseReportConverter.Type))) {
        return compare(desc, desc);
      }
      if (((o1 instanceof IReferenceTypeDescriptor)) && ((o2 instanceof IReferenceTypeDescriptor))) {
        return ((IReferenceTypeDescriptor)o1).getQualifiedName().compareTo(((IReferenceTypeDescriptor)o2).getQualifiedName());
      }
      if (((o1 instanceof IMethodDescriptor)) && ((o2 instanceof IMethodDescriptor))) {
        try
        {
          return Signatures.getQualifiedMethodSignature((IMethodDescriptor)o1).compareTo(Signatures.getQualifiedMethodSignature((IMethodDescriptor)o2));
        }
        catch (CoreException localCoreException1)
        {
          return -1;
        }
      }
      if (((o1 instanceof IFieldDescriptor)) && ((o2 instanceof IFieldDescriptor))) {
        try
        {
          return Signatures.getQualifiedFieldSignature((IFieldDescriptor)o1).compareTo(Signatures.getQualifiedFieldSignature((IFieldDescriptor)o2));
        }
        catch (CoreException localCoreException2)
        {
          return -1;
        }
      }
      if (((o1 instanceof IComponentDescriptor)) && ((o2 instanceof IComponentDescriptor))) {
        return ((IComponentDescriptor)o1).getId().compareTo(((IComponentDescriptor)o2).getId());
      }
      return -1;
    }
  };
  public static final int FRAGMENT_PERMISSIBLE = 5;
  public static final String DEFAULT_XSLT = "/references.xsl";
  public static final String NORMAL_REFS_COLOUR = "#FFFFFF";
  public static final String INTERNAL_REFS_COLOUR = "#F2C3C3";
  public static final String ILLEGAL_REFS_COLOUR = "#E0E0E0";
  public static final String REFERENCES_TABLE_HEADER_COLOUR = "#E0C040";
  static final String REF_STYLE;
  static final String REF_SCRIPT;
  
  static class Report
  {
    String name = null;
    TreeMap children = new TreeMap(UseReportConverter.compare);
    UseReportConverter.CountGroup counts = new UseReportConverter.CountGroup();
  }
  
  static class Type
  {
    IElementDescriptor desc = null;
    UseReportConverter.CountGroup counts = new UseReportConverter.CountGroup();
    
    public Type(IElementDescriptor desc)
    {
      this.desc = desc;
    }
  }
  
  static class Member
  {
    IElementDescriptor descriptor = null;
    TreeMap children = new TreeMap(UseReportConverter.compare);
    UseReportConverter.CountGroup counts = new UseReportConverter.CountGroup();
    
    public Member(IElementDescriptor desc)
    {
      descriptor = desc;
    }
  }
  
  static class Reference
  {
    IElementDescriptor desc = null;
    int line = -1;
    int vis = -1;
    String message = null;
    
    public Reference(IElementDescriptor desc, int line, int vis, String message)
    {
      this.desc = desc;
      this.line = line;
      this.vis = vis;
      this.message = message;
    }
  }
  
  static final class CountGroup
  {
    int total_api_field_count = 0;
    int total_private_field_count = 0;
    int total_permissable_field_count = 0;
    int total_fragment_permissible_field_count = 0;
    int total_illegal_field_count = 0;
    int total_api_method_count = 0;
    int total_private_method_count = 0;
    int total_permissable_method_count = 0;
    int total_fragment_permissible_method_count = 0;
    int total_illegal_method_count = 0;
    int total_api_type_count = 0;
    int total_private_type_count = 0;
    int total_permissable_type_count = 0;
    int total_fragment_permissible_type_count = 0;
    int total_illegal_type_count = 0;
    
    public int getTotalRefCount()
    {
      return total_api_field_count + 
        total_api_method_count + 
        total_api_type_count + 
        total_private_field_count + 
        total_private_method_count + 
        total_private_type_count + 
        total_permissable_field_count + 
        total_permissable_method_count + 
        total_permissable_type_count + 
        total_fragment_permissible_field_count + 
        total_fragment_permissible_method_count + 
        total_fragment_permissible_type_count + 
        total_illegal_field_count + 
        total_illegal_method_count + 
        total_illegal_type_count;
    }
    
    public int getTotalApiRefCount()
    {
      return total_api_field_count + total_api_method_count + total_api_type_count;
    }
    
    public int getTotalInternalRefCount()
    {
      return total_private_field_count + total_private_method_count + total_private_type_count;
    }
    
    public int getTotalPermissableRefCount()
    {
      return total_permissable_field_count + total_permissable_method_count + total_permissable_type_count;
    }
    
    public int getTotalFragmentPermissibleRefCount()
    {
      return total_fragment_permissible_field_count + total_fragment_permissible_method_count + total_fragment_permissible_type_count;
    }
    
    public int getTotalIllegalRefCount()
    {
      return total_illegal_field_count + total_illegal_method_count + total_illegal_type_count;
    }
  }
  
  static final class MissingHandler
    extends DefaultHandler
  {
    List missing = new ArrayList();
    static String pattern = "Require-Bundle:";
    
    public void startElement(String uri, String localName, String qName, Attributes attributes)
      throws SAXException
    {
      if ("component".equals(qName))
      {
        String value = attributes.getValue("details");
        StringTokenizer tokenizer = new StringTokenizer(value, "<>");
        int index = -1;
        while (tokenizer.hasMoreTokens())
        {
          value = tokenizer.nextToken();
          index = value.indexOf(pattern);
          if (index > -1) {
            missing.add(value.replaceAll(pattern, ""));
          }
        }
      }
    }
  }
  
  static
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("<style type=\"text/css\">\n");
    buffer.append("\t.main {\t\tfont-family:Arial, Helvetica, sans-serif;\n\t}\n");
    buffer.append("\t.main h3 {\n\t\tfont-family:Arial, Helvetica, sans-serif;\n\t\t\background-color:#FFFFFF;\n\t\tfont-size:14px;\n\t\tmargin:0.1em;\n\t}\n");
    buffer.append("\t.main h4 {\n\t\tbackground-color:#CCCCCC;\n\t\tmargin:0.15em;\n\t}\n");
    buffer.append("\ta.typeslnk {\n\t\tfont-family:Arial, Helvetica, sans-serif;\n\t\ttext-decoration:none;\n\t\tmargin-left:0.25em;\n\t}\n");
    buffer.append("\ta.typeslnk:hover {\n\t\ttext-decoration:underline;\n\t}\n");
    buffer.append("\ta.kindslnk {\n\t\tfont-family:Arial, Helvetica, sans-serif;\n\t\ttext-decoration:none;\n\t\tmargin-left:0.25em;\n\t}\n");
    buffer.append("\t.types {\n\t\tdisplay:none;\n\t\tmargin-bottom:0.25em;\n\t\tmargin-top:0.25em;\n\t\tmargin-right:0.25em;\n\t\tmargin-left:0.75em;\n\t}\n");
    buffer.append("</style>\n");
    REF_STYLE = buffer.toString();
    
    buffer = new StringBuffer();
    buffer.append("<script type=\"text/javascript\">\n\tfunction expand(location) {\n\t\tif(document.getElementById) {\n\t\t\tvar childhtml = location.firstChild;\n\t\t\tif(!childhtml.innerHTML) {\n\t\t\t\tchildhtml = childhtml.nextSibling;\n\t\t\t}\n\t\t\tchildhtml.innerHTML = childhtml.innerHTML == '[+] ' ? '[-] ' : '[+] ';\n\t\t\tvar parent = location.parentNode;\n\t\t\tchildhtml = parent.nextSibling.style ? parent.nextSibling : parent.nextSibling.nextSibling;\n\t\t\tchildhtml.style.display = childhtml.style.display == 'block' ? 'none' : 'block';\n\t\t}\n\t}\n</script>\n");
    buffer.append("<noscript>\n\t<style type=\"text/css\">\n\t\t.types {display:block;}\n\t\t.kinds{display:block;}\n\t</style>\n</noscript>\n");
    REF_SCRIPT = buffer.toString();
  }
  
  public static void setDebug(boolean debugValue)
  {
    DEBUG = (debugValue) || (Util.DEBUG);
  }
  
  protected static boolean DEBUG = Util.DEBUG;
  private String xmlLocation = null;
  private String htmlLocation = null;
  private File reportsRoot = null;
  private File htmlIndex = null;
  private boolean hasmissing = false;
  SAXParser parser = null;
  private UseMetadata metadata = null;
  Pattern[] topatterns = null;
  Pattern[] frompatterns = null;
  
  public UseReportConverter(String htmlroot, String xmlroot, String[] topatterns, String[] frompatterns)
  {
    xmlLocation = xmlroot;
    htmlLocation = htmlroot;
    if (topatterns != null)
    {
      ArrayList pats = new ArrayList(topatterns.length);
      for (int i = 0; i < topatterns.length; i++) {
        try
        {
          pats.add(Pattern.compile(topatterns[i]));
        }
        catch (PatternSyntaxException pse)
        {
          if (DEBUG)
          {
            System.out.println(NLS.bind(SearchMessages.UseReportConverter_filter_pattern_not_valid, topatterns[i]));
            System.out.println(pse.getMessage());
          }
        }
      }
      if (!pats.isEmpty()) {
        this.topatterns = ((Pattern[])pats.toArray(new Pattern[pats.size()]));
      }
    }
    if (frompatterns != null)
    {
      ArrayList pats = new ArrayList(frompatterns.length);
      for (int i = 0; i < frompatterns.length; i++) {
        try
        {
          pats.add(Pattern.compile(frompatterns[i]));
        }
        catch (PatternSyntaxException pse)
        {
          if (DEBUG)
          {
            System.out.println(NLS.bind(SearchMessages.UseReportConverter_filter_pattern_not_valid, frompatterns[i]));
            System.out.println(pse.getMessage());
          }
        }
      }
      if (!pats.isEmpty()) {
        this.frompatterns = ((Pattern[])pats.toArray(new Pattern[pats.size()]));
      }
    }
  }
  
  protected String getHtmlLocation()
  {
    return htmlLocation;
  }
  
  protected String getXmlLocation()
  {
    return xmlLocation;
  }
  
  protected File getReportsRoot()
  {
    if (reportsRoot == null) {
      reportsRoot = new File(getXmlLocation());
    }
    return reportsRoot;
  }
  
  protected boolean hasMissing()
  {
    return hasmissing;
  }
  
  /* Error */
  public void convert(String xslt, IProgressMonitor monitor)
    throws Exception
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 1420	org/eclipse/pde/api/tools/internal/search/UseReportConverter:getHtmlLocation	()Ljava/lang/String;
    //   4: ifnonnull +4 -> 8
    //   7: return
    //   8: aload_2
    //   9: getstatic 1239	org/eclipse/pde/api/tools/internal/search/SearchMessages:UseReportConverter_preparing_report_metadata	Ljava/lang/String;
    //   12: bipush 11
    //   14: invokestatic 1381	org/eclipse/core/runtime/SubMonitor:convert	(Lorg/eclipse/core/runtime/IProgressMonitor;Ljava/lang/String;I)Lorg/eclipse/core/runtime/SubMonitor;
    //   17: astore_3
    //   18: aload_3
    //   19: getstatic 1238	org/eclipse/pde/api/tools/internal/search/SearchMessages:UseReportConverter_preparing_html_root	Ljava/lang/String;
    //   22: invokevirtual 1379	org/eclipse/core/runtime/SubMonitor:setTaskName	(Ljava/lang/String;)V
    //   25: aload_3
    //   26: iconst_1
    //   27: invokestatic 1472	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   30: new 707	java/io/File
    //   33: dup
    //   34: aload_0
    //   35: invokevirtual 1420	org/eclipse/pde/api/tools/internal/search/UseReportConverter:getHtmlLocation	()Ljava/lang/String;
    //   38: invokespecial 1312	java/io/File:<init>	(Ljava/lang/String;)V
    //   41: astore 4
    //   43: aload 4
    //   45: invokevirtual 1306	java/io/File:exists	()Z
    //   48: ifne +29 -> 77
    //   51: aload 4
    //   53: invokevirtual 1309	java/io/File:mkdirs	()Z
    //   56: ifne +27 -> 83
    //   59: new 715	java/lang/Exception
    //   62: dup
    //   63: getstatic 1270	org/eclipse/pde/api/tools/internal/search/SearchMessages:could_not_create_file	Ljava/lang/String;
    //   66: aload_0
    //   67: invokevirtual 1420	org/eclipse/pde/api/tools/internal/search/UseReportConverter:getHtmlLocation	()Ljava/lang/String;
    //   70: invokestatic 1383	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   73: invokespecial 1325	java/lang/Exception:<init>	(Ljava/lang/String;)V
    //   76: athrow
    //   77: aload 4
    //   79: invokevirtual 1309	java/io/File:mkdirs	()Z
    //   82: pop
    //   83: aload_3
    //   84: getstatic 1240	org/eclipse/pde/api/tools/internal/search/SearchMessages:UseReportConverter_preparing_xml_root	Ljava/lang/String;
    //   87: invokevirtual 1379	org/eclipse/core/runtime/SubMonitor:setTaskName	(Ljava/lang/String;)V
    //   90: aload_3
    //   91: iconst_1
    //   92: invokestatic 1472	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   95: aload_0
    //   96: invokevirtual 1427	org/eclipse/pde/api/tools/internal/search/UseReportConverter:getXmlLocation	()Ljava/lang/String;
    //   99: ifnonnull +14 -> 113
    //   102: new 715	java/lang/Exception
    //   105: dup
    //   106: getstatic 1274	org/eclipse/pde/api/tools/internal/search/SearchMessages:missing_xml_files_location	Ljava/lang/String;
    //   109: invokespecial 1325	java/lang/Exception:<init>	(Ljava/lang/String;)V
    //   112: athrow
    //   113: aload_0
    //   114: invokevirtual 1413	org/eclipse/pde/api/tools/internal/search/UseReportConverter:getReportsRoot	()Ljava/io/File;
    //   117: astore 5
    //   119: aload 5
    //   121: invokevirtual 1306	java/io/File:exists	()Z
    //   124: ifeq +11 -> 135
    //   127: aload 5
    //   129: invokevirtual 1307	java/io/File:isDirectory	()Z
    //   132: ifne +21 -> 153
    //   135: new 715	java/lang/Exception
    //   138: dup
    //   139: getstatic 1272	org/eclipse/pde/api/tools/internal/search/SearchMessages:invalid_directory_name	Ljava/lang/String;
    //   142: aload_0
    //   143: invokevirtual 1427	org/eclipse/pde/api/tools/internal/search/UseReportConverter:getXmlLocation	()Ljava/lang/String;
    //   146: invokestatic 1383	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   149: invokespecial 1325	java/lang/Exception:<init>	(Ljava/lang/String;)V
    //   152: athrow
    //   153: aload_3
    //   154: getstatic 1241	org/eclipse/pde/api/tools/internal/search/SearchMessages:UseReportConverter_preparing_xslt_file	Ljava/lang/String;
    //   157: invokevirtual 1379	org/eclipse/core/runtime/SubMonitor:setTaskName	(Ljava/lang/String;)V
    //   160: aload_3
    //   161: iconst_1
    //   162: invokestatic 1472	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   165: aconst_null
    //   166: astore 6
    //   168: aload_1
    //   169: ifnull +40 -> 209
    //   172: new 707	java/io/File
    //   175: dup
    //   176: aload_1
    //   177: invokespecial 1312	java/io/File:<init>	(Ljava/lang/String;)V
    //   180: astore 6
    //   182: aload 6
    //   184: invokevirtual 1306	java/io/File:exists	()Z
    //   187: ifeq +11 -> 198
    //   190: aload 6
    //   192: invokevirtual 1308	java/io/File:isFile	()Z
    //   195: ifne +14 -> 209
    //   198: new 715	java/lang/Exception
    //   201: dup
    //   202: getstatic 1268	org/eclipse/pde/api/tools/internal/search/SearchMessages:UseReportConverter_xslt_file_not_valid	Ljava/lang/String;
    //   205: invokespecial 1325	java/lang/Exception:<init>	(Ljava/lang/String;)V
    //   208: athrow
    //   209: lconst_0
    //   210: lstore 7
    //   212: getstatic 1275	org/eclipse/pde/api/tools/internal/search/UseReportConverter:DEBUG	Z
    //   215: ifeq +8 -> 223
    //   218: invokestatic 1351	java/lang/System:currentTimeMillis	()J
    //   221: lstore 7
    //   223: aload_3
    //   224: getstatic 1266	org/eclipse/pde/api/tools/internal/search/SearchMessages:UseReportConverter_writing_not_searched	Ljava/lang/String;
    //   227: invokevirtual 1379	org/eclipse/core/runtime/SubMonitor:setTaskName	(Ljava/lang/String;)V
    //   230: aload_0
    //   231: aload_0
    //   232: aload 4
    //   234: invokevirtual 1417	org/eclipse/pde/api/tools/internal/search/UseReportConverter:writeMissingBundlesPage	(Ljava/io/File;)Z
    //   237: putfield 1276	org/eclipse/pde/api/tools/internal/search/UseReportConverter:hasmissing	Z
    //   240: aload_0
    //   241: aload 4
    //   243: invokevirtual 1416	org/eclipse/pde/api/tools/internal/search/UseReportConverter:writeNotSearchedPage	(Ljava/io/File;)V
    //   246: aload_3
    //   247: iconst_1
    //   248: invokestatic 1472	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   251: getstatic 1275	org/eclipse/pde/api/tools/internal/search/UseReportConverter:DEBUG	Z
    //   254: ifeq +51 -> 305
    //   257: getstatic 1192	java/lang/System:out	Ljava/io/PrintStream;
    //   260: new 721	java/lang/StringBuffer
    //   263: dup
    //   264: ldc_w 687
    //   267: invokespecial 1344	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   270: invokestatic 1351	java/lang/System:currentTimeMillis	()J
    //   273: lload 7
    //   275: lsub
    //   276: invokevirtual 1347	java/lang/StringBuffer:append	(J)Ljava/lang/StringBuffer;
    //   279: ldc_w 599
    //   282: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   285: invokevirtual 1343	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   288: invokevirtual 1317	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   291: getstatic 1192	java/lang/System:out	Ljava/io/PrintStream;
    //   294: ldc_w 680
    //   297: invokevirtual 1317	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   300: invokestatic 1351	java/lang/System:currentTimeMillis	()J
    //   303: lstore 7
    //   305: aload_3
    //   306: getstatic 1235	org/eclipse/pde/api/tools/internal/search/SearchMessages:UseReportConverter_parsing_use_scan	Ljava/lang/String;
    //   309: invokevirtual 1379	org/eclipse/core/runtime/SubMonitor:setTaskName	(Ljava/lang/String;)V
    //   312: aload_0
    //   313: aload_3
    //   314: iconst_5
    //   315: invokevirtual 1380	org/eclipse/core/runtime/SubMonitor:newChild	(I)Lorg/eclipse/core/runtime/SubMonitor;
    //   318: invokevirtual 1446	org/eclipse/pde/api/tools/internal/search/UseReportConverter:parse	(Lorg/eclipse/core/runtime/IProgressMonitor;)Ljava/util/List;
    //   321: astore 9
    //   323: aload_3
    //   324: iconst_1
    //   325: invokestatic 1472	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   328: getstatic 1275	org/eclipse/pde/api/tools/internal/search/UseReportConverter:DEBUG	Z
    //   331: ifeq +51 -> 382
    //   334: getstatic 1192	java/lang/System:out	Ljava/io/PrintStream;
    //   337: new 721	java/lang/StringBuffer
    //   340: dup
    //   341: ldc_w 687
    //   344: invokespecial 1344	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   347: invokestatic 1351	java/lang/System:currentTimeMillis	()J
    //   350: lload 7
    //   352: lsub
    //   353: invokevirtual 1347	java/lang/StringBuffer:append	(J)Ljava/lang/StringBuffer;
    //   356: ldc_w 599
    //   359: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   362: invokevirtual 1343	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   365: invokevirtual 1317	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   368: getstatic 1192	java/lang/System:out	Ljava/io/PrintStream;
    //   371: ldc_w 681
    //   374: invokevirtual 1317	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   377: invokestatic 1351	java/lang/System:currentTimeMillis	()J
    //   380: lstore 7
    //   382: aload_3
    //   383: getstatic 1267	org/eclipse/pde/api/tools/internal/search/SearchMessages:UseReportConverter_writing_root_index	Ljava/lang/String;
    //   386: invokevirtual 1379	org/eclipse/core/runtime/SubMonitor:setTaskName	(Ljava/lang/String;)V
    //   389: aload_0
    //   390: aload 9
    //   392: invokevirtual 1432	org/eclipse/pde/api/tools/internal/search/UseReportConverter:writeIndexPage	(Ljava/util/List;)V
    //   395: aload_3
    //   396: iconst_1
    //   397: invokestatic 1472	org/eclipse/pde/api/tools/internal/util/Util:updateMonitor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   400: getstatic 1275	org/eclipse/pde/api/tools/internal/search/UseReportConverter:DEBUG	Z
    //   403: ifeq +37 -> 440
    //   406: getstatic 1192	java/lang/System:out	Ljava/io/PrintStream;
    //   409: new 721	java/lang/StringBuffer
    //   412: dup
    //   413: ldc_w 687
    //   416: invokespecial 1344	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   419: invokestatic 1351	java/lang/System:currentTimeMillis	()J
    //   422: lload 7
    //   424: lsub
    //   425: invokevirtual 1347	java/lang/StringBuffer:append	(J)Ljava/lang/StringBuffer;
    //   428: ldc_w 599
    //   431: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   434: invokevirtual 1343	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   437: invokevirtual 1317	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   440: aload_0
    //   441: aload 4
    //   443: invokevirtual 1415	org/eclipse/pde/api/tools/internal/search/UseReportConverter:writeMetaPage	(Ljava/io/File;)V
    //   446: goto +16 -> 462
    //   449: astore 10
    //   451: aload_3
    //   452: ifnull +7 -> 459
    //   455: aload_3
    //   456: invokevirtual 1378	org/eclipse/core/runtime/SubMonitor:done	()V
    //   459: aload 10
    //   461: athrow
    //   462: aload_3
    //   463: ifnull +7 -> 470
    //   466: aload_3
    //   467: invokevirtual 1378	org/eclipse/core/runtime/SubMonitor:done	()V
    //   470: return
    // Line number table:
    //   Java source line #707	-> byte code offset #0
    //   Java source line #708	-> byte code offset #7
    //   Java source line #710	-> byte code offset #8
    //   Java source line #712	-> byte code offset #18
    //   Java source line #713	-> byte code offset #25
    //   Java source line #714	-> byte code offset #30
    //   Java source line #715	-> byte code offset #43
    //   Java source line #716	-> byte code offset #51
    //   Java source line #717	-> byte code offset #59
    //   Java source line #721	-> byte code offset #77
    //   Java source line #723	-> byte code offset #83
    //   Java source line #724	-> byte code offset #90
    //   Java source line #725	-> byte code offset #95
    //   Java source line #726	-> byte code offset #102
    //   Java source line #728	-> byte code offset #113
    //   Java source line #729	-> byte code offset #119
    //   Java source line #730	-> byte code offset #135
    //   Java source line #733	-> byte code offset #153
    //   Java source line #734	-> byte code offset #160
    //   Java source line #735	-> byte code offset #165
    //   Java source line #736	-> byte code offset #168
    //   Java source line #738	-> byte code offset #172
    //   Java source line #739	-> byte code offset #182
    //   Java source line #740	-> byte code offset #198
    //   Java source line #743	-> byte code offset #209
    //   Java source line #744	-> byte code offset #212
    //   Java source line #745	-> byte code offset #218
    //   Java source line #747	-> byte code offset #223
    //   Java source line #748	-> byte code offset #230
    //   Java source line #749	-> byte code offset #240
    //   Java source line #750	-> byte code offset #246
    //   Java source line #751	-> byte code offset #251
    //   Java source line #752	-> byte code offset #257
    //   Java source line #753	-> byte code offset #291
    //   Java source line #754	-> byte code offset #300
    //   Java source line #756	-> byte code offset #305
    //   Java source line #757	-> byte code offset #312
    //   Java source line #758	-> byte code offset #323
    //   Java source line #759	-> byte code offset #328
    //   Java source line #760	-> byte code offset #334
    //   Java source line #761	-> byte code offset #368
    //   Java source line #762	-> byte code offset #377
    //   Java source line #764	-> byte code offset #382
    //   Java source line #765	-> byte code offset #389
    //   Java source line #766	-> byte code offset #395
    //   Java source line #767	-> byte code offset #400
    //   Java source line #768	-> byte code offset #406
    //   Java source line #770	-> byte code offset #440
    //   Java source line #772	-> byte code offset #449
    //   Java source line #773	-> byte code offset #451
    //   Java source line #774	-> byte code offset #455
    //   Java source line #776	-> byte code offset #459
    //   Java source line #773	-> byte code offset #462
    //   Java source line #774	-> byte code offset #466
    //   Java source line #777	-> byte code offset #470
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	471	0	this	UseReportConverter
    //   0	471	1	xslt	String
    //   0	471	2	monitor	IProgressMonitor
    //   17	450	3	localmonitor	org.eclipse.core.runtime.SubMonitor
    //   41	401	4	htmlRoot	File
    //   117	11	5	reportsRoot	File
    //   166	25	6	xsltFile	File
    //   210	213	7	start	long
    //   321	70	9	result	List
    //   449	11	10	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   18	449	449	finally
  }
  
  protected List parse(IProgressMonitor monitor)
    throws Exception
  {
    UseScanParser parser = new UseScanParser();
    Visitor convertor = new Visitor();
    parser.parse(getXmlLocation(), monitor, convertor);
    return reports;
  }
  
  SAXParser getParser()
    throws Exception
  {
    if (parser == null)
    {
      SAXParserFactory factory = SAXParserFactory.newInstance();
      try
      {
        parser = factory.newSAXParser();
      }
      catch (ParserConfigurationException pce)
      {
        throw new Exception(SearchMessages.UseReportConverter_pce_error_getting_parser, pce);
      }
      catch (SAXException se)
      {
        throw new Exception(SearchMessages.UseReportConverter_se_error_parser_handle, se);
      }
      if (parser == null) {
        throw new Exception(SearchMessages.could_not_create_sax_parser);
      }
    }
    return parser;
  }
  
  protected String composeName(String id, String version)
  {
    String versionName = version;
    if (version == null) {
      versionName = Version.emptyVersion.toString();
    }
    StringBuffer buffer = new StringBuffer(3 + id.length() + versionName.length());
    buffer.append(id).append(" (").append(versionName).append(")");
    return buffer.toString();
  }
  
  public File getReportIndex()
  {
    return htmlIndex;
  }
  
  protected void setReportIndex(File index)
  {
    htmlIndex = index;
  }
  
  protected void applyXSLT(File xsltFile, File xmlfile, File htmloutput)
    throws TransformerException, Exception
  {
    Source xslt = null;
    if (xsltFile != null)
    {
      xslt = new StreamSource(xsltFile);
    }
    else
    {
      InputStream defaultXsltInputStream = UseReportConverter.class.getResourceAsStream("/references.xsl");
      if (defaultXsltInputStream != null) {
        xslt = new StreamSource(new BufferedInputStream(defaultXsltInputStream));
      }
    }
    if (xslt == null) {
      throw new Exception(SearchMessages.UseReportConverter_no_xstl_specified);
    }
    applyXSLT(xslt, xmlfile, htmloutput);
  }
  
  protected void applyXSLT(Source xslt, File xmlfile, File htmlfile)
    throws TransformerException
  {
    Source xml = new StreamSource(xmlfile);
    Result html = new StreamResult(htmlfile);
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer former = factory.newTransformer(xslt);
    former.transform(xml, html);
  }
  
  protected void tranformXml(File[] xmlfiles, File xsltFile)
  {
    File html = null;
    for (int i = 0; i < xmlfiles.length; i++) {
      try
      {
        File htmlroot = new File(getHtmlLocation(), getHTMLFileLocation(xmlfiles[i]));
        if (!htmlroot.exists()) {
          htmlroot.mkdirs();
        }
        html = new File(getNameFromXMLFilename(xmlfiles[i]));
        applyXSLT(xsltFile, xmlfiles[i], html);
      }
      catch (TransformerException localTransformerException) {}catch (Exception e)
      {
        ApiPlugin.log(e);
      }
    }
  }
  
  protected String getHTMLFileLocation(File xmlfile)
  {
    File reportRoot = new File(getXmlLocation());
    IPath xml = new Path(xmlfile.getPath());
    IPath report = new Path(reportRoot.getPath());
    int segments = xml.matchingFirstSegments(report);
    if (segments > 0)
    {
      if (xml.getDevice() != null) {
        xml = xml.setDevice(null);
      }
      IPath html = xml.removeFirstSegments(segments);
      return html.removeLastSegments(1).toOSString();
    }
    return null;
  }
  
  protected String getNameFromXMLFilename(File xmlFile)
  {
    String fileName = xmlFile.getAbsolutePath();
    int index = fileName.lastIndexOf('.');
    StringBuffer buffer = new StringBuffer();
    buffer.append(fileName.substring(getReportsRoot().getAbsolutePath().length(), index)).append(".html");
    File htmlFile = new File(getHtmlLocation(), String.valueOf(buffer));
    return htmlFile.getAbsolutePath();
  }
  
  protected String[] getMissingBundles(File missingfile)
    throws Exception
  {
    MissingHandler handler = new MissingHandler();
    getParser().parse(missingfile, handler);
    return (String[])missing.toArray(new String[missing.size()]);
  }
  
  protected String getMissingBundlesHeader()
  {
    return SearchMessages.UseReportConverter_reported_missing_bundles;
  }
  
  void writeMetaPage(File htmlroot)
    throws Exception
  {
    File meta = null;
    PrintWriter writer = null;
    try
    {
      File file = new File(getReportsRoot(), "meta.xml");
      if (!file.exists()) {
        return;
      }
      File file;
      String filename = "meta";
      meta = new File(htmlroot, filename + ".html");
      if (!meta.exists()) {
        meta.createNewFile();
      }
      StringBuffer buffer = new StringBuffer();
      buffer.append("<!doctype HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
      buffer.append("<html>\n").append("<head>\n").append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n");
      buffer.append("<title>").append(SearchMessages.UseReportConverter_use_scan_info).append("</title>\n");
      buffer.append("</head>\n");
      buffer.append("<body>\n");
      buffer.append("<h3>").append(SearchMessages.UseReportConverter_use_scan_info).append("</h3>\n");
      writeMetadataSummary(buffer);
      buffer.append("<p>\n\t<a href=\"http://validator.w3.org/check?uri=referer\">\n<img src=\"http://www.w3.org/Icons/valid-html401-blue\" alt=\"Valid HTML 4.01 Transitional\" height=\"31\" width=\"88\"></a>\n</p>\n");
      
      writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(meta), "UTF-8"));
      writer.println(buffer.toString());
      writer.flush();
    }
    catch (IOException localIOException)
    {
      throw new Exception(NLS.bind(SearchMessages.ioexception_writing_html_file, meta.getAbsolutePath()));
    }
    finally
    {
      if (writer != null) {
        writer.close();
      }
    }
    if (writer != null) {
      writer.close();
    }
  }
  
  /* Error */
  protected boolean writeMissingBundlesPage(File htmlroot)
    throws Exception
  {
    // Byte code:
    //   0: iconst_0
    //   1: istore_2
    //   2: aconst_null
    //   3: astore_3
    //   4: aconst_null
    //   5: astore 4
    //   7: ldc_w 693
    //   10: astore 5
    //   12: new 707	java/io/File
    //   15: dup
    //   16: aload_1
    //   17: new 721	java/lang/StringBuffer
    //   20: dup
    //   21: aload 5
    //   23: invokestatic 1340	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   26: invokespecial 1344	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   29: ldc_w 618
    //   32: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   35: invokevirtual 1343	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   38: invokespecial 1313	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   41: astore_3
    //   42: aload_3
    //   43: invokevirtual 1306	java/io/File:exists	()Z
    //   46: ifne +8 -> 54
    //   49: aload_3
    //   50: invokevirtual 1305	java/io/File:createNewFile	()Z
    //   53: pop
    //   54: new 707	java/io/File
    //   57: dup
    //   58: aload_0
    //   59: invokevirtual 1413	org/eclipse/pde/api/tools/internal/search/UseReportConverter:getReportsRoot	()Ljava/io/File;
    //   62: ldc_w 695
    //   65: invokespecial 1313	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   68: astore 6
    //   70: aload 6
    //   72: invokevirtual 1306	java/io/File:exists	()Z
    //   75: ifne +44 -> 119
    //   78: new 707	java/io/File
    //   81: dup
    //   82: new 721	java/lang/StringBuffer
    //   85: dup
    //   86: invokespecial 1341	java/lang/StringBuffer:<init>	()V
    //   89: aload_0
    //   90: invokevirtual 1413	org/eclipse/pde/api/tools/internal/search/UseReportConverter:getReportsRoot	()Ljava/io/File;
    //   93: invokevirtual 1349	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   96: getstatic 1191	java/io/File:separator	Ljava/lang/String;
    //   99: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   102: ldc_w 703
    //   105: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   108: invokevirtual 1343	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   111: ldc_w 695
    //   114: invokespecial 1314	java/io/File:<init>	(Ljava/lang/String;Ljava/lang/String;)V
    //   117: astore 6
    //   119: new 732	java/util/TreeSet
    //   122: dup
    //   123: getstatic 1302	org/eclipse/pde/api/tools/internal/util/Util:componentsorter	Ljava/util/Comparator;
    //   126: invokespecial 1363	java/util/TreeSet:<init>	(Ljava/util/Comparator;)V
    //   129: astore 7
    //   131: aload 6
    //   133: invokevirtual 1306	java/io/File:exists	()Z
    //   136: ifeq +51 -> 187
    //   139: aload_0
    //   140: aload 6
    //   142: invokevirtual 1437	org/eclipse/pde/api/tools/internal/search/UseReportConverter:getMissingBundles	(Ljava/io/File;)[Ljava/lang/String;
    //   145: astore 8
    //   147: aload 8
    //   149: arraylength
    //   150: ifle +7 -> 157
    //   153: iconst_1
    //   154: goto +4 -> 158
    //   157: iconst_0
    //   158: istore_2
    //   159: iconst_0
    //   160: istore 9
    //   162: goto +17 -> 179
    //   165: aload 7
    //   167: aload 8
    //   169: iload 9
    //   171: aaload
    //   172: invokevirtual 1362	java/util/TreeSet:add	(Ljava/lang/Object;)Z
    //   175: pop
    //   176: iinc 9 1
    //   179: iload 9
    //   181: aload 8
    //   183: arraylength
    //   184: if_icmplt -19 -> 165
    //   187: new 721	java/lang/StringBuffer
    //   190: dup
    //   191: invokespecial 1341	java/lang/StringBuffer:<init>	()V
    //   194: astore 8
    //   196: aload 8
    //   198: ldc_w 621
    //   201: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   204: pop
    //   205: aload 8
    //   207: ldc_w 654
    //   210: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   213: ldc_w 653
    //   216: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   219: ldc_w 655
    //   222: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   225: pop
    //   226: aload 8
    //   228: ldc_w 675
    //   231: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   234: getstatic 1229	org/eclipse/pde/api/tools/internal/search/SearchMessages:UseReportConverter_missing_required	Ljava/lang/String;
    //   237: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   240: ldc_w 637
    //   243: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   246: pop
    //   247: aload 8
    //   249: ldc_w 631
    //   252: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   255: pop
    //   256: aload 8
    //   258: ldc_w 647
    //   261: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   264: pop
    //   265: aload 8
    //   267: ldc_w 651
    //   270: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   273: getstatic 1229	org/eclipse/pde/api/tools/internal/search/SearchMessages:UseReportConverter_missing_required	Ljava/lang/String;
    //   276: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   279: ldc_w 629
    //   282: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   285: pop
    //   286: aload 7
    //   288: invokevirtual 1361	java/util/TreeSet:isEmpty	()Z
    //   291: ifeq +21 -> 312
    //   294: aload 8
    //   296: getstatic 1232	org/eclipse/pde/api/tools/internal/search/SearchMessages:UseReportConverter_no_required_missing	Ljava/lang/String;
    //   299: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   302: ldc_w 648
    //   305: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   308: pop
    //   309: goto +90 -> 399
    //   312: aload 8
    //   314: ldc_w 657
    //   317: invokevirtual 1350	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   320: aload_0
    //   321: invokevirtual 1422	org/eclipse/pde/api/tools/internal/search/UseReportConverter:getMis
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd