org.eclipse.osgi_3.8.2.v20130124-134944

}
    
    
      ((Boolean)AccessController.doPrivileged(new PrivilegedAction()
      {
        public Boolean run()
        {
          return file.isDirectory() ? Boolean.TRUE : Boolean.FALSE;
        }
      }, controlContext)).booleanValue();
  }
  
  public long lastModified(final File file)
  {
    if (System.getSecurityManager() == null) {
      return file.lastModified();
    }
    
    
      ((Long)AccessController.doPrivileged(new PrivilegedAction()
      {
        public Long run()
        {
          return new Long(file.lastModified());
        }
      }, controlContext)).longValue();
  }
  
  public String[] list(final File file)
  {
    if (System.getSecurityManager() == null) {
      return file.list();
    }
    (String[])AccessController.doPrivileged(new PrivilegedAction()
    {
      public String[] run()
      {
        return file.list();
      }
    }, controlContext);
  }
  
  /* Error */
  public ZipFile getZipFile(final File file)
    throws IOException
  {
    // Byte code:
    //   0: invokestatic 312	java/lang/System:getSecurityManager	()Ljava/lang/SecurityManager;
    //   3: ifnonnull +12 -> 15
    //   6: new 144	java/util/zip/ZipFile
    //   9: dup
    //   10: aload_1
    //   11: invokespecial 323	java/util/zip/ZipFile:<init>	(Ljava/io/File;)V
    //   14: areturn
    //   15: new 152	org/eclipse/osgi/framework/util/SecureAction$14
    //   18: dup
    //   19: aload_0
    //   20: aload_1
    //   21: invokespecial 334	org/eclipse/osgi/framework/util/SecureAction$14:<init>	(Lorg/eclipse/osgi/framework/util/SecureAction;Ljava/io/File;)V
    //   24: aload_0
    //   25: getfield 290	org/eclipse/osgi/framework/util/SecureAction:controlContext	Ljava/security/AccessControlContext;
    //   28: invokestatic 319	java/security/AccessController:doPrivileged	(Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;
    //   31: checkcast 144	java/util/zip/ZipFile
    //   34: areturn
    //   35: astore_2
    //   36: aload_2
    //   37: invokevirtual 320	java/security/PrivilegedActionException:getException	()Ljava/lang/Exception;
    //   40: instanceof 126
    //   43: ifeq +11 -> 54
    //   46: aload_2
    //   47: invokevirtual 320	java/security/PrivilegedActionException:getException	()Ljava/lang/Exception;
    //   50: checkcast 126	java/io/IOException
    //   53: athrow
    //   54: aload_2
    //   55: invokevirtual 320	java/security/PrivilegedActionException:getException	()Ljava/lang/Exception;
    //   58: checkcast 133	java/lang/RuntimeException
    //   61: athrow
    //   62: astore_2
    //   63: new 143	java/util/zip/ZipException
    //   66: dup
    //   67: new 135	java/lang/StringBuffer
    //   70: dup
    //   71: ldc 1
    //   73: invokespecial 310	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   76: aload_1
    //   77: invokevirtual 297	java/io/File:getPath	()Ljava/lang/String;
    //   80: invokevirtual 311	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   83: invokevirtual 309	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   86: invokespecial 321	java/util/zip/ZipException:<init>	(Ljava/lang/String;)V
    //   89: astore_3
    //   90: aload_3
    //   91: aload_2
    //   92: invokevirtual 322	java/util/zip/ZipException:initCause	(Ljava/lang/Throwable;)Ljava/lang/Throwable;
    //   95: pop
    //   96: aload_3
    //   97: athrow
    //   98: astore_2
    //   99: new 126	java/io/IOException
    //   102: dup
    //   103: new 135	java/lang/StringBuffer
    //   106: dup
    //   107: ldc 1
    //   109: invokespecial 310	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   112: aload_1
    //   113: invokevirtual 297	java/io/File:getPath	()Ljava/lang/String;
    //   116: invokevirtual 311	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   119: invokevirtual 309	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   122: invokespecial 301	java/io/IOException:<init>	(Ljava/lang/String;)V
    //   125: astore_3
    //   126: aload_3
    //   127: aload_2
    //   128: invokevirtual 302	java/io/IOException:initCause	(Ljava/lang/Throwable;)Ljava/lang/Throwable;
    //   131: pop
    //   132: aload_3
    //   133: athrow
    // Line number table:
    //   Java source line #273	-> byte code offset #0
    //   Java source line #274	-> byte code offset #6
    //   Java source line #276	-> byte code offset #15
    //   Java source line #280	-> byte code offset #24
    //   Java source line #276	-> byte code offset #28
    //   Java source line #281	-> byte code offset #35
    //   Java source line #282	-> byte code offset #36
    //   Java source line #283	-> byte code offset #46
    //   Java source line #284	-> byte code offset #54
    //   Java source line #286	-> byte code offset #62
    //   Java source line #287	-> byte code offset #63
    //   Java source line #288	-> byte code offset #90
    //   Java source line #289	-> byte code offset #96
    //   Java source line #290	-> byte code offset #98
    //   Java source line #291	-> byte code offset #99
    //   Java source line #292	-> byte code offset #126
    //   Java source line #293	-> byte code offset #132
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	134	0	this	SecureAction
    //   0	134	1	file	File
    //   35	20	2	e	PrivilegedActionException
    //   62	30	2	e	java.util.zip.ZipException
    //   98	30	2	e	IOException
    //   89	8	3	zipNameException	java.util.zip.ZipException
    //   125	8	3	fileNameException	IOException
    // Exception table:
    //   from	to	target	type
    //   15	34	35	java/security/PrivilegedActionException
    //   0	14	62	java/util/zip/ZipException
    //   15	34	62	java/util/zip/ZipException
    //   35	62	62	java/util/zip/ZipException
    //   0	14	98	java/io/IOException
    //   15	34	98	java/io/IOException
    //   35	62	98	java/io/IOException
  }
  
  public URL getURL(final String protocol, final String host, final int port, final String file, final URLStreamHandler handler)
    throws MalformedURLException
  {
    if (System.getSecurityManager() == null) {
      return new URL(protocol, host, port, file, handler);
    }
    try
    {
      (URL)AccessController.doPrivileged(new PrivilegedExceptionAction()
      {
        public URL run()
          throws MalformedURLException
        {
          return new URL(protocol, host, port, file, handler);
        }
      }, controlContext);
    }
    catch (PrivilegedActionException e)
    {
      if ((e.getException() instanceof MalformedURLException)) {
        throw ((MalformedURLException)e.getException());
      }
      throw ((RuntimeException)e.getException());
    }
  }
  
  public Thread createThread(final Runnable target, final String name, final ClassLoader contextLoader)
  {
    if (System.getSecurityManager() == null) {
      return createThread0(target, name, contextLoader);
    }
    (Thread)AccessController.doPrivileged(new PrivilegedAction()
    {
      public Thread run()
      {
        return createThread0(target, name, contextLoader);
      }
    }, controlContext);
  }
  
  Thread createThread0(Runnable target, String name, ClassLoader contextLoader)
  {
    Thread result = new Thread(target, name);
    if (contextLoader != null) {
      result.setContextClassLoader(contextLoader);
    }
    return result;
  }
  
  public <S> S getService(final ServiceReference<S> reference, final BundleContext context)
  {
    if (System.getSecurityManager() == null) {
      return (S)context.getService(reference);
    }
    (S)AccessController.doPrivileged(new PrivilegedAction()
    {
      public S run()
      {
        return (S)context.getService(reference);
      }
    }, controlContext);
  }
  
  public Class<?> forName(final String name)
    throws ClassNotFoundException
  {
    if (System.getSecurityManager() == null) {
      return Class.forName(name);
    }
    try
    {
      (Class)AccessController.doPrivileged(new PrivilegedExceptionAction()
      {
        public Class<?> run()
          throws Exception
        {
          return Class.forName(name);
        }
      }, controlContext);
    }
    catch (PrivilegedActionException e)
    {
      if ((e.getException() instanceof ClassNotFoundException)) {
        throw ((ClassNotFoundException)e.getException());
      }
      throw ((RuntimeException)e.getException());
    }
  }
  
  public Class<?> loadSystemClass(final String name)
    throws ClassNotFoundException
  {
    if (System.getSecurityManager() == null)
    {
      ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
      return systemClassLoader != null ? systemClassLoader.loadClass(name) : bootClassLoader.loadClass(name);
    }
    try
    {
      (Class)AccessController.doPrivileged(new PrivilegedExceptionAction()
      {
        public Class<?> run()
          throws Exception
        {
          ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
          return systemClassLoader != null ? systemClassLoader.loadClass(name) : SecureAction.bootClassLoader.loadClass(name);
        }
      }, controlContext);
    }
    catch (PrivilegedActionException e)
    {
      if ((e.getException() instanceof ClassNotFoundException)) {
        throw ((ClassNotFoundException)e.getException());
      }
      throw ((RuntimeException)e.getException());
    }
  }
  
  public void open(final ServiceTracker<?, ?> tracker)
  {
    if (System.getSecurityManager() == null)
    {
      tracker.open();
      return;
    }
    AccessController.doPrivileged(new PrivilegedAction()
    {
      public Object run()
      {
        tracker.open();
        return null;
      }
    }, controlContext);
  }
  
  public void start(final Bundle bundle, final int options)
    throws BundleException
  {
    if (System.getSecurityManager() == null)
    {
      bundle.start(options);
      return;
    }
    try
    {
      AccessController.doPrivileged(new PrivilegedExceptionAction()
      {
        public Object run()
          throws BundleException
        {
          bundle.start(options);
          return null;
        }
      }, controlContext);
      return;
    }
    catch (PrivilegedActionException e)
    {
      if ((e.getException() instanceof BundleException)) {
        throw ((BundleException)e.getException());
      }
      throw ((RuntimeException)e.getException());
    }
  }
  
  public void start(Bundle bundle)
    throws BundleException
  {
    start(bundle, 0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.util.SecureAction
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import org.eclipse.osgi.util.NLS;

public class AdaptorMsg
  extends NLS
{
  public static String ADAPTER_FILEEXIST_EXCEPTION;
  public static String ADAPTOR_DIRECTORY_CREATE_EXCEPTION;
  public static String ADAPTOR_DIRECTORY_EXCEPTION;
  public static String ADAPTOR_EXTENSION_IMPORT_ERROR;
  public static String ADAPTOR_EXTENSION_NATIVECODE_ERROR;
  public static String ADAPTOR_EXTENSION_REQUIRE_ERROR;
  public static String ADAPTOR_STORAGE_EXCEPTION;
  public static String ADAPTOR_STORAGE_INIT_FAILED_MSG;
  public static String ADAPTOR_STORAGE_INIT_FAILED_TITLE;
  public static String ADAPTOR_URL_CREATE_EXCEPTION;
  public static String BUNDLE_CLASSPATH_ENTRY_NOT_FOUND_EXCEPTION;
  public static String BUNDLE_NATIVECODE_EXCEPTION;
  public static String BUNDLE_READ_EXCEPTION;
  public static String MANIFEST_NOT_FOUND_EXCEPTION;
  public static String RESOURCE_NOT_FOUND_EXCEPTION;
  public static String SYSTEMBUNDLE_MISSING_MANIFEST;
  public static String SYSTEMBUNDLE_NOTRESOLVED;
  public static String URL_INVALID_BUNDLE_ID;
  public static String URL_NO_BUNDLE_FOUND;
  public static String URL_NO_BUNDLE_ID;
  private static final String BUNDLE_NAME = "org.eclipse.osgi.internal.baseadaptor.ExternalMessages";
  
  static
  {
    NLS.initializeMessages("org.eclipse.osgi.internal.baseadaptor.ExternalMessages", AdaptorMsg.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.AdaptorMsg
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Dictionary;
import java.util.Hashtable;
import org.eclipse.core.runtime.internal.adaptor.EclipseAdaptorMsg;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.util.Headers;
import org.eclipse.osgi.framework.util.ObjectPool;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.Version;

public class AdaptorUtil
{
  public static final byte NULL = 0;
  public static final byte OBJECT = 1;
  
  public static void copyDir(File inDir, File outDir)
    throws IOException
  {
    String[] files = inDir.list();
    if ((files != null) && (files.length > 0))
    {
      outDir.mkdir();
      for (int i = 0; i < files.length; i++)
      {
        File inFile = new File(inDir, files[i]);
        File outFile = new File(outDir, files[i]);
        if (inFile.isDirectory())
        {
          copyDir(inFile, outFile);
        }
        else
        {
          InputStream in = new FileInputStream(inFile);
          readFile(in, outFile);
        }
      }
    }
  }
  
  /* Error */
  public static void readFile(InputStream in, File file)
    throws IOException
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_2
    //   2: new 180	java/io/FileOutputStream
    //   5: dup
    //   6: aload_1
    //   7: invokespecial 346	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   10: astore_2
    //   11: sipush 1024
    //   14: newarray <illegal type>
    //   16: astore_3
    //   17: goto +11 -> 28
    //   20: aload_2
    //   21: aload_3
    //   22: iconst_0
    //   23: iload 4
    //   25: invokevirtual 345	java/io/FileOutputStream:write	([BII)V
    //   28: aload_0
    //   29: aload_3
    //   30: iconst_0
    //   31: aload_3
    //   32: arraylength
    //   33: invokevirtual 348	java/io/InputStream:read	([BII)I
    //   36: dup
    //   37: istore 4
    //   39: ifgt -19 -> 20
    //   42: goto +50 -> 92
    //   45: astore_3
    //   46: getstatic 327	org/eclipse/osgi/framework/debug/Debug:DEBUG_GENERAL	Z
    //   49: ifeq +12 -> 61
    //   52: ldc 5
    //   54: invokestatic 371	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   57: aload_3
    //   58: invokestatic 372	org/eclipse/osgi/framework/debug/Debug:printStackTrace	(Ljava/lang/Throwable;)V
    //   61: aload_3
    //   62: athrow
    //   63: astore 5
    //   65: aload_0
    //   66: ifnull +11 -> 77
    //   69: aload_0
    //   70: invokevirtual 347	java/io/InputStream:close	()V
    //   73: goto +4 -> 77
    //   76: pop
    //   77: aload_2
    //   78: ifnull +11 -> 89
    //   81: aload_2
    //   82: invokevirtual 344	java/io/FileOutputStream:close	()V
    //   85: goto +4 -> 89
    //   88: pop
    //   89: aload 5
    //   91: athrow
    //   92: aload_0
    //   93: ifnull +11 -> 104
    //   96: aload_0
    //   97: invokevirtual 347	java/io/InputStream:close	()V
    //   100: goto +4 -> 104
    //   103: pop
    //   104: aload_2
    //   105: ifnull +11 -> 116
    //   108: aload_2
    //   109: invokevirtual 344	java/io/FileOutputStream:close	()V
    //   112: goto +4 -> 116
    //   115: pop
    //   116: return
    // Line number table:
    //   Java source line #70	-> byte code offset #0
    //   Java source line #72	-> byte code offset #2
    //   Java source line #74	-> byte code offset #11
    //   Java source line #76	-> byte code offset #17
    //   Java source line #77	-> byte code offset #20
    //   Java source line #76	-> byte code offset #28
    //   Java source line #79	-> byte code offset #42
    //   Java source line #80	-> byte code offset #46
    //   Java source line #81	-> byte code offset #52
    //   Java source line #82	-> byte code offset #57
    //   Java source line #85	-> byte code offset #61
    //   Java source line #86	-> byte code offset #63
    //   Java source line #87	-> byte code offset #65
    //   Java source line #89	-> byte code offset #69
    //   Java source line #90	-> byte code offset #73
    //   Java source line #95	-> byte code offset #77
    //   Java source line #97	-> byte code offset #81
    //   Java source line #98	-> byte code offset #85
    //   Java source line #102	-> byte code offset #89
    //   Java source line #87	-> byte code offset #92
    //   Java source line #89	-> byte code offset #96
    //   Java source line #90	-> byte code offset #100
    //   Java source line #95	-> byte code offset #104
    //   Java source line #97	-> byte code offset #108
    //   Java source line #98	-> byte code offset #112
    //   Java source line #103	-> byte code offset #116
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	117	0	in	InputStream
    //   0	117	1	file	File
    //   1	108	2	fos	java.io.FileOutputStream
    //   16	16	3	buffer	byte[]
    //   45	17	3	e	IOException
    //   20	4	4	count	int
    //   37	3	4	count	int
    //   63	27	5	localObject	Object
    //   76	1	8	localIOException1	IOException
    //   88	1	9	localIOException2	IOException
    //   103	1	10	localIOException3	IOException
    //   115	1	11	localIOException4	IOException
    // Exception table:
    //   from	to	target	type
    //   2	42	45	java/io/IOException
    //   2	63	63	finally
    //   69	73	76	java/io/IOException
    //   81	85	88	java/io/IOException
    //   96	100	103	java/io/IOException
    //   108	112	115	java/io/IOException
  }
  
  public static boolean rm(File file)
  {
    if (file.exists())
    {
      if (file.isDirectory())
      {
        String[] list = file.list();
        if (list != null)
        {
          int len = list.length;
          for (int i = 0; i < len; i++) {
            rm(new File(file, list[i]));
          }
        }
      }
      if (Debug.DEBUG_GENERAL) {
        if (file.isDirectory()) {
          Debug.println("rmdir " + file.getPath());
        } else {
          Debug.println("rm " + file.getPath());
        }
      }
      boolean success = file.delete();
      if ((Debug.DEBUG_GENERAL) && 
        (!success)) {
        Debug.println("  rm failed!!");
      }
      return success;
    }
    return true;
  }
  
  public static String readString(DataInputStream in, boolean intern)
    throws IOException
  {
    byte type = in.readByte();
    if (type == 0) {
      return null;
    }
    return intern ? in.readUTF().intern() : in.readUTF();
  }
  
  public static void writeStringOrNull(DataOutputStream out, String string)
    throws IOException
  {
    if (string == null)
    {
      out.writeByte(0);
    }
    else
    {
      out.writeByte(1);
      out.writeUTF(string);
    }
  }
  
  public static Version loadVersion(DataInputStream in)
    throws IOException
  {
    String versionString = readString(in, false);
    try
    {
      return (Version)ObjectPool.intern(Version.parseVersion(versionString));
    }
    catch (IllegalArgumentException localIllegalArgumentException) {}
    return new InvalidVersion(versionString);
  }
  
  public static ServiceRegistration<?> register(String name, Object service, BundleContext context)
  {
    Dictionary<String, Object> properties = new Hashtable(7);
    Dictionary<String, String> headers = context.getBundle().getHeaders();
    properties.put("service.vendor", headers.get("Bundle-Vendor"));
    properties.put("service.ranking", new Integer(Integer.MAX_VALUE));
    properties.put("service.pid", context.getBundle().getBundleId() + "." + service.getClass().getName());
    return context.registerService(name, service, properties);
  }
  
  public static Dictionary<String, String> loadManifestFrom(BaseData bundledata)
    throws BundleException
  {
    URL url = bundledata.getEntry("META-INF/MANIFEST.MF");
    if (url == null) {
      return null;
    }
    try
    {
      return Headers.parseManifest(url.openStream());
    }
    catch (IOException e)
    {
      throw new BundleException(NLS.bind(EclipseAdaptorMsg.ECLIPSE_DATA_ERROR_READING_MANIFEST, bundledata.getLocation()), 3, e);
    }
  }
  
  /* Error */
  public static boolean canWrite(File installDir)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 333	java/io/File:canWrite	()Z
    //   4: ifne +5 -> 9
    //   7: iconst_0
    //   8: ireturn
    //   9: aload_0
    //   10: invokevirtual 336	java/io/File:isDirectory	()Z
    //   13: ifne +5 -> 18
    //   16: iconst_0
    //   17: ireturn
    //   18: aconst_null
    //   19: astore_1
    //   20: ldc_w 175
    //   23: ldc_w 170
    //   26: aload_0
    //   27: invokestatic 342	java/io/File:createTempFile	(Ljava/lang/String;Ljava/lang/String;Ljava/io/File;)Ljava/io/File;
    //   30: astore_1
    //   31: goto +27 -> 58
    //   34: pop
    //   35: aload_1
    //   36: ifnull +8 -> 44
    //   39: aload_1
    //   40: invokevirtual 334	java/io/File:delete	()Z
    //   43: pop
    //   44: iconst_0
    //   45: ireturn
    //   46: astore_2
    //   47: aload_1
    //   48: ifnull +8 -> 56
    //   51: aload_1
    //   52: invokevirtual 334	java/io/File:delete	()Z
    //   55: pop
    //   56: aload_2
    //   57: athrow
    //   58: aload_1
    //   59: ifnull +8 -> 67
    //   62: aload_1
    //   63: invokevirtual 334	java/io/File:delete	()Z
    //   66: pop
    //   67: iconst_1
    //   68: ireturn
    // Line number table:
    //   Java source line #198	-> byte code offset #0
    //   Java source line #199	-> byte code offset #7
    //   Java source line #201	-> byte code offset #9
    //   Java source line #202	-> byte code offset #16
    //   Java source line #204	-> byte code offset #18
    //   Java source line #208	-> byte code offset #20
    //   Java source line #209	-> byte code offset #31
    //   Java source line #213	-> byte code offset #35
    //   Java source line #214	-> byte code offset #39
    //   Java source line #211	-> byte code offset #44
    //   Java source line #212	-> byte code offset #46
    //   Java source line #213	-> byte code offset #47
    //   Java source line #214	-> byte code offset #51
    //   Java source line #215	-> byte code offset #56
    //   Java source line #213	-> byte code offset #58
    //   Java source line #214	-> byte code offset #62
    //   Java source line #216	-> byte code offset #67
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	69	0	installDir	File
    //   19	44	1	fileTest	File
    //   46	11	2	localObject	Object
    //   34	1	3	localIOException	IOException
    // Exception table:
    //   from	to	target	type
    //   20	31	34	java/io/IOException
    //   20	35	46	finally
  }
  
  public static URL encodeFileURL(File file)
    throws MalformedURLException
  {
    try
    {
      Method toURI = File.class.getMethod("toURI", null);
      Object uri = toURI.invoke(file, null);
      Method toURL = uri.getClass().getMethod("toURL", null);
      return (URL)toURL.invoke(uri, null);
    }
    catch (NoSuchMethodException localNoSuchMethodException) {}catch (IllegalAccessException localIllegalAccessException) {}catch (InvocationTargetException e)
    {
      if ((e.getTargetException() instanceof MalformedURLException)) {
        throw ((MalformedURLException)e.getTargetException());
      }
    }
    return file.toURL();
  }
  
  /* Error */
  public static byte[] getBytes(InputStream in, int length, int BUF_SIZE)
    throws IOException
  {
    // Byte code:
    //   0: iconst_0
    //   1: istore 4
    //   3: iload_1
    //   4: ifle +47 -> 51
    //   7: iload_1
    //   8: newarray <illegal type>
    //   10: astore_3
    //   11: goto +31 -> 42
    //   14: aload_0
    //   15: aload_3
    //   16: iload 4
    //   18: iload_1
    //   19: iload 4
    //   21: isub
    //   22: invokevirtual 348	java/io/InputStream:read	([BII)I
    //   25: istore 5
    //   27: iload 5
    //   29: ifgt +6 -> 35
    //   32: goto +86 -> 118
    //   35: iload 4
    //   37: iload 5
    //   39: iadd
    //   40: istore 4
    //   42: iload 4
    //   44: iload_1
    //   45: if_icmplt -31 -> 14
    //   48: goto +70 -> 118
    //   51: iload_2
    //   52: istore_1
    //   53: iload_1
    //   54: newarray <illegal type>
    //   56: astore_3
    //   57: goto +31 -> 88
    //   60: aload_0
    //   61: aload_3
    //   62: iload 4
    //   64: iload_1
    //   65: iload 4
    //   67: isub
    //   68: invokevirtual 348	java/io/InputStream:read	([BII)I
    //   71: istore 5
    //   73: iload 5
    //   75: ifgt +6 -> 81
    //   78: goto +40 -> 118
    //   81: iload 4
    //   83: iload 5
    //   85: iadd
    //   86: istore 4
    //   88: iload 4
    //   90: iload_1
    //   91: if_icmplt -31 -> 60
    //   94: aload_3
    //   95: astore 6
    //   97: iload_1
    //   98: iload_2
    //   99: iadd
    //   100: istore_1
    //   101: iload_1
    //   102: newarray <illegal type>
    //   104: astore_3
    //   105: aload 6
    //   107: iconst_0
    //   108: aload_3
    //   109: iconst_0
    //   110: iload 4
    //   112: invokestatic 361	java/lang/System:arraycopy	(Ljava/lang/Object;ILjava/lang/Object;II)V
    //   115: goto -27 -> 88
    //   118: aload_3
    //   119: arraylength
    //   120: iload 4
    //   122: if_icmple +37 -> 159
    //   125: aload_3
    //   126: astore 6
    //   128: iload 4
    //   130: newarray <illegal type>
    //   132: astore_3
    //   133: aload 6
    //   135: iconst_0
    //   136: aload_3
    //   137: iconst_0
    //   138: iload 4
    //   140: invokestatic 361	java/lang/System:arraycopy	(Ljava/lang/Object;ILjava/lang/Object;II)V
    //   143: goto +16 -> 159
    //   146: astore 7
    //   148: aload_0
    //   149: invokevirtual 347	java/io/InputStream:close	()V
    //   152: goto +4 -> 156
    //   155: pop
    //   156: aload 7
    //   158: athrow
    //   159: aload_0
    //   160: invokevirtual 347	java/io/InputStream:close	()V
    //   163: goto +4 -> 167
    //   166: pop
    //   167: aload_3
    //   168: areturn
    // Line number table:
    //   Java source line #241	-> byte code offset #0
    //   Java source line #244	-> byte code offset #3
    //   Java source line #245	-> byte code offset #7
    //   Java source line #246	-> byte code offset #11
    //   Java source line #247	-> byte code offset #14
    //   Java source line #248	-> byte code offset #27
    //   Java source line #249	-> byte code offset #32
    //   Java source line #246	-> byte code offset #35
    //   Java source line #251	-> byte code offset #48
    //   Java source line #252	-> byte code offset #51
    //   Java source line #253	-> byte code offset #53
    //   Java source line #255	-> byte code offset #57
    //   Java source line #256	-> byte code offset #60
    //   Java source line #257	-> byte code offset #73
    //   Java source line #258	-> byte code offset #78
    //   Java source line #255	-> byte code offset #81
    //   Java source line #260	-> byte code offset #94
    //   Java source line #261	-> byte code offset #97
    //   Java source line #262	-> byte code offset #101
    //   Java source line #263	-> byte code offset #105
    //   Java source line #254	-> byte code offset #115
    //   Java source line #266	-> byte code offset #118
    //   Java source line #267	-> byte code offset #125
    //   Java source line #268	-> byte code offset #128
    //   Java source line #269	-> byte code offset #133
    //   Java source line #271	-> byte code offset #143
    //   Java source line #273	-> byte code offset #148
    //   Java source line #274	-> byte code offset #152
    //   Java source line #277	-> byte code offset #156
    //   Java source line #273	-> byte code offset #159
    //   Java source line #274	-> byte code offset #163
    //   Java source line #278	-> byte code offset #167
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	169	0	in	InputStream
    //   0	169	1	length	int
    //   0	169	2	BUF_SIZE	int
    //   10	6	3	classbytes	byte[]
    //   56	81	3	classbytes	byte[]
    //   159	1	3	classbytes	byte[]
    //   167	1	3	classbytes	byte[]
    //   1	138	4	bytesread	int
    //   25	13	5	readcount	int
    //   71	13	5	readcount	int
    //   95	11	6	oldbytes	byte[]
    //   126	8	6	oldbytes	byte[]
    //   146	11	7	localObject	Object
    //   155	1	13	localIOException1	IOException
    //   166	1	14	localIOException2	IOException
    // Exception table:
    //   from	to	target	type
    //   3	146	146	finally
    //   148	152	155	java/io/IOException
    //   159	163	166	java/io/IOException
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.AdaptorUtil
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import java.util.Iterator;

class ArrayMap$1
  implements Iterator<K>
{
  final ArrayMap this$0;
  
  ArrayMap$1(ArrayMap paramArrayMap, Iterator paramIterator1, Iterator paramIterator2) {}
  
  public boolean hasNext()
  {
    return val$keyIter.hasNext();
  }
  
  public K next()
  {
    val$valueIter.next();
    return (K)val$keyIter.next();
  }
  
  public void remove()
  {
    val$valueIter.remove();
    val$keyIter.remove();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.ArrayMap.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import org.eclipse.osgi.service.resolver.extras.Sortable;

public class ArrayMap<K, V>
  implements Collection<K>, Sortable<K>
{
  final List<K> keys;
  final List<V> values;
  
  public ArrayMap(int initialCapacity)
  {
    keys = new ArrayList(initialCapacity);
    values = new ArrayList(initialCapacity);
  }
  
  public ArrayMap(List<K> keys, List<V> values)
  {
    if (keys.size() != values.size()) {
      throw new IllegalArgumentException("Keys and values size must be equal.");
    }
    this.keys = keys;
    this.values = values;
  }
  
  public V get(K key)
  {
    int index = keys.indexOf(key);
    if (index < 0) {
      return null;
    }
    return (V)values.get(index);
  }
  
  public void put(K key, V value)
  {
    int index = keys.indexOf(key);
    if (index > 0)
    {
      values.set(index, value);
    }
    else
    {
      keys.add(key);
      values.add(value);
    }
  }
  
  public boolean remove(Object key)
  {
    int index = keys.indexOf(key);
    if (index < 0) {
      return false;
    }
    keys.remove(index);
    values.remove(index);
    return true;
  }
  
  public void clear()
  {
    keys.clear();
    values.clear();
  }
  
  public List<K> getKeys()
  {
    return new ArrayList(keys);
  }
  
  public List<V> getValues()
  {
    return new ArrayList(values);
  }
  
  public int size()
  {
    return keys.size();
  }
  
  public boolean isEmpty()
  {
    return keys.isEmpty();
  }
  
  public boolean contains(Object o)
  {
    return keys.contains(o);
  }
  
  public Iterator<K> iterator()
  {
    final Iterator<K> keyIter = keys.iterator();
    final Iterator<V> valueIter = values.iterator();
    
    new Iterator()
    {
      public boolean hasNext()
      {
        return keyIter.hasNext();
      }
      
      public K next()
      {
        valueIter.next();
        return (K)keyIter.next();
      }
      
      public void remove()
      {
        valueIter.remove();
        keyIter.remove();
      }
    };
  }
  
  public Object[] toArray()
  {
    return keys.toArray();
  }
  
  public <T> T[] toArray(T[] a)
  {
    return keys.toArray(a);
  }
  
  public boolean add(K o)
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean containsAll(Collection<?> c)
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean addAll(Collection<? extends K> c)
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean removeAll(Collection<?> c)
  {
    boolean result = false;
    for (Iterator localIterator = c.iterator(); localIterator.hasNext();)
    {
      Object key = localIterator.next();
      result |= remove(key);
    }
    return result;
  }
  
  public boolean retainAll(Collection<?> c)
  {
    boolean result = false;
    Object[] keyArray = keys.toArray();
    Object[] arrayOfObject1;
    int j = (arrayOfObject1 = keyArray).length;
    for (int i = 0; i < j; i++)
    {
      Object key = arrayOfObject1[i];
      if (!c.contains(key)) {
        result |= remove(key);
      }
    }
    return result;
  }
  
  public K getKey(int index)
  {
    return (K)keys.get(index);
  }
  
  public V getValue(int index)
  {
    return (V)values.get(index);
  }
  
  public void sort(Comparator<K> comparator)
  {
    List<K> sortedKeys = new ArrayList(keys);
    Collections.sort(sortedKeys, comparator);
    List<V> sortedValues = new ArrayList(sortedKeys.size());
    for (Iterator localIterator = sortedKeys.iterator(); localIterator.hasNext();)
    {
      K key = (Object)localIterator.next();
      sortedValues.add(getByIdentity(key));
    }
    clear();
    for (int i = 0; i < sortedKeys.size(); i++) {
      put(sortedKeys.get(i), sortedValues.get(i));
    }
  }
  
  private V getByIdentity(K key)
  {
    int index = 0;
    for (Iterator localIterator = keys.iterator(); localIterator.hasNext();)
    {
      K existing = (Object)localIterator.next();
      if (existing == key) {
        return (V)getValue(index);
      }
      index++;
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.ArrayMap
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import java.io.File;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;
import org.eclipse.osgi.baseadaptor.hooks.ClassLoadingHook;
import org.eclipse.osgi.baseadaptor.loader.BaseClassLoader;
import org.eclipse.osgi.baseadaptor.loader.ClasspathEntry;
import org.eclipse.osgi.baseadaptor.loader.ClasspathManager;
import org.eclipse.osgi.framework.adaptor.BundleProtectionDomain;
import org.eclipse.osgi.framework.adaptor.ClassLoaderDelegate;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.util.ManifestElement;

public class BaseClassLoadingHook
  implements ClassLoadingHook
{
  private static final String[] LIB_EXTENSIONS;
  private static final String[] EMPTY_STRINGS = new String[0];
  
  static
  {
    String[] libExtensions = ManifestElement.getArrayFromList(FrameworkProperties.getProperty("osgi.framework.library.extensions", FrameworkProperties.getProperty("org.osgi.framework.library.extensions", getOSLibraryExtDefaults())), ",");
    for (int i = 0; i < libExtensions.length; i++) {
      if ((libExtensions[i].length() > 0) && (libExtensions[i].charAt(0) != '.')) {
        libExtensions[i] = ('.' + libExtensions[i]);
      }
    }
    LIB_EXTENSIONS = libExtensions;
  }
  
  private static String getOSLibraryExtDefaults()
  {
    String os = FrameworkProperties.getProperty("os.name");
    return (os == null) || (!os.startsWith("Mac OS")) ? null : "dylib,jnilib";
  }
  
  public static String[] mapLibraryNames(String mappedLibName)
  {
    int extIndex = mappedLibName.lastIndexOf('.');
    if ((LIB_EXTENSIONS.length == 0) || (extIndex < 0)) {
      return EMPTY_STRINGS;
    }
    String libNameBase = mappedLibName.substring(0, extIndex);
    String[] results = new String[LIB_EXTENSIONS.length];
    for (int i = 0; i < results.length; i++) {
      results[i] = (libNameBase + LIB_EXTENSIONS[i]);
    }
    return results;
  }
  
  public String findLibrary(BaseData data, String libName)
  {
    String mappedName = System.mapLibraryName(libName);
    String path = null;
    if (Debug.DEBUG_LOADER) {
      Debug.println("  mapped library name: " + mappedName);
    }
    path = findNativePath(data, mappedName);
    if (path == null)
    {
      String[] mappedNames = mapLibraryNames(mappedName);
      for (int i = 0; (i < mappedNames.length) && (path == null); i++) {
        path = findNativePath(data, mappedNames[i]);
      }
    }
    if (path == null)
    {
      if (Debug.DEBUG_LOADER) {
        Debug.println("  library does not exist: " + mappedName);
      }
      path = findNativePath(data, libName);
    }
    if (Debug.DEBUG_LOADER) {
      Debug.println("  returning library: " + path);
    }
    return path;
  }
  
  private String findNativePath(BaseData bundledata, String libname)
  {
    int slash = libname.lastIndexOf('/');
    if (slash >= 0) {
      libname = libname.substring(slash + 1);
    }
    String[] nativepaths = getNativePaths(bundledata);
    if (nativepaths == null) {
      return null;
    }
    for (int i = 0; i < nativepaths.length; i++)
    {
      slash = nativepaths[i].lastIndexOf('/');
      String path = slash < 0 ? nativepaths[i] : nativepaths[i].substring(slash + 1);
      if (path.equals(libname))
      {
        if (nativepaths[i].startsWith("external:"))
        {
          String externalPath = BaseStorageHook.substituteVars(nativepaths[i].substring("external:".length()));
          File nativeFile = new File(externalPath);
          return nativeFile.getAbsolutePath();
        }
        File nativeFile = bundledata.getBundleFile().getFile(nativepaths[i], true);
        if (nativeFile != null) {
          return nativeFile.getAbsolutePath();
        }
      }
    }
    return null;
  }
  
  private String[] getNativePaths(BaseData bundledata)
  {
    BaseStorageHook storageHook = (BaseStorageHook)bundledata.getStorageHook(BaseStorageHook.KEY);
    return storageHook != null ? storageHook.getNativePaths() : null;
  }
  
  public boolean addClassPathEntry(ArrayList<ClasspathEntry> cpEntries, String cp, ClasspathManager hostmanager, BaseData sourcedata, ProtectionDomain sourcedomain)
  {
    return false;
  }
  
  public ClassLoader getBundleClassLoaderParent()
  {
    return null;
  }
  
  public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager)
  {
    return null;
  }
  
  public BaseClassLoader createClassLoader(ClassLoader parent, ClassLoaderDelegate delegate, BundleProtectionDomain domain, BaseData data, String[] bundleclasspath)
  {
    return null;
  }
  
  public void initializedClassLoader(BaseClassLoader baseClassLoader, BaseData data) {}
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.BaseClassLoadingHook
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import org.eclipse.osgi.baseadaptor.HookConfigurator;
import org.eclipse.osgi.baseadaptor.HookRegistry;

public class BaseHookConfigurator
  implements HookConfigurator
{
  public void addHooks(HookRegistry registry)
  {
    BaseStorageHook hook = new BaseStorageHook(new BaseStorage());
    registry.addStorageHook(hook);
    registry.addAdaptorHook(hook);
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87

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