org.eclipse.osgi_3.8.2.v20130124-134944

l 245	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:getClasses	()[Ljava/lang/String;
    //   458: astore_2
    //   459: aload_2
    //   460: aload_1
    //   461: invokestatic 247	org/eclipse/osgi/internal/serviceregistry/ServiceRegistry:checkServiceClass	([Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   464: astore_3
    //   465: aload_3
    //   466: ifnull +77 -> 543
    //   469: getstatic 210	org/eclipse/osgi/framework/debug/Debug:DEBUG_SERVICES	Z
    //   472: ifeq +22 -> 494
    //   475: new 111	java/lang/StringBuffer
    //   478: dup
    //   479: ldc 8
    //   481: invokespecial 232	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   484: aload_3
    //   485: invokevirtual 234	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   488: invokevirtual 231	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   491: invokestatic 238	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   494: new 127	org/osgi/framework/ServiceException
    //   497: dup
    //   498: getstatic 212	org/eclipse/osgi/framework/internal/core/Msg:SERVICE_FACTORY_NOT_INSTANCEOF_CLASS_EXCEPTION	Ljava/lang/String;
    //   501: aload_0
    //   502: getfield 222	org/eclipse/osgi/internal/serviceregistry/ServiceUse:factory	Lorg/osgi/framework/ServiceFactory;
    //   505: invokevirtual 229	java/lang/Object:getClass	()Ljava/lang/Class;
    //   508: invokevirtual 225	java/lang/Class:getName	()Ljava/lang/String;
    //   511: aload_3
    //   512: invokestatic 252	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
    //   515: iconst_2
    //   516: invokespecial 254	org/osgi/framework/ServiceException:<init>	(Ljava/lang/String;I)V
    //   519: astore 4
    //   521: aload_0
    //   522: getfield 220	org/eclipse/osgi/internal/serviceregistry/ServiceUse:context	Lorg/eclipse/osgi/framework/internal/core/BundleContextImpl;
    //   525: invokevirtual 241	org/eclipse/osgi/framework/internal/core/BundleContextImpl:getFramework	()Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   528: iconst_2
    //   529: aload_0
    //   530: getfield 221	org/eclipse/osgi/internal/serviceregistry/ServiceUse:registration	Lorg/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl;
    //   533: invokevirtual 246	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:getBundle	()Lorg/osgi/framework/Bundle;
    //   536: aload 4
    //   538: invokevirtual 243	org/eclipse/osgi/framework/internal/core/Framework:publishFrameworkEvent	(ILorg/osgi/framework/Bundle;Ljava/lang/Throwable;)V
    //   541: aconst_null
    //   542: areturn
    //   543: aload_0
    //   544: aload_1
    //   545: putfield 219	org/eclipse/osgi/internal/serviceregistry/ServiceUse:cachedService	Ljava/lang/Object;
    //   548: aload_0
    //   549: dup
    //   550: getfield 216	org/eclipse/osgi/internal/serviceregistry/ServiceUse:useCount	I
    //   553: iconst_1
    //   554: iadd
    //   555: putfield 216	org/eclipse/osgi/internal/serviceregistry/ServiceUse:useCount	I
    //   558: aload_1
    //   559: areturn
    // Line number table:
    //   Java source line #114	-> byte code offset #0
    //   Java source line #115	-> byte code offset #21
    //   Java source line #116	-> byte code offset #35
    //   Java source line #117	-> byte code offset #44
    //   Java source line #119	-> byte code offset #55
    //   Java source line #120	-> byte code offset #65
    //   Java source line #123	-> byte code offset #70
    //   Java source line #124	-> byte code offset #76
    //   Java source line #127	-> byte code offset #133
    //   Java source line #128	-> byte code offset #140
    //   Java source line #129	-> byte code offset #146
    //   Java source line #132	-> byte code offset #171
    //   Java source line #133	-> byte code offset #199
    //   Java source line #134	-> byte code offset #219
    //   Java source line #136	-> byte code offset #221
    //   Java source line #139	-> byte code offset #226
    //   Java source line #144	-> byte code offset #238
    //   Java source line #145	-> byte code offset #242
    //   Java source line #146	-> byte code offset #248
    //   Java source line #147	-> byte code offset #280
    //   Java source line #150	-> byte code offset #284
    //   Java source line #151	-> byte code offset #300
    //   Java source line #152	-> byte code offset #328
    //   Java source line #155	-> byte code offset #347
    //   Java source line #153	-> byte code offset #352
    //   Java source line #154	-> byte code offset #354
    //   Java source line #155	-> byte code offset #356
    //   Java source line #156	-> byte code offset #361
    //   Java source line #155	-> byte code offset #364
    //   Java source line #158	-> byte code offset #369
    //   Java source line #159	-> byte code offset #373
    //   Java source line #160	-> byte code offset #379
    //   Java source line #163	-> byte code offset #404
    //   Java source line #164	-> byte code offset #429
    //   Java source line #165	-> byte code offset #449
    //   Java source line #168	-> byte code offset #451
    //   Java source line #169	-> byte code offset #459
    //   Java source line #170	-> byte code offset #465
    //   Java source line #171	-> byte code offset #469
    //   Java source line #172	-> byte code offset #475
    //   Java source line #174	-> byte code offset #494
    //   Java source line #175	-> byte code offset #521
    //   Java source line #176	-> byte code offset #541
    //   Java source line #179	-> byte code offset #543
    //   Java source line #180	-> byte code offset #548
    //   Java source line #182	-> byte code offset #558
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	560	0	this	ServiceUse<S>
    //   198	18	1	se	ServiceException
    //   237	2	1	service	S
    //   364	195	1	service	S
    //   241	83	2	t	Throwable
    //   428	18	2	se	ServiceException
    //   458	2	2	clazzes	String[]
    //   327	17	3	se	ServiceException
    //   464	48	3	invalidService	String
    //   354	8	4	localObject	Object
    //   519	18	4	se	ServiceException
    // Exception table:
    //   from	to	target	type
    //   226	238	241	java/lang/Throwable
    //   226	347	354	finally
  }
  
  boolean ungetService()
  {
    assert (Thread.holdsLock(this));
    if (useCount == 0) {
      return true;
    }
    useCount -= 1;
    if (useCount > 0) {
      return false;
    }
    if (factory == null) {
      return true;
    }
    final S service = cachedService;
    cachedService = null;
    if (Debug.DEBUG_SERVICES) {
      Debug.println("ungetService[factory=" + registration.getBundle() + "](" + context.getBundleImpl() + "," + registration + ")");
    }
    try
    {
      AccessController.doPrivileged(new PrivilegedAction()
      {
        public S run()
        {
          factory.ungetService(context.getBundleImpl(), registration, service);
          return null;
        }
      });
    }
    catch (Throwable t)
    {
      if (Debug.DEBUG_GENERAL)
      {
        Debug.println(factory + ".ungetService() exception");
        Debug.printStackTrace(t);
      }
      ServiceException se = new ServiceException(NLS.bind(Msg.SERVICE_FACTORY_EXCEPTION, factory.getClass().getName(), "ungetService"), 3, t);
      context.getFramework().publishFrameworkEvent(2, registration.getBundle(), se);
    }
    return true;
  }
  
  void releaseService()
  {
    assert (Thread.holdsLock(this));
    if ((useCount == 0) || (factory == null)) {
      return;
    }
    final S service = cachedService;
    cachedService = null;
    useCount = 0;
    if (Debug.DEBUG_SERVICES) {
      Debug.println("releaseService[factory=" + registration.getBundle() + "](" + context.getBundleImpl() + "," + registration + ")");
    }
    try
    {
      AccessController.doPrivileged(new PrivilegedAction()
      {
        public S run()
        {
          factory.ungetService(context.getBundleImpl(), registration, service);
          return null;
        }
      });
    }
    catch (Throwable t)
    {
      if (Debug.DEBUG_SERVICES)
      {
        Debug.println(factory + ".ungetService() exception");
        Debug.printStackTrace(t);
      }
      ServiceException se = new ServiceException(NLS.bind(Msg.SERVICE_FACTORY_EXCEPTION, factory.getClass().getName(), "ungetService"), 3, t);
      context.getFramework().publishFrameworkEvent(2, registration.getBundle(), se);
    }
  }
}

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

