org-openide-util

16:40:46.055 INFO  jd.cli.Main - Decompiling org-openide-util.jar
package org.netbeans.modules.openide.util;

import java.net.URLStreamHandler;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import org.openide.util.Lookup.Result;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;

class ProxyURLStreamHandlerFactory$1
  implements LookupListener
{
  ProxyURLStreamHandlerFactory$1(ProxyURLStreamHandlerFactory paramProxyURLStreamHandlerFactory, Lookup.Result paramResult, String paramString) {}
  
  public void resultChanged(LookupEvent paramLookupEvent)
  {
    synchronized (this$0)
    {
      Collection localCollection = val$result.allInstances();
      ProxyURLStreamHandlerFactory.access$000(this$0).put(val$protocol, localCollection.isEmpty() ? null : (URLStreamHandler)localCollection.iterator().next());
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.openide.util.ProxyURLStreamHandlerFactory.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.openide.util;

import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.openide.util.Lookup;
import org.openide.util.Lookup.Result;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;
import org.openide.util.lookup.Lookups;

public final class ProxyURLStreamHandlerFactory
  implements URLStreamHandlerFactory
{
  private final Map<String, Lookup.Result<URLStreamHandler>> results = new HashMap();
  private final Map<String, URLStreamHandler> handlers = new HashMap();
  
  public synchronized URLStreamHandler createURLStreamHandler(final String paramString)
  {
    if (!results.containsKey(paramString))
    {
      final Lookup.Result localResult = Lookups.forPath("URLStreamHandler/" + paramString).lookupResult(URLStreamHandler.class);
      LookupListener local1 = new LookupListener()
      {
        public void resultChanged(LookupEvent paramAnonymousLookupEvent)
        {
          synchronized (ProxyURLStreamHandlerFactory.this)
          {
            Collection localCollection = localResult.allInstances();
            handlers.put(paramString, localCollection.isEmpty() ? null : (URLStreamHandler)localCollection.iterator().next());
          }
        }
      };
      localResult.addLookupListener(local1);
      local1.resultChanged(null);
      results.put(paramString, localResult);
    }
    return (URLStreamHandler)handlers.get(paramString);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.openide.util.ProxyURLStreamHandlerFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.openide.util;

import java.net.URLStreamHandler;
import java.util.Collections;
import java.util.Set;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import org.openide.util.URLStreamHandlerRegistration;
import org.openide.util.lookup.implspi.AbstractServiceProviderProcessor;

@SupportedSourceVersion(SourceVersion.RELEASE_6)
public class URLStreamHandlerRegistrationProcessor
  extends AbstractServiceProviderProcessor
{
  public static final String REGISTRATION_PREFIX = "URLStreamHandler/";
  
  public Set<String> getSupportedAnnotationTypes()
  {
    return Collections.singleton(URLStreamHandlerRegistration.class.getCanonicalName());
  }
  
  protected boolean handleProcess(Set<? extends TypeElement> paramSet, RoundEnvironment paramRoundEnvironment)
  {
    for (Element localElement : paramRoundEnvironment.getElementsAnnotatedWith(URLStreamHandlerRegistration.class))
    {
      TypeElement localTypeElement = (TypeElement)localElement;
      URLStreamHandlerRegistration localURLStreamHandlerRegistration = (URLStreamHandlerRegistration)localTypeElement.getAnnotation(URLStreamHandlerRegistration.class);
      DeclaredType localDeclaredType = processingEnv.getTypeUtils().getDeclaredType(processingEnv.getElementUtils().getTypeElement(URLStreamHandler.class.getName()), new TypeMirror[0]);
      for (String str : localURLStreamHandlerRegistration.protocol()) {
        register(localTypeElement, URLStreamHandlerRegistration.class, localDeclaredType, "URLStreamHandler/" + str, localURLStreamHandlerRegistration.position(), new String[0]);
      }
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.openide.util.URLStreamHandlerRegistrationProcessor
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide;

import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

final class ErrorManager$AnnException
  extends Exception
  implements Callable<LogRecord[]>
{
  private List<LogRecord> records;
  private static Map<Throwable, AnnException> extras = new WeakHashMap();
  
  public String getMessage()
  {
    StringBuilder localStringBuilder = new StringBuilder();
    String str = "";
    for (LogRecord localLogRecord : records) {
      if (localLogRecord.getMessage() != null)
      {
        localStringBuilder.append(str);
        localStringBuilder.append(localLogRecord.getMessage());
        str = "\n";
      }
    }
    return localStringBuilder.toString();
  }
  
  static AnnException findOrCreate(Throwable paramThrowable, boolean paramBoolean)
  {
    if ((paramThrowable instanceof AnnException)) {
      return (AnnException)paramThrowable;
    }
    if (paramThrowable.getCause() == null)
    {
      if (paramBoolean) {
        try
        {
          paramThrowable.initCause(new AnnException());
        }
        catch (IllegalStateException localIllegalStateException)
        {
          AnnException localAnnException = (AnnException)extras.get(paramThrowable);
          if (localAnnException == null)
          {
            localAnnException = new AnnException();
            localAnnException.initCause(paramThrowable);
            Logger.getLogger(ErrorManager.class.getName()).log(Level.FINE, "getCause was null yet initCause failed for " + paramThrowable, localIllegalStateException);
            extras.put(paramThrowable, localAnnException);
          }
          return localAnnException;
        }
      }
      return (AnnException)paramThrowable.getCause();
    }
    return findOrCreate(paramThrowable.getCause(), paramBoolean);
  }
  
  public synchronized void addRecord(LogRecord paramLogRecord)
  {
    if (records == null) {
      records = new ArrayList();
    }
    records.add(paramLogRecord);
  }
  
  public LogRecord[] call()
  {
    List localList = records;
    LogRecord[] arrayOfLogRecord = new LogRecord[0];
    return localList == null ? arrayOfLogRecord : (LogRecord[])localList.toArray(arrayOfLogRecord);
  }
  
  public void printStackTrace(PrintStream paramPrintStream)
  {
    super.printStackTrace(paramPrintStream);
    logRecords(paramPrintStream);
  }
  
  public void printStackTrace(PrintWriter paramPrintWriter)
  {
    super.printStackTrace(paramPrintWriter);
    logRecords(paramPrintWriter);
  }
  
  public void printStackTrace()
  {
    printStackTrace(System.err);
  }
  
  private void logRecords(Appendable paramAppendable)
  {
    List localList = records;
    if (localList == null) {
      return;
    }
    try
    {
      for (LogRecord localLogRecord : localList)
      {
        if (localLogRecord.getMessage() != null) {
          paramAppendable.append(localLogRecord.getMessage()).append("\n");
        }
        if (localLogRecord.getThrown() != null)
        {
          StringWriter localStringWriter = new StringWriter();
          localLogRecord.getThrown().printStackTrace(new PrintWriter(localStringWriter));
          paramAppendable.append(localStringWriter.toString()).append("\n");
        }
      }
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.ErrorManager.AnnException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide;

import java.util.Date;

public abstract interface ErrorManager$Annotation
{
  public abstract String getMessage();
  
  public abstract String getLocalizedMessage();
  
  public abstract Throwable getStackTrace();
  
  public abstract Date getDate();
  
  public abstract int getSeverity();
}

/* Location:
 * Qualified Name:     org.openide.ErrorManager.Annotation
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide;

import java.util.Enumeration;
import java.util.ResourceBundle;
import org.openide.util.Enumerations;

class ErrorManager$DelegatingErrorManager$1
  extends ResourceBundle
{
  ErrorManager$DelegatingErrorManager$1(ErrorManager.DelegatingErrorManager paramDelegatingErrorManager, String paramString) {}
  
  public Object handleGetObject(String paramString)
  {
    if ("msg".equals(paramString)) {
      return val$localizedMessage;
    }
    return null;
  }
  
  public Enumeration<String> getKeys()
  {
    return Enumerations.singleton("msg");
  }
}

/* Location:
 * Qualified Name:     org.openide.ErrorManager.DelegatingErrorManager.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide;

import java.util.Collection;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import org.openide.util.Enumerations;
import org.openide.util.Lookup;
import org.openide.util.Lookup.Result;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;
import org.openide.util.WeakSet;

class ErrorManager$DelegatingErrorManager
  extends ErrorManager
  implements LookupListener
{
  private String name = null;
  private Set<ErrorManager> delegates = new HashSet();
  private Logger logger;
  private WeakSet<DelegatingErrorManager> createdByMe = new WeakSet();
  Lookup.Result<ErrorManager> r;
  private static volatile Thread lastThread;
  
  public ErrorManager$DelegatingErrorManager(String paramString)
  {
    name = paramString;
  }
  
  Logger logger()
  {
    if (logger == null) {
      logger = Logger.getLogger(name);
    }
    return logger;
  }
  
  public ErrorManager getInstance(String paramString)
  {
    if ((paramString == null) || ("".equals(paramString))) {
      return this;
    }
    DelegatingErrorManager localDelegatingErrorManager = new DelegatingErrorManager(paramString);
    synchronized (this)
    {
      attachNewDelegates(localDelegatingErrorManager, paramString);
      createdByMe.add(localDelegatingErrorManager);
    }
    return localDelegatingErrorManager;
  }
  
  public Throwable attachAnnotations(Throwable paramThrowable, ErrorManager.Annotation[] paramArrayOfAnnotation)
  {
    for (ErrorManager localErrorManager : delegates) {
      localErrorManager.attachAnnotations(paramThrowable, paramArrayOfAnnotation);
    }
    return paramThrowable;
  }
  
  public ErrorManager.Annotation[] findAnnotations(Throwable paramThrowable)
  {
    for (ErrorManager localErrorManager : delegates)
    {
      ErrorManager.Annotation[] arrayOfAnnotation = localErrorManager.findAnnotations(paramThrowable);
      if ((arrayOfAnnotation != null) && (arrayOfAnnotation.length > 0)) {
        return arrayOfAnnotation;
      }
    }
    return new ErrorManager.Annotation[0];
  }
  
  public Throwable annotate(Throwable paramThrowable1, int paramInt, String paramString1, final String paramString2, Throwable paramThrowable2, Date paramDate)
  {
    Object localObject2;
    if (delegates.isEmpty())
    {
      localObject1 = new LogRecord(convertSeverity(paramInt, true, Level.ALL), paramString1);
      if (paramThrowable2 != null) {
        ((LogRecord)localObject1).setThrown(paramThrowable2);
      }
      if (paramDate != null) {
        ((LogRecord)localObject1).setMillis(paramDate.getTime());
      }
      if (paramString2 != null)
      {
        localObject2 = new ResourceBundle()
        {
          public Object handleGetObject(String paramAnonymousString)
          {
            if ("msg".equals(paramAnonymousString)) {
              return paramString2;
            }
            return null;
          }
          
          public Enumeration<String> getKeys()
          {
            return Enumerations.singleton("msg");
          }
        };
        ((LogRecord)localObject1).setResourceBundle((ResourceBundle)localObject2);
        ((LogRecord)localObject1).setMessage("msg");
      }
      localObject2 = ErrorManager.AnnException.findOrCreate(paramThrowable1, true);
      if (localObject2 != null) {
        ((ErrorManager.AnnException)localObject2).addRecord((LogRecord)localObject1);
      }
      return paramThrowable1;
    }
    for (Object localObject1 = delegates.iterator(); ((Iterator)localObject1).hasNext();)
    {
      localObject2 = (ErrorManager)((Iterator)localObject1).next();
      ((ErrorManager)localObject2).annotate(paramThrowable1, paramInt, paramString1, paramString2, paramThrowable2, paramDate);
    }
    return paramThrowable1;
  }
  
  public void notify(int paramInt, Throwable paramThrowable)
  {
    Object localObject1;
    if (delegates.isEmpty())
    {
      if (enterLogger()) {
        return;
      }
      try
      {
        localObject1 = (ErrorManager.AnnException)ErrorManager.AnnException.access$000().get(paramThrowable);
        if (localObject1 != null) {
          paramThrowable = (Throwable)localObject1;
        }
        logger().log(convertSeverity(paramInt, true, ErrorManager.OwnLevel.UNKNOWN), paramThrowable.getMessage(), paramThrowable);
      }
      finally
      {
        exitLogger();
      }
      return;
    }
    try
    {
      for (localObject1 = delegates.iterator(); ((Iterator)localObject1).hasNext();)
      {
        ErrorManager localErrorManager = (ErrorManager)((Iterator)localObject1).next();
        localErrorManager.notify(paramInt, paramThrowable);
      }
    }
    catch (RuntimeException localRuntimeException)
    {
      localRuntimeException.printStackTrace();
      paramThrowable.printStackTrace();
    }
    catch (LinkageError localLinkageError)
    {
      localLinkageError.printStackTrace();
      paramThrowable.printStackTrace();
    }
  }
  
  public void log(int paramInt, String paramString)
  {
    if (paramInt == 0) {
      throw new IllegalArgumentException("ErrorManager.log(UNKNOWN, ...) is not permitted");
    }
    if (delegates.isEmpty())
    {
      localObject1 = convertSeverity(paramInt, false, Level.FINE);
      if (enterLogger()) {
        return;
      }
      try
      {
        logger().log((Level)localObject1, paramString);
      }
      finally
      {
        exitLogger();
      }
      return;
    }
    for (Object localObject1 = delegates.iterator(); ((Iterator)localObject1).hasNext();)
    {
      ErrorManager localErrorManager = (ErrorManager)((Iterator)localObject1).next();
      localErrorManager.log(paramInt, paramString);
    }
  }
  
  private static Level convertSeverity(int paramInt, boolean paramBoolean, Level paramLevel)
  {
    Level localLevel = paramLevel;
    if (paramInt >= 65536) {
      localLevel = Level.SEVERE;
    } else if (paramInt >= 4096) {
      localLevel = Level.SEVERE;
    } else if (paramInt >= 256) {
      localLevel = ErrorManager.OwnLevel.USER;
    } else if (paramInt >= 16) {
      localLevel = Level.WARNING;
    } else if (paramInt >= 1) {
      localLevel = paramBoolean ? Level.INFO : Level.FINE;
    }
    return localLevel;
  }
  
  public boolean isLoggable(int paramInt)
  {
    if (paramInt == 0) {
      throw new IllegalArgumentException("ErrorManager.isLoggable(UNKNOWN) is not permitted");
    }
    if (delegates.isEmpty()) {
      return logger().isLoggable(convertSeverity(paramInt, false, null));
    }
    for (ErrorManager localErrorManager : delegates) {
      if (localErrorManager.isLoggable(paramInt)) {
        return true;
      }
    }
    return false;
  }
  
  public boolean isNotifiable(int paramInt)
  {
    if (paramInt == 0) {
      throw new IllegalArgumentException("ErrorManager.isNotifiable(UNKNOWN) is not permitted");
    }
    if (delegates.isEmpty()) {
      return logger().isLoggable(convertSeverity(paramInt, true, null));
    }
    for (ErrorManager localErrorManager : delegates) {
      if (localErrorManager.isNotifiable(paramInt)) {
        return true;
      }
    }
    return false;
  }
  
  public synchronized void setDelegates(Collection<? extends ErrorManager> paramCollection)
  {
    delegates = new LinkedHashSet(paramCollection);
    for (DelegatingErrorManager localDelegatingErrorManager : createdByMe) {
      attachNewDelegates(localDelegatingErrorManager, localDelegatingErrorManager.getName());
    }
  }
  
  private String getName()
  {
    return name;
  }
  
  private void attachNewDelegates(DelegatingErrorManager paramDelegatingErrorManager, String paramString)
  {
    HashSet localHashSet = new HashSet();
    for (ErrorManager localErrorManager : delegates) {
      localHashSet.add(localErrorManager.getInstance(paramString));
    }
    paramDelegatingErrorManager.setDelegates(localHashSet);
  }
  
  public void initialize()
  {
    r = Lookup.getDefault().lookupResult(ErrorManager.class);
    setDelegates(r.allInstances());
  }
  
  public void resultChanged(LookupEvent paramLookupEvent)
  {
    if (r != null) {
      setDelegates(r.allInstances());
    }
  }
  
  private static boolean enterLogger()
  {
    if (lastThread == Thread.currentThread())
    {
      new Exception("using error manager from inside a logger").printStackTrace();
      return true;
    }
    lastThread = Thread.currentThread();
    return false;
  }
  
  private static void exitLogger()
  {
    lastThread = null;
  }
}

/* Location:
 * Qualified Name:     org.openide.ErrorManager.DelegatingErrorManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide;

import java.util.logging.Level;

final class ErrorManager$OwnLevel
  extends Level
{
  public static final Level USER = new OwnLevel("USER", 1973);
  public static final Level UNKNOWN = new OwnLevel("SEVERE", Level.SEVERE.intValue() + 1);
  
  private ErrorManager$OwnLevel(String paramString, int paramInt)
  {
    super(paramString, paramInt);
  }
}

/* Location:
 * Qualified Name:     org.openide.ErrorManager.OwnLevel
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide;

import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import org.openide.util.Enumerations;
import org.openide.util.Lookup;
import org.openide.util.Lookup.Result;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;
import org.openide.util.WeakSet;

public abstract class ErrorManager
{
  public static final int UNKNOWN = 0;
  public static final int INFORMATIONAL = 1;
  public static final int WARNING = 16;
  public static final int USER = 256;
  public static final int EXCEPTION = 4096;
  public static final int ERROR = 65536;
  private static DelegatingErrorManager current;
  
  public static ErrorManager getDefault()
  {
    synchronized (ErrorManager.class)
    {
      if (current != null) {
        return current;
      }
    }
    return getDefaultDelegate();
  }
  
  private static DelegatingErrorManager getDefaultDelegate()
  {
    DelegatingErrorManager localDelegatingErrorManager = new DelegatingErrorManager("");
    try
    {
      localDelegatingErrorManager.initialize();
      synchronized (ErrorManager.class)
      {
        if (current == null)
        {
          current = localDelegatingErrorManager;
          
          currentr.addLookupListener(current);
        }
      }
    }
    catch (RuntimeException localRuntimeException)
    {
      localRuntimeException.printStackTrace();
      current = localDelegatingErrorManager;
    }
    catch (LinkageError localLinkageError)
    {
      localLinkageError.printStackTrace();
      current = localDelegatingErrorManager;
    }
    return current;
  }
  
  public abstract Throwable attachAnnotations(Throwable paramThrowable, Annotation[] paramArrayOfAnnotation);
  
  public abstract Annotation[] findAnnotations(Throwable paramThrowable);
  
  public abstract Throwable annotate(Throwable paramThrowable1, int paramInt, String paramString1, String paramString2, Throwable paramThrowable2, Date paramDate);
  
  public abstract void notify(int paramInt, Throwable paramThrowable);
  
  public final void notify(Throwable paramThrowable)
  {
    notify(0, paramThrowable);
  }
  
  public abstract void log(int paramInt, String paramString);
  
  public final void log(String paramString)
  {
    log(1, paramString);
  }
  
  public boolean isLoggable(int paramInt)
  {
    return true;
  }
  
  public boolean isNotifiable(int paramInt)
  {
    return isLoggable(paramInt);
  }
  
  public abstract ErrorManager getInstance(String paramString);
  
  public final Throwable annotate(Throwable paramThrowable, String paramString)
  {
    return annotate(paramThrowable, 0, null, paramString, null, null);
  }
  
  public final Throwable annotate(Throwable paramThrowable1, Throwable paramThrowable2)
  {
    return annotate(paramThrowable1, 0, null, null, paramThrowable2, null);
  }
  
  @Deprecated
  public final Throwable copyAnnotation(Throwable paramThrowable1, Throwable paramThrowable2)
  {
    return annotate(paramThrowable1, 0, null, null, paramThrowable2, null);
  }
  
  public static abstract interface Annotation
  {
    public abstract String getMessage();
    
    public abstract String getLocalizedMessage();
    
    public abstract Throwable getStackTrace();
    
    public abstract Date getDate();
    
    public abstract int getSeverity();
  }
  
  private static class DelegatingErrorManager
    extends ErrorManager
    implements LookupListener
  {
    private String name = null;
    private Set<ErrorManager> delegates = new HashSet();
    private Logger logger;
    private WeakSet<DelegatingErrorManager> createdByMe = new WeakSet();
    Lookup.Result<ErrorManager> r;
    private static volatile Thread lastThread;
    
    public DelegatingErrorManager(String paramString)
    {
      name = paramString;
    }
    
    Logger logger()
    {
      if (logger == null) {
        logger = Logger.getLogger(name);
      }
      return logger;
    }
    
    public ErrorManager getInstance(String paramString)
    {
      if ((paramString == null) || ("".equals(paramString))) {
        return this;
      }
      DelegatingErrorManager localDelegatingErrorManager = new DelegatingErrorManager(paramString);
      synchronized (this)
      {
        attachNewDelegates(localDelegatingErrorManager, paramString);
        createdByMe.add(localDelegatingErrorManager);
      }
      return localDelegatingErrorManager;
    }
    
    public Throwable attachAnnotations(Throwable paramThrowable, ErrorManager.Annotation[] paramArrayOfAnnotation)
    {
      for (ErrorManager localErrorManager : delegates) {
        localErrorManager.attachAnnotations(paramThrowable, paramArrayOfAnnotation);
      }
      return paramThrowable;
    }
    
    public ErrorManager.Annotation[] findAnnotations(Throwable paramThrowable)
    {
      for (ErrorManager localErrorManager : delegates)
      {
        ErrorManager.Annotation[] arrayOfAnnotation = localErrorManager.findAnnotations(paramThrowable);
        if ((arrayOfAnnotation != null) && (arrayOfAnnotation.length > 0)) {
          return arrayOfAnnotation;
        }
      }
      return new ErrorManager.Annotation[0];
    }
    
    public Throwable annotate(Throwable paramThrowable1, int paramInt, String paramString1, final String paramString2, Throwable paramThrowable2, Date paramDate)
    {
      Object localObject2;
      if (delegates.isEmpty())
      {
        localObject1 = new LogRecord(convertSeverity(paramInt, true, Level.ALL), paramString1);
        if (paramThrowable2 != null) {
          ((LogRecord)localObject1).setThrown(paramThrowable2);
        }
        if (paramDate != null) {
          ((LogRecord)localObject1).setMillis(paramDate.getTime());
        }
        if (paramString2 != null)
        {
          localObject2 = new ResourceBundle()
          {
            public Object handleGetObject(String paramAnonymousString)
            {
              if ("msg".equals(paramAnonymousString)) {
                return paramString2;
              }
              return null;
            }
            
            public Enumeration<String> getKeys()
            {
              return Enumerations.singleton("msg");
            }
          };
          ((LogRecord)localObject1).setResourceBundle((ResourceBundle)localObject2);
          ((LogRecord)localObject1).setMessage("msg");
        }
        localObject2 = ErrorManager.AnnException.findOrCreate(paramThrowable1, true);
        if (localObject2 != null) {
          ((ErrorManager.AnnException)localObject2).addRecord((LogRecord)localObject1);
        }
        return paramThrowable1;
      }
      for (Object localObject1 = delegates.iterator(); ((Iterator)localObject1).hasNext();)
      {
        localObject2 = (ErrorManager)((Iterator)localObject1).next();
        ((ErrorManager)localObject2).annotate(paramThrowable1, paramInt, paramString1, paramString2, paramThrowable2, paramDate);
      }
      return paramThrowable1;
    }
    
    public void notify(int paramInt, Throwable paramThrowable)
    {
      Object localObject1;
      if (delegates.isEmpty())
      {
        if (enterLogger()) {
          return;
        }
        try
        {
          localObject1 = (ErrorManager.AnnException)ErrorManager.AnnException.extras.get(paramThrowable);
          if (localObject1 != null) {
            paramThrowable = (Throwable)localObject1;
          }
          logger().log(convertSeverity(paramInt, true, ErrorManager.OwnLevel.UNKNOWN), paramThrowable.getMessage(), paramThrowable);
        }
        finally
        {
          exitLogger();
        }
        return;
      }
      try
      {
        for (localObject1 = delegates.iterator(); ((Iterator)localObject1).hasNext();)
        {
          ErrorManager localErrorManager = (ErrorManager)((Iterator)localObject1).next();
          localErrorManager.notify(paramInt, paramThrowable);
        }
      }
      catch (RuntimeException localRuntimeException)
      {
        localRuntimeException.printStackTrace();
        paramThrowable.printStackTrace();
      }
      catch (LinkageError localLinkageError)
      {
        localLinkageError.printStackTrace();
        paramThrowable.printStackTrace();
      }
    }
    
    public void log(int paramInt, String paramString)
    {
      if (paramInt == 0) {
        throw new IllegalArgumentException("ErrorManager.log(UNKNOWN, ...) is not permitted");
      }
      if (delegates.isEmpty())
      {
        localObject1 = convertSeverity(paramInt, false, Level.FINE);
        if (enterLogger()) {
          return;
        }
        try
        {
          logger().log((Level)localObject1, paramString);
        }
        finally
        {
          exitLogger();
        }
        return;
      }
      for (Object localObject1 = delegates.iterator(); ((Iterator)localObject1).hasNext();)
      {
        ErrorManager localErrorManager = (ErrorManager)((Iterator)localObject1).next();
        localErrorManager.log(paramInt, paramString);
      }
    }
    
    private static Level convertSeverity(int paramInt, boolean paramBoolean, Level paramLevel)
    {
      Level localLevel = paramLevel;
      if (paramInt >= 65536) {
        localLevel = Level.SEVERE;
      } else if (paramInt >= 4096) {
        localLevel = Level.SEVERE;
      } else if (paramInt >= 256) {
        localLevel = ErrorManager.OwnLevel.USER;
      } else if (paramInt >= 16) {
        localLevel = Level.WARNING;
      } else if (paramInt >= 1) {
        localLevel = paramBoolean ? Level.INFO : Level.FINE;
      }
      return localLevel;
    }
    
    public boolean isLoggable(int paramInt)
    {
      if (paramInt == 0) {
        throw new IllegalArgumentException("ErrorManager.isLoggable(UNKNOWN) is not permitted");
      }
      if (delegates.isEmpty()) {
        return logger().isLoggable(convertSeverity(paramInt, false, null));
      }
      for (ErrorManager localErrorManager : delegates) {
        if (localErrorManager.isLoggable(paramInt)) {
          return true;
        }
      }
      return false;
    }
    
    public boolean isNotifiable(int paramInt)
    {
      if (paramInt == 0) {
        throw new IllegalArgumentException("ErrorManager.isNotifiable(UNKNOWN) is not permitted");
      }
      if (delegates.isEmpty()) {
        return logger().isLoggable(convertSeverity(paramInt, true, null));
      }
      for (ErrorManager localErrorManager : delegates) {
        if (localErrorManager.isNotifiable(paramInt)) {
          return true;
        }
      }
      return false;
    }
    
    public synchronized void setDelegates(Collection<? extends ErrorManager> paramCollection)
    {
      delegates = new LinkedHashSet(paramCollection);
      for (DelegatingErrorManager localDelegatingErrorManager : createdByMe) {
        attachNewDelegates(localDelegatingErrorManager, localDelegatingErrorManager.getName());
      }
    }
    
    private String getName()
    {
      return name;
    }
    
    private void attachNewDelegates(DelegatingErrorManager paramDelegatingErrorManager, String paramString)
    {
      HashSet localHashSet = new HashSet();
      for (ErrorManager localErrorManager : delegates) {
        localHashSet.add(localErrorManager.getInstance(paramString));
      }
      paramDelegatingErrorManager.setDelegates(localHashSet);
    }
    
    public void initialize()
    {
      r = Lookup.getDefault().lookupResult(ErrorManager.class);
      setDelegates(r.allInstances());
    }
    
    public void resultChanged(LookupEvent paramLookupEvent)
    {
      if (r != null) {
        setDelegates(r.allInstances());
      }
    }
    
    private static boolean enterLogger()
    {
      if (lastThread == Thread.currentThread())
      {
        new Exception("using error manager from inside a logger").printStackTrace();
        return true;
      }
      lastThread = Thread.currentThread();
      return false;
    }
    
    private static void exitLogger()
    {
      lastThread = null;
    }
  }
  
  private static final class AnnException
    extends Exception
    implements Callable<LogRecord[]>
  {
    private List<LogRecord> records;
    private static Map<Throwable, AnnException> extras = new WeakHashMap();
    
    public String getMessage()
    {
      StringBuilder localStringBuilder = new StringBuilder();
      String str = "";
      for (LogRecord localLogRecord : records) {
        if (localLogRecord.getMessage() != null)
        {
          localStringBuilder.append(str);
          localStringBuilder.append(localLogRecord.getMessage());
          str = "\n";
        }
      }
      return localStringBuilder.toString();
    }
    
    static AnnException findOrCreate(Throwable paramThrowable, boolean paramBoolean)
    {
      if ((paramThrowable instanceof AnnException)) {
        return (AnnException)paramThrowable;
      }
      if (paramThrowable.getCause() == null)
      {
        if (paramBoolean) {
          try
          {
            paramThrowable.initCause(new AnnException());
          }
          catch (IllegalStateException localIllegalStateException)
          {
            AnnException localAnnException = (AnnException)extras.get(paramThrowable);
            if (localAnnException == null)
            {
              localAnnException = new AnnException();
              localAnnException.initCause(paramThrowable);
              Logger.getLogger(ErrorManager.class.getName()).log(Level.FINE, "getCause was null yet initCause failed for " + paramThrowable, localIllegalStateException);
              extras.put(paramThrowable, localAnnException);
            }
            return localAnnException;
          }
        }
        return (AnnException)paramThrowable.getCause();
      }
      return findOrCreate(paramThrowable.getCause(), paramBoolean);
    }
    
    public synchronized void addRecord(LogRecord paramLogRecord)
    {
      if (records == null) {
        records = new ArrayList();
      }
      records.add(paramLogRecord);
    }
    
    public LogRecord[] call()
    {
      List localList = records;
      LogRecord[] arrayOfLogRecord = new LogRecord[0];
      return localList == null ? arrayOfLogRecord : (LogRecord[])localList.toArray(arrayOfLogRecord);
    }
    
    public void printStackTrace(PrintStream paramPrintStream)
    {
      super.printStackTrace(paramPrintStream);
      logRecords(paramPrintStream);
    }
    
    public void printStackTrace(PrintWriter paramPrintWriter)
    {
      super.printStackTrace(paramPrintWriter);
      logRecords(paramPrintWriter);
    }
    
    public void printStackTrace()
    {
      printStackTrace(System.err);
    }
    
    private void logRecords(Appendable paramAppendable)
    {
      List localList = records;
      if (localList == null) {
        return;
      }
      try
      {
        for (LogRecord localLogRecord : localList)
        {
          if (localLogRecord.getMessage() != null) {
            paramAppendable.append(localLogRecord.getMessage()).append("\n");
          }
          if (localLogRecord.getThrown() != null)
          {
            StringWriter localStringWriter = new StringWriter();
            localLogRecord.getThrown().printStackTrace(new PrintWriter(localStringWriter));
            paramAppendable.append(localStringWriter.toString()).append("\n");
          }
        }
      }
      catch (IOException localIOException)
      {
        localIOException.printStackTrace();
      }
    }
  }
  
  private static final class OwnLevel
    extends Level
  {
    public static final Level USER = new OwnLevel("USER", 1973);
    public static final Level UNKNOWN = new OwnLevel("SEVERE", Level.SEVERE.intValue() + 1);
    
    private OwnLevel(String paramString, int paramInt)
    {
      super(paramInt);
    }
  }
}

/* Location:
 * Qualified Name:     org.openide.ErrorManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide;

final class LifecycleManager$Trivial
  extends LifecycleManager
{
  public void exit()
  {
    System.exit(0);
  }
  
  public void saveAll() {}
}

/* Location:
 * Qualified Name:     org.openide.LifecycleManager.Trivial
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide;

import org.openide.util.Lookup;

public abstract class LifecycleManager
{
  public static LifecycleManager getDefault()
  {
    Object localObject = (LifecycleManager)Lookup.getDefault().lookup(LifecycleManager.class);
    if (localObject == null) {
      localObject = new Trivial();
    }
    return (LifecycleManager)localObject;
  }
  
  public abstract void saveAll();
  
  public abstract void exit();
  
  public void markForRestart()
    throws UnsupportedOperationException
  {
    throw new UnsupportedOperationException();
  }
  
  private static final class Trivial
    extends LifecycleManager
  {
    public void exit()
    {
      System.exit(0);
    }
    
    public void saveAll() {}
  }
}

/* Location:
 * Qualified Name:     org.openide.LifecycleManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.openide;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openide.util.Lookup;
import org.openide.util.Utilities;

@Deprecated
public final class ServiceType$Handle
  implements Serializable
{
  static final long serialVersionUID = 7233109534462148872L;
  private String name;
  private String className;
  private transient ServiceType serviceType;
  
  public ServiceType$Handle(ServiceType paramServiceType)
  {
    name = paramServiceType.getName();
    className = paramServiceType.getClass().getName();
    serviceType = paramServiceType;
  }
  
  public ServiceType getServiceType()
  {
    if (serviceType == null)
    {
      Class localClass2;
      Class localClass1;
      try
      {
        localClass2 = Class.forName(className, true, (ClassLoader)Lookup.getDefault().lookup(ClassLoader.class));
        localClass1 = localClass2.asSubclass(ServiceType.class);
        while (localClass2.getSuperclass() != ServiceType.class) {
          localClass2 = localClass2.getSuperclass();
        }
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        ServiceType.access$000().log(Level.FINE, "Service not found", localClassNotFoundException);
        
        localClass1 = ServiceType.class;
        localClass2 = ServiceType.class;
      }
      ServiceType.Registry localRegistry = (ServiceType.Registry)Lookup.getDefault().lookup(ServiceType.Registry.class);
      Enumeration localEnumeration = localRegistry.services(localClass1);
      Object localObject = localRegistry.find(localClass1);
      while (localEnumeration.hasMoreElements())
      {
        ServiceType localServiceType = (ServiceType)localEnumeration.nextElement();
        if (localClass2.isInstance(localServiceType))
        {
          String str = localServiceType.getName();
          if ((str != null) && (str.equals(name))) {
            return localServiceType;
          }
          if ((localObject == null) || ((localObject.getClass() != localClass1) && (localServiceType.getClass() == localClass1))) {
            localObject = localServiceType;
          }
        }
      }
      if (localClass2 == ServiceType.class) {
        return null;
      }
      return (ServiceType)localObject;
    }
    return serviceType;
  }
  
  private void readObject(ObjectInputStream paramObjectInputStream)
    throws IOException, ClassNotFoundException
  {
    name = ((String)paramObjectInputStream.readObject());
    
    String str = (String)paramObjectInputStream.readObject();
    className = (str == null ? null : Utilities.translate(str));
  }
  
  private void writeObject(ObjectOutputStream paramObjectOutputStream)
    throws IOException
  {
    paramObjectOutputStream.writeObject(name);
    paramObjectOutputStream.writeObject(className);
  }
  
  public String toString()
  {
    return "Handle[" + className + ":" + name + "]";
  }
}

/* Location:
 * Qualified Name:     org
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

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-2017. Infinite Loop Ltd