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

ng s)
  {
    super(s);
  }
  
  public TarException(String s, Throwable cause)
  {
    super(s, cause);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.util.TarException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal.util;

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

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

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.util.TarFile.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal.util;

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

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

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.util.TarFile.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal.util;

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

class TarFile$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 TarFile$TarInputStream(InputStream in)
    throws TarException, IOException
  {
    super(in);
    
    firstEntry = getNextEntry();
  }
  
  TarFile$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;
    }
    int size = super.read(b, off, len > nextEOF ? nextEOF : 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.pde.api.tools.internal.util.TarFile.TarInputStream
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal.util;

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

public class TarFile
{
  private File file;
  TarInputStream entryEnumerationStream;
  TarEntry curEntry;
  private TarInputStream entryStream;
  private InputStream internalEntryStream;
  
  private static 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();
      
      firstEntry = getNextEntry();
    }
    
    TarInputStream(InputStream in, TarEntry entry)
      throws TarException, IOException
    {
      super();
      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;
      }
      int size = super.read(b, off, len > nextEOF ? nextEOF : 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];
    }
  }
  
  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
  {
    if (entryEnumerationStream != null) {
      entryEnumerationStream.close();
    }
    if (internalEntryStream != null) {
      internalEntryStream.close();
    }
  }
  
  public TarFile(String filename)
    throws TarException, IOException
  {
    this(new File(filename));
  }
  
  public Enumeration entries()
  {
    new Enumeration()
    {
      public boolean hasMoreElements()
      {
        return curEntry != null;
      }
      
      public Object 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.pde.api.tools.internal.util.TarFile
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal.util;

import java.util.Comparator;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
import org.eclipse.pde.api.tools.internal.search.SkippedComponent;

class Util$1
  implements Comparator
{
  public int compare(Object o1, Object o2)
  {
    if (((o1 instanceof IApiComponent)) && ((o2 instanceof IApiComponent))) {
      return ((IApiComponent)o1).getSymbolicName().compareTo(((IApiComponent)o2).getSymbolicName());
    }
    if (((o1 instanceof SkippedComponent)) && ((o2 instanceof SkippedComponent))) {
      return ((SkippedComponent)o1).getComponentId().compareTo(((SkippedComponent)o2).getComponentId());
    }
    if (((o1 instanceof String)) && ((o2 instanceof String))) {
      return ((String)o1).compareTo((String)o2);
    }
    return -1;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.util.Util.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal.util;

import java.io.File;
import java.util.Comparator;

class Util$2
  implements Comparator
{
  public int compare(Object o1, Object o2)
  {
    if (((o1 instanceof File)) && ((o2 instanceof File))) {
      return ((File)o1).getName().compareTo(((File)o2).getName());
    }
    return 0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.util.Util.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal.util;

import java.util.List;
import org.eclipse.pde.api.tools.internal.provisional.comparator.DeltaVisitor;
import org.eclipse.pde.api.tools.internal.provisional.comparator.IDelta;

class Util$3
  extends DeltaVisitor
{
  private final List val$list;
  
  Util$3(List paramList)
  {
    val$list = paramList;
  }
  
  public void endVisit(IDelta localDelta)
  {
    if (localDelta.getChildren().length == 0) {
      val$list.add(localDelta);
    }
    super.endVisit(localDelta);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.util.Util.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal.util;

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

class Util$4
  implements FilenameFilter
{
  public boolean accept(File dir, String name)
  {
    return name.endsWith(".jar") & !name.endsWith("-src.jar");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.util.Util.4
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal.util;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.osgi.util.NLS;
import org.eclipse.pde.api.tools.internal.builder.BuildState;

final class Util$BuildJob
  extends Job
{
  private final IProject[] fProjects;
  private int fBuildType;
  
  Util$BuildJob(String name, IProject[] projects)
  {
    this(name, projects, 6);
  }
  
  Util$BuildJob(String name, IProject[] projects, int buildType)
  {
    super(name);
    fProjects = projects;
    fBuildType = buildType;
  }
  
  public boolean belongsTo(Object family)
  {
    return ResourcesPlugin.FAMILY_MANUAL_BUILD == family;
  }
  
  public boolean isCoveredBy(BuildJob other)
  {
    if (fProjects == null) {
      return true;
    }
    if (fProjects != null)
    {
      int i = 0;
      for (int max = fProjects.length; i < max; i++) {
        if (!other.contains(fProjects[i])) {
          return false;
        }
      }
      return true;
    }
    return false;
  }
  
  public boolean contains(IProject project)
  {
    if (project == null) {
      return false;
    }
    int i = 0;
    for (int max = fProjects.length; i < max; i++) {
      if (project.equals(fProjects[i])) {
        return true;
      }
    }
    return false;
  }
  
  protected IStatus run(IProgressMonitor monitor)
  {
    synchronized (getClass())
    {
      if (monitor.isCanceled()) {
        return Status.CANCEL_STATUS;
      }
      cancelBuild(ResourcesPlugin.FAMILY_MANUAL_BUILD);
    }
    try
    {
      if (fProjects != null)
      {
        SubMonitor localmonitor = SubMonitor.convert(monitor, UtilMessages.Util_0, fProjects.length);
        int i = 0;
        for (int max = fProjects.length; i < max; i++)
        {
          IProject currentProject = fProjects[i];
          if (fBuildType == 6) {
            BuildState.setLastBuiltState(currentProject, null);
          }
          localmonitor.subTask(NLS.bind(UtilMessages.Util_5, currentProject.getName()));
          if (ResourcesPlugin.getWorkspace().isAutoBuilding()) {
            currentProject.touch(null);
          } else {
            currentProject.build(10, localmonitor.newChild(1));
          }
        }
      }
    }
    catch (CoreException e)
    {
      return new Status(e.getStatus().getSeverity(), "org.eclipse.pde.api.tools", 120, UtilMessages.Util_builder_errorMessage, e);
    }
    catch (OperationCanceledException localOperationCanceledException)
    {
      Object localObject2;
      return Status.CANCEL_STATUS;
    }
    finally
    {
      monitor.done();
    }
    monitor.done();
    
    return Status.OK_STATUS;
  }
  
  private void cancelBuild(Object jobfamily)
  {
    Job[] buildJobs = Job.getJobManager().find(jobfamily);
    for (int i = 0; i < buildJobs.length; i++)
    {
      Job curr = buildJobs[i];
      if ((curr != this) && ((curr instanceof BuildJob)))
      {
        BuildJob job = (BuildJob)curr;
        if (job.isCoveredBy(this)) {
          curr.cancel();
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.util.Util.BuildJob
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal.util;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.filebuffers.ITextFileBuffer;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.filebuffers.LocationKind;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceRuleFactory;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.LibraryLocation;
import org.eclipse.jface.text.IDocument;
import org.eclipse.osgi.util.NLS;
import org.eclipse.pde.api.tools.internal.builder.BuildState;
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
import org.eclipse.pde.api.tools.internal.provisional.Factory;
import org.eclipse.pde.api.tools.internal.provisional.IRequiredComponentDescription;
import org.eclipse.pde.api.tools.internal.provisional.VisibilityModifiers;
import org.eclipse.pde.api.tools.internal.provisional.comparator.DeltaVisitor;
import org.eclipse.pde.api.tools.internal.provisional.comparator.IDelta;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IPackageDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.descriptors.IReferenceTypeDescriptor;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiType;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiTypeRoot;
import org.eclipse.pde.api.tools.internal.search.SkippedComponent;
import org.eclipse.pde.internal.core.WorkspaceModelManager;
import org.osgi.framework.Version;

public final class Util
{
  public static final String DOT_TGZ = ".tgz";
  public static final String DOT_TAR_GZ = ".tar.gz";
  public static final String DOT_JAR = ".jar";
  public static final String DOT_ZIP = ".zip";
  public static final char VERSION_SEPARATOR = '(';
  public static boolean DEBUG;
  public static final String EMPTY_STRING = "";
  public static final String DEFAULT_PACKAGE_NAME = "";
  public static final String MANIFEST_NAME = "MANIFEST.MF";
  public static final String DOT_CLASS_SUFFIX = ".class";
  public static final String DOT_JAVA_SUFFIX = ".java";
  private static final int DEFAULT_READING_SIZE = 8192;
  private static final String JAVA_LANG_OBJECT = "java.lang.Object";
  private static final String JAVA_LANG_RUNTIMEEXCEPTION = "java.lang.RuntimeException";
  
  private static final class BuildJob
    extends Job
  {
    private final IProject[] fProjects;
    private int fBuildType;
    
    BuildJob(String name, IProject[] projects)
    {
      this(name, projects, 6);
    }
    
    BuildJob(String name, IProject[] projects, int buildType)
    {
      super();
      fProjects = projects;
      fBuildType = buildType;
    }
    
    public boolean belongsTo(Object family)
    {
      return ResourcesPlugin.FAMILY_MANUAL_BUILD == family;
    }
    
    public boolean isCoveredBy(BuildJob other)
    {
      if (fProjects == null) {
        return true;
      }
      if (fProjects != null)
      {
        int i = 0;
        for (int max = fProjects.length; i < max; i++) {
          if (!other.contains(fProjects[i])) {
            return false;
          }
        }
        return true;
      }
      return false;
    }
    
    public boolean contains(IProject project)
    {
      if (project == null) {
        return false;
      }
      int i = 0;
      for (int max = fProjects.length; i < max; i++) {
        if (project.equals(fProjects[i])) {
          return true;
        }
      }
      return false;
    }
    
    protected IStatus run(IProgressMonitor monitor)
    {
      synchronized (getClass())
      {
        if (monitor.isCanceled()) {
          return Status.CANCEL_STATUS;
        }
        cancelBuild(ResourcesPlugin.FAMILY_MANUAL_BUILD);
      }
      try
      {
        if (fProjects != null)
        {
          SubMonitor localmonitor = SubMonitor.convert(monitor, UtilMessages.Util_0, fProjects.length);
          int i = 0;
          for (int max = fProjects.length; i < max; i++)
          {
            IProject currentProject = fProjects[i];
            if (fBuildType == 6) {
              BuildState.setLastBuiltState(currentProject, null);
            }
            localmonitor.subTask(NLS.bind(UtilMessages.Util_5, currentProject.getName()));
            if (ResourcesPlugin.getWorkspace().isAutoBuilding()) {
              currentProject.touch(null);
            } else {
              currentProject.build(10, localmonitor.newChild(1));
            }
          }
        }
      }
      catch (CoreException e)
      {
        return new Status(e.getStatus().getSeverity(), "org.eclipse.pde.api.tools", 120, UtilMessages.Util_builder_errorMessage, e);
      }
      catch (OperationCanceledException localOperationCanceledException)
      {
        Object localObject2;
        return Status.CANCEL_STATUS;
      }
      finally
      {
        monitor.done();
      }
      monitor.done();
      
      return Status.OK_STATUS;
    }
    
    private void cancelBuild(Object jobfamily)
    {
      Job[] buildJobs = Job.getJobManager().find(jobfamily);
      for (int i = 0; i < buildJobs.length; i++)
      {
        Job curr = buildJobs[i];
        if ((curr != this) && ((curr instanceof BuildJob)))
        {
          BuildJob job = (BuildJob)curr;
          if (job.isCoveredBy(this)) {
            curr.cancel();
          }
        }
      }
    }
  }
  
  public static final String LINE_DELIMITER = System.getProperty("line.separator");
  public static final String UNKNOWN_ELEMENT_KIND = "UNKNOWN_ELEMENT_KIND";
  public static final String UNKNOWN_FLAGS = "UNKNOWN_FLAGS";
  public static final String UNKNOWN_KIND = "UNKNOWN_KIND";
  public static final String UNKNOWN_VISIBILITY = "UNKNOWN_VISIBILITY";
  public static final String ISO_8859_1 = "ISO-8859-1";
  public static final String REGULAR_EXPRESSION_START = "R:";
  private static int DELETE_MAX_TIME = 0;
  private static boolean DELETE_DEBUG = false;
  private static int DELETE_MAX_WAIT = 10000;
  public static final IPath MANIFEST_PROJECT_RELATIVE_PATH = new Path("META-INF/MANIFEST.MF");
  public static final String ORG_ECLIPSE_SWT = "org.eclipse.swt";
  
  static
  {
    String property = System.getProperty("DEBUG");
    DEBUG = (property != null) && (property.equalsIgnoreCase("TRUE"));
  }
  
  private static void abort(String message, Throwable exception)
    throws CoreException
  {
    IStatus status = new Status(4, "org.eclipse.pde.api.tools", message, exception);
    throw new CoreException(status);
  }
  
  private static void appendProperty(StringBuffer buffer, String key, String value)
  {
    buffer.append(key);
    buffer.append('=');
    buffer.append(value);
    buffer.append('\n');
  }
  
  public static List collectAllDeltas(IDelta delta)
  {
    List list = new ArrayList();
    delta.accept(new DeltaVisitor()
    {
      public void endVisit(IDelta localDelta)
      {
        if (localDelta.getChildren().length == 0) {
          add(localDelta);
        }
        super.endVisit(localDelta);
      }
    });
    return list;
  }
  
  private static void collectAllFiles(File root, ArrayList collector, FileFilter fileFilter)
  {
    File[] files = root.listFiles(fileFilter);
    for (int i = 0; i < files.length; i++)
    {
      File currentFile = files[i];
      if (currentFile.isDirectory()) {
        collectAllFiles(currentFile, collector, fileFilter);
      } else {
        collector.add(currentFile);
      }
    }
  }
  
  public static IProject[] getApiProjects()
  {
    IProject[] allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
    ArrayList temp = new ArrayList();
    IProject project = null;
    int i = 0;
    for (int max = allProjects.length; i < max; i++)
    {
      project = allProjects[i];
      if (project.isAccessible()) {
        try
        {
          if (project.hasNature("org.eclipse.pde.api.tools.apiAnalysisNature")) {
            temp.add(project);
          }
        }
        catch (CoreException localCoreException) {}
      }
    }
    IProject[] projects = (IProject[])null;
    if (temp.size() != 0)
    {
      projects = new IProject[temp.size()];
      temp.toArray(projects);
    }
    return projects;
  }
  
  /* Error */
  public static boolean copy(File file, File newFile)
  {
    // Byte code:
    //   0: aconst_null
    //   1: checkcast 971	[B
    //   4: astore_2
    //   5: aconst_null
    //   6: astore_3
    //   7: new 977	java/io/BufferedInputStream
    //   10: dup
    //   11: new 983	java/io/FileInputStream
    //   14: dup
    //   15: aload_0
    //   16: invokespecial 1643	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   19: invokespecial 1613	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
    //   22: astore_3
    //   23: aload_3
    //   24: iconst_m1
    //   25: invokestatic 1790	org/eclipse/pde/api/tools/internal/util/Util:getInputStreamAsByteArray	(Ljava/io/InputStream;I)[B
    //   28: astore_2
    //   29: goto +82 -> 111
    //   32: astore 4
    //   34: aload 4
    //   36: invokestatic 1769	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   39: aload_3
    //   40: ifnull +89 -> 129
    //   43: aload_3
    //   44: invokevirtual 1611	java/io/BufferedInputStream:close	()V
    //   47: goto +82 -> 129
    //   50: astore 6
    //   52: aload 6
    //   54: invokestatic 1769	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   57: goto +72 -> 129
    //   60: astore 4
    //   62: aload 4
    //   64: invokestatic 1769	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   67: aload_3
    //   68: ifnull +61 -> 129
    //   71: aload_3
    //   72: invokevirtual 1611	java/io/BufferedInputStream:close	()V
    //   75: goto +54 -> 129
    //   78: astore 6
    //   80: aload 6
    //   82: invokestatic 1769	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   85: goto +44 -> 129
    //   88: astore 5
    //   90: aload_3
    //   91: ifnull +17 -> 108
    //   94: aload_3
    //   95: invokevirtual 1611	java/io/BufferedInputStream:close	()V
    //   98: goto +10 -> 108
    //   101: astore 6
    //   103: aload 6
    //   105: invokestatic 1769	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   108: aload 5
    //   110: athrow
    //   111: aload_3
    //   112: ifnull +17 -> 129
    //   115: aload_3
    //   116: invokevirtual 1611	java/io/BufferedInputStream:close	()V
    //   119: goto +10 -> 129
    //   122: astore 6
    //   124: aload 6
    //   126: invokestatic 1769	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   129: aload_2
    //   130: ifnull +120 -> 250
    //   133: aconst_null
    //   134: astore 4
    //   136: new 978	java/io/BufferedOutputStream
    //   139: dup
    //   140: new 985	java/io/FileOutputStream
    //   143: dup
    //   144: aload_1
    //   145: invokespecial 1647	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   148: invokespecial 1618	java/io/BufferedOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   151: astore 4
    //   153: aload 4
    //   155: aload_2
    //   156: invokevirtual 1616	java/io/BufferedOutputStream:write	([B)V
    //   159: aload 4
    //   161: invokevirtual 1615	java/io/BufferedOutputStream:flush	()V
    //   164: goto +70 -> 234
    //   167: astore 5
    //   169: aload 5
    //   171: invokestatic 1769	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   174: aload 4
    //   176: ifnull +72 -> 248
    //   179: aload 4
    //   181: invokevirtual 1614	java/io/BufferedOutputStream:close	()V
    //   184: goto +64 -> 248
    //   187: pop
    //   188: goto +60 -> 248
    //   191: astore 5
    //   193: aload 5
    //   195: invokestatic 1769	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   198: aload 4
    //   200: ifnull +48 -> 248
    //   203: aload 4
    //   205: invokevirtual 1614	java/io/BufferedOutputStream:close	()V
    //   208: goto +40 -> 248
    //   211: pop
    //   212: goto +36 -> 248
    //   215: astore 6
    //   217: aload 4
    //   219: ifnull +12 -> 231
    //   222: aload 4
    //   224: invokevirtual 1614	java/io/BufferedOutputStream:close	()V
    //   227: goto +4 -> 231
   
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