import java.util.Collection;
import java.util.Iterator;
import java.util.List;

class ShrinkableCollection$1
  implements Iterator<E>
{
  private E last;
  final ShrinkableCollection this$0;
  
  ShrinkableCollection$1(ShrinkableCollection paramShrinkableCollection, Iterator paramIterator, List paramList) {}
  
  public boolean hasNext()
  {
    return val$iter.hasNext();
  }
  
  public E next()
  {
    last = val$iter.next();
    return (E)last;
  }
  
  public void remove()
  {
    val$iter.remove();
    for (Iterator localIterator = val$collections.iterator(); localIterator.hasNext();)
    {
      Collection<? extends E> c = (Collection)localIterator.next();
      c.remove(last);
    }
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

public class ShrinkableCollection<E>
  implements Collection<E>
{
  private final Collection<? extends E> collection;
  private final List<Collection<? extends E>> list;
  
  static
  {
    try {}catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
    }
  }
  
  public ShrinkableCollection(Collection<? extends E> c)
  {
    if (c == null) {
      throw new NullPointerException();
    }
    List<Collection<? extends E>> empty = Collections.EMPTY_LIST;
    list = empty;
    collection = c;
  }
  
  public ShrinkableCollection(Collection<? extends E> c1, Collection<? extends E> c2)
  {
    list = new ArrayList(2);
    list.add(c1);
    list.add(c2);
    collection = initComposite(list);
  }
  
  public ShrinkableCollection(List<Collection<? extends E>> l)
  {
    list = new ArrayList(l);
    collection = initComposite(list);
  }
  
  private static <E> Collection<? extends E> initComposite(List<Collection<? extends E>> collections)
  {
    int size = 0;
    for (Iterator localIterator1 = collections.iterator(); localIterator1.hasNext();)
    {
      Collection<? extends E> c = (Collection)localIterator1.next();
      assert (verifyNoDuplicates(c));
      size += c.size();
    }
    Collection<E> result = new ArrayList(size);
    Iterator localIterator3;
    for (Iterator localIterator2 = collections.iterator(); localIterator2.hasNext(); localIterator3.hasNext())
    {
      Object c = (Collection)localIterator2.next();
      localIterator3 = ((Collection)c).iterator(); continue;E e = (Object)localIterator3.next();
      if (!result.contains(e)) {
        result.add(e);
      }
    }
    return result;
  }
  
  private static <E> boolean verifyNoDuplicates(Collection<? extends E> c)
  {
    for (Iterator localIterator1 = c.iterator(); localIterator1.hasNext();)
    {
      E e = (Object)localIterator1.next();
      int count = 0;
      for (Iterator localIterator2 = c.iterator(); localIterator2.hasNext();)
      {
        E f = (Object)localIterator2.next();
        if (e == null)
        {
          if (f == null) {
            count++;
          }
        }
        else if (e.equals(f)) {
          count++;
        }
      }
      if (count != 1) {
        return false;
      }
    }
    return true;
  }
  
  public boolean add(E e)
  {
    throw new UnsupportedOperationException();
  }
  
  public boolean addAll(Collection<? extends E> c)
  {
    throw new UnsupportedOperationException();
  }
  
  public void clear()
  {
    collection.clear();
    for (Iterator localIterator = list.iterator(); localIterator.hasNext();)
    {
      Collection<? extends E> c = (Collection)localIterator.next();
      c.clear();
    }
  }
  
  public boolean contains(Object o)
  {
    return collection.contains(o);
  }
  
  public boolean containsAll(Collection<?> c)
  {
    return collection.containsAll(c);
  }
  
  public boolean isEmpty()
  {
    return collection.isEmpty();
  }
  
  public Iterator<E> iterator()
  {
    final Iterator<E> iter = collection.iterator();
    final List<Collection<? extends E>> collections = list;
    if (collections.isEmpty()) {
      return iter;
    }
    new Iterator()
    {
      private E last;
      
      public boolean hasNext()
      {
        return iter.hasNext();
      }
      
      public E next()
      {
        last = iter.next();
        return (E)last;
      }
      
      public void remove()
      {
        iter.remove();
        for (Iterator localIterator = collections.iterator(); localIterator.hasNext();)
        {
          Collection<? extends E> c = (Collection)localIterator.next();
          c.remove(last);
        }
      }
    };
  }
  
  public boolean remove(Object o)
  {
    boolean result = collection.remove(o);
    if (result) {
      for (Iterator localIterator = list.iterator(); localIterator.hasNext();)
      {
        Collection<? extends E> c = (Collection)localIterator.next();
        c.remove(o);
      }
    }
    return result;
  }
  
  public boolean removeAll(Collection<?> c)
  {
    boolean result = collection.removeAll(c);
    if (result) {
      for (Iterator localIterator = list.iterator(); localIterator.hasNext();)
      {
        Collection<? extends E> cc = (Collection)localIterator.next();
        cc.removeAll(c);
      }
    }
    return result;
  }
  
  public boolean retainAll(Collection<?> c)
  {
    boolean result = collection.retainAll(c);
    if (result) {
      for (Iterator localIterator = list.iterator(); localIterator.hasNext();)
      {
        Collection<? extends E> cc = (Collection)localIterator.next();
        cc.retainAll(c);
      }
    }
    return result;
  }
  
  public int size()
  {
    return collection.size();
  }
  
  public Object[] toArray()
  {
    return collection.toArray();
  }
  
  public <T> T[] toArray(T[] var0)
  {
    return collection.toArray(var0);
  }
  
  public String toString()
  {
    return collection.toString();
  }
}

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

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

final class ShrinkableEntrySetValueCollection$ValueIterator<E>
  implements Iterator<E>
{
  private final Iterator<? extends Map.Entry<?, ? extends E>> iter;
  
  ShrinkableEntrySetValueCollection$ValueIterator(Iterator<? extends Map.Entry<?, ? extends E>> i)
  {
    iter = i;
  }
  
  public boolean hasNext()
  {
    return iter.hasNext();
  }
  
  public E next()
  {
    Map.Entry<?, ? extends E> entry = (Map.Entry)iter.next();
    return (E)entry.getValue();
  }
  
  public void remove()
  {
    iter.remove();
  }
}

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

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

public class ShrinkableEntrySetValueCollection<E>
  extends AbstractCollection<E>
  implements Collection<E>
{
  private final Set<? extends Map.Entry<?, ? extends E>> entrySet;
  
  public ShrinkableEntrySetValueCollection(Set<? extends Map.Entry<?, ? extends E>> e)
  {
    if (e == null) {
      throw new NullPointerException();
    }
    entrySet = e;
  }
  
  public void clear()
  {
    entrySet.clear();
  }
  
  public boolean isEmpty()
  {
    return entrySet.isEmpty();
  }
  
  public Iterator<E> iterator()
  {
    return new ValueIterator(entrySet.iterator());
  }
  
  public int size()
  {
    return entrySet.size();
  }
  
  private static final class ValueIterator<E>
    implements Iterator<E>
  {
    private final Iterator<? extends Map.Entry<?, ? extends E>> iter;
    
    ValueIterator(Iterator<? extends Map.Entry<?, ? extends E>> i)
    {
      iter = i;
    }
    
    public boolean hasNext()
    {
      return iter.hasNext();
    }
    
    public E next()
    {
      Map.Entry<?, ? extends E> entry = (Map.Entry)iter.next();
      return (E)entry.getValue();
    }
    
    public void remove()
    {
      iter.remove();
    }
  }
}

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

import java.util.Collection;
import java.util.Map.Entry;

final class ShrinkableValueCollectionMap$Entry
  implements Map.Entry<K, Collection<V>>
{
  private final K key;
  private Collection<V> value;
  final ShrinkableValueCollectionMap this$0;
  
  ShrinkableValueCollectionMap$Entry(K arg1)
  {
    key = k;
  }
  
  public K getKey()
  {
    return (K)key;
  }
  
  public Collection<V> getValue()
  {
    if (value == null) {
      value = this$0.get(key);
    }
    return value;
  }
  
  public Collection<V> setValue(Collection<V> value)
  {
    throw new UnsupportedOperationException();
  }
  
  public String toString()
  {
    return getKey() + "=" + getValue();
  }
  
  public int hashCode()
  {
    return ShrinkableValueCollectionMap.hash(getKey()) ^ ShrinkableValueCollectionMap.hash(getValue());
  }
  
  public boolean equals(Object obj)
  {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof Map.Entry)) {
      return false;
    }
    Map.Entry<?, ?> other = (Map.Entry)obj;
    return (ShrinkableValueCollectionMap.equality(getKey(), other.getKey())) && (ShrinkableValueCollectionMap.equality(getValue(), other.getValue()));
  }
}

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

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

