org.eclipse.equinox.p2.core_2.2.0.v20120430-0525

eption5	IOException
    //   221	1	15	localIOException6	IOException
    // Exception table:
    //   from	to	target	type
    //   20	159	162	java/util/zip/ZipException
    //   163	168	171	java/io/IOException
    //   172	176	179	java/io/IOException
    //   20	163	183	finally
    //   185	190	193	java/io/IOException
    //   194	198	201	java/io/IOException
    //   205	210	213	java/io/IOException
    //   214	218	221	java/io/IOException
  }
  
  public static IPathComputer createRootPathComputer(File root)
  {
    new IPathComputer()
    {
      public IPath computePath(File source)
      {
        IPath result = new Path(source.getAbsolutePath());
        IPath rootPath = new Path(getAbsolutePath());
        result = result.removeFirstSegments(rootPath.matchingFirstSegments(result));
        return result.setDevice(null);
      }
      
      public void reset() {}
    };
  }
  
  public static IPathComputer createDynamicPathComputer(int segmentsToKeep)
  {
    new IPathComputer()
    {
      FileUtils.IPathComputer computer = null;
      private final int val$segmentsToKeep;
      
      public IPath computePath(File source)
      {
        if (computer == null)
        {
          IPath sourcePath = new Path(source.getAbsolutePath());
          sourcePath = sourcePath.removeLastSegments(val$segmentsToKeep);
          computer = FileUtils.createRootPathComputer(sourcePath.toFile());
        }
        return computer.computePath(source);
      }
      
      public void reset()
      {
        computer = null;
      }
    };
  }
  
  public static IPathComputer createParentPrefixComputer(int segmentsToKeep)
  {
    new IPathComputer()
    {
      private final int val$segmentsToKeep;
      
      public IPath computePath(File source)
      {
        IPath sourcePath = new Path(source.getAbsolutePath());
        sourcePath = sourcePath.removeFirstSegments(Math.max(0, sourcePath.segmentCount() - val$segmentsToKeep));
        return sourcePath.setDevice(null);
      }
      
      public void reset() {}
    };
  }
  
  public static abstract interface IPathComputer
  {
    public abstract IPath computePath(File paramFile);
    
    public abstract void reset();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.FileUtils
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.io.PrintStream;
import java.util.ArrayList;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.core.Activator;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.osgi.framework.log.FrameworkLog;
import org.eclipse.osgi.framework.log.FrameworkLogEntry;

public class LogHelper
{
  public static void log(IStatus status)
  {
    FrameworkLog log = Activator.getFrameworkLog();
    if (log != null)
    {
      log.log(getLog(status));
    }
    else
    {
      System.out.println(status.getMessage());
      if (status.getException() != null) {
        status.getException().printStackTrace();
      }
    }
  }
  
  public static void log(ProvisionException exception)
  {
    log(new Status(exception.getStatus().getSeverity(), "org.eclipse.equinox.p2.core", "Provisioning exception", exception));
  }
  
  private static FrameworkLogEntry getLog(IStatus status)
  {
    Throwable t = status.getException();
    ArrayList<FrameworkLogEntry> childlist = new ArrayList();
    
    int stackCode = (t instanceof CoreException) ? 1 : 0;
    if (stackCode == 1)
    {
      IStatus coreStatus = ((CoreException)t).getStatus();
      if (coreStatus != null) {
        childlist.add(getLog(coreStatus));
      }
    }
    if (status.isMultiStatus())
    {
      IStatus[] children = status.getChildren();
      for (int i = 0; i < children.length; i++) {
        childlist.add(getLog(children[i]));
      }
    }
    FrameworkLogEntry[] children = childlist.size() == 0 ? null : (FrameworkLogEntry[])childlist.toArray(new FrameworkLogEntry[childlist.size()]);
    
    return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(), status.getCode(), status.getMessage(), stackCode, t, children);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.LogHelper
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import org.eclipse.osgi.util.NLS;

class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.core.helpers.messages";
  public static String Util_Invalid_Zip_File_Format;
  public static String Util_Error_Unzipping;
  public static String Util_Empty_Zip_Entry;
  public static String Util_Absolute_Entry;
  
  static
  {
    NLS.initializeMessages("org.eclipse.equinox.internal.p2.core.helpers.messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.Messages
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;

class OrderedProperties$StringsEnum
  implements Enumeration<String>
{
  private final Iterator<String> iterator;
  final OrderedProperties this$0;
  
  public OrderedProperties$StringsEnum(Collection<String> arg1)
  {
    iterator = elems.iterator();
  }
  
  public boolean hasMoreElements()
  {
    return iterator.hasNext();
  }
  
  public String nextElement()
  {
    return (String)iterator.next();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties.StringsEnum
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

class OrderedProperties$UnmodifiableProperties
  extends OrderedProperties
{
  OrderedProperties$UnmodifiableProperties(Map<String, String> properties)
  {
    for (Iterator localIterator = properties.entrySet().iterator(); localIterator.hasNext();)
    {
      Map.Entry<String, String> entry = (Map.Entry)localIterator.next();
      super.put((String)entry.getKey(), (String)entry.getValue());
    }
  }
  
  public synchronized Object setProperty(String key, String value)
  {
    throw new UnsupportedOperationException();
  }
  
  public synchronized String put(String key, String value)
  {
    throw new UnsupportedOperationException();
  }
  
  public synchronized String remove(Object key)
  {
    throw new UnsupportedOperationException();
  }
  
  public synchronized void putAll(Map<? extends String, ? extends String> t)
  {
    throw new UnsupportedOperationException();
  }
  
  public synchronized void clear()
  {
    throw new UnsupportedOperationException();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties.UnmodifiableProperties
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.util.Collection;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class OrderedProperties
  extends Dictionary<String, String>
  implements Map<String, String>
{
  LinkedHashMap<String, String> propertyMap = null;
  
  public static OrderedProperties unmodifiableProperties(Map<String, String> properties)
  {
    return new UnmodifiableProperties(properties);
  }
  
  public OrderedProperties() {}
  
  public OrderedProperties(int size)
  {
    propertyMap = new LinkedHashMap(size);
  }
  
  public OrderedProperties(OrderedProperties properties)
  {
    propertyMap = new LinkedHashMap(properties.size());
    putAll(properties);
  }
  
  public Object setProperty(String key, String value)
  {
    init();
    return propertyMap.put(key, value);
  }
  
  public String getProperty(String key)
  {
    return propertyMap == null ? null : (String)propertyMap.get(key);
  }
  
  public void putAll(OrderedProperties properties)
  {
    putAll(properties);
  }
  
  private void init()
  {
    if (propertyMap == null) {
      propertyMap = new LinkedHashMap();
    }
  }
  
  public int size()
  {
    return propertyMap == null ? 0 : propertyMap.size();
  }
  
  public boolean isEmpty()
  {
    return propertyMap == null ? true : propertyMap.isEmpty();
  }
  
  public synchronized void clear()
  {
    propertyMap = null;
  }
  
  public String put(String key, String value)
  {
    init();
    return (String)propertyMap.put(key, value);
  }
  
  public boolean containsKey(Object key)
  {
    return propertyMap != null ? propertyMap.containsKey(key) : false;
  }
  
  public boolean containsValue(Object value)
  {
    return propertyMap != null ? propertyMap.containsValue(value) : false;
  }
  
  public Set<Map.Entry<String, String>> entrySet()
  {
    return propertyMap != null ? propertyMap.entrySet() : CollectionUtils.emptySet();
  }
  
  public String get(Object key)
  {
    return propertyMap != null ? (String)propertyMap.get(key) : null;
  }
  
  public Set<String> keySet()
  {
    return propertyMap != null ? propertyMap.keySet() : CollectionUtils.emptySet();
  }
  
  public void putAll(Map<? extends String, ? extends String> arg0)
  {
    init();
    propertyMap.putAll(arg0);
  }
  
  public String remove(Object key)
  {
    return propertyMap != null ? (String)propertyMap.remove(key) : null;
  }
  
  public Collection<String> values()
  {
    return propertyMap != null ? propertyMap.values() : CollectionUtils.emptyList();
  }
  
  public boolean equals(Object o)
  {
    if (o == this) {
      return true;
    }
    if ((o instanceof OrderedProperties))
    {
      OrderedProperties rhs = (OrderedProperties)o;
      if (propertyMap == propertyMap) {
        return true;
      }
      if (propertyMap == null) {
        return propertyMap.isEmpty();
      }
      if (propertyMap == null) {
        return rhs.isEmpty();
      }
      return propertyMap.equals(propertyMap);
    }
    if (propertyMap == null)
    {
      if ((o instanceof Map)) {
        return ((Map)o).isEmpty();
      }
      return false;
    }
    return propertyMap.equals(o);
  }
  
  public int hashCode()
  {
    return (propertyMap == null) || (propertyMap.isEmpty()) ? 0 : propertyMap.hashCode();
  }
  
  public String toString()
  {
    StringBuffer sb = new StringBuffer();
    sb.append(propertyMap);
    return sb.toString();
  }
  
  private class StringsEnum
    implements Enumeration<String>
  {
    private final Iterator<String> iterator;
    
    public StringsEnum()
    {
      iterator = elems.iterator();
    }
    
    public boolean hasMoreElements()
    {
      return iterator.hasNext();
    }
    
    public String nextElement()
    {
      return (String)iterator.next();
    }
  }
  
  public Enumeration<String> elements()
  {
    return new StringsEnum(propertyMap.values());
  }
  
  public Enumeration<String> keys()
  {
    return new StringsEnum(propertyMap.keySet());
  }
  
  private static class UnmodifiableProperties
    extends OrderedProperties
  {
    UnmodifiableProperties(Map<String, String> properties)
    {
      for (Iterator localIterator = properties.entrySet().iterator(); localIterator.hasNext();)
      {
        Map.Entry<String, String> entry = (Map.Entry)localIterator.next();
        super.put((String)entry.getKey(), (String)entry.getValue());
      }
    }
    
    public synchronized Object setProperty(String key, String value)
    {
      throw new UnsupportedOperationException();
    }
    
    public synchronized String put(String key, String value)
    {
      throw new UnsupportedOperationException();
    }
    
    public synchronized String remove(Object key)
    {
      throw new UnsupportedOperationException();
    }
    
    public synchronized void putAll(Map<? extends String, ? extends String> t)
    {
      throw new UnsupportedOperationException();
    }
    
    public synchronized void clear()
    {
      throw new UnsupportedOperationException();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.util.Collection;
import java.util.Iterator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;

public class ServiceHelper
{
  public static <T> T getService(BundleContext context, Class<T> clazz)
  {
    if (context == null) {
      return null;
    }
    ServiceReference<T> reference = context.getServiceReference(clazz);
    if (reference == null) {
      return null;
    }
    T result = context.getService(reference);
    context.ungetService(reference);
    return result;
  }
  
  public static <T> T getService(BundleContext context, Class<T> clazz, String filter)
  {
    try
    {
      references = context.getServiceReferences(clazz, filter);
    }
    catch (InvalidSyntaxException localInvalidSyntaxException)
    {
      Collection<ServiceReference<T>> references;
      return null;
    }
    Collection<ServiceReference<T>> references;
    if (references.isEmpty()) {
      return null;
    }
    ServiceReference<T> ref = (ServiceReference)references.iterator().next();
    T result = context.getService(ref);
    context.ungetService(ref);
    return result;
  }
  
  public static Object getService(BundleContext context, String name)
  {
    if (context == null) {
      return null;
    }
    ServiceReference<?> reference = context.getServiceReference(name);
    if (reference == null) {
      return null;
    }
    Object result = context.getService(reference);
    context.ungetService(reference);
    return result;
  }
  
  public static Object getService(BundleContext context, String name, String filter)
  {
    try
    {
      references = context.getServiceReferences(name, filter);
    }
    catch (InvalidSyntaxException localInvalidSyntaxException)
    {
      ServiceReference[] references;
      return null;
    }
    ServiceReference[] references;
    if ((references == null) || (references.length == 0)) {
      return null;
    }
    Object result = context.getService(references[0]);
    context.ungetService(references[0]);
    return result;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.util.ArrayList;
import java.util.List;

public class StringHelper
{
  public static String[] EMPTY_ARRAY = new String[0];
  
  public static String[] getArrayFromString(String spec, char c)
  {
    String[] resultArr = EMPTY_ARRAY;
    if (spec != null)
    {
      int splitIdx = spec.indexOf(c);
      if (splitIdx <= 0)
      {
        spec = spec.trim();
        if (spec.length() > 0) {
          resultArr = new String[] { spec };
        }
      }
      else
      {
        List<String> result = new ArrayList();
        while (splitIdx >= 0)
        {
          String part = spec.substring(0, splitIdx).trim();
          if (part.length() > 0) {
            result.add(part);
          }
          spec = spec.substring(splitIdx + 1);
          splitIdx = spec.indexOf(c);
        }
        spec = spec.trim();
        if (spec.length() > 0) {
          result.add(spec);
        }
        resultArr = (String[])result.toArray(new String[result.size()]);
      }
    }
    return resultArr;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.StringHelper
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

public class TarEntry
  implements Cloneable
{
  private String name;
  private long mode;
  private long time;
  private long size;
  private int type;
  int filepos;
  public static final int FILE = 48;
  public static final int DIRECTORY = 53;
  
  TarEntry(String name, int pos)
  {
    this.name = name;
    mode = 420L;
    type = 48;
    filepos = pos;
    time = (System.currentTimeMillis() / 1000L);
  }
  
  public int getFileType()
  {
    return type;
  }
  
  public long getMode()
  {
    return mode;
  }
  
  public String getName()
  {
    return name;
  }
  
  public long getSize()
  {
    return size;
  }
  
  public long getTime()
  {
    return time;
  }
  
  public void setFileType(int type)
  {
    this.type = type;
  }
  
  public void setMode(long mode)
  {
    this.mode = mode;
  }
  
  public void setSize(long size)
  {
    this.size = size;
  }
  
  public void setTime(long time)
  {
    this.time = time;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.TarEntry
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

public class TarException
  extends Exception
{
  private static final long serialVersionUID = 2886671254518853528L;
  
  public TarException(String s)
  {
    super(s);
  }
  
  public TarException(String s, Throwable cause)
  {
    super(s, cause);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.TarException
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.io.IOException;
import java.util.Enumeration;

class TarFile$1
  implements Enumeration<TarEntry>
{
  final TarFile this$0;
  
  TarFile$1(TarFile paramTarFile) {}
  
  public boolean hasMoreElements()
  {
    return TarFile.access$0(this$0) != null;
  }
  
  public TarEntry nextElement()
  {
    TarEntry oldEntry = TarFile.access$0(this$0);
    try
    {
      TarFile.access$2(this$0, TarFile.access$1(this$0).getNextEntry());
    }
    catch (TarException localTarException)
    {
      TarFile.access$2(this$0, null);
    }
    catch (IOException localIOException)
    {
      TarFile.access$2(this$0, null);
    }
    return oldEntry;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.TarFile.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.io.IOException;
import java.io.InputStream;

class TarFile$2
  extends TarInputStream
{
  final TarFile this$0;
  
  TarFile$2(TarFile paramTarFile, InputStream $anonymous0, TarEntry $anonymous1)
    throws TarException, IOException
  {
    super($anonymous0, $anonymous1);
  }
  
  public void close() {}
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.TarFile.2
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.zip.GZIPInputStream;

public class TarFile
{
  private File file;
  private TarInputStream entryEnumerationStream;
  private TarEntry curEntry;
  private TarInputStream entryStream;
  private InputStream internalEntryStream;
  
  public TarFile(File file)
    throws TarException, IOException
  {
    this.file = file;
    
    InputStream in = new FileInputStream(file);
    try
    {
      in = new GZIPInputStream(in);
    }
    catch (IOException localIOException)
    {
      in.close();
      in = new FileInputStream(file);
    }
    try
    {
      entryEnumerationStream = new TarInputStream(in);
    }
    catch (TarException ex)
    {
      in.close();
      throw ex;
    }
    curEntry = entryEnumerationStream.getNextEntry();
  }
  
  public void close()
    throws IOException
  {
    entryEnumerationStream.close();
    if (internalEntryStream != null) {
      internalEntryStream.close();
    }
  }
  
  public Enumeration<TarEntry> entries()
  {
    new Enumeration()
    {
      public boolean hasMoreElements()
      {
        return curEntry != null;
      }
      
      public TarEntry nextElement()
      {
        TarEntry oldEntry = curEntry;
        try
        {
          curEntry = entryEnumerationStream.getNextEntry();
        }
        catch (TarException localTarException)
        {
          curEntry = null;
        }
        catch (IOException localIOException)
        {
          curEntry = null;
        }
        return oldEntry;
      }
    };
  }
  
  public InputStream getInputStream(TarEntry entry)
    throws TarException, IOException
  {
    if ((entryStream == null) || (!entryStream.skipToEntry(entry)))
    {
      if (internalEntryStream != null) {
        internalEntryStream.close();
      }
      internalEntryStream = new FileInputStream(file);
      try
      {
        internalEntryStream = new GZIPInputStream(internalEntryStream);
      }
      catch (IOException localIOException)
      {
        internalEntryStream.close();
        internalEntryStream = new FileInputStream(file);
      }
      entryStream = new TarInputStream(internalEntryStream, entry)
      {
        public void close() {}
      };
    }
    return entryStream;
  }
  
  public String getName()
  {
    return file.getPath();
  }
  
  protected void finalize()
    throws Throwable
  {
    close();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.TarFile
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

public class TarInputStream
  extends FilterInputStream
{
  private int nextEntry = 0;
  private int nextEOF = 0;
  private int filepos = 0;
  private int bytesread = 0;
  private TarEntry firstEntry = null;
  private String longLinkName = null;
  
  public TarInputStream(InputStream in)
    throws TarException, IOException
  {
    super(in);
    
    firstEntry = getNextEntry();
  }
  
  TarInputStream(InputStream in, TarEntry entry)
    throws TarException, IOException
  {
    super(in);
    skipToEntry(entry);
  }
  
  private long headerChecksum(byte[] header)
  {
    long sum = 0L;
    for (int i = 0; i < 512; i++) {
      sum += (header[i] & 0xFF);
    }
    return sum;
  }
  
  boolean skipToEntry(TarEntry entry)
    throws TarException, IOException
  {
    int bytestoskip = filepos - bytesread;
    if (bytestoskip < 0) {
      return false;
    }
    while (bytestoskip > 0)
    {
      long ret = in.skip(bytestoskip);
      if (ret < 0L) {
        throw new IOException("early end of stream");
      }
      bytestoskip = (int)(bytestoskip - ret);
      bytesread = ((int)(bytesread + ret));
    }
    filepos = filepos;
    nextEntry = 0;
    nextEOF = 0;
    
    getNextEntry();
    return true;
  }
  
  private boolean isValidTarHeader(byte[] header)
  {
    int pos = 148;
    StringBuffer checksumString = new StringBuffer();
    for (int i = 0; i < 8; i++) {
      if (header[(pos + i)] != 32)
      {
        if ((header[(pos + i)] == 0) || (!Character.isDigit((char)header[(pos + i)]))) {
          break;
        }
        checksumString.append((char)header[(pos + i)]);
      }
    }
    if (checksumString.length() == 0) {
      return false;
    }
    if (checksumString.charAt(0) != '0') {
      checksumString.insert(0, '0');
    }
    try
    {
      fileChecksum = Long.decode(checksumString.toString()).longValue();
    }
    catch (NumberFormatException localNumberFormatException)
    {
      long fileChecksum;
      return false;
    }
    long fileChecksum;
    for (i = 0; i < 8; i++) {
      header[(pos + i)] = 32;
    }
    long calculatedChecksum = headerChecksum(header);
    
    return fileChecksum == calculatedChecksum;
  }
  
  TarEntry getNextEntryInternal()
    throws TarException, IOException
  {
    byte[] header = new byte['?'];
    int pos = 0;
    if (firstEntry != null)
    {
      entryReturn = firstEntry;
      firstEntry = null;
      return entryReturn;
    }
    while (nextEntry > 0)
    {
      TarEntry entryReturn;
      long ret = in.skip(nextEntry);
      if (ret < 0L) {
        throw new IOException("early end of stream");
      }
      nextEntry = ((int)(nextEntry - ret));
      bytesread = ((int)(bytesread + ret));
    }
    int bytestoread = 512;
    while (bytestoread > 0)
    {
      int ret = super.read(header, 512 - bytestoread, bytestoread);
      if (ret < 0) {
        throw new IOException("early end of stream");
      }
      bytestoread -= ret;
      bytesread += ret;
    }
    if (headerChecksum(header) == 0L)
    {
      if (filepos > 0) {
        return null;
      }
      throw new TarException("not in tar format");
    }
    if (!isValidTarHeader(header)) {
      throw new TarException("not in tar format");
    }
    while ((pos < 100) && (header[pos] != 0)) {
      pos++;
    }
    String name = new String(header, 0, pos, "UTF8");
    
    pos = 345;
    if (header[pos] != 0)
    {
      while ((pos < 500) && (header[pos] != 0)) {
        pos++;
      }
      String prefix = new String(header, 345, pos - 345, "UTF8");
      name = prefix + "/" + name;
    }
    TarEntry entry;
    if (longLinkName != null)
    {
      TarEntry entry = new TarEntry(longLinkName, filepos);
      longLinkName = null;
    }
    else
    {
      entry = new TarEntry(name, filepos);
    }
    if (header['?'] != 0) {
      entry.setFileType(header['?']);
    }
    pos = 100;
    StringBuffer mode = new StringBuffer();
    for (int i = 0; i < 8; i++)
    {
      if (header[(pos + i)] == 0) {
        break;
      }
      if (header[(pos + i)] != 32) {
        mode.append((char)header[(pos + i)]);
      }
    }
    if ((mode.length() > 0) && (mode.charAt(0) != '0')) {
      mode.insert(0, '0');
    }
    try
    {
      long fileMode = Long.decode(mode.toString()).longValue();
      entry.setMode(fileMode);
    }
    catch (NumberFormatException nfe)
    {
      throw new TarException("Not a valid TAR format.", nfe);
    }
    pos = 124;
    StringBuffer size = new StringBuffer();
    for (i = 0; i < 12; i++)
    {
      if (header[(pos + i)] == 0) {
        break;
      }
      if (header[(pos + i)] != 32) {
        size.append((char)header[(pos + i)]);
      }
    }
    if (size.charAt(0) != '0') {
      size.insert(0, '0');
    }
    try
    {
      fileSize = Integer.decode(size.toString()).intValue();
    }
    catch (NumberFormatException nfe)
    {
      int fileSize;
      throw new TarException("Not a valid TAR format.", nfe);
    }
    int fileSize;
    entry.setSize(fileSize);
    nextEOF = fileSize;
    if (fileSize % 512 > 0) {
      nextEntry = (fileSize + (512 - fileSize % 512));
    } else {
      nextEntry = fileSize;
    }
    filepos += nextEntry + 512;
    return entry;
  }
  
  public TarEntry getNextEntry()
    throws TarException, IOException
  {
    TarEntry entry = getNextEntryInternal();
    if ((entry != null) && (entry.getName().equals("././@LongLink")))
    {
      byte[] longNameData = new byte[(int)entry.getSize()];
      int bytesread = 0;
      while (bytesread < longNameData.length)
      {
        int cur = read(longNameData, bytesread, longNameData.length - bytesread);
        if (cur < 0) {
          throw new IOException("early end of stream");
        }
        bytesread += cur;
      }
      int pos = 0;
      while ((pos < longNameData.length) && (longNameData[pos] != 0)) {
        pos++;
      }
      longLinkName = new String(longNameData, 0, pos, "UTF8");
      return getNextEntryInternal();
    }
    return entry;
  }
  
  public int read(byte[] b, int off, int len)
    throws IOException
  {
    if (nextEOF == 0) {
      return -1;
    }
    if (len > nextEOF) {
      len = nextEOF;
    }
    int size = super.read(b, off, len);
    nextEntry -= size;
    nextEOF -= size;
    bytesread += size;
    return size;
  }
  
  public int read()
    throws IOException
  {
    byte[] data = new byte[1];
    int size = read(data, 0, 1);
    if (size < 0) {
      return size;
    }
    return data[0];
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.TarInputStream
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.io.PrintStream;
import java.util.Date;
import org.eclipse.equinox.internal.p2.core.Activator;
import org.eclipse.osgi.service.debug.DebugOptions;

public class Tracing
{
  public static boolean DEBUG = false;
  public static boolean DEBUG_GENERATOR_PARSING = false;
  public static boolean DEBUG_INSTALL_REGISTRY = false;
  public static boolean DEBUG_METADATA_PARSING = false;
  public static boolean DEBUG_MIRRORS = false;
  public static boolean DEBUG_PARSE_PROBLEMS = false;
  public static boolean DEBUG_PLANNER_OPERANDS = false;
  public static boolean DEBUG_PLANNER_PROJECTOR = false;
  public static boolean DEBUG_PLANNER_PROJECTOR_ENCODING = false;
  public static boolean DEBUG_PROFILE_PREFERENCES = false;
  public static boolean DEBUG_PUBLISHING = false;
  public static boolean DEBUG_RECONCILER = false;
  public static boolean DEBUG_REMOVE_REPO = false;
  public static boolean DEBUG_UPDATE_CHECK = false;
  public static boolean DEBUG_EVENTS_CLIENT = false;
  public static boolean DEBUG_DEFAULT_UI = false;
  
  static
  {
    DebugOptions options = (DebugOptions)ServiceHelper.getService(Activator.context, DebugOptions.class.getName());
    if (options != null)
    {
      DEBUG = options.getBooleanOption("org.eclipse.equinox.p2.core/debug", false);
      if (DEBUG)
      {
        DEBUG_EVENTS_CLIENT = options.getBooleanOption("org.eclipse.equinox.p2.core/events/client", false);
        DEBUG_GENERATOR_PARSING = options.getBooleanOption("org.eclipse.equinox.p2.core/generator/parsing", false);
        DEBUG_INSTALL_REGISTRY = options.getBooleanOption("org.eclipse.equinox.p2.core/engine/installregistry", false);
        DEBUG_METADATA_PARSING = options.getBooleanOption("org.eclipse.equinox.p2.core/metadata/parsing", false);
        DEBUG_MIRRORS = options.getBooleanOption("org.eclipse.equinox.p2.core/artifacts/mirrors", false);
        DEBUG_PARSE_PROBLEMS = options.getBooleanOption("org.eclipse.equinox.p2.core/core/parseproblems", false);
        DEBUG_PLANNER_OPERANDS = options.getBooleanOption("org.eclipse.equinox.p2.core/planner/operands", false);
        DEBUG_PLANNER_PROJECTOR = options.getBooleanOption("org.eclipse.equinox.p2.core/planner/projector", false);
        DEBUG_PLANNER_PROJECTOR_ENCODING = options.getBooleanOption("org.eclipse.equinox.p2.core/planner/encoding", false);
        DEBUG_PROFILE_PREFERENCES = options.getBooleanOption("org.eclipse.equinox.p2.core/engine/profilepreferences", false);
        DEBUG_PUBLISHING = options.getBooleanOption("org.eclipse.equinox.p2.core/publisher", false);
        DEBUG_RECONCILER = options.getBooleanOption("org.eclipse.equinox.p2.core/reconciler", false);
        DEBUG_REMOVE_REPO = options.getBooleanOption("org.eclipse.equinox.p2.core/core/removeRepo", false);
        DEBUG_UPDATE_CHECK = options.getBooleanOption("org.eclipse.equinox.p2.core/updatechecker", false);
        DEBUG_DEFAULT_UI = options.getBooleanOption("org.eclipse.equinox.p2.core/ui/default", false);
      }
    }
  }
  
  public static void debug(String message)
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("[p2] ");
    buffer.append(new Date(System.currentTimeMillis()));
    buffer.append(" - [");
    buffer.append(Thread.currentThread().getName());
    buffer.append("] ");
    buffer.append(message);
    System.out.println(buffer.toString());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.Tracing
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.core.helpers;

import java.io.File;
import java.net.URI;
import java.net.URL;

public class URLUtil
{
  public static File toFile(URL url)
  {
    if (!"file".equalsIgnoreCase(url.getProtocol())) {
      return null;
    }
    String externalForm = url.toExternalForm();
    String pathString = externalForm.substring(5);
    try
    {
      if (pathString.indexOf('/') == 0)
      {
        if (pathString.indexOf("//") == 0) {
          externalForm = "file:" + ensureUNCPath(pathString);
        }
        return new File(new URI(externalForm));
      }
      if (pathString.indexOf(':') == 1) {
        return new File(new URI("file:/" + pathString));
      }
      return new File(new URI(pathString).getSchemeSpecificPart());
    }
    catch (Exception localException) {}
    return new File(pathString);
  }
  
  private static String ensureUNCPath(String path)
  {
    int len = path.length();
    StringBuffer result = new StringBuffer(len);
    for (int i = 0; i < 4; i++) {
      if ((i >= len) || (result.length() > 0) || (path.charAt(i) != '/')) {
        result.append('/');
      }
    }
    result.append(path);
    return result.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.core.helpers.URLUtil
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.provisional.p2.core.eventbus;

import java.util.EventObject;
import org.eclipse.osgi.framework.eventmgr.EventDispatcher;

public abstract interface IProvisioningEventBus
  extends EventDispatcher<ProvisioningListener, ProvisioningListener, EventObject>
{
  static
  {
    try {}catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
    }
  }
  
  public static final String SERVICE_NAME = Class.forName("org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus").getName();
  
  public abstract void addListener(ProvisioningListener paramProvisioningListener);
  
  public abstract void removeListener(ProvisioningListener paramProvisioningListener);
  
  public abstract void publishEvent(EventObject paramEventObject);
  
  public abstract void close();
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.provisional.p2.core.eventbus;

import java.util.EventListener;
import java.util.EventObject;

public abstract interface ProvisioningListener
  extends EventListener
{
  public abstract void notify(EventObject paramEventObject);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.provisional.p2.core.eventbus;

public abstract interface SynchronousProvisioningListener
  extends ProvisioningListener
{}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.core;

import java.net.URI;

public abstract interface IAgentLocation
{
  static
  {
    try {}catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
    }
  }
  
  public static final String SERVICE_NAME = Class.forName("org.eclipse.equinox.p2.core.IAgentLocation").getName();
  
  public abstract URI getDataArea(String paramString);
  
  public abstract URI getRootLocation();
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.core.IAgentLocation
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.core;

public abstract interface IPool<T>
{
  public abstract T add(T paramT);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.core.IPool
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.core;

public abstract interface IProvisioningAgent
{
  static
  {
    try {}catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
    }
  }
  
  public static final String SERVICE_NAME = Class.forName("org.eclipse.equinox.p2.core.IProvisioningAgent").getName();
  public static final String INSTALLER_AGENT = "org.eclipse.equinox.p2.installer.agent";
  public static final String INSTALLER_PROFILEID = "org.eclipse.equinox.p2.installer.profile.id";
  public static final String SERVICE_CURRENT = "agent.current";
  
  public abstract Object getService(String paramString);
  
  public abstract void registerService(String paramString, Object paramObject);
  
  public abstract void stop();
  
  public abstract void unregisterService(String paramString, Object paramObject);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.core.IProvisioningAgent
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.core;

import java.net.URI;

public abstract interface IProvisioningAgentProvider
{
  static
  {
    try {}catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
    }
  }
  
  public static final String SERVICE_NAME = Class.forName("org.eclipse.equinox.p2.core.IProvisioningAgentProvider").getName();
  
  public abstract IProvisioningAgent createAgent(URI paramURI)
    throws ProvisionException;
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.core.IProvisioningAgentProvider
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.core;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;

public class ProvisionException
  extends CoreException
{
  private static final long serialVersionUID = 1L;
  public static final int INTERNAL_ERROR = 1;
  public static final int REPOSITORY_NOT_FOUND = 1000;
  public static final int REPOSITORY_EXISTS = 1001;
  public static final int REPOSITORY_FAILED_READ = 1002;
  public static final int REPOSITORY_FAILED_WRITE = 1003;
  public static final int REPOSITORY_READ_ONLY = 1004;
  public static final int REPOSITORY_UNKNOWN_TYPE = 1005;
  public static final int REPOSITORY_INVALID_LOCATION = 1006;
  public static final int REPOSITORY_FAILED_AUTHENTICATION = 1007;
  public static final int ARTIFACT_NOT_FOUND = 1200;
  public static final int ARTIFACT_EXISTS = 1201;
  public static final int ARTIFACT_INCOMPLETE_SIZING = 1202;
  public static final int ARTIFACT_MD5_NOT_MATCH = 1203;
  
  public ProvisionException(IStatus status)
  {
    super(status);
  }
  
  public ProvisionException(String message)
  {
    super(new Status(4, "org.eclipse.equinox.p2.core", message));
  }
  
  public ProvisionException(String message, Throwable cause)
  {
    super(new Status(4, "org.eclipse.equinox.p2.core", message, cause));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.core.ProvisionException
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.core;

import java.util.HashMap;
import java.util.Map;

public class StrongPool<T>
  implements IPool<T>
{
  private Map<T, T> pool = new HashMap();
  
  public T add(T newObject)
  {
    if (newObject == null) {
      return null;
    }
    T reference = pool.get(newObject);
    if (reference == null)
    {
      pool.put(newObject, newObject);
1 2 3 4

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