updater

16:53:52.035 INFO  jd.cli.Main - Decompiling updater.jar
package org.netbeans.updater;

import java.util.Iterator;
import java.util.Locale;
import java.util.NoSuchElementException;

class Localization$LocaleIterator
  implements Iterator
{
  private boolean defaultInProgress = false;
  private boolean empty = false;
  private Locale locale;
  private Locale initLocale;
  private String current;
  private String branding;
  
  public Localization$LocaleIterator(Locale paramLocale)
  {
    locale = (initLocale = paramLocale);
    if (paramLocale.equals(Locale.getDefault())) {
      defaultInProgress = true;
    }
    current = ('_' + paramLocale.toString());
    if (Localization.access$000() == null) {
      branding = null;
    } else {
      branding = ("_" + Localization.access$000());
    }
  }
  
  public Object next()
    throws NoSuchElementException
  {
    if (current == null) {
      throw new NoSuchElementException();
    }
    String str;
    if (branding == null) {
      str = current;
    } else {
      str = branding + current;
    }
    int i = current.lastIndexOf('_');
    if (i == 0)
    {
      if (empty)
      {
        reset();
      }
      else
      {
        current = "";
        empty = true;
      }
    }
    else if (i == -1)
    {
      if (defaultInProgress)
      {
        reset();
      }
      else
      {
        locale = Locale.getDefault();
        current = ('_' + locale.toString());
        defaultInProgress = true;
      }
    }
    else {
      current = current.substring(0, i);
    }
    return str;
  }
  
  private void reset()
  {
    if (branding != null)
    {
      current = ('_' + initLocale.toString());
      int i = branding.lastIndexOf('_');
      if (i == 0) {
        branding = null;
      } else {
        branding = branding.substring(0, i);
      }
      empty = false;
    }
    else
    {
      current = null;
    }
  }
  
  public boolean hasNext()
  {
    return current != null;
  }
  
  public void remove()
    throws UnsupportedOperationException
  {
    throw new UnsupportedOperationException();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.updater.Localization.LocaleIterator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.updater;

import java.util.Collections;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;

final class Localization$PBundle
  extends ResourceBundle
{
  private final Map<String, String> m;
  private final Locale locale;
  
  public Localization$PBundle(Map paramMap, Locale paramLocale)
  {
    m = paramMap;
    locale = paramLocale;
  }
  
  public Enumeration<String> getKeys()
  {
    return Collections.enumeration(m.keySet());
  }
  
  protected Object handleGetObject(String paramString)
  {
    return m.get(paramString);
  }
  
  public Locale getLocale()
  {
    return locale;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.updater.Localization.PBundle
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.updater;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.ResourceBundle;

class Localization
{
  private static final String FILE_SEPARATOR = System.getProperty("file.separator");
  private static final String LOCALE_DIR = "modules" + FILE_SEPARATOR + "ext" + FILE_SEPARATOR + "locale";
  private static final String BUNDLE_NAME = "org/netbeans/updater/Bundle";
  private static final String BUNDLE_EXT = ".properties";
  private static final String UPDATER_JAR = "updater";
  private static final String UPDATER_JAR_EXT = ".jar";
  private static ClassLoader brandedLoader = null;
  private static String brandingToken = null;
  private static Map<String, ResourceBundle> bundleCache = new HashMap();
  
  public static String getBranding()
  {
    if (brandingToken != null) {
      init();
    }
    return brandingToken;
  }
  
  public static String getBrandedString(String paramString)
  {
    
    for (LocaleIterator localLocaleIterator = new LocaleIterator(Locale.getDefault()); localLocaleIterator.hasNext();) {
      try
      {
        ResourceBundle localResourceBundle = findBrandedBundle((String)localLocaleIterator.next());
        if (localResourceBundle != null)
        {
          String str = localResourceBundle.getString(paramString);
          if (str != null) {
            return str;
          }
        }
      }
      catch (MissingResourceException localMissingResourceException) {}
    }
    return null;
  }
  
  private static ResourceBundle findBrandedBundle(String paramString)
  {
    Object localObject1 = (ResourceBundle)bundleCache.get(paramString);
    if (localObject1 != null) {
      return (ResourceBundle)localObject1;
    }
    InputStream localInputStream = brandedLoader.getResourceAsStream("org/netbeans/updater/Bundle" + paramString + ".properties");
    if (localInputStream != null) {
      try
      {
        try
        {
          Properties localProperties = new Properties();
          localProperties.load(localInputStream);
          localObject1 = new PBundle(localProperties, new Locale(""));
          bundleCache.put(paramString, localObject1);
          return (ResourceBundle)localObject1;
        }
        finally
        {
          localInputStream.close();
        }
        return null;
      }
      catch (IOException localIOException)
      {
        return null;
      }
    }
  }
  
  public static URL getBrandedResource(String paramString1, String paramString2)
  {
    
    for (LocaleIterator localLocaleIterator = new LocaleIterator(Locale.getDefault()); localLocaleIterator.hasNext();)
    {
      URL localURL = brandedLoader.getResource(paramString1 + localLocaleIterator.next() + paramString2);
      if (localURL != null) {
        return localURL;
      }
    }
    return null;
  }
  
  public static InputStream getBrandedResourceAsStream(String paramString1, String paramString2)
  {
    
    for (LocaleIterator localLocaleIterator = new LocaleIterator(Locale.getDefault()); localLocaleIterator.hasNext();)
    {
      InputStream localInputStream = brandedLoader.getResourceAsStream(paramString1 + localLocaleIterator.next() + paramString2);
      if (localInputStream != null) {
        return localInputStream;
      }
    }
    return null;
  }
  
  public static void setBranding(String paramString)
  {
    brandingToken = paramString;
  }
  
  private static synchronized void init()
  {
    if (brandingToken == null) {
      brandingToken = initBranding();
    }
    if (brandedLoader == null)
    {
      brandedLoader = Localization.class.getClassLoader();
      
      ArrayList localArrayList = new ArrayList();
      for (Object localObject = new LocaleIterator(Locale.getDefault()); ((LocaleIterator)localObject).hasNext();)
      {
        String str = ((LocaleIterator)localObject).next().toString();
        
        Iterator localIterator = UpdateTracking.clusters(true).iterator();
        while (localIterator.hasNext())
        {
          File localFile1 = (File)localIterator.next();
          File localFile2 = new File(localFile1.getPath() + FILE_SEPARATOR + LOCALE_DIR + FILE_SEPARATOR + "updater" + str + ".jar");
          if (localFile2.exists()) {
            try
            {
              localArrayList.add(localFile2.toURI().toURL());
            }
            catch (MalformedURLException localMalformedURLException) {}
          }
        }
      }
      if (!localArrayList.isEmpty())
      {
        localObject = new URL[localArrayList.size()];
        localArrayList.toArray((Object[])localObject);
        
        brandedLoader = new URLClassLoader((URL[])localObject, brandedLoader);
      }
    }
  }
  
  private static String initBranding()
  {
    BufferedReader localBufferedReader = null;
    str = null;
    try
    {
      if (UpdateTracking.getPlatformDir() == null) {
        return str;
      }
      Object localObject1 = new File(UpdateTracking.getPlatformDir(), "lib" + FILE_SEPARATOR + "branding");
      
      localBufferedReader = new BufferedReader(new FileReader((File)localObject1));
      if (localBufferedReader.ready()) {
        System.out.println("Warning - It's obsolete. Use --branding <branding> instead 'branding' file.");
      }
      return localBufferedReader.readLine();
    }
    catch (IOException localIOException2) {}finally
    {
      if (localBufferedReader != null) {
        try
        {
          localBufferedReader.close();
        }
        catch (IOException localIOException5) {}
      }
    }
  }
  
  private static class LocaleIterator
    implements Iterator
  {
    private boolean defaultInProgress = false;
    private boolean empty = false;
    private Locale locale;
    private Locale initLocale;
    private String current;
    private String branding;
    
    public LocaleIterator(Locale paramLocale)
    {
      locale = (initLocale = paramLocale);
      if (paramLocale.equals(Locale.getDefault())) {
        defaultInProgress = true;
      }
      current = ('_' + paramLocale.toString());
      if (Localization.brandingToken == null) {
        branding = null;
      } else {
        branding = ("_" + Localization.brandingToken);
      }
    }
    
    public Object next()
      throws NoSuchElementException
    {
      if (current == null) {
        throw new NoSuchElementException();
      }
      String str;
      if (branding == null) {
        str = current;
      } else {
        str = branding + current;
      }
      int i = current.lastIndexOf('_');
      if (i == 0)
      {
        if (empty)
        {
          reset();
        }
        else
        {
          current = "";
          empty = true;
        }
      }
      else if (i == -1)
      {
        if (defaultInProgress)
        {
          reset();
        }
        else
        {
          locale = Locale.getDefault();
          current = ('_' + locale.toString());
          defaultInProgress = true;
        }
      }
      else {
        current = current.substring(0, i);
      }
      return str;
    }
    
    private void reset()
    {
      if (branding != null)
      {
        current = ('_' + initLocale.toString());
        int i = branding.lastIndexOf('_');
        if (i == 0) {
          branding = null;
        } else {
          branding = branding.substring(0, i);
        }
        empty = false;
      }
      else
      {
        current = null;
      }
    }
    
    public boolean hasNext()
    {
      return current != null;
    }
    
    public void remove()
      throws UnsupportedOperationException
    {
      throw new UnsupportedOperationException();
    }
  }
  
  private static final class PBundle
    extends ResourceBundle
  {
    private final Map<String, String> m;
    private final Locale locale;
    
    public PBundle(Map paramMap, Locale paramLocale)
    {
      m = paramMap;
      locale = paramLocale;
    }
    
    public Enumeration<String> getKeys()
    {
      return Collections.enumeration(m.keySet());
    }
    
    protected Object handleGetObject(String paramString)
    {
      return m.get(paramString);
    }
    
    public Locale getLocale()
    {
      return locale;
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.updater.Localization
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.updater;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import javax.swing.SwingUtilities;

public final class ModuleDeactivator
{
  public static final String TO_UNINSTALL = "to_uninstall.txt";
  public static final String TO_DISABLE = "to_disable.txt";
  public static final String CONFIG = "config";
  public static final String MODULES = "Modules";
  
  public static void delete()
  {
    assert (!SwingUtilities.isEventDispatchThread()) : "Cannot run in EQ";
    UpdaterFrame.setLabel(Localization.getBrandedString("CTL_DeletingFiles"));
    HashSet localHashSet = new HashSet();
    for (Iterator localIterator = UpdateTracking.clusters(true).iterator(); localIterator.hasNext();)
    {
      localObject = (File)localIterator.next();
      boolean bool = localHashSet.addAll(readFilesMarkedForDeleteInCluster((File)localObject));
      bool = (localHashSet.add(getControlFileForMarkedForDelete((File)localObject))) || (bool);
      bool = (localHashSet.add(getDeactivateLater((File)localObject))) || (bool);
      if (bool) {
        UpdaterDispatcher.touchLastModified((File)localObject);
      }
    }
    UpdaterFrame.setProgressRange(0L, localHashSet.size());
    int i = 0;
    for (Object localObject = localHashSet.iterator(); ((Iterator)localObject).hasNext();)
    {
      File localFile = (File)((Iterator)localObject).next();
      doDelete(localFile);
      UpdaterFrame.setProgressValue(i++);
    }
  }
  
  public static void disable()
  {
    assert (!SwingUtilities.isEventDispatchThread()) : "Cannot run in EQ";
    UpdaterFrame.setLabel(Localization.getBrandedString("CTL_DisablingFiles"));
    HashSet localHashSet = new HashSet();
    for (Iterator localIterator = UpdateTracking.clusters(true).iterator(); localIterator.hasNext();)
    {
      localObject = (File)localIterator.next();
      localHashSet.addAll(readFilesMarkedForDisableInCluster((File)localObject));
      doDelete(getControlFileForMarkedForDisable((File)localObject));
      doDelete(getDeactivateLater((File)localObject));
    }
    UpdaterFrame.setProgressRange(0L, localHashSet.size());
    int i = 0;
    for (Object localObject = localHashSet.iterator(); ((Iterator)localObject).hasNext();)
    {
      File localFile = (File)((Iterator)localObject).next();
      doDisable(localFile);
      UpdaterFrame.setProgressValue(i++);
    }
  }
  
  public static boolean hasModulesForDelete(File paramFile)
  {
    File localFile = new File(paramFile, "deactivate");
    return (localFile.exists()) && (localFile.isDirectory()) && (Arrays.asList(localFile.list()).contains("to_uninstall.txt"));
  }
  
  public static boolean hasModulesForDisable(File paramFile)
  {
    File localFile = new File(paramFile, "deactivate");
    return (localFile.exists()) && (localFile.isDirectory()) && (Arrays.asList(localFile.list()).contains("to_disable.txt"));
  }
  
  public static File getDeactivateLater(File paramFile)
  {
    File localFile = new File(paramFile, "update" + UpdateTracking.FILE_SEPARATOR + "deactivate" + UpdateTracking.FILE_SEPARATOR + "deactivate_later.txt");
    
    return localFile;
  }
  
  public static File getControlFileForMarkedForDelete(File paramFile)
  {
    File localFile = new File(paramFile, "update" + UpdateTracking.FILE_SEPARATOR + "deactivate" + UpdateTracking.FILE_SEPARATOR + "to_uninstall.txt");
    
    return localFile;
  }
  
  public static File getControlFileForMarkedForDisable(File paramFile)
  {
    File localFile = new File(paramFile, "update" + UpdateTracking.FILE_SEPARATOR + "deactivate" + UpdateTracking.FILE_SEPARATOR + "to_disable.txt");
    
    return localFile;
  }
  
  public static void writeStringToFile(String paramString, File paramFile)
  {
    BufferedWriter localBufferedWriter = null;
    try
    {
      try
      {
        localBufferedWriter = new BufferedWriter(new FileWriter(paramFile));
        localBufferedWriter.write(paramString);
      }
      finally
      {
        if (localBufferedWriter != null) {
          localBufferedWriter.close();
        }
      }
    }
    catch (FileNotFoundException localFileNotFoundException)
    {
      System.out.println("Error: Writing " + paramFile + " throws " + localFileNotFoundException);
    }
    catch (IOException localIOException)
    {
      System.out.println("Error: Writing " + paramFile + " throws " + localIOException);
    }
  }
  
  public static String readStringFromFile(File paramFile)
  {
    StringBuffer localStringBuffer = null;
    BufferedReader localBufferedReader = null;
    try
    {
      try
      {
        localStringBuffer = new StringBuffer();
        localBufferedReader = new BufferedReader(new FileReader(paramFile));
        char[] arrayOfChar = new char['?'];
        int i = 0;
        while ((i = localBufferedReader.read(arrayOfChar)) != -1)
        {
          String str = String.valueOf(arrayOfChar, 0, i);
          localStringBuffer.append(str);
          arrayOfChar = new char['?'];
        }
      }
      finally
      {
        if (localBufferedReader != null) {
          localBufferedReader.close();
        }
      }
    }
    catch (FileNotFoundException localFileNotFoundException)
    {
      System.out.println("Error: Reading " + paramFile + " throws " + localFileNotFoundException);
    }
    catch (IOException localIOException)
    {
      System.out.println("Error: Reading " + paramFile + " throws " + localIOException);
    }
    return localStringBuffer == null ? "" : localStringBuffer.toString();
  }
  
  private static void doDelete(File paramFile)
  {
    assert (paramFile != null) : ("Invalid file " + paramFile + " for delete.");
    if (!paramFile.exists()) {
      return;
    }
    if (!paramFile.delete()) {
      paramFile.deleteOnExit();
    }
    paramFile = paramFile.getParentFile();
    while ((paramFile != null) && (doDeleteEmptyDirectory(paramFile))) {
      paramFile = paramFile.getParentFile();
    }
  }
  
  private static boolean doDeleteEmptyDirectory(File paramFile)
  {
    assert (paramFile != null) : (paramFile + " cannot be null");
    
    boolean bool = false;
    if (paramFile.isDirectory())
    {
      List localList = Arrays.asList(paramFile.listFiles());
      if (localList.size() == 1)
      {
        File localFile = (File)localList.get(0);
        if ((".lastModified".endsWith(localFile.getName())) && 
          (localFile.delete())) {
          bool = paramFile.delete();
        }
      }
      bool = paramFile.delete();
    }
    else
    {
      bool = paramFile.delete();
    }
    return bool;
  }
  
  private static Set<File> readFilesMarkedForDeleteInCluster(File paramFile)
  {
    File localFile1 = getControlFileForMarkedForDelete(paramFile);
    if (!localFile1.exists()) {
      return Collections.emptySet();
    }
    HashSet localHashSet = new HashSet();
    
    String str1 = readStringFromFile(localFile1);
    StringTokenizer localStringTokenizer = new StringTokenizer(str1, UpdateTracking.PATH_SEPARATOR);
    while (localStringTokenizer.hasMoreElements())
    {
      String str2 = localStringTokenizer.nextToken();
      File localFile2 = new File(str2);
      if (localFile2.exists()) {
        localHashSet.add(localFile2);
      }
    }
    return localHashSet;
  }
  
  private static Set<File> readFilesMarkedForDisableInCluster(File paramFile)
  {
    File localFile1 = getControlFileForMarkedForDisable(paramFile);
    if (!localFile1.exists()) {
      return Collections.emptySet();
    }
    HashSet localHashSet = new HashSet();
    
    String str1 = readStringFromFile(localFile1);
    StringTokenizer localStringTokenizer = new StringTokenizer(str1, UpdateTracking.PATH_SEPARATOR);
    while (localStringTokenizer.hasMoreElements())
    {
      String str2 = localStringTokenizer.nextToken();
      File localFile2 = new File(str2);
      if (localFile2.exists()) {
        localHashSet.add(localFile2);
      }
    }
    return localHashSet;
  }
  
  private static String ENABLE_TAG = "<param name=\"enabled\">true</param>";
  private static String DISABLE_TAG = "<param name=\"enabled\">false</param>";
  
  private static void doDisable(File paramFile)
  {
    String str1 = readStringFromFile(paramFile);
    int i = str1.indexOf(ENABLE_TAG);
    assert (i != -1) : (ENABLE_TAG + " must be contained in " + str1);
    int j = ENABLE_TAG.length();
    String str2 = str1.substring(0, i);
    String str3 = str1.substring(i + j);
    String str4 = str2 + DISABLE_TAG + str3;
    File localFile1 = new File(new File(UpdateTracking.getUserDir(), "config"), "Modules");
    localFile1.mkdirs();
    File localFile2 = new File(localFile1, paramFile.getName());
    writeStringToFile(str4, localFile2);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.updater.ModuleDeactivator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.updater;

import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXParseException;

class ModuleUpdate$ErrorCatcher
  implements ErrorHandler
{
  ModuleUpdate$ErrorCatcher(ModuleUpdate paramModuleUpdate) {}
  
  private void message(String paramString, SAXParseException paramSAXParseException)
  {
    ModuleUpdate.access$002(this$0, true);
  }
  
  public void error(SAXParseException paramSAXParseException)
  {
    ModuleUpdate.access$002(this$0, true);
  }
  
  public void warning(SAXParseException paramSAXParseException) {}
  
  public void fatalError(SAXParseException paramSAXParseException)
  {
    ModuleUpdate.access$002(this$0, true);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.updater.ModuleUpdate.ErrorCatcher
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.updater;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

class ModuleUpdate
{
  private static final String ATTR_CODENAMEBASE = "codenamebase";
  private String codenamebase = null;
  private String specification_version = null;
  private boolean pError = false;
  private boolean l10n = false;
  
  ModuleUpdate(File paramFile)
  {
    if (paramFile.getName().endsWith("jar")) {
      createFromOSGiDistribution(paramFile);
    } else {
      createFromNbmDistribution(paramFile);
    }
  }
  
  private void createFromOSGiDistribution(File paramFile)
  {
    JarFile localJarFile = null;
    int i = 0;
    String str1 = null;
    try
    {
      localJarFile = new JarFile(paramFile);
      String str2 = localJarFile.getManifest().getMainAttributes().getValue("Bundle-SymbolicName");
      if (str2 != null) {
        setCodenamebase(str2);
      }
      String str3 = localJarFile.getManifest().getMainAttributes().getValue("Bundle-Version");
      setSpecification_version(str3 != null ? str3.replaceFirst("^(\\d+([.]\\d+([.]\\d+)?)?)([.].+)?$", "$1") : "0");
      try
      {
        if (localJarFile != null) {
          localJarFile.close();
        }
      }
      catch (IOException localIOException1)
      {
        localIOException1.printStackTrace();
        i = 1;
      }
      if (i == 0) {
        return;
      }
    }
    catch (IOException localIOException2)
    {
      str1 = "Missing info : " + paramFile.getAbsolutePath();
      System.out.println(str1);
      localIOException2.printStackTrace();
      i = 1;
    }
    finally
    {
      try
      {
        if (localJarFile != null) {
          localJarFile.close();
        }
      }
      catch (IOException localIOException4)
      {
        localIOException4.printStackTrace();
        i = 1;
      }
    }
    throw new RuntimeException(str1);
  }
  
  private void createFromNbmDistribution(File paramFile)
  {
    Document localDocument = null;
    Object localObject1 = null;
    Element localElement = null;
    
    JarFile localJarFile = null;
    InputStream localInputStream = null;
    int i = 0;
    String str = null;
    try
    {
      localJarFile = new JarFile(paramFile);
      localInputStream = localJarFile.getInputStream(localJarFile.getEntry("Info/info.xml"));
      
      InputSource localInputSource = new InputSource(localInputStream);
      localDocument = XMLUtil.parse(localInputSource, false, false, new ErrorCatcher(), XMLUtil.createAUResolver());
      
      localElement = localDocument.getDocumentElement();
      localObject1 = localElement;
      if (localInputStream != null) {
        localInputStream.close();
      }
      try
      {
        if (localInputStream != null) {
          localInputStream.close();
        }
        if (localJarFile != null) {
          localJarFile.close();
        }
      }
      catch (IOException localIOException1)
      {
        localIOException1.printStackTrace();
        i = 1;
      }
      if (i == 0) {
        break label339;
      }
    }
    catch (SAXException localSAXException)
    {
      str = "Bad info : " + paramFile.getAbsolutePath();
      System.out.println(str);
      localSAXException.printStackTrace();
      i = 1;
    }
    catch (IOException localIOException3)
    {
      str = "Missing info : " + paramFile.getAbsolutePath();
      System.out.println(str);
      localIOException3.printStackTrace();
      i = 1;
    }
    finally
    {
      try
      {
        if (localInputStream != null) {
          localInputStream.close();
        }
        if (localJarFile != null) {
          localJarFile.close();
        }
      }
      catch (IOException localIOException5)
      {
        localIOException5.printStackTrace();
        i = 1;
      }
    }
    throw new RuntimeException(str);
    label339:
    setCodenamebase(getAttribute((Node)localObject1, "codenamebase"));
    NodeList localNodeList = ((Element)localObject1).getElementsByTagName("l10n");
    if (localNodeList.getLength() > 0)
    {
      l10n = true;
      Node localNode = localNodeList.item(0);
      setSpecification_version(getAttribute(localNode, "module_spec_version"));
    }
    else
    {
      localNodeList = ((Element)localObject1).getElementsByTagName("manifest");
      for (int j = 0; j < localNodeList.getLength(); j++)
      {
        if ((localNodeList.item(j).getNodeType() != 1) || (!(localNodeList.item(j) instanceof Element))) {
          break;
        }
        NamedNodeMap localNamedNodeMap = localNodeList.item(j).getAttributes();
        for (int k = 0; k < localNamedNodeMap.getLength(); k++)
        {
          Attr localAttr = (Attr)localNamedNodeMap.item(k);
          if (localAttr.getName().equals("OpenIDE-Module")) {
            setCodenamebase(localAttr.getValue());
          } else if (localAttr.getName().equals("OpenIDE-Module-Specification-Version")) {
            setSpecification_version(localAttr.getValue());
          }
        }
      }
    }
  }
  
  private String getAttribute(Node paramNode, String paramString)
  {
    Node localNode = paramNode.getAttributes().getNamedItem(paramString);
    return localNode == null ? null : localNode.getNodeValue();
  }
  
  String getCodenamebase()
  {
    return codenamebase;
  }
  
  void setCodenamebase(String paramString)
  {
    codenamebase = paramString;
  }
  
  String getSpecification_version()
  {
    return specification_version;
  }
  
  void setSpecification_version(String paramString)
  {
    specification_version = paramString;
  }
  
  public boolean isL10n()
  {
    return l10n;
  }
  
  class ErrorCatcher
    implements ErrorHandler
  {
    ErrorCatcher() {}
    
    private void message(String paramString, SAXParseException paramSAXParseException)
    {
      pError = true;
    }
    
    public void error(SAXParseException paramSAXParseException)
    {
      pError = true;
    }
    
    public void warning(SAXParseException paramSAXParseException) {}
    
    public void fatalError(SAXParseException paramSAXParseException)
    {
      pError = true;
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.updater.ModuleUpdate
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.updater;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;

class ModuleUpdater$1
  extends Thread
{
  ModuleUpdater$1(ModuleUpdater paramModuleUpdater, Process paramProcess) {}
  
  public void run()
  {
    try
    {
      InputStreamReader localInputStreamReader = new InputStreamReader(val$proc2.getErrorStream());
      BufferedReader localBufferedReader = new BufferedReader(localInputStreamReader);
      String str;
      do
      {
        str = localBufferedReader.readLine();
        if (str != null) {
          System.out.println(str);
        }
      } while (str != null);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.updater.ModuleUpdater.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.updater;

import java.io.File;
import java.io.FilenameFilter;

class ModuleUpdater$1NbmFilter
  implements FilenameFilter
{
  public boolean accept(File paramFile, String paramString)
  {
    return paramString.endsWith("nbm");
  }
}

/* Location:
 * Qualified Name:     org.netbeans.updater.ModuleUpdater.1NbmFilter
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.updater;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.StringTokenizer;

class ModuleUpdater$MainConfig
{
  private final String PAR_MAIN = "mainClass";
  private final String PAR_RELCP = "relativeClassPath";
  private final String PAR_JVMPAR = "jvm.parameters";
  private final String PAR_MAINARGS = "mainClass.arguments";
  private final String VAR_IDE_HOME = "%IDE_HOME%";
  private final String VAR_IDE_USER = "%IDE_USER%";
  private final String VAR_FILE_SEPARATOR = "%FS%";
  private final String VAR_JAVA_HOME = "%JAVA_HOME%";
  private String parameters = "";
  private String classpath = "";
  private boolean valid = false;
  private final File activeCluster;
  
  public ModuleUpdater$MainConfig(ModuleUpdater paramModuleUpdater, String paramString, File paramFile)
  {
    valid = readParms(paramString);
    activeCluster = paramFile;
  }
  
  public String getCommand()
  {
    return parameters;
  }
  
  public String getClasspath()
  {
    return classpath;
  }
  
  public boolean isValid()
  {
    return valid;
  }
  
  private boolean readParms(String paramString)
  {
    Properties localProperties = new Properties();
    FileInputStream localFileInputStream = null;
    try
    {
      localProperties.load(localFileInputStream = new FileInputStream(paramString));
      if (localFileInputStream != null) {
        try
        {
          localFileInputStream.close();
        }
        catch (IOException localIOException1) {}
      }
      str2 = localProperties.getProperty("relativeClassPath", null);
    }
    catch (IOException localIOException2)
    {
      return false;
    }
    finally
    {
      if (localFileInputStream != null) {
        try
        {
          localFileInputStream.close();
        }
        catch (IOException localIOException4) {}
      }
    }
    String str2;
    if (str2 != null)
    {
      str2 = replaceVars(str2);
      StringTokenizer localStringTokenizer = new StringTokenizer(str2, UpdateTracking.PATH_SEPARATOR, false);
      while (localStringTokenizer.hasMoreTokens()) {
        classpath = (classpath + UpdateTracking.PATH_SEPARATOR + changeRelative(localStringTokenizer.nextToken()));
      }
    }
    parameters = "";
    String str3 = localProperties.getProperty("jvm.parameters", null);
    if (str3 != null) {
      parameters = (parameters + " " + str3);
    }
    String str1 = localProperties.getProperty("mainClass", null);
    if (str1 == null) {
      return false;
    }
    parameters = (parameters + " " + str1);
    
    String str4 = localProperties.getProperty("mainClass.arguments", null);
    if (str4 != null) {
      parameters = (parameters + " " + str4);
    }
    parameters = replaceVars(parameters);
    return true;
  }
  
  private String replaceVars(String paramString)
  {
    paramString = replaceAll(paramString, "%IDE_HOME%", UpdateTracking.getPlatformDir() == null ? "" : UpdateTracking.getPlatformDir().getPath());
    
    paramString = replaceAll(paramString, "%IDE_USER%", UpdateTracking.getUserDir() == null ? "" : UpdateTracking.getUserDir().getPath());
    
    paramString = replaceAll(paramString, "%FS%", UpdateTracking.FILE_SEPARATOR);
    
    paramString = replaceAll(paramString, "%JAVA_HOME%", System.getProperty("java.home"));
    
    return paramString;
  }
  
  private String changeRelative(String paramString)
  {
    if (new File(paramString).isAbsolute()) {
      return paramString;
    }
    return ModuleUpdater.access$000(this$0, activeCluster) + UpdateTracking.FILE_SEPARATOR + paramString;
  }
  
  private String replaceAll(String paramString1, String paramString2, String paramString3)
  {
    StringBuffer localStringBuffer = new StringBuffer(paramString1);
    int i = localStringBuffer.toString().indexOf(paramString2);
    int j = paramString2.length();
    while (i > -1)
    {
      localStringBuffer.replace(i, i + j, paramString3);
      i = localStringBuffer.toString().indexOf(paramString2, i + 1);
    }
    return localStringBuffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.updater.ModuleUpdater.MainConfig
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.updater;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.zip.ZipEntry;
import javax.swing.SwingUtilities;

public final class ModuleUpdater
  extends Thread
{
  private static final String DOWNLOAD_DIR_NAME = "download";
  
  public ModuleUpdater(Collection<File> paramCollection)
  {
    forInstall = paramCollection;
  }
  
  static final String DOWNLOAD_DIR = "update" + UpdateTracking.FILE_SEPARATOR + "download";
  private static final String BACKUP_DIR = "update" + UpdateTracking.FILE_SEPARATOR + "backup";
  public static final String UPDATE_NETBEANS_DIR = "netbeans";
  public static final String UPDATE_JAVA_EXT_DIR = "java_ext";
  public static final String UPDATE_MAIN_DIR = "main";
  private static final String JVM_PARAMS_FILE = "main.properties";
  public static final String NBM_EXTENSION = "nbm";
  public static final String JAR_EXTENSION = "jar";
  public static final String LOG_FILE_NAME = "update.log";
  public static final String LATER_FILE_NAME = "install_later.xml";
  public static final char SPACE = ' ';
  public static final char QUOTE = '"';
  private static final String TEMP_FILE_NAME = "temporary";
  public static final String UPDATER_JAR = "updater.jar";
  public static final String AUTOUPDATE_UPDATER_JAR_PATH = "netbeans/modules/ext/updater.jar";
  public static final String AUTOUPDATE_UPDATER_JAR_LOCALE_PATTERN = "netbeans/modules/ext/locale/updater(_[a-zA-Z0-9]+)+";
  public static final String EXECUTABLE_FILES_ENTRY = "Info/executables.list";
  private Collection<File> forInstall;
  private Map<File, Collection<File>> files2clustersForInstall;
  private volatile boolean stop = false;
  private volatile boolean suspend = false;
  private long totalLength;
  
  public void run()
  {
    assert (!SwingUtilities.isEventDispatchThread()) : "Cannot run in EQ";
    try
    {
      checkStop();
      if (getClustersForInstall().isEmpty()) {
        endRun();
      }
      checkStop();
      
      totalLength();
      
      checkStop();
      
      unpack();
      for (File localFile : UpdateTracking.clusters(true)) {
        deleteAdditionalInfo(localFile);
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    finally
    {
      if (UpdaterFrame.isFromIDE()) {
        UpdaterFrame.getUpdaterFrame().runningFinished();
      }
    }
  }
  
  private void deleteInstallLater(File paramFile)
  {
    File localFile1 = new File(paramFile, UpdateTracking.FILE_SEPARATOR + DOWNLOAD_DIR + UpdateTracking.FILE_SEPARATOR + "install_later.xml");
    if (localFile1.exists()) {
      localFile1.delete();
    }
    File localFile2 = localFile1.getParentFile();
    while ((localFile2 != null) && (localFile2.delete())) {
      localFile2 = localFile2.getParentFile();
    }
  }
  
  private void deleteAdditionalInfo(File paramFile)
  {
    File localFile1 = new File(paramFile, UpdateTracking.FILE_SEPARATOR + DOWNLOAD_DIR + UpdateTracking.FILE_SEPARATOR + "additional_information.xml");
    if ((localFile1 != null) && (localFile1.exists())) {
      localFile1.delete();
    }
    File localFile2 = localFile1 == null ? null : localFile1.getParentFile();
    while ((localFile2 != null) && (localFile2.delete())) {
      localFile2 = localFile2.getParentFile();
    }
  }
  
  void endRun()
  {
    stop = true;
  }
  
  private void checkStop()
  {
    while ((suspend) && 
      (suspend)) {}
    if (stop) {
      if (UpdaterFrame.isFromIDE()) {
        UpdaterFrame.getUpdaterFrame().unpackingFinished();
      } else {
        System.exit(0);
      }
    }
  }
  
  private void processFilesForInstall()
  {
    Iterator localIterator;
    File localFile;
    Object localObject;
    if (forInstall == null)
    {
      files2clustersForInstall = new HashMap();
      for (localIterator = UpdateTracking.clusters(true).iterator(); localIterator.hasNext();)
      {
        localFile = (File)localIterator.next();
        localObject = getModulesToInstall(localFile);
        files2clustersForInstall.put(localFile, localObject);
        if (!UpdaterFrame.isFromIDE()) {
          deleteInstallLater(localFile);
        }
      }
    }
    else
    {
      files2clustersForInstall = new HashMap();
      for (localIterator = forInstall.iterator(); localIterator.hasNext();)
      {
        localFile = (File)localIterator.next();
        localObject = getCluster(localFile);
        if (files2clustersForInstall.get(localObject) == null) {
          files2clustersForInstall.put(localObject, new HashSet());
        }
        ((Collection)files2clustersForInstall.get(localObject)).add(localFile);
      }
    }
  }
  
  private static File getCluster(File paramFile)
  {
    File localFile = null;
    try
    {
      assert (paramFile.exists()) : (paramFile + " for install exists.");
      assert (paramFile.getParentFile() != null) : (paramFile + " has parent.");
      assert
1 2 3 4 5

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-2017. Infinite Loop Ltd