final class ShrinkableValueCollectionMap$EntryIterator
  implements Iterator<Map.Entry<K, Collection<V>>>
{
  private final Iterator<? extends K> iter;
  private K last;
  final ShrinkableValueCollectionMap this$0;
  
  ShrinkableValueCollectionMap$EntryIterator(ShrinkableValueCollectionMap paramShrinkableValueCollectionMap)
  {
    iter = map.keySet().iterator();
  }
  
  public boolean hasNext()
  {
    return iter.hasNext();
  }
  
  public Map.Entry<K, Collection<V>> next()
  {
    last = iter.next();
    return new ShrinkableValueCollectionMap.Entry(this$0, last);
  }
  
  public void remove()
  {
    iter.remove();
    if (this$0.values != null) {
      this$0.values.remove(last);
    }
  }
}

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

import java.util.AbstractSet;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map.Entry;

final class ShrinkableValueCollectionMap$EntrySet
  extends AbstractSet<Map.Entry<K, Collection<V>>>
{
  final ShrinkableValueCollectionMap this$0;
  
  ShrinkableValueCollectionMap$EntrySet(ShrinkableValueCollectionMap paramShrinkableValueCollectionMap) {}
  
  public Iterator<Map.Entry<K, Collection<V>>> iterator()
  {
    return new ShrinkableValueCollectionMap.EntryIterator(this$0);
  }
  
  public int size()
  {
    return this$0.size();
  }
}

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

