org.eclipse.osgi_3.8.2.v20130124-134944

framework/internal/core/AbstractBundle:completeStateChange	()V
    //   40: return
    // Line number table:
    //   Java source line #561	-> byte code offset #0
    //   Java source line #562	-> byte code offset #8
    //   Java source line #564	-> byte code offset #9
    //   Java source line #566	-> byte code offset #13
    //   Java source line #567	-> byte code offset #18
    //   Java source line #568	-> byte code offset #22
    //   Java source line #569	-> byte code offset #26
    //   Java source line #571	-> byte code offset #30
    //   Java source line #568	-> byte code offset #32
    //   Java source line #569	-> byte code offset #36
    //   Java source line #572	-> byte code offset #40
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	41	0	this	AbstractBundle
    //   0	41	1	lock	boolean
    //   21	10	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   13	21	21	finally
  }
  
  public void update()
    throws BundleException
  {
    update(null);
  }
  
  /* Error */
  public void update(final InputStream in)
    throws BundleException
  {
    // Byte code:
    //   0: getstatic 769	org/eclipse/osgi/framework/debug/Debug:DEBUG_GENERAL	Z
    //   3: ifeq +51 -> 54
    //   6: new 391	java/lang/StringBuffer
    //   9: dup
    //   10: ldc_w 375
    //   13: invokespecial 815	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   16: aload_0
    //   17: getfield 778	org/eclipse/osgi/framework/internal/core/AbstractBundle:bundledata	Lorg/eclipse/osgi/framework/adaptor/BundleData;
    //   20: invokeinterface 923 1 0
    //   25: invokevirtual 820	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   28: invokevirtual 814	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   31: invokestatic 840	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   34: new 391	java/lang/StringBuffer
    //   37: dup
    //   38: ldc_w 355
    //   41: invokespecial 815	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   44: aload_1
    //   45: invokevirtual 819	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   48: invokevirtual 814	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   51: invokestatic 840	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   54: aload_0
    //   55: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   58: aload_0
    //   59: ldc_w 367
    //   62: invokevirtual 897	org/eclipse/osgi/framework/internal/core/Framework:checkAdminPermission	(Lorg/osgi/framework/Bundle;Ljava/lang/String;)V
    //   65: aload_0
    //   66: getfield 778	org/eclipse/osgi/framework/internal/core/AbstractBundle:bundledata	Lorg/eclipse/osgi/framework/adaptor/BundleData;
    //   69: invokeinterface 919 1 0
    //   74: bipush 22
    //   76: iand
    //   77: ifeq +14 -> 91
    //   80: aload_0
    //   81: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   84: aload_0
    //   85: ldc_w 365
    //   88: invokevirtual 897	org/eclipse/osgi/framework/internal/core/Framework:checkAdminPermission	(Lorg/osgi/framework/Bundle;Ljava/lang/String;)V
    //   91: aload_0
    //   92: invokevirtual 846	org/eclipse/osgi/framework/internal/core/AbstractBundle:checkValid	()V
    //   95: aload_0
    //   96: invokevirtual 845	org/eclipse/osgi/framework/internal/core/AbstractBundle:beginStateChange	()V
    //   99: invokestatic 827	java/security/AccessController:getContext	()Ljava/security/AccessControlContext;
    //   102: astore_2
    //   103: aload_0
    //   104: new 418	org/eclipse/osgi/framework/internal/core/AbstractBundle$2
    //   107: dup
    //   108: aload_0
    //   109: aload_1
    //   110: aload_2
    //   111: invokespecial 882	org/eclipse/osgi/framework/internal/core/AbstractBundle$2:<init>	(Lorg/eclipse/osgi/framework/internal/core/AbstractBundle;Ljava/io/InputStream;Ljava/security/AccessControlContext;)V
    //   114: invokevirtual 865	org/eclipse/osgi/framework/internal/core/AbstractBundle:updateWorker	(Ljava/security/PrivilegedExceptionAction;)V
    //   117: goto +10 -> 127
    //   120: astore_3
    //   121: aload_0
    //   122: invokevirtual 848	org/eclipse/osgi/framework/internal/core/AbstractBundle:completeStateChange	()V
    //   125: aload_3
    //   126: athrow
    //   127: aload_0
    //   128: invokevirtual 848	org/eclipse/osgi/framework/internal/core/AbstractBundle:completeStateChange	()V
    //   131: return
    // Line number table:
    //   Java source line #579	-> byte code offset #0
    //   Java source line #580	-> byte code offset #6
    //   Java source line #581	-> byte code offset #34
    //   Java source line #583	-> byte code offset #54
    //   Java source line #584	-> byte code offset #65
    //   Java source line #586	-> byte code offset #80
    //   Java source line #587	-> byte code offset #91
    //   Java source line #588	-> byte code offset #95
    //   Java source line #590	-> byte code offset #99
    //   Java source line #592	-> byte code offset #103
    //   Java source line #613	-> byte code offset #117
    //   Java source line #614	-> byte code offset #121
    //   Java source line #615	-> byte code offset #125
    //   Java source line #614	-> byte code offset #127
    //   Java source line #616	-> byte code offset #131
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	132	0	this	AbstractBundle
    //   0	132	1	in	InputStream
    //   102	9	2	callerContext	AccessControlContext
    //   120	6	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   99	120	120	finally
  }
  
  /* Error */
  protected void updateWorker(PrivilegedExceptionAction<Object> action)
    throws BundleException
  {
    // Byte code:
    //   0: iconst_0
    //   1: istore_2
    //   2: aload_0
    //   3: invokevirtual 850	org/eclipse/osgi/framework/internal/core/AbstractBundle:isFragment	()Z
    //   6: ifne +8 -> 14
    //   9: aload_0
    //   10: getfield 770	org/eclipse/osgi/framework/internal/core/AbstractBundle:state	I
    //   13: istore_2
    //   14: iload_2
    //   15: bipush 40
    //   17: iand
    //   18: ifeq +34 -> 52
    //   21: aload_0
    //   22: iconst_1
    //   23: invokevirtual 857	org/eclipse/osgi/framework/internal/core/AbstractBundle:stopWorker	(I)V
    //   26: goto +26 -> 52
    //   29: astore_3
    //   30: aload_0
    //   31: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   34: iconst_2
    //   35: aload_0
    //   36: aload_3
    //   37: invokevirtual 898	org/eclipse/osgi/framework/internal/core/Framework:publishFrameworkEvent	(ILorg/osgi/framework/Bundle;Ljava/lang/Throwable;)V
    //   40: aload_0
    //   41: getfield 770	org/eclipse/osgi/framework/internal/core/AbstractBundle:state	I
    //   44: bipush 40
    //   46: iand
    //   47: ifeq +5 -> 52
    //   50: aload_3
    //   51: athrow
    //   52: aload_1
    //   53: invokestatic 829	java/security/AccessController:doPrivileged	(Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;
    //   56: pop
    //   57: aload_0
    //   58: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   61: bipush 8
    //   63: aload_0
    //   64: invokevirtual 896	org/eclipse/osgi/framework/internal/core/Framework:publishBundleEvent	(ILorg/osgi/framework/Bundle;)V
    //   67: goto +76 -> 143
    //   70: astore_3
    //   71: aload_3
    //   72: invokevirtual 832	java/security/PrivilegedActionException:getException	()Ljava/lang/Exception;
    //   75: instanceof 387
    //   78: ifeq +11 -> 89
    //   81: aload_3
    //   82: invokevirtual 832	java/security/PrivilegedActionException:getException	()Ljava/lang/Exception;
    //   85: checkcast 387	java/lang/RuntimeException
    //   88: athrow
    //   89: aload_3
    //   90: invokevirtual 832	java/security/PrivilegedActionException:getException	()Ljava/lang/Exception;
    //   93: checkcast 446	org/osgi/framework/BundleException
    //   96: athrow
    //   97: astore 4
    //   99: iload_2
    //   100: bipush 40
    //   102: iand
    //   103: ifeq +37 -> 140
    //   106: aload_0
    //   107: iconst_1
    //   108: iload_2
    //   109: bipush 8
    //   111: iand
    //   112: ifeq +7 -> 119
    //   115: iconst_2
    //   116: goto +4 -> 120
    //   119: iconst_0
    //   120: ior
    //   121: invokevirtual 855	org/eclipse/osgi/framework/internal/core/AbstractBundle:startWorker	(I)V
    //   124: goto +16 -> 140
    //   127: astore 5
    //   129: aload_0
    //   130: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   133: iconst_2
    //   134: aload_0
    //   135: aload 5
    //   137: invokevirtual 898	org/eclipse/osgi/framework/internal/core/Framework:publishFrameworkEvent	(ILorg/osgi/framework/Bundle;Ljava/lang/Throwable;)V
    //   140: aload 4
    //   142: athrow
    //   143: iload_2
    //   144: bipush 40
    //   146: iand
    //   147: ifeq +37 -> 184
    //   150: aload_0
    //   151: iconst_1
    //   152: iload_2
    //   153: bipush 8
    //   155: iand
    //   156: ifeq +7 -> 163
    //   159: iconst_2
    //   160: goto +4 -> 164
    //   163: iconst_0
    //   164: ior
    //   165: invokevirtual 855	org/eclipse/osgi/framework/internal/core/AbstractBundle:startWorker	(I)V
    //   168: goto +16 -> 184
    //   171: astore 5
    //   173: aload_0
    //   174: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   177: iconst_2
    //   178: aload_0
    //   179: aload 5
    //   181: invokevirtual 898	org/eclipse/osgi/framework/internal/core/Framework:publishFrameworkEvent	(ILorg/osgi/framework/Bundle;Ljava/lang/Throwable;)V
    //   184: return
    // Line number table:
    //   Java source line #622	-> byte code offset #0
    //   Java source line #623	-> byte code offset #2
    //   Java source line #624	-> byte code offset #9
    //   Java source line #625	-> byte code offset #14
    //   Java source line #627	-> byte code offset #21
    //   Java source line #628	-> byte code offset #26
    //   Java source line #629	-> byte code offset #30
    //   Java source line #630	-> byte code offset #40
    //   Java source line #631	-> byte code offset #50
    //   Java source line #636	-> byte code offset #52
    //   Java source line #637	-> byte code offset #57
    //   Java source line #638	-> byte code offset #67
    //   Java source line #639	-> byte code offset #71
    //   Java source line #640	-> byte code offset #81
    //   Java source line #641	-> byte code offset #89
    //   Java source line #642	-> byte code offset #97
    //   Java source line #643	-> byte code offset #99
    //   Java source line #645	-> byte code offset #106
    //   Java source line #646	-> byte code offset #124
    //   Java source line #647	-> byte code offset #129
    //   Java source line #650	-> byte code offset #140
    //   Java source line #643	-> byte code offset #143
    //   Java source line #645	-> byte code offset #150
    //   Java source line #646	-> byte code offset #168
    //   Java source line #647	-> byte code offset #173
    //   Java source line #651	-> byte code offset #184
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	185	0	this	AbstractBundle
    //   0	185	1	action	PrivilegedExceptionAction<Object>
    //   1	152	2	previousState	int
    //   29	22	3	e	BundleException
    //   70	20	3	pae	PrivilegedActionException
    //   97	44	4	localObject	Object
    //   127	9	5	e	BundleException
    //   171	9	5	e	BundleException
    // Exception table:
    //   from	to	target	type
    //   21	26	29	org/osgi/framework/BundleException
    //   52	67	70	java/security/PrivilegedActionException
    //   52	97	97	finally
    //   106	124	127	org/osgi/framework/BundleException
    //   150	168	171	org/osgi/framework/BundleException
  }
  
  protected void updateWorkerPrivileged(URLConnection source, AccessControlContext callerContext)
    throws BundleException
  {
    AbstractBundle oldBundle = createBundle(bundledata, framework, false);
    boolean reloaded = false;
    BundleOperation storage = framework.adaptor.updateBundle(bundledata, source);
    BundleRepository bundles = framework.getBundles();
    try
    {
      BundleData newBundleData = storage.begin();
      
      final AbstractBundle newBundle = framework.createAndVerifyBundle(2, this, newBundleData, false);
      
      int st = getState();
      synchronized (bundles)
      {
        String oldBSN = getSymbolicName();
        boolean exporting = reload(newBundle);
        
        bundles.update(oldBSN, this);
        manifestLocalization = null;
      }
      boolean exporting;
      reloaded = true;
      if (System.getSecurityManager() != null)
      {
        final boolean extension = (bundledata.getType() & 0x16) != 0;
        if ((extension) && (!hasPermission(new AllPermission()))) {
          throw new BundleException(Msg.BUNDLE_EXTENSION_PERMISSION, 6, new SecurityException(Msg.BUNDLE_EXTENSION_PERMISSION));
        }
        try
        {
          AccessController.doPrivileged(new PrivilegedExceptionAction()
          {
            public Object run()
              throws Exception
            {
              framework.checkAdminPermission(newBundle, "lifecycle");
              if (extension) {
                framework.checkAdminPermission(newBundle, "extensionLifecycle");
              }
              return null;
            }
          }, callerContext);
        }
        catch (PrivilegedActionException e)
        {
          throw e.getException();
        }
      }
      if (st == 4) {
        framework.publishBundleEvent(64, this);
      }
      storage.commit(exporting);
    }
    catch (Throwable t)
    {
      try
      {
        storage.undo();
        if (reloaded) {
          synchronized (bundles)
          {
            String oldBSN = getSymbolicName();
            reload(oldBundle);
            
            bundles.update(oldBSN, this);
          }
        }
      }
      catch (BundleException ee)
      {
        framework.publishFrameworkEvent(2, this, ee);
        if ((t instanceof SecurityException)) {
          throw ((SecurityException)t);
        }
        if ((t instanceof BundleException)) {
          throw ((BundleException)t);
        }
        throw new BundleException(t.getMessage(), t);
      }
    }
  }
  
  /* Error */
  public void uninstall()
    throws BundleException
  {
    // Byte code:
    //   0: getstatic 769	org/eclipse/osgi/framework/debug/Debug:DEBUG_GENERAL	Z
    //   3: ifeq +31 -> 34
    //   6: new 391	java/lang/StringBuffer
    //   9: dup
    //   10: ldc_w 373
    //   13: invokespecial 815	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   16: aload_0
    //   17: getfield 778	org/eclipse/osgi/framework/internal/core/AbstractBundle:bundledata	Lorg/eclipse/osgi/framework/adaptor/BundleData;
    //   20: invokeinterface 923 1 0
    //   25: invokevirtual 820	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   28: invokevirtual 814	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   31: invokestatic 840	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   34: aload_0
    //   35: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   38: aload_0
    //   39: ldc_w 367
    //   42: invokevirtual 897	org/eclipse/osgi/framework/internal/core/Framework:checkAdminPermission	(Lorg/osgi/framework/Bundle;Ljava/lang/String;)V
    //   45: aload_0
    //   46: getfield 778	org/eclipse/osgi/framework/internal/core/AbstractBundle:bundledata	Lorg/eclipse/osgi/framework/adaptor/BundleData;
    //   49: invokeinterface 919 1 0
    //   54: bipush 22
    //   56: iand
    //   57: ifeq +14 -> 71
    //   60: aload_0
    //   61: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   64: aload_0
    //   65: ldc_w 365
    //   68: invokevirtual 897	org/eclipse/osgi/framework/internal/core/Framework:checkAdminPermission	(Lorg/osgi/framework/Bundle;Ljava/lang/String;)V
    //   71: aload_0
    //   72: invokevirtual 846	org/eclipse/osgi/framework/internal/core/AbstractBundle:checkValid	()V
    //   75: aload_0
    //   76: invokevirtual 845	org/eclipse/osgi/framework/internal/core/AbstractBundle:beginStateChange	()V
    //   79: aload_0
    //   80: new 420	org/eclipse/osgi/framework/internal/core/AbstractBundle$4
    //   83: dup
    //   84: aload_0
    //   85: invokespecial 884	org/eclipse/osgi/framework/internal/core/AbstractBundle$4:<init>	(Lorg/eclipse/osgi/framework/internal/core/AbstractBundle;)V
    //   88: invokevirtual 864	org/eclipse/osgi/framework/internal/core/AbstractBundle:uninstallWorker	(Ljava/security/PrivilegedExceptionAction;)V
    //   91: goto +10 -> 101
    //   94: astore_1
    //   95: aload_0
    //   96: invokevirtual 848	org/eclipse/osgi/framework/internal/core/AbstractBundle:completeStateChange	()V
    //   99: aload_1
    //   100: athrow
    //   101: aload_0
    //   102: invokevirtual 848	org/eclipse/osgi/framework/internal/core/AbstractBundle:completeStateChange	()V
    //   105: return
    // Line number table:
    //   Java source line #774	-> byte code offset #0
    //   Java source line #775	-> byte code offset #6
    //   Java source line #777	-> byte code offset #34
    //   Java source line #778	-> byte code offset #45
    //   Java source line #780	-> byte code offset #60
    //   Java source line #781	-> byte code offset #71
    //   Java source line #782	-> byte code offset #75
    //   Java source line #784	-> byte code offset #79
    //   Java source line #790	-> byte code offset #91
    //   Java source line #791	-> byte code offset #95
    //   Java source line #792	-> byte code offset #99
    //   Java source line #791	-> byte code offset #101
    //   Java source line #793	-> byte code offset #105
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	106	0	this	AbstractBundle
    //   94	6	1	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   79	94	94	finally
  }
  
  protected void uninstallWorker(PrivilegedExceptionAction<Object> action)
    throws BundleException
  {
    boolean bundleActive = false;
    if (!isFragment()) {
      bundleActive = (state & 0x28) != 0;
    }
    if (bundleActive) {
      try
      {
        stopWorker(1);
      }
      catch (BundleException e)
      {
        framework.publishFrameworkEvent(2, this, e);
      }
    }
    try
    {
      AccessController.doPrivileged(action);
    }
    catch (PrivilegedActionException pae)
    {
      if (bundleActive) {
        try
        {
          startWorker(1);
        }
        catch (BundleException e)
        {
          framework.publishFrameworkEvent(2, this, e);
        }
      }
      throw ((BundleException)pae.getException());
    }
    framework.publishBundleEvent(16, this);
  }
  
  /* Error */
  protected void uninstallWorkerPrivileged()
    throws BundleException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   4: getfield 782	org/eclipse/osgi/framework/internal/core/Framework:adaptor	Lorg/eclipse/osgi/framework/adaptor/FrameworkAdaptor;
    //   7: invokeinterface 933 1 0
    //   12: astore_1
    //   13: aload_1
    //   14: ifnull +12 -> 26
    //   17: aload_1
    //   18: aload_0
    //   19: bipush 64
    //   21: invokeinterface 932 3 0
    //   26: iconst_0
    //   27: istore_2
    //   28: aload_0
    //   29: invokevirtual 866	org/eclipse/osgi/framework/internal/core/AbstractBundle:getHeaders	()Ljava/util/Dictionary;
    //   32: pop
    //   33: aload_0
    //   34: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   37: getfield 782	org/eclipse/osgi/framework/internal/core/Framework:adaptor	Lorg/eclipse/osgi/framework/adaptor/FrameworkAdaptor;
    //   40: aload_0
    //   41: getfield 778	org/eclipse/osgi/framework/internal/core/AbstractBundle:bundledata	Lorg/eclipse/osgi/framework/adaptor/BundleData;
    //   44: invokeinterface 935 2 0
    //   49: astore_3
    //   50: aload_0
    //   51: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   54: invokevirtual 894	org/eclipse/osgi/framework/internal/core/Framework:getBundles	()Lorg/eclipse/osgi/framework/internal/core/BundleRepository;
    //   57: astore 4
    //   59: aload_3
    //   60: invokeinterface 931 1 0
    //   65: pop
    //   66: aload_0
    //   67: invokevirtual 843	org/eclipse/osgi/framework/internal/core/AbstractBundle:getState	()I
    //   70: istore 6
    //   72: aload 4
    //   74: dup
    //   75: astore 7
    //   77: monitorenter
    //   78: aload 4
    //   80: aload_0
    //   81: invokevirtual 891	org/eclipse/osgi/framework/internal/core/BundleRepository:remove	(Lorg/eclipse/osgi/framework/internal/core/AbstractBundle;)Z
    //   84: pop
    //   85: aload_0
    //   86: invokevirtual 853	org/eclipse/osgi/framework/internal/core/AbstractBundle:unload	()Z
    //   89: istore 5
    //   91: aload 7
    //   93: monitorexit
    //   94: goto +7 -> 101
    //   97: aload 7
    //   99: monitorexit
    //   100: athrow
    //   101: iload 6
    //   103: iconst_4
    //   104: if_icmpne +13 -> 117
    //   107: aload_0
    //   108: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   111: bipush 64
    //   113: aload_0
    //   114: invokevirtual 896	org/eclipse/osgi/framework/internal/core/Framework:publishBundleEvent	(ILorg/osgi/framework/Bundle;)V
    //   117: iconst_1
    //   118: istore_2
    //   119: aload_3
    //   120: iload 5
    //   122: invokeinterface 930 2 0
    //   127: aload_0
    //   128: invokevirtual 847	org/eclipse/osgi/framework/internal/core/AbstractBundle:close	()V
    //   131: goto +76 -> 207
    //   134: astore 5
    //   136: aload_3
    //   137: invokeinterface 929 1 0
    //   142: iload_2
    //   143: ifeq +42 -> 185
    //   146: aload 4
    //   148: dup
    //   149: astore 6
    //   151: monitorenter
    //   152: aload_0
    //   153: invokevirtual 849	org/eclipse/osgi/framework/internal/core/AbstractBundle:load	()V
    //   156: aload 4
    //   158: aload_0
    //   159: invokevirtual 890	org/eclipse/osgi/framework/internal/core/BundleRepository:add	(Lorg/eclipse/osgi/framework/internal/core/AbstractBundle;)V
    //   162: aload 6
    //   164: monitorexit
    //   165: goto +20 -> 185
    //   168: aload 6
    //   170: monitorexit
    //   171: athrow
    //   172: astore 6
    //   174: aload_0
    //   175: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   178: iconst_2
    //   179: aload_0
    //   180: aload 6
    //   182: invokevirtual 898	org/eclipse/osgi/framework/internal/core/Framework:publishFrameworkEvent	(ILorg/osgi/framework/Bundle;Ljava/lang/Throwable;)V
    //   185: aload 5
    //   187: athrow
    //   188: astore 8
    //   190: aload_1
    //   191: ifnull +13 -> 204
    //   194: aload_1
    //   195: aload_0
    //   196: sipush 128
    //   199: invokeinterface 932 3 0
    //   204: aload 8
    //   206: athrow
    //   207: aload_1
    //   208: ifnull +13 -> 221
    //   211: aload_1
    //   212: aload_0
    //   213: sipush 128
    //   216: invokeinterface 932 3 0
    //   221: return
    // Line number table:
    //   Java source line #832	-> byte code offset #0
    //   Java source line #833	-> byte code offset #13
    //   Java source line #834	-> byte code offset #17
    //   Java source line #835	-> byte code offset #26
    //   Java source line #837	-> byte code offset #28
    //   Java source line #838	-> byte code offset #33
    //   Java source line #839	-> byte code offset #50
    //   Java source line #841	-> byte code offset #59
    //   Java source line #843	-> byte code offset #66
    //   Java source line #844	-> byte code offset #72
    //   Java source line #845	-> byte code offset #78
    //   Java source line #846	-> byte code offset #85
    //   Java source line #844	-> byte code offset #91
    //   Java source line #849	-> byte code offset #101
    //   Java source line #850	-> byte code offset #107
    //   Java source line #851	-> byte code offset #117
    //   Java source line #852	-> byte code offset #119
    //   Java source line #853	-> byte code offset #127
    //   Java source line #854	-> byte code offset #131
    //   Java source line #856	-> byte code offset #136
    //   Java source line #857	-> byte code offset #142
    //   Java source line #858	-> byte code offset #146
    //   Java source line #859	-> byte code offset #152
    //   Java source line #860	-> byte code offset #156
    //   Java source line #858	-> byte code offset #162
    //   Java source line #863	-> byte code offset #172
    //   Java source line #868	-> byte code offset #174
    //   Java source line #870	-> byte code offset #185
    //   Java source line #871	-> byte code offset #188
    //   Java source line #872	-> byte code offset #190
    //   Java source line #873	-> byte code offset #194
    //   Java source line #874	-> byte code offset #204
    //   Java source line #872	-> byte code offset #207
    //   Java source line #873	-> byte code offset #211
    //   Java source line #875	-> byte code offset #221
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	222	0	this	AbstractBundle
    //   12	200	1	bundleStats	org.eclipse.osgi.framework.adaptor.BundleWatcher
    //   27	116	2	unloaded	boolean
    //   49	88	3	storage	BundleOperation
    //   57	100	4	bundles	BundleRepository
    //   89	3	5	exporting	boolean
    //   101	20	5	exporting	boolean
    //   134	52	5	e	BundleException
    //   70	32	6	st	int
    //   149	20	6	Ljava/lang/Object;	Object
    //   172	9	6	ee	BundleException
    //   75	23	7	Ljava/lang/Object;	Object
    //   188	17	8	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   78	94	97	finally
    //   97	100	97	finally
    //   59	131	134	org/osgi/framework/BundleException
    //   152	165	168	finally
    //   168	171	168	finally
    //   136	172	172	org/osgi/framework/BundleException
    //   59	188	188	finally
  }
  
  public Dictionary<String, String> getHeaders()
  {
    return getHeaders(null);
  }
  
  public Dictionary<String, String> getHeaders(String localeString)
  {
    framework.checkAdminPermission(this, "metadata");
    try
    {
      localization = getManifestLocalization();
    }
    catch (BundleException e)
    {
      ManifestLocalization localization;
      framework.publishFrameworkEvent(2, this, e);
      
      return new Hashtable();
    }
    ManifestLocalization localization;
    if (localeString == null) {
      localeString = Locale.getDefault().toString();
    }
    return localization.getHeaders(localeString);
  }
  
  public long getBundleId()
  {
    return bundledata.getBundleID();
  }
  
  public String getLocation()
  {
    framework.checkAdminPermission(this, "metadata");
    return bundledata.getLocation();
  }
  
  public boolean hasPermission(Object permission)
  {
    checkValid();
    if (domain != null)
    {
      if ((permission instanceof Permission))
      {
        SecurityManager sm = System.getSecurityManager();
        if ((sm instanceof EquinoxSecurityManager))
        {
          AccessControlContext acc = getAccessControlContext();
          try
          {
            sm.checkPermission((Permission)permission, acc);
            return true;
          }
          catch (Exception localException)
          {
            return false;
          }
        }
        return domain.implies((Permission)permission);
      }
      return false;
    }
    return true;
  }
  
  protected void beginStateChange()
    throws BundleException
  {
    synchronized (statechangeLock)
    {
      boolean doubleFault = false;
      if (stateChanging == null)
      {
        stateChanging = Thread.currentThread();
        return;
      }
      if ((doubleFault) || (stateChanging == Thread.currentThread())) {
        throw new BundleException(NLS.bind(Msg.BUNDLE_STATE_CHANGE_EXCEPTION, getBundleData().getLocation(), stateChanging.getName()), 7, new BundleStatusException(null, 4, stateChanging));
      }
      try
      {
        long start = 0L;
        if (Debug.DEBUG_GENERAL)
        {
          Debug.println(" Waiting for state to change in bundle " + this);
          start = System.currentTimeMillis();
        }
        statechangeLock.wait(STATE_CHANGE_TIMEOUT);
        if (Debug.DEBUG_GENERAL)
        {
          long end = System.currentTimeMillis();
          if (end - start > 0L) {
            System.out.println("Waiting... : " + getSymbolicName() + ' ' + (end - start));
          }
        }
      }
      catch (InterruptedException localInterruptedException) {}
      doubleFault = true;
    }
  }
  
  protected void completeStateChange()
  {
    synchronized (statechangeLock)
    {
      if (stateChanging == Thread.currentThread())
      {
        stateChanging = null;
        statechangeLock.notify();
      }
    }
  }
  
  public String toString()
  {
    String name = bundledata.getSymbolicName();
    if (name == null) {
      name = "unknown";
    }
    return name + '_' + bundledata.getVersion() + " [" + getBundleId() + "]";
  }
  
  public int compareTo(Bundle obj)
  {
    int slcomp = getInternalStartLevel() - ((AbstractBundle)obj).getInternalStartLevel();
    if (slcomp != 0) {
      return slcomp;
    }
    long idcomp = getBundleId() - ((AbstractBundle)obj).getBundleId();
    return idcomp > 0L ? 1 : idcomp < 0L ? -1 : 0;
  }
  
  protected void checkValid()
  {
    if (state == 1) {
      throw new IllegalStateException(NLS.bind(Msg.BUNDLE_UNINSTALLED_EXCEPTION, getBundleData().getLocation()));
    }
  }
  
  public BundleProtectionDomain getProtectionDomain()
  {
    return domain;
  }
  
  private AccessControlContext getAccessControlContext()
  {
    return new AccessControlContext(new ProtectionDomain[] { domain });
  }
  
  protected BundleFragment[] getFragments()
  {
    checkValid();
    return null;
  }
  
  protected boolean isFragment()
  {
    return false;
  }
  
  BundleHost[] getHosts()
  {
    checkValid();
    return null;
  }
  
  public Class<?> loadClass(String classname)
    throws ClassNotFoundException
  {
    return loadClass(classname, true);
  }
  
  public Enumeration<String> getEntryPaths(final String path)
  {
    try
    {
      framework.checkAdminPermission(this, "resource");
    }
    catch (SecurityException localSecurityException)
    {
      return null;
    }
    checkValid();
    
    (Enumeration)AccessController.doPrivileged(new PrivilegedAction()
    {
      public Enumeration<String> run()
      {
        return bundledata.getEntryPaths(path);
      }
    });
  }
  
  public URL getEntry(String fileName)
  {
    try
    {
      framework.checkAdminPermission(this, "resource");
    }
    catch (SecurityException localSecurityException)
    {
      return null;
    }
    return getEntry0(fileName);
  }
  
  URL getEntry0(String fileName)
  {
    checkValid();
    return bundledata.getEntry(fileName);
  }
  
  public String getSymbolicName()
  {
    return bundledata.getSymbolicName();
  }
  
  public long getLastModified()
  {
    return bundledata.getLastModified();
  }
  
  public BundleData getBundleData()
  {
    return bundledata;
  }
  
  public Version getVersion()
  {
    return bundledata.getVersion();
  }
  
  public BundleDescription getBundleDescription()
  {
    return framework.adaptor.getState().getBundle(getBundleId());
  }
  
  int getInternalStartLevel()
  {
    return bundledata.getStartLevel();
  }
  
  protected abstract BundleLoader getBundleLoader();
  
  protected void resolve()
  {
    if ((Debug.DEBUG_GENERAL) && 
      ((state & 0x2) == 0))
    {
      Debug.println("Bundle.resolve called when state != INSTALLED: " + this);
      Debug.printStackTrace(new Exception("Stack trace"));
    }
    if (state == 2) {
      state = 4;
    }
  }
  
  public BundleContext getBundleContext()
  {
    framework.checkAdminPermission(this, "context");
    return getContext();
  }
  
  protected abstract BundleContextImpl getContext();
  
  public BundleException getResolutionFailureException()
  {
    BundleDescription bundleDescription = getBundleDescription();
    if (bundleDescription == null) {
      return new BundleException(NLS.bind(Msg.BUNDLE_UNRESOLVED_EXCEPTION, toString()), 4);
    }
    if (bundleDescription.isResolved()) {
      return new BundleException(Msg.BUNDLE_UNRESOLVED_STATE_CONFLICT, 4);
    }
    return getResolverError(bundleDescription);
  }
  
  private BundleException getResolverError(BundleDescription bundleDesc)
  {
    ResolverError[] errors = framework.adaptor.getState().getResolverErrors(bundleDesc);
    if ((errors == null) || (errors.length == 0)) {
      return new BundleException(NLS.bind(Msg.BUNDLE_UNRESOLVED_EXCEPTION, toString()), 4);
    }
    StringBuffer message = new StringBuffer();
    int errorType = 4;
    for (int i = 0; i < errors.length; i++)
    {
      if ((errors[i].getType() & 0x20000) != 0) {
        errorType = 8;
      }
      message.append(errors[i].toString());
      if (i < errors.length - 1) {
        message.append(", ");
      }
    }
    return new BundleException(NLS.bind(Msg.BUNDLE_UNRESOLVED_UNSATISFIED_CONSTRAINT_EXCEPTION, toString(), message.toString()), errorType);
  }
  
  public int getKeyHashCode()
  {
    long id = getBundleId();
    return (int)(id ^ id >>> 32);
  }
  
  public boolean compare(KeyedElement other)
  {
    return getBundleId() == ((AbstractBundle)other).getBundleId();
  }
  
  public Object getKey()
  {
    return new Long(getBundleId());
  }
  
  public ResourceBundle getResourceBundle(String localeString)
  {
    try
    {
      localization = getManifestLocalization();
    }
    catch (BundleException localBundleException)
    {
      ManifestLocalization localization;
      return null;
    }
    ManifestLocalization localization;
    String defaultLocale = Locale.getDefault().toString();
    if (localeString == null) {
      localeString = defaultLocale;
    }
    return localization.getResourceBundle(localeString, defaultLocale.equals(localeString));
  }
  
  private synchronized ManifestLocalization getManifestLocalization()
    throws BundleException
  {
    ManifestLocalization currentLocalization = manifestLocalization;
    if (currentLocalization == null)
    {
      Dictionary<String, String> rawHeaders = bundledata.getManifest();
      manifestLocalization = (currentLocalization = new ManifestLocalization(this, rawHeaders));
    }
    return currentLocalization;
  }
  
  public boolean testStateChanging(Object thread)
  {
    return stateChanging == thread;
  }
  
  public Thread getStateChanging()
  {
    return stateChanging;
  }
  
  public Enumeration<URL> findEntries(String path, String filePattern, boolean recurse)
  {
    try
    {
      framework.checkAdminPermission(this, "resource");
    }
    catch (SecurityException localSecurityException)
    {
      return null;
    }
    checkValid();
    if (!isResolved()) {
      framework.packageAdmin.resolveBundles(new Bundle[] { this });
    }
    BundleFragment[] fragments = getFragments();
    List<BundleData> datas = new ArrayList((fragments == null ? 0 : fragments.length) + 1);
    datas.add(getBundleData());
    if (fragments != null)
    {
      BundleFragment[] arrayOfBundleFragment1;
      int j = (arrayOfBundleFragment1 = fragments).length;
      for (int i = 0; i < j; i++)
      {
        BundleFragment fragment = arrayOfBundleFragment1[i];
        datas.add(fragment.getBundleData());
      }
    }
    int options = recurse ? 1 : 0;
    return framework.getAdaptor().findEntries(datas, path, filePattern, options);
  }
  
  class BundleStatusException
    extends Throwable
    implements StatusException
  {
    private static final long serialVersionUID = 7201911791818929100L;
    private int code;
    private transient Object status;
    
    BundleStatusException(String message, int code, Object status)
    {
      super();
      this.code = code;
      this.status = status;
    }
    
    public Object getStatus()
    {
      return status;
    }
    
    public int getStatusCode()
    {
      return code;
    }
  }
  
  public Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int signersType)
  {
    Map<X509Certificate, List<X509Certificate>> empty = Collections.EMPTY_MAP;
    if ((signersType != 1) && (signersType != 2)) {
      throw new IllegalArgumentException("Invalid signers type: " + signersType);
    }
    if (framework == null) {
      return empty;
    }
    SignedContentFactory factory = framework.getSignedContentFactory();
    if (factory == null) {
      return empty;
    }
    try
    {
      SignedContent signedContent = factory.getSignedContent(this);
      SignerInfo[] infos = signedContent.getSignerInfos();
      if (infos.length == 0) {
        return empty;
      }
      Map<X509Certificate, List<X509Certificate>> results = new HashMap(infos.length);
      for (int i = 0; i < infos.length; i++) {
        if ((signersType != 2) || (infos[i].isTrusted()))
        {
          Certificate[] certs = infos[i].getCertificateChain();
          if ((certs != null) && (certs.length != 0))
          {
            List<X509Certificate> certChain = new ArrayList();
            for (int j = 0; j < certs.length; j++) {
              certChain.add((X509Certificate)certs[j]);
            }
            results.put((X509Certificate)certs[0], certChain);
          }
        }
      }
      return results;
    }
    catch (Exception localException) {}
    return empty;
  }
  
  public final <A> A adapt(Class<A> adapterType)
  {
    checkAdaptPermission(adapterType);
    return (A)adapt0(adapterType);
  }
  
  public List<BundleRevision> getRevisions()
  {
    List<BundleRevision> revisions = new ArrayList();
    BundleDescription current = getBundleDescription();
    if (current != null) {
      revisions.add(current);
    }
    BundleDescription[] removals = framework.adaptor.getState().getRemovalPending();
    BundleDescription[] arrayOfBundleDescription1;
    int j = (arrayOfBundleDescription1 = removals).length;
    for (int i = 0; i < j; i++)
    {
      BundleDescription removed = arrayOfBundleDescription1[i];
      if ((removed.getBundleId() == getBundleId()) && (removed != current)) {
        revisions.add(removed);
      }
    }
    return revisions;
  }
  
  protected <A> A adapt0(Class<A> adapterType)
  {
    if (adapterType.isInstance(this)) {
      return this;
    }
    if (BundleContext.class.equals(adapterType)) {
      try
      {
        return getBundleContext();
      }
      catch (SecurityException localSecurityException)
      {
        return null;
      }
    }
    if (AccessControlContext.class.equals(ad
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