unoloader

16:53:51.574 INFO  jd.cli.Main - Decompiling unoloader.jar
package com.sun.star.lib.unoloader;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.jar.Attributes;
import java.util.jar.Attributes.Name;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;

public final class UnoClassLoader
  extends URLClassLoader
{
  public UnoClassLoader(URL paramURL, URL[] paramArrayOfURL, ClassLoader paramClassLoader)
    throws MalformedURLException
  {
    super(createUrls(paramURL, paramArrayOfURL), paramClassLoader);
  }
  
  public ClassLoader getClassLoader(URL paramURL, Attributes paramAttributes)
    throws MalformedURLException
  {
    String str1 = paramAttributes == null ? null : paramAttributes.getValue("UNO-Type-Path");
    if (str1 == null) {
      str1 = "<>";
    }
    for (int i = 0; i < str1.length();)
    {
      while ((i < str1.length()) && (str1.charAt(i) == ' ')) {
        i++;
      }
      if (i < str1.length())
      {
        int j;
        String str2;
        if (str1.charAt(i) == '<')
        {
          j = str1.indexOf('>', i + 1);
          if (j < 0)
          {
            str2 = str1.substring(i + 1);
            i = str1.length();
          }
          else
          {
            str2 = str1.substring(i + 1, j);
            i = j + 1;
          }
        }
        else
        {
          j = str1.indexOf(' ', i + 1);
          if (j < 0) {
            j = str1.length();
          }
          str2 = str1.substring(i, j);
          i = j;
        }
        addURL(new URL(paramURL, str2));
      }
    }
    return URLClassLoader.newInstance(new URL[] { paramURL }, this);
  }
  
  public void execute(URL paramURL, String[] paramArrayOfString)
    throws IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException
  {
    Attributes localAttributes = getJarMainAttributes(paramURL);
    String str = localAttributes == null ? null : localAttributes.getValue(Attributes.Name.MAIN_CLASS);
    if (str == null) {
      throw new ClassNotFoundException(paramURL + " does not specify a main class");
    }
    try
    {
      getClassLoader(paramURL, localAttributes).loadClass(str.replace('/', '.')).getMethod("main", new Class[] { String[].class }).invoke(null, new Object[] { paramArrayOfString });
    }
    catch (IllegalAccessException localIllegalAccessException)
    {
      throw new RuntimeException("impossible " + localIllegalAccessException);
    }
  }
  
  public static Attributes getJarMainAttributes(URL paramURL)
    throws IOException
  {
    JarInputStream localJarInputStream = new JarInputStream(paramURL.openStream());
    Manifest localManifest;
    try
    {
      localManifest = localJarInputStream.getManifest();
    }
    finally
    {
      localJarInputStream.close();
    }
    return localManifest == null ? null : localManifest.getMainAttributes();
  }
  
  private static URL[] createUrls(URL paramURL, URL[] paramArrayOfURL)
    throws MalformedURLException
  {
    URL[] arrayOfURL = new URL[4 + (paramArrayOfURL == null ? 0 : paramArrayOfURL.length)];
    arrayOfURL[0] = new URL(paramURL, "java_uno.jar");
    arrayOfURL[1] = new URL(paramURL, "juh.jar");
    arrayOfURL[2] = new URL(paramURL, "jurt.jar");
    arrayOfURL[3] = new URL(paramURL, "ridl.jar");
    if (paramArrayOfURL != null) {
      System.arraycopy(paramArrayOfURL, 0, arrayOfURL, 4, paramArrayOfURL.length);
    }
    return arrayOfURL;
  }
}

/* Location:
 * Qualified Name:     com.sun.star.lib.unoloader.UnoClassLoader
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.lib.unoloader;

import java.net.MalformedURLException;
import java.net.URL;
import java.security.PrivilegedExceptionAction;

final class UnoLoader$1
  implements PrivilegedExceptionAction
{
  UnoLoader$1(URL paramURL) {}
  
  public Object run()
    throws MalformedURLException
  {
    return new UnoClassLoader(val$base, null, UnoLoader.class.getClassLoader());
  }
}

/* Location:
 * Qualified Name:     com.sun.star.lib.unoloader.UnoLoader.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.lib.unoloader;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;

public final class UnoLoader
{
  public static void execute(URL paramURL1, URL paramURL2, String[] paramArrayOfString)
    throws IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException
  {
    UnoClassLoader localUnoClassLoader;
    try
    {
      localUnoClassLoader = (UnoClassLoader)AccessController.doPrivileged(new PrivilegedExceptionAction()
      {
        public Object run()
          throws MalformedURLException
        {
          return new UnoClassLoader(val$base, null, UnoLoader.class.getClassLoader());
        }
      });
    }
    catch (PrivilegedActionException localPrivilegedActionException)
    {
      throw ((MalformedURLException)localPrivilegedActionException.getException());
    }
    localUnoClassLoader.execute(paramURL2, paramArrayOfString);
  }
}

/* Location:
 * Qualified Name:     com.sun.star.lib.unoloader.UnoLoader
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
1

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