import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class ShrinkableValueCollectionMap<K, V>
  extends AbstractMap<K, Collection<V>>
  implements Map<K, Collection<V>>
{
  final Map<? extends K, ? extends Set<? extends Map.Entry<?, ? extends V>>> map;
  Map<Object, Collection<V>> values;
  
  public ShrinkableValueCollectionMap(Map<? extends K, ? extends Set<? extends Map.Entry<?, ? extends V>>> m)
  {
    if (m == null) {
      throw new NullPointerException();
    }
    map = m;
    values = null;
  }
  
  public void clear()
  {
    map.clear();
    if (values != null) {
      values.clear();
    }
  }
  
  public boolean containsKey(Object key)
  {
    return map.containsKey(key);
  }
  
  public boolean containsValue(Object value)
  {
    if (values == null) {
      return false;
    }
    return values.containsValue(value);
  }
  
  public Set<Map.Entry<K, Collection<V>>> entrySet()
  {
    return new EntrySet();
  }
  
  public Collection<V> get(Object key)
  {
    Collection<V> value = null;
    if (values != null) {
      value = (Collection)values.get(key);
    }
    if (value == null)
    {
      Set<? extends Map.Entry<?, ? extends V>> entrySet = (Set)map.get(key);
      if (entrySet == null) {
        return null;
      }
      value = new ShrinkableEntrySetValueCollection(entrySet);
      if (values == null) {
        values = new HashMap(map.size());
      }
      values.put(key, value);
    }
    return value;
  }
  
  public boolean isEmpty()
  {
    return map.isEmpty();
  }
  
  public Collection<V> remove(Object key)
  {
    Set<? extends Map.Entry<?, ? extends V>> entrySet = (Set)map.remove(key);
    Collection<V> value = null;
    if (values != null) {
      value = (Collection)values.remove(key);
    }
    if ((value == null) && (entrySet != null)) {
      value = new ShrinkableEntrySetValueCollection(entrySet);
    }
    return value;
  }
  
  public int size()
  {
    return map.size();
  }
  
  private final class EntrySet
    extends AbstractSet<Map.Entry<K, Collection<V>>>
  {
    EntrySet() {}
    
    public Iterator<Map.Entry<K, Collection<V>>> iterator()
    {
      return new ShrinkableValueCollectionMap.EntryIterator(ShrinkableValueCollectionMap.this);
    }
    
    public int size()
    {
      return ShrinkableValueCollectionMap.this.size();
    }
  }
  
  private final class EntryIterator
    implements Iterator<Map.Entry<K, Collection<V>>>
  {
    private final Iterator<? extends K> iter;
    private K last;
    
    EntryIterator()
    {
      iter = map.keySet().iterator();
    }
    
    public boolean hasNext()
    {
      return iter.hasNext();
    }
    
    public Map.Entry<K, Collection<V>> next()
    {
      last = iter.next();
      return new ShrinkableValueCollectionMap.Entry(ShrinkableValueCollectionMap.this, last);
    }
    
    public void remove()
    {
      iter.remove();
      if (values != null) {
        values.remove(last);
      }
    }
  }
  
  private final class Entry
    implements Map.Entry<K, Collection<V>>
  {
    private final K key;
    private Collection<V> value;
    
    Entry()
    {
      key = k;
    }
    
    public K getKey()
    {
      return (K)key;
    }
    
    public Collection<V> getValue()
    {
      if (value == null) {
        value = get(key);
      }
      return value;
    }
    
    public Collection<V> setValue(Collection<V> value)
    {
      throw new UnsupportedOperationException();
    }
    
    public String toString()
    {
      return getKey() + "=" + getValue();
    }
    
    public int hashCode()
    {
      return ShrinkableValueCollectionMap.hash(getKey()) ^ ShrinkableValueCollectionMap.hash(getValue());
    }
    
    public boolean equals(Object obj)
    {
      if (obj == this) {
        return true;
      }
      if (!(obj instanceof Map.Entry)) {
        return false;
      }
      Map.Entry<?, ?> other = (Map.Entry)obj;
      return (ShrinkableValueCollectionMap.equality(getKey(), other.getKey())) && (ShrinkableValueCollectionMap.equality(getValue(), other.getValue()));
    }
  }
  
  static int hash(Object one)
  {
    return one == null ? 0 : one.hashCode();
  }
  
  static boolean equality(Object one, Object two)
  {
    return one == null ? false : two == null ? true : one.equals(two);
  }
}

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

import java.math.BigInteger;
import java.security.SignatureException;

public class BERProcessor
{
  byte[] buffer;
  int offset;
  int lastOffset;
  int contentOffset;
  int contentLength;
  int endOffset;
  int classOfTag;
  static final int UNIVERSAL_TAGCLASS = 0;
  static final int APPLICATION_TAGCLASS = 1;
  static final int CONTEXTSPECIFIC_TAGCLASS = 2;
  static final int PRIVATE_TAGCLASS = 3;
  static final byte BOOLTAG = 1;
  static final byte INTTAG = 2;
  static final byte OIDTAG = 6;
  static final byte SEQTAG = 16;
  static final byte SETTAG = 17;
  static final byte NULLTAG = 5;
  static final String[] tagNames = { "<null>", "boolean", "int", "bitstring", "octetstring", "null", "objid", "objdesc", "external", "real", "enum", "pdv", "utf8", "relobjid", "resv", "resv", "sequence", "set", "char string" };
  public boolean constructed;
  public byte tag;
  
  public BERProcessor(byte[] buffer, int offset, int len)
    throws SignatureException
  {
    this.buffer = buffer;
    this.offset = offset;
    lastOffset = (len + offset);
    processStructure();
  }
  
  public void processStructure()
    throws SignatureException
  {
    if (offset == -1) {
      return;
    }
    endOffset = offset;
    
    classOfTag = ((buffer[offset] & 0xFF) >> 6);
    
    constructed = ((buffer[offset] & 0x20) != 0);
    
    byte tagNumber = (byte)(buffer[offset] & 0x1F);
    if (tagNumber < 32)
    {
      tag = tagNumber;
      endOffset = (offset + 1);
    }
    else
    {
      throw new SignatureException("Can't handle tags > 32");
    }
    if ((buffer[endOffset] & 0x80) == 0)
    {
      contentLength = buffer[endOffset];
      endOffset += 1;
    }
    else
    {
      int octetCount = buffer[endOffset] & 0x7F;
      if (octetCount > 3) {
        throw new SignatureException("ContentLength octet count too large: " + octetCount);
      }
      contentLength = 0;
      endOffset += 1;
      for (int i = 0; i < octetCount; i++)
      {
        contentLength <<= 8;
        contentLength |= buffer[endOffset] & 0xFF;
        endOffset += 1;
      }
      if (octetCount == 0) {
        contentLength = -1;
      }
    }
    contentOffset = endOffset;
    if (contentLength != -1) {
      endOffset += contentLength;
    }
    if (endOffset > lastOffset) {
      throw new SignatureException("Content length too large: " + endOffset + " > " + lastOffset);
    }
  }
  
  public String toString()
  {
    StringBuffer sb = new StringBuffer();
    switch (classOfTag)
    {
    case 0: 
      sb.append('U');
      break;
    case 1: 
      sb.append('A');
      break;
    case 2: 
      sb.append('C');
      break;
    case 3: 
      sb.append('P');
    }
    sb.append(constructed ? 'C' : 'P');
    sb.append(" tag=" + tag);
    if (tag < tagNames.length) {
      sb.append("(" + tagNames[tag] + ")");
    }
    sb.append(" len=");
    sb.append(contentLength);
    switch (tag)
    {
    case 2: 
      sb.append(" value=" + getIntValue());
      break;
    case 6: 
      sb.append(" value=");
      int[] oid = getObjId();
      for (int i = 0; i < oid.length; i++)
      {
        if (i > 0) {
          sb.append('.');
        }
        sb.append(oid[i]);
      }
    }
    if ((tag == 12) || ((tag >= 18) && (tag <= 22)) || ((tag >= 25) && (tag <= 30)))
    {
      sb.append(" value=");
      sb.append(getString());
    }
    return sb.toString();
  }
  
  public BERProcessor stepInto()
    throws SignatureException
  {
    return new BERProcessor(buffer, contentOffset, contentLength);
  }
  
  public void stepOver()
    throws SignatureException
  {
    offset = endOffset;
    if (endOffset >= lastOffset)
    {
      offset = -1;
      return;
    }
    processStructure();
  }
  
  public boolean endOfSequence()
  {
    return offset == -1;
  }
  
  public String getString()
  {
    return new String(buffer, contentOffset, contentLength);
  }
  
  public BigInteger getIntValue()
  {
    return new BigInteger(getBytes());
  }
  
  public int[] getObjId()
  {
    int count = 0;
    for (int i = 0; i < contentLength; i++) {
      if ((buffer[(contentOffset + i)] & 0x80) == 0) {
        count++;
      }
    }
    count++;
    int[] oid = new int[count];
    int index = 0;
    int currentValue = 0;
    for (int i = 0; i < contentLength; i++)
    {
      currentValue <<= 7;
      currentValue |= buffer[(contentOffset + i)] & 0x7F;
      if ((buffer[(contentOffset + i)] & 0x80) == 0)
      {
        if (index == 0)
        {
          oid[(index++)] = (currentValue / 40);
          oid[(index++)] = (currentValue % 40);
        }
        else
        {
          oid[(index++)] = currentValue;
        }
        currentValue = 0;
      }
    }
    return oid;
  }
  
  public byte[] getBytes()
  {
    byte[] v = new byte[contentLength];
    System.arraycopy(buffer, contentOffset, v, 0, contentLength);
    return v;
  }
}

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

public class Base64
{
  private static final byte equalSign = 61;
  static char[] digits = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 
    'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 
    'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 
    'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' };
  
  public static byte[] decode(byte[] data)
  {
    if (data.length == 0) {
      return data;
    }
    int lastRealDataIndex = data.length - 1;
    while (data[lastRealDataIndex] == 61) {
      lastRealDataIndex--;
    }
    int padBytes = data.length - 1 - lastRealDataIndex;
    int byteLength = data.length * 6 / 8 - padBytes;
    byte[] result = new byte[byteLength];
    
    int dataIndex = 0;
    int resultIndex = 0;
    int allBits = 0;
    
    int resultChunks = (lastRealDataIndex + 1) / 4;
    for (int i = 0; i < resultChunks; i++)
    {
      allBits = 0;
      for (int j = 0; j < 4; j++) {
        allBits = allBits << 6 | decodeDigit(data[(dataIndex++)]);
      }
      for (int j = resultIndex + 2; j >= resultIndex; j--)
      {
        result[j] = ((byte)(allBits & 0xFF));
        allBits >>>= 8;
      }
      resultIndex += 3;
    }
    switch (padBytes)
    {
    case 1: 
      allBits = 0;
      for (int j = 0; j < 3; j++) {
        allBits = allBits << 6 | decodeDigit(data[(dataIndex++)]);
      }
      allBits <<= 6;
      
      allBits >>>= 8;
      for (int j = resultIndex + 1; j >= resultIndex; j--)
      {
        result[j] = ((byte)(allBits & 0xFF));
        
        allBits >>>= 8;
      }
      break;
    case 2: 
      allBits = 0;
      for (int j = 0; j < 2; j++) {
        allBits = allBits << 6 | decodeDigit(data[(dataIndex++)]);
      }
      allBits <<= 6;
      allBits <<= 6;
      
      allBits >>>= 8;
      allBits >>>= 8;
      result[resultIndex] = ((byte)(allBits & 0xFF));
    }
    return result;
  }
  
  static int decodeDigit(byte data)
  {
    char charData = (char)data;
    if ((charData <= 'Z') && (charData >= 'A')) {
      return charData - 'A';
    }
    if ((charData <= 'z') && (charData >= 'a')) {
      return charData - 'a' + 26;
    }
    if ((charData <= '9') && (charData >= '0')) {
      return charData - '0' + 52;
    }
    switch (charData)
    {
    case '+': 
      return 62;
    case '/': 
      return 63;
    }
    throw new IllegalArgumentException("Invalid char to decode: " + data);
  }
  
  public static byte[] encode(byte[] data)
  {
    int sourceChunks = data.length / 3;
    int len = (data.length + 2) / 3 * 4;
    byte[] result = new byte[len];
    int extraBytes = data.length - sourceChunks * 3;
    
    int dataIndex = 0;
    int resultIndex = 0;
    int allBits = 0;
    for (int i = 0; i < sourceChunks; i++)
    {
      allBits = 0;
      for (int j = 0; j < 3; j++) {
        allBits = allBits << 8 | data[(dataIndex++)] & 0xFF;
      }
      for (int j = resultIndex + 3; j >= resultIndex; j--)
      {
        result[j] = ((byte)digits[(allBits & 0x3F)]);
        
        allBits >>>= 6;
      }
      resultIndex += 4;
    }
    switch (extraBytes)
    {
    case 1: 
      allBits = data[(dataIndex++)];
      allBits <<= 8;
      allBits <<= 8;
      for (int j = resultIndex + 3; j >= resultIndex; j--)
      {
        result[j] = ((byte)digits[(allBits & 0x3F)]);
        
        allBits >>>= 6;
      }
      result[(result.length - 1)] = 61;
      result[(result.length - 2)] = 61;
      break;
    case 2: 
      allBits = data[(dataIndex++)];
      allBits = allBits << 8 | data[(dataIndex++)] & 0xFF;
      
      allBits <<= 8;
      for (int j = resultIndex + 3; j >= resultIndex; j--)
      {
        result[j] = ((byte)digits[(allBits & 0x3F)]);
        
        allBits >>>= 6;
      }
      result[(result.length - 1)] = 61;
    }
    return result;
  }
}

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

import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.framework.internal.core.AbstractBundle;
import org.eclipse.osgi.internal.provisional.service.security.AuthorizationEngine;
import org.eclipse.osgi.signedcontent.SignedContent;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.SynchronousBundleListener;

public class BundleInstallListener
  implements SynchronousBundleListener
{
  public void bundleChanged(BundleEvent event)
  {
    Bundle bundle = event.getBundle();
    switch (event.getType())
    {
    case 1: 
    case 8: 
      TrustEngineListener listener = TrustEngineListener.getInstance();
      AuthorizationEngine authEngine = listener == null ? null : listener.getAuthorizationEngine();
      if (authEngine != null)
      {
        BaseData baseData = (BaseData)((AbstractBundle)bundle).getBundleData();
        SignedStorageHook hook = (SignedStorageHook)baseData.getStorageHook(SignedStorageHook.KEY);
        SignedContent signedContent = hook != null ? signedContent : null;
        authEngine.authorize(signedContent, bundle);
      }
      break;
    }
  }
}

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

import java.io.FilterInputStream;
import java.io.IOException;
import java.security.MessageDigest;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;
import org.eclipse.osgi.signedcontent.InvalidContentException;
import org.eclipse.osgi.signedcontent.SignerInfo;
import org.eclipse.osgi.util.NLS;

class DigestedInputStream
  extends FilterInputStream
{
  private final MessageDigest[] digests;
  private final byte[][] result;
  private final BundleEntry entry;
  private final BundleFile bundleFile;
  private long remaining;
  
  DigestedInputStream(BundleEntry entry, BundleFile bundleFile, SignerInfo[] signerInfos, byte[][] results, long size)
    throws IOException
  {
    super(entry.getInputStream());
    this.entry = entry;
    this.bundleFile = bundleFile;
    remaining = size;
    digests = new MessageDigest[signerInfos.length];
    for (int i = 0; i < signerInfos.length; i++) {
      digests[i] = SignatureBlockProcessor.getMessageDigest(signerInfos[i].getMessageDigestAlgorithm());
    }
    result = results;
  }
  
  public synchronized void mark(int readlimit) {}
  
  public boolean markSupported()
  {
    return false;
  }
  
  public int read()
    throws IOException
  {
    if (remaining <= 0L) {
      return -1;
    }
    int c = super.read();
    if (c != -1)
    {
      for (int i = 0; i < digests.length; i++) {
        digests[i].update((byte)c);
      }
      remaining -= 1L;
    }
    else
    {
      remaining = 0L;
    }
    if (remaining == 0L) {
      verifyDigests();
    }
    return c;
  }
  
  private void verifyDigests()
    throws InvalidContentException
  {
    for (int i = 0; i < digests.length; i++)
    {
      byte[] rc = digests[i].digest();
      if (!MessageDigest.isEqual(result[i], rc)) {
        throw new InvalidContentException(NLS.bind(SignedContentMessages.File_In_Jar_Is_Tampered, entry.getName(), bundleFile.getBaseFile()), null);
      }
    }
  }
  
  public int read(byte[] b, int off, int len)
    throws IOException
  {
    if (remaining <= 0L) {
      return -1;
    }
    int rc = super.read(b, off, len);
    if (rc != -1)
    {
      for (int i = 0; i < digests.length; i++) {
        digests[i].update(b, off, rc);
      }
      remaining -= rc;
    }
    else
    {
      remaining = 0L;
    }
    if (remaining <= 0L) {
      verifyDigests();
    }
    return rc;
  }
  
  public synchronized void reset()
    throws IOException
  {
    throw new IOException("Reset not supported");
  }
  
  public long skip(long n)
    throws IOException
  {
    byte[] buffer = new byte['?'];
    long count = 0L;
    while (n - count > 0L)
    {
      int rc = n - count > buffer.length ? buffer.length : (int)(n - count);
      rc = read(buffer, 0, rc);
      if (rc == -1) {
        break;
      }
      count += rc;
      n -= rc;
    }
    return count;
  }
}

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

import java.security.Principal;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.Date;
import org.eclipse.osgi.internal.provisional.verifier.CertificateChain;
import org.eclipse.osgi.signedcontent.SignedContent;
import org.eclipse.osgi.signedcontent.SignerInfo;

class LegacyVerifierFactory$LegacyChain
  implements CertificateChain
{
  private final SignerInfo signerInfo;
  private final SignedContent content;
  
  public LegacyVerifierFactory$LegacyChain(SignerInfo signerInfo, SignedContent content)
  {
    this.signerInfo = signerInfo;
    this.content = content;
  }
  
  public Certificate[] getCertificates()
  {
    return signerInfo.getCertificateChain();
  }
  
  public String getChain()
  {
    StringBuffer sb = new StringBuffer();
    Certificate[] certs = getCertificates();
    for (int i = 0; i < certs.length; i++)
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