Java Examples for java.lang.NoClassDefFoundError

The following java examples will help you to understand the usage of java.lang.NoClassDefFoundError. These source code samples are taken from different open source projects.

Example 1
Project: pluotsorbet-master  File: constructor.java View source code
/**
     * Runs the test using the specified harness.
     *
     * @param harness  the test harness (<code>null</code> not permitted).
     */
public void test(TestHarness harness) {
    NoClassDefFoundError error1 = new NoClassDefFoundError();
    harness.check(error1 != null);
    harness.check(error1.toString(), "java.lang.NoClassDefFoundError");
    NoClassDefFoundError error2 = new NoClassDefFoundError("nothing happens");
    harness.check(error2 != null);
    harness.check(error2.toString(), "java.lang.NoClassDefFoundError: nothing happens");
}
Example 2
Project: Tank-master  File: BaseResponseTest.java View source code
/**
     * Run the String getBody() method test.
     * 
     * @throws Exception
     * 
     * @generatedBy CodePro at 12/16/14 3:57 PM
     */
@Test
public void testGetBody_1() throws Exception {
    BaseResponse fixture = new MockResponse();
    fixture.responseTime = 1L;
    fixture.cookies = new HashMap<String, String>();
    fixture.httpCode = 1;
    fixture.response = "";
    fixture.responseByteArray = new byte[] {};
    fixture.rspMessage = "";
    fixture.headers = new HashMap<String, String>();
    fixture.responseLogMsg = "";
    String result = fixture.getBody();
    // An unexpected exception was thrown in user code while executing this test:
    // java.lang.NoClassDefFoundError: Could not initialize class com.intuit.tank.http.binary.TestResponse
    assertNotNull(result);
}
Example 3
Project: apkinspector-master  File: SynchronizerManager.java View source code
/** Creates a method which calls java.lang.Class.forName(String). 
     *
     * The method should look like the following:
<pre>
         .static java.lang.Class class$(java.lang.String)
         {
             java.lang.String r0, $r5;
             java.lang.ClassNotFoundException r1, $r3;
             java.lang.Class $r2;
             java.lang.NoClassDefFoundError $r4;

             r0 := @parameter0: java.lang.String;

         label0:
             $r2 = .staticinvoke <java.lang.Class: java.lang.Class forName(java.lang.String)>(r0);
             .return $r2;

         label1:
             $r3 := @caughtexception;
             r1 = $r3;
             $r4 = .new java.lang.NoClassDefFoundError;
             $r5 = .virtualinvoke r1.<java.lang.Throwable: java.lang.String getMessage()>();
             .specialinvoke $r4.<java.lang.NoClassDefFoundError: .void <init>(java.lang.String)>($r5);
             .throw $r4;

             .catch java.lang.ClassNotFoundException .from label0 .to label1 .with label1;
         }
</pre>
    */
public SootMethod createClassFetcherFor(SootClass c, String methodName) {
    // Create the method
    SootMethod method = new SootMethod(methodName, Arrays.asList(new Type[] { RefType.v("java.lang.String") }), RefType.v("java.lang.Class"), Modifier.STATIC);
    c.addMethod(method);
    // Create the method body
    {
        JimpleBody body = Jimple.v().newBody(method);
        method.setActiveBody(body);
        Chain units = body.getUnits();
        Local l_r0, l_r1, l_r2, l_r3, l_r4, l_r5;
        // Add some locals
        l_r0 = Jimple.v().newLocal("r0", RefType.v("java.lang.String"));
        l_r1 = Jimple.v().newLocal("r1", RefType.v("java.lang.ClassNotFoundException"));
        l_r2 = Jimple.v().newLocal("$r2", RefType.v("java.lang.Class"));
        l_r3 = Jimple.v().newLocal("$r3", RefType.v("java.lang.ClassNotFoundException"));
        l_r4 = Jimple.v().newLocal("$r4", RefType.v("java.lang.NoClassDefFoundError"));
        l_r5 = Jimple.v().newLocal("$r5", RefType.v("java.lang.String"));
        body.getLocals().add(l_r0);
        body.getLocals().add(l_r1);
        body.getLocals().add(l_r2);
        body.getLocals().add(l_r3);
        body.getLocals().add(l_r4);
        body.getLocals().add(l_r5);
        // add "r0 := @parameter0: java.lang.String"
        units.add(Jimple.v().newIdentityStmt(l_r0, Jimple.v().newParameterRef(RefType.v("java.lang.String"), 0)));
        // add "$r2 = .staticinvoke <java.lang.Class: java.lang.Class forName(java.lang.String)>(r0); 
        AssignStmt asi;
        units.add(asi = Jimple.v().newAssignStmt(l_r2, Jimple.v().newStaticInvokeExpr(Scene.v().getMethod("<java.lang.Class: java.lang.Class" + " forName(java.lang.String)>").makeRef(), Arrays.asList(new Value[] { l_r0 }))));
        // insert "return $r2;"
        units.add(Jimple.v().newReturnStmt(l_r2));
        // add "r3 := @caughtexception;"
        Stmt handlerStart;
        units.add(handlerStart = Jimple.v().newIdentityStmt(l_r3, Jimple.v().newCaughtExceptionRef()));
        // add "r1 = r3;"
        units.add(Jimple.v().newAssignStmt(l_r1, l_r3));
        // add "$r4 = .new java.lang.NoClassDefFoundError;"
        units.add(Jimple.v().newAssignStmt(l_r4, Jimple.v().newNewExpr(RefType.v("java.lang.NoClassDefFoundError"))));
        // add "$r5 = virtualinvoke r1.<java.lang.Throwable: java.lang.String getMessage()>();"
        units.add(Jimple.v().newAssignStmt(l_r5, Jimple.v().newVirtualInvokeExpr(l_r1, Scene.v().getMethod("<java.lang.Throwable: java.lang.String getMessage()>").makeRef(), new LinkedList())));
        // add .specialinvoke $r4.<java.lang.NoClassDefFoundError: .void <init>(java.lang.String)>($r5);
        units.add(Jimple.v().newInvokeStmt(Jimple.v().newSpecialInvokeExpr(l_r4, Scene.v().getMethod("<java.lang.NoClassDefFoundError: void" + " <init>(java.lang.String)>").makeRef(), Arrays.asList(new Value[] { l_r5 }))));
        // add .throw $r4;
        units.add(Jimple.v().newThrowStmt(l_r4));
        body.getTraps().add(Jimple.v().newTrap(Scene.v().getSootClass("java.lang.ClassNotFoundException"), asi, handlerStart, handlerStart));
    }
    return method;
}
Example 4
Project: sisu.inject-master  File: DeclaredMembersTest.java View source code
@Ignore("Need to replace some test archives")
public void ignoreResumableIteration() throws /* test */
ClassNotFoundException {
    final Iterator<Member> itr = new DeclaredMembers(Class.forName("Incomplete")).iterator();
    assertTrue(itr.hasNext());
    assertEquals("public Incomplete(java.lang.String)", itr.next().toString());
    try {
        itr.hasNext();
        fail("Expected NoClassDefFoundError");
    } catch (final NoClassDefFoundError e) {
        assertEquals("java.lang.NoClassDefFoundError: Param", e.toString());
    }
    assertTrue(itr.hasNext());
    assertEquals("public java.lang.String Incomplete.address", itr.next().toString());
    try {
        itr.hasNext();
        fail("Expected NoClassDefFoundError");
    } catch (final NoClassDefFoundError e) {
        assertEquals("java.lang.NoClassDefFoundError: Param", e.toString());
    }
    assertTrue(itr.hasNext());
    assertEquals("public void IncompleteBase.setName(java.lang.String)", itr.next().toString());
    assertFalse(itr.hasNext());
}
Example 5
Project: OmniscientDebugger-master  File: TestLoadClass.java View source code
public static void main(String args[]) {
    String cd = System.getProperty("INSTRUMENT");
    if (cd != null)
        Debugger.INSTRUMENT = true;
    else
        Debugger.INSTRUMENT = false;
    //new DebugifyingClassLoader();
    Debugger.classLoader = Thread.currentThread().getContextClassLoader();
    String className;
    Class clazz0 = null, clazz1 = null;
    Debugger.TRACE_LOADER = true;
    System.out.println("Test-loading classes " + Debugger.version);
    for (int i = 0; i < args.length; i++) {
        String classFile = args[i];
        if (!classFile.endsWith(".class")) {
            System.out.println("Not a class file?! " + classFile);
            continue;
        }
        try {
            JavaClass javaClass = new ClassParser(classFile).parse();
            className = javaClass.getClassName();
        } catch (IOException e) {
            System.out.println("Can't parse class??? " + classFile);
            e.printStackTrace();
            continue;
        }
        try {
            clazz0 = Debugger.classLoader.loadClass(className);
            clazz0.getDeclaredMethod("mainx", new Class[] {});
        } catch (NoSuchMethodException e) {
        } catch (java.lang.NoClassDefFoundError e) {
        } catch (Exception e) {
            System.err.println("****************Problem with " + className + " " + e);
            continue;
        } catch (Error e) {
            System.err.println("****************Problem with " + className + " " + e);
            continue;
        }
        //	    Debugger.INSTRUMENT = true;
        try {
            clazz1 = Debugger.classLoader.loadClass(className);
            clazz1.getDeclaredMethod("mainx", new Class[] {});
        } catch (NoSuchMethodException e) {
        } catch (java.lang.NoClassDefFoundError e) {
        } catch (Exception e) {
            System.err.println("****************Problem with " + className + " " + e);
            continue;
        } catch (Error e) {
            System.err.println("****************Problem with " + className + " " + e);
            continue;
        }
    //	    System.out.println("Test-loaded:  " + classFile);
    //	    System.out.println(clazz0 == clazz1);
    }
    System.out.println("Done.");
}
Example 6
Project: rhq-master  File: ModClusterDiscoveryComponent.java View source code
@SuppressWarnings("static-access")
private String findConfigurationFile(ResourceComponent parentResourceComponent) {
    try {
        if (parentResourceComponent instanceof ApplicationServerComponent) {
            ApplicationServerComponent parentComponent = (ApplicationServerComponent) parentResourceComponent;
            return parentComponent.getResourceContext().getPluginConfiguration().getSimple("serverHomeDir").getStringValue() + JBOSS_AS5_CONFIGURATION_FILE_RELATIVE_PATH;
        }
    } catch (java.lang.NoClassDefFoundError e) {
    }
    try {
        if (parentResourceComponent instanceof JBossASServerComponent) {
            JBossASServerComponent parentComponent = (JBossASServerComponent) parentResourceComponent;
            return parentComponent.getPluginConfiguration().getSimple(parentComponent.CONFIGURATION_PATH_CONFIG_PROP).getStringValue() + JBOSS_AS4_CONFIGURATION_FILE_RELATIVE_PATH;
        }
    } catch (java.lang.NoClassDefFoundError e) {
    }
    return null;
}
Example 7
Project: arddude-master  File: ReadPrefs.java View source code
private void loadIdeClass() {
    File coreJar = new File(arduinoIdePath, "lib" + File.separatorChar + "arduino-core.jar");
    try {
        logger.debug("adding in classpath core jar " + coreJar);
        ClassPathHacker.addFile(coreJar);
    } catch (IOException e) {
        logger.fatal("Can't find arduino IDE path", e);
        System.exit(1);
    }
    try {
        @SuppressWarnings("unused") Class<?> b = BaseNoGui.class;
        logger.debug("class BaseNoGui found");
    } catch (java.lang.NoClassDefFoundError e) {
        logger.fatal("Can't load arduino core class");
        System.exit(1);
    }
}
Example 8
Project: datanucleus-core-master  File: LoadClass.java View source code
/**
     * Method to add the contents of the class method.
     */
public void execute() {
    visitor.visitCode();
    Label l0 = new Label();
    Label l1 = new Label();
    Label l2 = new Label();
    visitor.visitTryCatchBlock(l0, l1, l2, "java/lang/ClassNotFoundException");
    visitor.visitLabel(l0);
    visitor.visitVarInsn(Opcodes.ALOAD, 0);
    visitor.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;");
    visitor.visitLabel(l1);
    visitor.visitInsn(Opcodes.ARETURN);
    visitor.visitLabel(l2);
    visitor.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] { "java/lang/ClassNotFoundException" });
    visitor.visitVarInsn(Opcodes.ASTORE, 1);
    Label l3 = new Label();
    visitor.visitLabel(l3);
    visitor.visitTypeInsn(Opcodes.NEW, "java/lang/NoClassDefFoundError");
    visitor.visitInsn(Opcodes.DUP);
    visitor.visitVarInsn(Opcodes.ALOAD, 1);
    visitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/ClassNotFoundException", "getMessage", "()Ljava/lang/String;");
    visitor.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/NoClassDefFoundError", "<init>", "(Ljava/lang/String;)V");
    visitor.visitInsn(Opcodes.ATHROW);
    Label l4 = new Label();
    visitor.visitLabel(l4);
    visitor.visitLocalVariable(argNames[0], "Ljava/lang/String;", null, l0, l4, 0);
    visitor.visitLocalVariable("e", "Ljava/lang/ClassNotFoundException;", null, l3, l4, 1);
    visitor.visitMaxs(3, 2);
    visitor.visitEnd();
}
Example 9
Project: geogebra-master  File: GeoGebraMenuBar.java View source code
/**
	 * Show the print preview dialog.
	 * 
	 * @param app
	 */
public static void showPrintPreview(final AppD app) {
    try {
        Thread runner = new Thread() {

            @Override
            public void run() {
                try {
                    app.setWaitCursor();
                    // use reflection for
                    // new geogebra.export.PrintPreview(app,
                    // app.getEuclidianView(), PageFormat.LANDSCAPE);
                    // Class classObject =
                    // Class.forName("geogebra.export.PrintPreview");
                    // Object[] args = new Object[] { app ,
                    // app.getEuclidianView(), new
                    // Integer(PageFormat.LANDSCAPE)};
                    // Class [] types = new Class[] {Application.class,
                    // Printable.class, int.class};
                    // Constructor constructor =
                    // classObject.getDeclaredConstructor(types);
                    // constructor.newInstance(args);
                    /*
						 * old code boolean printCAS=false; if
						 * (((GuiManagerD)app.getGuiManager()).hasCasView()){
						 * DockManager
						 * dm=((GuiManagerD)app.getGuiManager()).getLayout
						 * ().getDockManager(); //if CAS-view has Focus, print
						 * CAS if
						 * (dm.getFocusedPanel()==dm.getPanel(Application.
						 * VIEW_CAS)){ new geogebra.export.PrintPreview(app,
						 * ((GuiManagerD)app.getGuiManager()).getCasView(),
						 * PageFormat.LANDSCAPE); printCAS=true; } }
						 * 
						 * if (!printCAS) new geogebra.export.PrintPreview(app,
						 * app .getEuclidianView(), PageFormat.LANDSCAPE);
						 */
                    GuiManagerD gui = (GuiManagerD) app.getGuiManager();
                    DockManagerD dm = gui.getLayout().getDockManager();
                    int viewId = (dm.getFocusedPanel() == null) ? -1 : dm.getFocusedPanel().getViewId();
                    PrintPreviewD pre = PrintPreviewD.get(app, viewId, PageFormat.LANDSCAPE);
                    pre.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                    Log.debug("Print preview not available");
                } finally {
                    app.setDefaultCursor();
                }
            }
        };
        runner.start();
    } catch (java.lang.NoClassDefFoundError ee) {
        app.showError(app.getLocalization().getError("ExportJarMissing"));
        ee.printStackTrace();
    }
}
Example 10
Project: groovy-eclipse-master  File: Compliance_CLDC.java View source code
public void test002() throws Exception {
    this.runConformTest(new String[] { "X.java", "public class X {\n" + "\n" + "	public static void main(String[] args) {\n" + "			System.out.print(X.class != null);\n" + "			System.out.print(String.class != null);\n" + "			System.out.print(Object.class != null);\n" + "			System.out.print(X.class != null);\n" + "	}\n" + "}" }, "truetruetruetrue");
    String expectedOutput = "  // Method descriptor #20 ([Ljava/lang/String;)V\n" + "  // Stack: 3, Locals: 1\n" + "  public static void main(java.lang.String[] args);\n" + "      0  getstatic java.lang.System.out : java.io.PrintStream [21]\n" + "      3  getstatic X.class$0 : java.lang.Class [27]\n" + "      6  dup\n" + "      7  ifnonnull 35\n" + "     10  pop\n" + "     11  ldc <String \"X\"> [29]\n" + "     13  invokestatic java.lang.Class.forName(java.lang.String) : java.lang.Class [30]\n" + "     16  dup\n" + "     17  putstatic X.class$0 : java.lang.Class [27]\n" + "     20  goto 35\n" + "     23  new java.lang.NoClassDefFoundError [36]\n" + "     26  dup_x1\n" + "     27  swap\n" + "     28  invokevirtual java.lang.Throwable.getMessage() : java.lang.String [38]\n" + "     31  invokespecial java.lang.NoClassDefFoundError(java.lang.String) [44]\n" + "     34  athrow\n" + "     35  ifnull 42\n" + "     38  iconst_1\n" + "     39  goto 43\n" + "     42  iconst_0\n" + "     43  invokevirtual java.io.PrintStream.print(boolean) : void [47]\n" + "     46  getstatic java.lang.System.out : java.io.PrintStream [21]\n" + "     49  getstatic X.class$1 : java.lang.Class [53]\n" + "     52  dup\n" + "     53  ifnonnull 81\n" + "     56  pop\n" + "     57  ldc <String \"java.lang.String\"> [55]\n" + "     59  invokestatic java.lang.Class.forName(java.lang.String) : java.lang.Class [30]\n" + "     62  dup\n" + "     63  putstatic X.class$1 : java.lang.Class [53]\n" + "     66  goto 81\n" + "     69  new java.lang.NoClassDefFoundError [36]\n" + "     72  dup_x1\n" + "     73  swap\n" + "     74  invokevirtual java.lang.Throwable.getMessage() : java.lang.String [38]\n" + "     77  invokespecial java.lang.NoClassDefFoundError(java.lang.String) [44]\n" + "     80  athrow\n" + "     81  ifnull 88\n" + "     84  iconst_1\n" + "     85  goto 89\n" + "     88  iconst_0\n" + "     89  invokevirtual java.io.PrintStream.print(boolean) : void [47]\n" + "     92  getstatic java.lang.System.out : java.io.PrintStream [21]\n" + "     95  getstatic X.class$2 : java.lang.Class [57]\n" + "     98  dup\n" + "     99  ifnonnull 127\n" + "    102  pop\n" + "    103  ldc <String \"java.lang.Object\"> [59]\n" + "    105  invokestatic java.lang.Class.forName(java.lang.String) : java.lang.Class [30]\n" + "    108  dup\n" + "    109  putstatic X.class$2 : java.lang.Class [57]\n" + "    112  goto 127\n" + "    115  new java.lang.NoClassDefFoundError [36]\n" + "    118  dup_x1\n" + "    119  swap\n" + "    120  invokevirtual java.lang.Throwable.getMessage() : java.lang.String [38]\n" + "    123  invokespecial java.lang.NoClassDefFoundError(java.lang.String) [44]\n" + "    126  athrow\n" + "    127  ifnull 134\n" + "    130  iconst_1\n" + "    131  goto 135\n" + "    134  iconst_0\n" + "    135  invokevirtual java.io.PrintStream.print(boolean) : void [47]\n" + "    138  getstatic java.lang.System.out : java.io.PrintStream [21]\n" + "    141  getstatic X.class$0 : java.lang.Class [27]\n" + "    144  dup\n" + "    145  ifnonnull 173\n" + "    148  pop\n" + "    149  ldc <String \"X\"> [29]\n" + "    151  invokestatic java.lang.Class.forName(java.lang.String) : java.lang.Class [30]\n" + "    154  dup\n" + "    155  putstatic X.class$0 : java.lang.Class [27]\n" + "    158  goto 173\n" + "    161  new java.lang.NoClassDefFoundError [36]\n" + "    164  dup_x1\n" + "    165  swap\n" + "    166  invokevirtual java.lang.Throwable.getMessage() : java.lang.String [38]\n" + "    169  invokespecial java.lang.NoClassDefFoundError(java.lang.String) [44]\n" + "    172  athrow\n" + "    173  ifnull 180\n" + "    176  iconst_1\n" + "    177  goto 181\n" + "    180  iconst_0\n" + "    181  invokevirtual java.io.PrintStream.print(boolean) : void [47]\n" + "    184  return\n" + "      Exception Table:\n" + "        [pc: 11, pc: 16] -> 23 when : java.lang.ClassNotFoundException\n" + "        [pc: 57, pc: 62] -> 69 when : java.lang.ClassNotFoundException\n" + "        [pc: 103, pc: 108] -> 115 when : java.lang.ClassNotFoundException\n" + "        [pc: 149, pc: 154] -> 161 when : java.lang.ClassNotFoundException\n" + "      Line numbers:\n" + "        [pc: 0, line: 4]\n" + "        [pc: 46, line: 5]\n" + "        [pc: 92, line: 6]\n" + "        [pc: 138, line: 7]\n" + "        [pc: 184, line: 8]\n" + "      Local variable table:\n" + "        [pc: 0, pc: 185] local: args index: 0 type: java.lang.String[]\n" + "      Stack map : number of frames 16\n" + "        [pc: 23, full, stack: {java.lang.ClassNotFoundException}, locals: {java.lang.String[]}]\n" + "        [pc: 35, full, stack: {java.io.PrintStream, java.lang.Class}, locals: {java.lang.String[]}]\n" + "        [pc: 42, full, stack: {java.io.PrintStream}, locals: {java.lang.String[]}]\n" + "        [pc: 43, full, stack: {java.io.PrintStream, int}, locals: {java.lang.String[]}]\n" + "        [pc: 69, full, stack: {java.lang.ClassNotFoundException}, locals: {java.lang.String[]}]\n" + "        [pc: 81, full, stack: {java.io.PrintStream, java.lang.Class}, locals: {java.lang.String[]}]\n" + "        [pc: 88, full, stack: {java.io.PrintStream}, locals: {java.lang.String[]}]\n" + "        [pc: 89, full, stack: {java.io.PrintStream, int}, locals: {java.lang.String[]}]\n" + "        [pc: 115, full, stack: {java.lang.ClassNotFoundException}, locals: {java.lang.String[]}]\n" + "        [pc: 127, full, stack: {java.io.PrintStream, java.lang.Class}, locals: {java.lang.String[]}]\n" + "        [pc: 134, full, stack: {java.io.PrintStream}, locals: {java.lang.String[]}]\n" + "        [pc: 135, full, stack: {java.io.PrintStream, int}, locals: {java.lang.String[]}]\n" + "        [pc: 161, full, stack: {java.lang.ClassNotFoundException}, locals: {java.lang.String[]}]\n" + "        [pc: 173, full, stack: {java.io.PrintStream, java.lang.Class}, locals: {java.lang.String[]}]\n" + "        [pc: 180, full, stack: {java.io.PrintStream}, locals: {java.lang.String[]}]\n" + "        [pc: 181, full, stack: {java.io.PrintStream, int}, locals: {java.lang.String[]}]\n";
    checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
}
Example 11
Project: eclipse.jdt.core-master  File: CodeStream.java View source code
/**
 * Macro for building a class descriptor object
 */
public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
    Label endLabel;
    ExceptionLabel anyExceptionHandler;
    int saveStackSize;
    if (accessedType.isBaseType() && accessedType != NullBinding) {
        this.getTYPE(accessedType.id);
        return;
    }
    if (this.targetLevel >= ClassFileConstants.JDK1_5) {
        // generation using the new ldc_w bytecode
        this.ldc(accessedType);
    } else {
        endLabel = new Label(this);
        if (// non interface case
        syntheticFieldBinding != null) {
            this.getstatic(syntheticFieldBinding);
            this.dup();
            this.ifnonnull(endLabel);
            this.pop();
        }
        /* Macro for building a class descriptor object... using or not a field cache to store it into...
		this sequence is responsible for building the actual class descriptor.
		
		If the fieldCache is set, then it is supposed to be the body of a synthetic access method
		factoring the actual descriptor creation out of the invocation site (saving space).
		If the fieldCache is nil, then we are dumping the bytecode on the invocation site, since
		we have no way to get a hand on the field cache to do better. */
        // Wrap the code in an exception handler to convert a ClassNotFoundException into a NoClassDefError
        anyExceptionHandler = new ExceptionLabel(this, BaseTypes.NullBinding);
        //$NON-NLS-1$
        this.ldc(accessedType == BaseTypes.NullBinding ? "java.lang.Object" : String.valueOf(accessedType.constantPoolName()).replace('/', '.'));
        this.invokeClassForName();
        /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=37565
		if (accessedType == BaseTypes.NullBinding) {
			this.ldc("java.lang.Object"); //$NON-NLS-1$
		} else if (accessedType.isArrayType()) {
			this.ldc(String.valueOf(accessedType.constantPoolName()).replace('/', '.'));
		} else {
			// we make it an array type (to avoid class initialization)
			this.ldc("[L" + String.valueOf(accessedType.constantPoolName()).replace('/', '.') + ";"); //$NON-NLS-1$//$NON-NLS-2$
		}
		this.invokeClassForName();
		if (!accessedType.isArrayType()) { // extract the component type, which doesn't initialize the class
			this.invokeJavaLangClassGetComponentType();
		}	
		*/
        /* We need to protect the runtime code from binary inconsistencies
		in case the accessedType is missing, the ClassNotFoundException has to be converted
		into a NoClassDefError(old ex message), we thus need to build an exception handler for this one. */
        anyExceptionHandler.placeEnd();
        if (// non interface case
        syntheticFieldBinding != null) {
            this.dup();
            this.putstatic(syntheticFieldBinding);
        }
        this.goto_(endLabel);
        // Generate the body of the exception handler
        saveStackSize = stackDepth;
        stackDepth = 1;
        /* ClassNotFoundException on stack -- the class literal could be doing more things
		on the stack, which means that the stack may not be empty at this point in the
		above code gen. So we save its state and restart it from 1. */
        anyExceptionHandler.place();
        // Transform the current exception, and repush and throw a 
        // NoClassDefFoundError(ClassNotFound.getMessage())
        this.newNoClassDefFoundError();
        this.dup_x1();
        this.swap();
        // Retrieve the message from the old exception
        this.invokeThrowableGetMessage();
        // Send the constructor taking a message string as an argument
        this.invokeNoClassDefFoundErrorStringConstructor();
        this.athrow();
        stackDepth = saveStackSize;
        endLabel.place();
    }
}
Example 12
Project: surefire-master  File: AbstractSurefireMojo.java View source code
private void warnIfNotApplicableSkipAfterFailureCount() throws MojoFailureException {
    int skipAfterFailureCount = getSkipAfterFailureCount();
    if (skipAfterFailureCount < 0) {
        throw new MojoFailureException("Parameter \"skipAfterFailureCount\" should not be negative.");
    } else if (skipAfterFailureCount > 0) {
        try {
            Artifact testng = getTestNgArtifact();
            if (testng != null) {
                VersionRange range = VersionRange.createFromVersionSpec("[5.10,)");
                if (!range.containsVersion(new DefaultArtifactVersion(testng.getVersion()))) {
                    throw new MojoFailureException("Parameter \"skipAfterFailureCount\" expects TestNG Version 5.10 or higher. " + "java.lang.NoClassDefFoundError: org/testng/IInvokedMethodListener");
                }
            } else {
                // TestNG is dependent on JUnit
                Artifact junit = getJunitArtifact();
                if (junit != null) {
                    VersionRange range = VersionRange.createFromVersionSpec("[4.0,)");
                    if (!range.containsVersion(new DefaultArtifactVersion(junit.getVersion()))) {
                        throw new MojoFailureException("Parameter \"skipAfterFailureCount\" expects JUnit Version 4.0 or higher. " + "java.lang.NoSuchMethodError: " + "org.junit.runner.notification.RunNotifier.pleaseStop()V");
                    }
                }
            }
        } catch (MojoExecutionException e) {
            throw new MojoFailureException(e.getLocalizedMessage());
        } catch (InvalidVersionSpecificationException e) {
            throw new RuntimeException(e);
        }
    }
}
Example 13
Project: odo-master  File: PluginManager.java View source code
/**
     * This is used to pass all the methods into the model for editGroup
     * (mostly just for testing and seeing how things work for now)
     * gets all the methods so that i can pass them in as an attribute to our model
     *
     * @return List of all Methods
     * @throws Exception exception
     */
public List<com.groupon.odo.proxylib.models.Method> getAllMethods() throws Exception {
    ArrayList<com.groupon.odo.proxylib.models.Method> methods = new ArrayList<com.groupon.odo.proxylib.models.Method>();
    String[] classes = getPluginClasses();
    for (int i = 0; i < classes.length; i++) {
        try {
            String[] methodNames = getMethods(classes[i]);
            for (int j = 0; j < methodNames.length; j++) {
                com.groupon.odo.proxylib.models.Method method = getMethod(classes[i], methodNames[j]);
                methods.add(method);
            }
        } catch (java.lang.NoClassDefFoundError e) {
        } catch (java.lang.ClassNotFoundException e) {
        }
    }
    return methods;
}
Example 14
Project: phoneme-components-cdc-master  File: Test2.java View source code
public void run() {
    System.out.println("Try to access JSR 135 classes using reflection ...");
    try {
        Class p = Class.forName("javax.microedition.media.PlayerPermission");
        System.out.println("Fail.");
    } catch (java.lang.ClassNotFoundException e) {
        System.out.println("Pass.");
    } catch (java.lang.NoClassDefFoundError e) {
        System.out.println("Pass.");
    }
}
Example 15
Project: RoboBinding-master  File: ViewBindingProcessor.java View source code
private void generateViewBindingObjectSourceFile(ViewBindingInfo info, Logger log) throws IOException, JClassAlreadyExistsException, ClassNotFoundException {
    try {
        ViewBindingObjectClassGen gen = new ViewBindingObjectClassGen(info);
        run(gen);
        gen.writeTo(createOutput());
        log.info("ViewBinding '" + info.viewBindingObjectTypeName() + "' generated.");
    } catch (java.lang.NoClassDefFoundError e) {
        RuntimeException error = new RuntimeException("an error occured when generating source code for '" + info.viewBindingObjectTypeName() + "'", e);
        log.error(error);
        throw error;
    }
}
Example 16
Project: openjdk-master  File: CompileTheWorld.java View source code
/**
     * Entry point. Compiles classes in {@code paths}
     *
     * @param paths paths to jar/zip, dir contains classes, or to .lst file
     *              contains list of classes to compile
     */
public static void main(String[] paths) {
    if (paths.length == 0) {
        throw new IllegalArgumentException("Expect a path to a compile target.");
    }
    String logfile = Utils.LOG_FILE;
    PrintStream os = null;
    if (logfile != null) {
        try {
            os = new PrintStream(Files.newOutputStream(Paths.get(logfile)));
        } catch (IOException io) {
        }
    }
    if (os != null) {
        OUT = os;
    }
    try {
        try {
            if (ManagementFactory.getCompilationMXBean() == null) {
                throw new RuntimeException("CTW can not work in interpreted mode");
            }
        } catch (java.lang.NoClassDefFoundError e) {
        }
        ExecutorService executor = createExecutor();
        long start = System.currentTimeMillis();
        try {
            String path;
            for (int i = 0, n = paths.length; i < n && !PathHandler.isFinished(); ++i) {
                path = paths[i];
                PathHandler.create(path, executor).process();
            }
        } finally {
            await(executor);
        }
        CompileTheWorld.OUT.printf("Done (%d classes, %d methods, %d ms)%n", PathHandler.getClassCount(), Compiler.getMethodCount(), System.currentTimeMillis() - start);
    } finally {
        if (os != null) {
            os.close();
        }
    }
}
Example 17
Project: ACaZoo-master  File: SnappyCompressor.java View source code
public static boolean isAvailable() {
    try {
        create(Collections.<String, String>emptyMap());
        return true;
    } catch (Exception e) {
        return false;
    } catch (NoClassDefFoundError e) {
        return false;
    } catch (SnappyError e) {
        return false;
    } catch (UnsatisfiedLinkError e) {
        return false;
    }
}
Example 18
Project: docx4j-master  File: NamespacePrefixMapperUtils.java View source code
public static Object getPrefixMapper() throws JAXBException {
    if (prefixMapper != null)
        return prefixMapper;
    if (haveTried)
        return null;
    // will be true soon..
    haveTried = true;
    if (testContext == null) {
        java.lang.ClassLoader classLoader = NamespacePrefixMapperUtils.class.getClassLoader();
        testContext = JAXBContext.newInstance("org.docx4j.relationships", classLoader);
    }
    if (testContext == null) {
        throw new JAXBException("Couldn't create context for org.docx4j.relationships.  Everything is broken!");
    }
    Marshaller m = testContext.createMarshaller();
    if (System.getProperty("java.vendor").contains("Android")) {
        // Avoid unwanted Android logging; art logs the full ClassNotFoundException 
        log.info("Android .. assuming RI.");
        return tryUsingRI(m);
    }
    try {
        // Assume use of Java 6 implementation (ie not RI)
        Class c = Class.forName("org.docx4j.jaxb.NamespacePrefixMapperSunInternal");
        m.setProperty("com.sun.xml.internal.bind.namespacePrefixMapper", c.newInstance());
        log.info("Using NamespacePrefixMapperSunInternal, which is suitable for Java 6");
        prefixMapper = c.newInstance();
        return prefixMapper;
    } catch (java.lang.NoClassDefFoundError notJava6) {
        log.warn(notJava6.getMessage() + " .. trying RI.");
        return tryUsingRI(m);
    } catch (javax.xml.bind.PropertyException notJava6) {
        log.warn(notJava6.getMessage() + " .. trying RI.");
        return tryUsingRI(m);
    } catch (ClassNotFoundException notJava6) {
        log.warn(notJava6.getMessage() + " .. trying RI.");
        return tryUsingRI(m);
    } catch (InstantiationException notJava6) {
        log.warn(notJava6.getMessage() + " .. trying RI.");
        return tryUsingRI(m);
    } catch (IllegalAccessException notJava6) {
        log.warn(notJava6.getMessage() + " .. trying RI.");
        return tryUsingRI(m);
    }
}
Example 19
Project: HBuilder-opensource-master  File: ClassLiteral.java View source code
public static Class getClass(String className) {
    synchronized (classes) {
        Class c = (Class) classes.get(className);
        if (c != null) {
            return c;
        }
    }
    try {
        Class c = Class.forName(className.replace('/', '.'));
        synchronized (classes) {
            classes.put(className, c);
        }
        return c;
    } catch (ClassNotFoundException e) {
        throw new NoClassDefFoundError(e.getMessage());
    }
}
Example 20
Project: mockey-master  File: PluginStore.java View source code
/**
	 * 
	 * @param className
	 * @return Instance of a Class with 'className, if implements
	 *         <code>IRequestInspector</code>, otherwise returns null.
	 */
private Class<?> doesThisImplementIRequestInspector(String className) {
    try {
        try {
            // HACK:
            Class<?> xx = Class.forName(className);
            if (!xx.getName().equalsIgnoreCase(RequestInspectorDefinedByJson.class.getName()) && (!xx.isInterface() && IRequestInspector.class.isAssignableFrom(xx))) {
                return xx;
            }
        } catch (ClassNotFoundException e) {
            Class<?> xx = ClassLoader.getSystemClassLoader().loadClass(className);
            if (!xx.isInterface() && IRequestInspector.class.isAssignableFrom(xx)) {
                return xx;
            }
        }
    } catch (java.lang.NoClassDefFoundError classDefNotFound) {
        logger.debug("Unable to create class: " + className + "; reason: java.lang.NoClassDefFoundError");
    } catch (Exception e) {
        logger.error("Unable to create an instance of a class w/ name " + className, e);
    }
    return null;
}
Example 21
Project: geode-master  File: AbstractLauncherTest.java View source code
@Test
public void testIsAttachAPINotFound() {
    final AbstractLauncher<?> launcher = createAbstractLauncher("012", "TestMember");
    assertTrue(launcher.isAttachAPINotFound(new NoClassDefFoundError("Exception in thread \"main\" java.lang.NoClassDefFoundError: com/sun/tools/attach/AttachNotSupportedException")));
    assertTrue(launcher.isAttachAPINotFound(new ClassNotFoundException("Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException")));
    assertTrue(launcher.isAttachAPINotFound(new NoClassDefFoundError("Exception in thread \"main\" java.lang.NoClassDefFoundError: com/ibm/tools/attach/AgentNotSupportedException")));
    assertTrue(launcher.isAttachAPINotFound(new ClassNotFoundException("Caused by: java.lang.ClassNotFoundException: com.ibm.tools.attach.AgentNotSupportedException")));
    assertFalse(launcher.isAttachAPINotFound(new IllegalArgumentException("Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.AttachNotSupportedException")));
    assertFalse(launcher.isAttachAPINotFound(new IllegalStateException("Caused by: java.lang.ClassNotFoundException: com.ibm.tools.attach.AgentNotSupportedException")));
    assertFalse(launcher.isAttachAPINotFound(new NoClassDefFoundError("Exception in thread \"main\" java.lang.NoClassDefFoundError: com/companyx/app/service/MyServiceClass")));
    assertFalse(launcher.isAttachAPINotFound(new ClassNotFoundException("Caused by: java.lang.ClassNotFoundException: com.companyx.app.attach.NutsNotAttachedException")));
}
Example 22
Project: BETaaS_Platform-Tools-master  File: InternalAPIImpl.java View source code
/** 
	 * @return the object that implements the TaaSRM interface 
	 */
private TaaSResourceManager getResourceManagerIF() {
    if (mContext == null)
        return null;
    try {
        ServiceReference ref = mContext.getServiceReference(TaaSResourceManager.class.getName());
        if (ref != null) {
            return ((TaaSResourceManager) mContext.getService(ref));
        }
    } catch (java.lang.NoClassDefFoundError e) {
        mLogger.error("No class definition found for TaaSRM");
        return null;
    } catch (Exception e) {
        mLogger.error("TaaSRM not available: " + e.getMessage());
        return null;
    }
    return null;
}
Example 23
Project: JOML-master  File: Java6to2.java View source code
/**
             * Generates the synthetic "class$" method, used to lookup classes via Class.forName(). This uses the exact same code as does JDK8 javac for target 1.2.
             */
void generateSyntheticClassLookupMethod() {
    MethodVisitor mv = cv.visitMethod(ACC_PRIVATE | ACC_STATIC | ACC_SYNTHETIC, "class$", "(Ljava/lang/String;)Ljava/lang/Class;", null, null);
    {
        Label start = new Label();
        Label end = new Label();
        Label handler = new Label();
        mv.visitTryCatchBlock(start, end, handler, "java/lang/ClassNotFoundException");
        mv.visitLabel(start);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESTATIC, "java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;", false);
        mv.visitLabel(end);
        mv.visitInsn(ARETURN);
        mv.visitLabel(handler);
        mv.visitVarInsn(ASTORE, 1);
        mv.visitTypeInsn(NEW, "java/lang/NoClassDefFoundError");
        mv.visitInsn(DUP);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NoClassDefFoundError", "<init>", "()V", false);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/NoClassDefFoundError", "initCause", "(Ljava/lang/Throwable;)Ljava/lang/Throwable;", false);
        mv.visitInsn(ATHROW);
    }
    mv.visitMaxs(2, 2);
    mv.visitEnd();
}
Example 24
Project: javasec-master  File: RmPathHelper.java View source code
/**
	 * 功能: 获得war目录。默认从缓存Servlet上下文取,如没有直接取RmGlobalReference所在目录(后者适用于开发环境)
	 * 
	 * @return
	 */
public static File getWarDir() {
    File result = null;
    try {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        if (cl == null) {
            cl = ClassLoader.getSystemClassLoader();
        }
        Class clz = cl.loadClass("org.quickbundle.config.RmLoadConfig");
        Method customMethod = clz.getDeclaredMethod("getWarDirCustom", new Class[] {});
        if (customMethod != null) {
            result = (File) customMethod.invoke(null, new Object[] {});
        }
    } catch (java.lang.NoSuchMethodException e) {
    } catch (java.lang.ClassNotFoundException e) {
    } catch (java.lang.NoClassDefFoundError e) {
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
    if (result != null) {
        return result;
    }
    String defaultRealPath = null;
    try {
        defaultRealPath = RmHolderServlet.getDefaultRealPath("/");
    } catch (java.lang.NoClassDefFoundError e) {
    }
    if (defaultRealPath != null) {
        return new File(defaultRealPath);
    }
    File fileClasses = new File(getClassRootPath(RmBaseConfig.class));
    if (fileClasses.toString().indexOf("WEB-INF") > -1) {
        return findParentDir(fileClasses, "WEB-INF").getParentFile();
    } else if (fileClasses.toString().indexOf("target/test-classes") > -1) {
        return findParentDirContainerFile(fileClasses, "WEB-INF");
    }
    return null;
}
Example 25
Project: unravl-master  File: JsonBodyAssertion.java View source code
@Override
public void check(UnRAVL current, ObjectNode assertion, Stage when, ApiCall call) throws UnRAVLAssertionException, UnRAVLException {
    super.check(current, assertion, when, call);
    JsonNode expected = Json.firstFieldValue(assertion);
    ObjectMapper mapper = new ObjectMapper();
    String content;
    try {
        content = current.expand(Text.utf8ToString(call.getResponseBody().toByteArray()));
        JsonNode actual = mapper.readTree(content);
        JsonNode mapped = Json.expand(actual, current);
        expected = realize(expected, mapper);
        boolean same = mapped.equals(expected);
        if (!same)
            throw new UnRAVLAssertionException("Response body does not match expected. Received:" + actual);
    } catch (JsonProcessingException e) {
        throw new UnRAVLException("Could not parse response body as JSON: " + e.getMessage(), e);
    } catch (IOException e) {
        throw new UnRAVLException("Could not parse response body as JSON: " + e.getMessage(), e);
    }
// Following JSONAssert fails - I get java.lang.NoClassDefFoundError:
// org/skyscreamer/jsonassert/JSONAssert
// even though it is right here...
// Bummer, JSONAssert uses org.json.JSONObject, not Jackson JsonNode
// So I'll convert to string then compare with JSONAssert
// String expected = expectedj.toString();
// String body = new String(current.responseBody().toByteArray());
// try {
// // TODO: add additional fields to control the strictness,
// // maybe to ignore some values?
// JSONAssert.assertEquals(expected, body, false);
// } catch (JSONException e) {
// throw new UnravlAssertionException(e.getMessage(), e);
// }
}
Example 26
Project: opencit-master  File: StartHttpServer.java View source code
protected ServerConnector createTlsConnector(Server server) {
    HttpConfiguration httpsConfig = new HttpConfiguration();
    //        httpConfig.setSecurePort(configuration.getTrustagentHttpTlsPort()); // only need on an http connection to inform client where to connect with https
    httpsConfig.setOutputBufferSize(32768);
    httpsConfig.addCustomizer(new SecureRequestCustomizer());
    SslContextFactory sslContextFactory = new SslContextFactory();
    sslContextFactory.setKeyStorePath(configuration.getTrustagentKeystoreFile().getAbsolutePath());
    sslContextFactory.setKeyStorePassword(configuration.getTrustagentKeystorePassword());
    sslContextFactory.setTrustStorePath(configuration.getTrustagentKeystoreFile().getAbsolutePath());
    sslContextFactory.setTrustStorePassword(configuration.getTrustagentKeystorePassword());
    sslContextFactory.addExcludeProtocols("SSL", "SSLv2", "SSLv3");
    // fixes this error in mtwilson java.lang.NoClassDefFoundError: org/bouncycastle/jce/spec/ECPublicKeySpec by limiting our supported tls ciphers to RSA ciphers
    sslContextFactory.setExcludeProtocols("SSL", "SSLv2", "SSLv2Hello", "SSLv3");
    sslContextFactory.setIncludeCipherSuites("TLS_DHE_RSA.*", "TLS_ECDHE.*");
    sslContextFactory.setExcludeCipherSuites(".*NULL.*", ".*RC4.*", ".*MD5.*", ".*DES.*", ".*DSS.*");
    sslContextFactory.setRenegotiationAllowed(false);
    ServerConnector https = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(httpsConfig));
    https.setPort(configuration.getTrustagentHttpTlsPort());
    https.setIdleTimeout(1000000);
    return https;
}
Example 27
Project: gocd-master  File: LogParserTest.java View source code
@Test
public void testCanReadError() throws Exception {
    LogFile logFile = new LogFile(DataUtils.getFailedBuildLbuildAsFile().getFile());
    boolean isPassed = false;
    Map map = logParser.parseLogFile(logFile, isPassed);
    List suites = getTestSuites(map);
    BuildTestSuite firstSuite = (BuildTestSuite) suites.get(0);
    List erroringTestCases = firstSuite.getErrorTestCases();
    assertThat(erroringTestCases.size(), is(1));
    BuildTestCase erroredTest = (BuildTestCase) erroringTestCases.get(0);
    String expectedClassName = "net.sourceforge.cruisecontrol.sampleproject.connectfour.PlayingStandTest";
    String expectedNoClassDefFoundError = "java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor";
    String exptectedClassPath = "at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:165)";
    assertThat(erroredTest.getClassname(), is(expectedClassName));
    assertThat(erroredTest.getDuration(), is("0.016"));
    assertThat(erroredTest.getName(), is("testFourConnected"));
    assertThat(erroredTest.didError(), is(true));
    assertThat(erroredTest.getMessage(), is("org/objectweb/asm/CodeVisitor"));
    assertThat(erroredTest.getMessageBody(), containsString(expectedNoClassDefFoundError));
    assertThat(erroredTest.getMessageBody(), containsString(exptectedClassPath));
}
Example 28
Project: sheepit-client-master  File: Linux.java View source code
@Override
public CPU getCPU() {
    CPU ret = new CPU();
    try {
        String filePath = "/proc/cpuinfo";
        Scanner scanner = new Scanner(new File(filePath));
        while (scanner.hasNextLine()) {
            String line = scanner.nextLine();
            if (line.startsWith("model name")) {
                String buf[] = line.split(":");
                if (buf.length > 1) {
                    ret.setName(buf[1].trim());
                }
            }
            if (line.startsWith("cpu family")) {
                String buf[] = line.split(":");
                if (buf.length > 1) {
                    ret.setFamily(buf[1].trim());
                }
            }
            if (line.startsWith("model") && line.startsWith("model name") == false) {
                String buf[] = line.split(":");
                if (buf.length > 1) {
                    ret.setModel(buf[1].trim());
                }
            }
        }
        scanner.close();
    } catch (java.lang.NoClassDefFoundError e) {
        System.err.println("OS.Linux::getCPU error " + e + " mostly because Scanner class was introduced by Java 5 and you are running a lower version");
    } catch (Exception e) {
        e.printStackTrace();
    }
    return ret;
}
Example 29
Project: scout-master  File: ClassOptimizer.java View source code
@Override
public void visitEnd() {
    if (syntheticClassFields.isEmpty()) {
        if (hasClinitMethod) {
            MethodVisitor mv = cv.visitMethod(Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC, "_clinit_", "()V", null, null);
            mv.visitCode();
            mv.visitInsn(Opcodes.RETURN);
            mv.visitMaxs(0, 0);
            mv.visitEnd();
        }
    } else {
        MethodVisitor mv = cv.visitMethod(Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC, "class$", "(Ljava/lang/String;)Ljava/lang/Class;", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        Label l2 = new Label();
        mv.visitTryCatchBlock(l0, l1, l2, "java/lang/ClassNotFoundException");
        mv.visitLabel(l0);
        mv.visitVarInsn(Opcodes.ALOAD, 0);
        mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;", false);
        mv.visitLabel(l1);
        mv.visitInsn(Opcodes.ARETURN);
        mv.visitLabel(l2);
        mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/ClassNotFoundException", "getMessage", "()Ljava/lang/String;", false);
        mv.visitVarInsn(Opcodes.ASTORE, 1);
        mv.visitTypeInsn(Opcodes.NEW, "java/lang/NoClassDefFoundError");
        mv.visitInsn(Opcodes.DUP);
        mv.visitVarInsn(Opcodes.ALOAD, 1);
        mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/NoClassDefFoundError", "<init>", "(Ljava/lang/String;)V", false);
        mv.visitInsn(Opcodes.ATHROW);
        mv.visitMaxs(3, 2);
        mv.visitEnd();
        if (hasClinitMethod) {
            mv = cv.visitMethod(Opcodes.ACC_STATIC | Opcodes.ACC_PRIVATE, "_clinit_", "()V", null, null);
        } else {
            mv = cv.visitMethod(Opcodes.ACC_STATIC, "<clinit>", "()V", null, null);
        }
        for (String ldcName : syntheticClassFields) {
            String fieldName = "class$" + ldcName.replace('/', '$');
            mv.visitLdcInsn(ldcName.replace('/', '.'));
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, clsName, "class$", "(Ljava/lang/String;)Ljava/lang/Class;", false);
            mv.visitFieldInsn(Opcodes.PUTSTATIC, clsName, fieldName, "Ljava/lang/Class;");
        }
        mv.visitInsn(Opcodes.RETURN);
        mv.visitMaxs(1, 0);
        mv.visitEnd();
    }
    super.visitEnd();
}
Example 30
Project: rife-master  File: MethodOptimizer.java View source code
@Override
public void visitLdcInsn(Object cst) {
    if (!(cst instanceof Type)) {
        super.visitLdcInsn(cst);
        return;
    }
    // transform Foo.class to foo$(class) for 1.2 compatibility
    String ldcName = ((Type) cst).getInternalName();
    String fieldName = "class$" + ldcName.replace('/', '$');
    FieldVisitor fv = classOptimizer.syntheticFieldVisitor(ACC_STATIC | ACC_SYNTHETIC, fieldName, "Ljava/lang/Class;");
    fv.visitEnd();
    if (!classOptimizer.class$) {
        MethodVisitor mv = classOptimizer.visitMethod(ACC_STATIC | ACC_SYNTHETIC, "class$", "(Ljava/lang/String;)Ljava/lang/Class;", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        Label l2 = new Label();
        mv.visitTryCatchBlock(l0, l1, l2, "java/lang/ClassNotFoundException");
        mv.visitLabel(l0);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESTATIC, "java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;");
        mv.visitLabel(l1);
        mv.visitInsn(ARETURN);
        mv.visitLabel(l2);
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/ClassNotFoundException", "getMessage", "()Ljava/lang/String;");
        mv.visitVarInsn(ASTORE, 1);
        mv.visitTypeInsn(NEW, "java/lang/NoClassDefFoundError");
        mv.visitInsn(DUP);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NoClassDefFoundError", "<init>", "(Ljava/lang/String;)V");
        mv.visitInsn(ATHROW);
        mv.visitMaxs(3, 2);
        mv.visitEnd();
        classOptimizer.class$ = true;
    }
    String clsName = classOptimizer.clsName;
    mv.visitFieldInsn(GETSTATIC, clsName, fieldName, "Ljava/lang/Class;");
    Label elseLabel = new Label();
    mv.visitJumpInsn(IFNONNULL, elseLabel);
    mv.visitLdcInsn(ldcName.replace('/', '.'));
    mv.visitMethodInsn(INVOKESTATIC, clsName, "class$", "(Ljava/lang/String;)Ljava/lang/Class;");
    mv.visitInsn(DUP);
    mv.visitFieldInsn(PUTSTATIC, clsName, fieldName, "Ljava/lang/Class;");
    Label endLabel = new Label();
    mv.visitJumpInsn(GOTO, endLabel);
    mv.visitLabel(elseLabel);
    mv.visitFieldInsn(GETSTATIC, clsName, fieldName, "Ljava/lang/Class;");
    mv.visitLabel(endLabel);
}
Example 31
Project: java-driver-master  File: Activator.java View source code
@Override
public void stop(BundleContext context) throws Exception {
    if (cluster != null) {
        cluster.close();
        /*
            Allow Netty ThreadDeathWatcher to terminate;
            unfortunately we can't explicitly call ThreadDeathWatcher.awaitInactivity()
            because Netty could be shaded.
            If this thread isn't terminated when this bundle is closed,
            we could get exceptions such as this one:
            Exception in thread "threadDeathWatcher-2-1" java.lang.NoClassDefFoundError: xxx
            Caused by: java.lang.ClassNotFoundException: Unable to load class 'xxx' because the bundle wiring for xxx is no longer valid.
            Although ugly, they are harmless and can be safely ignored.
            */
        Thread.sleep(1000);
    }
}
Example 32
Project: mm8leveleditor-master  File: WavHandler.java View source code
public Component getComponentFor(LodResource lodResource, TaskObserver taskObserver) {
    Component component = null;
    byte byteData[] = null;
    try {
        byteData = lodResource.getData();
        bytearrayinputstream = new ByteArrayInputStream(byteData);
        JPanel parentPanel = new JPanel();
        panel = new Panel();
        parentPanel.add(panel);
        component = parentPanel;
    } catch (Exception exception) {
        component = new JLabel(exception.getMessage());
    }
    JPanel contentPanel = new JPanel(new BorderLayout());
    JTextArea description = new JTextArea(lodResource.getTextDescription());
    contentPanel.add(description, BorderLayout.PAGE_START);
    contentPanel.add(component, BorderLayout.CENTER);
    try {
        initPlayer(bytearrayinputstream);
    } catch (java.lang.NoClassDefFoundError e) {
        JTextArea error = new JTextArea("Unable to initialize wav player.   Is jfm.jar in the classpath?");
        contentPanel.add(error, BorderLayout.PAGE_END);
        e.printStackTrace();
    }
    return contentPanel;
}
Example 33
Project: i2p.i2p-master  File: StatSummarizer.java View source code
/**
     *  This does the single data graphs.
     *  For the two-data bandwidth graph see renderRatePng().
     *  Synchronized to conserve memory.
     *
     *  @param end number of periods before now
     *  @return success
     */
public boolean renderPng(Rate rate, OutputStream out, int width, int height, boolean hideLegend, boolean hideGrid, boolean hideTitle, boolean showEvents, int periodCount, int end, boolean showCredit) throws IOException {
    try {
        try {
            _sem.acquire();
        } catch (InterruptedException ie) {
        }
        try {
            return locked_renderPng(rate, out, width, height, hideLegend, hideGrid, hideTitle, showEvents, periodCount, end, showCredit);
        } catch (NoClassDefFoundError ncdfe) {
            _isDisabled = true;
            _isRunning = false;
            String s = "Error rendering - disabling graph generation. Install ttf-dejavu font package?";
            _log.logAlways(Log.WARN, s);
            IOException ioe = new IOException(s);
            ioe.initCause(ncdfe);
            throw ioe;
        }
    } finally {
        _sem.release();
    }
}
Example 34
Project: sos-ws2010-mas-master  File: StringACLCodec.java View source code
/**
     * if there was an automatical Base64 encoding, then it performs
     * automatic decoding.
     **/
private void checkBase64Encoding(ACLMessage msg) {
    String encoding = msg.getUserDefinedParameter(BASE64ENCODING_KEY);
    if (CaseInsensitiveString.equalsIgnoreCase(BASE64ENCODING_VALUE, encoding)) {
        try // decode Base64
        {
            String content = msg.getContent();
            if ((content != null) && (content.length() > 0)) {
                //char[] cc = new char[content.length()];
                //content.getChars(0,content.length(),cc,0);
                msg.setByteSequenceContent(Base64.decodeBase64(content.getBytes("US-ASCII")));
                // reset the slot value for encoding
                msg.removeUserDefinedParameter(BASE64ENCODING_KEY);
            }
        } catch (java.lang.StringIndexOutOfBoundsException e) {
            e.printStackTrace();
        } catch (java.lang.NullPointerException e2) {
            e2.printStackTrace();
        } catch (java.lang.NoClassDefFoundError jlncdfe) {
            System.err.println("\t\t===== E R R O R !!! =======\n");
            System.err.println("Missing support for Base64 conversions");
            System.err.println("Please refer to the documentation for details.");
            System.err.println("=============================================\n\n");
            try {
                Thread.currentThread().sleep(3000);
            } catch (InterruptedException ie) {
            }
        } catch (UnsupportedEncodingException e3) {
            System.err.println("\t\t===== E R R O R !!! =======\n");
            System.err.println("Missing support for US-ASCII encoding for Base64 conversions");
        }
    }
//end of if CaseInsensitiveString
}
Example 35
Project: hq-master  File: ServerControlPlugin.java View source code
protected int doCommand(String program, String[] params) {
    ArrayList args = new ArrayList();
    ExecuteWatchdog watchdog = new ExecuteWatchdog(getTimeoutMillis());
    this.output.reset();
    Execute ex = new Execute(new PumpStreamHandler(this.output), watchdog);
    //weblogic and jboss scripts for example
    //must be run from the directory where the script lives
    File wd = getWorkingDirectory();
    if (wd.exists()) {
        ex.setWorkingDirectory(wd);
    }
    if (isBackgroundCommand()) {
        //XXX bloody ugly hack for startup scripts such as weblogic
        //which do not background themselves
        Properties props = getManager().getProperties();
        String cwd = System.getProperty("user.dir");
        String dir = "";
        try {
            dir = props.getProperty(AgentConfig.PROP_INSTALLHOME[0]);
        } catch (// in standalone -> Exception in thread "main" java.lang.NoClassDefFoundError: org/hyperic/hq/agent/AgentConfig
        java.lang.NoClassDefFoundError // in standalone -> Exception in thread "main" java.lang.NoClassDefFoundError: org/hyperic/hq/agent/AgentConfig
        e) {
            dir = props.getProperty("agent.install.home", cwd);
        }
        if (dir.equals(".")) {
            //XXX: ./background.sh command silently fails when running
            //in the agent, even tho ./ is the same place as user.dir
            dir = cwd;
        }
        File background = new File(dir, BACKGROUND_SCRIPT);
        if (!background.exists()) {
            //try relative to pdk.dir for command-line usage
            File pdk = new File(ProductPluginManager.getPdkDir());
            if (!pdk.isAbsolute()) {
                pdk = new File(new File(cwd), ProductPluginManager.getPdkDir());
            }
            background = new File(pdk, "../" + BACKGROUND_SCRIPT);
        }
        if (background.exists()) {
            try {
                args.add(background.getCanonicalPath());
            } catch (IOException ex1) {
                args.add(background.getAbsolutePath());
                getLog().debug(ex1);
            }
        }
        getLog().info("background=" + background);
    }
    String prefix = getControlProgramPrefix();
    if (prefix != null && prefix.length() != 0) {
        try {
            String[] prefixArgs = StringUtil.explodeQuoted(getControlProgramPrefix());
            for (int i = 0; i < prefixArgs.length; i++) {
                args.add(prefixArgs[i]);
            }
        } catch (IllegalArgumentException e) {
            getLog().error("Unable to parse arguments: " + prefix);
        }
    }
    if (HypericOperatingSystem.IS_WIN32) {
        //Runtime.exec does not handle file associations
        //such as foo.pl -> perl.exe, foo.py -> python.exe.
        String exe = Win32.findScriptExecutable(program);
        if (exe != null) {
            args.add(exe);
        }
    }
    if (new File(program).isAbsolute())
        args.add(program);
    else
        args.add(installPrefix + File.separator + program);
    if (params != null) {
        for (int i = 0; i < params.length; i++) {
            if (params[i] == null) {
                continue;
            }
            args.add(params[i]);
        }
    }
    String[] commandArgs = getCommandArgs();
    for (int i = 0; i < commandArgs.length; i++) {
        if (commandArgs[i] == null) {
            continue;
        }
        args.add(commandArgs[i]);
    }
    getLog().info("doCommand args=" + args);
    ex.setCommandline((String[]) args.toArray(new String[0]));
    //set some environment variables for use by control scripts
    String[] env = { "HQ_CONTROL_RESOURCE=" + getName(), "HQ_CONTROL_TYPE=" + getTypeInfo().getName(), "HQ_CONTROL_WAIT=" + getBackgroundWaitTime() };
    env = combine(env, ex.getEnvironment());
    String[] cmdEnv = getCommandEnv();
    if (cmdEnv != null) {
        env = combine(env, cmdEnv);
    }
    ex.setEnvironment(env);
    this.exitCode = RESULT_FAILURE;
    try {
        this.exitCode = ex.execute();
    } catch (Exception e) {
        getLog().error(e.getMessage(), e);
        setMessage(e.getMessage());
    }
    if (this.exitCode == 0) {
        setResult(RESULT_SUCCESS);
    } else {
        setResult(RESULT_FAILURE);
    }
    // that are backgrounded.
    if (watchdog.killedProcess()) {
        String err = "Command did not complete within timeout of " + getTimeout() + " seconds";
        getLog().error(err);
        setMessage(err);
        setResult(RESULT_FAILURE);
        return getResult();
    }
    getLog().info("doCommand result=" + getResult() + ", exitCode=" + this.exitCode);
    String message = this.output.toString();
    if (message.length() > 0) {
        setMessage(message);
    }
    return getResult();
}
Example 36
Project: java-oss-lib-master  File: Reflection.java View source code
/**
	 * accesses a getter.  will return null if the getter is not found, else returns whatever the
	 * data is.
	 * @param obj
	 * @param name
	 * @return
	 */
public static Object getter(Object obj, String name) {
    //		log.warn("Trying to get getter: " + name + " for " + obj);
    try {
        if (!name.startsWith("get")) {
            name = "get" + StringHelper.capitalize(name);
        }
        return obj.getClass().getMethod(name).invoke(obj);
    } catch (java.lang.NoClassDefFoundError ex) {
        log.warn("Caught and swallowed (likely an unresolved dependancy) while trying to use getter: " + name, ex);
    } catch (NoSuchMethodException x) {
    } catch (Throwable x) {
        log.info("Caught and swalled (trying to use getter: " + name + ")", x);
    }
    return null;
}
Example 37
Project: glassfish-master  File: EjbTest.java View source code
/**
     * <p>
     * run an individual test against the deployment descriptor for the 
     * archive the verifier is performing compliance tests against.
     * </p>
     *
     * @param descriptor deployment descriptor for the archive
     * @return result object containing the result of the individual test
     * performed
     */
public Result check(Descriptor descriptor) {
    try {
        return check((EjbDescriptor) descriptor);
    } catch (Throwable t) {
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        Result r = getInitializedResult();
        if (t instanceof java.lang.NoClassDefFoundError) {
            String s = t.toString();
            String className = s.substring(s.indexOf(":"));
            addWarningDetails(r, compName);
            r.warning(smh.getLocalString("com.sun.enterprise.tools.verifier.checkinclasspath", "The class [ {0} ] was not found, check manifest classpath, or make sure it is available in classpath at runtime.", new Object[] { className }));
            return r;
        } else
            throw new RuntimeException(t);
    }
}
Example 38
Project: FastLogin-master  File: FastLoginBukkit.java View source code
@Override
public void onEnable() {
    core = new FastLoginCore<>(this);
    core.load();
    try {
        bungeeCord = Class.forName("org.spigotmc.SpigotConfig").getDeclaredField("bungee").getBoolean(null);
    } catch (ClassNotFoundException notFoundEx) {
    } catch (Exception ex) {
        getLogger().log(Level.WARNING, "Cannot check bungeecord support. You use a non-spigot build", ex);
    }
    if (getServer().getOnlineMode()) {
        //we need to require offline to prevent a loginSession request for a offline player
        getLogger().severe("Server have to be in offline mode");
        setEnabled(false);
        return;
    }
    if (bungeeCord) {
        setServerStarted();
        //check for incoming messages from the bungeecord version of this plugin
        getServer().getMessenger().registerIncomingPluginChannel(this, getName(), new BungeeCordListener(this));
        getServer().getMessenger().registerOutgoingPluginChannel(this, getName());
    //register listeners on success
    } else {
        if (!core.setupDatabase()) {
            setEnabled(false);
            return;
        }
        if (getServer().getPluginManager().isPluginEnabled("ProtocolSupport")) {
            getServer().getPluginManager().registerEvents(new ProtocolSupportListener(this), this);
        } else if (getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
            //we are performing HTTP request on these so run it async (seperate from the Netty IO threads)
            //they will be created with a static builder, because otherwise it will throw a
            //java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener if ProtocolSupport was
            //only found
            StartPacketListener.register(this, WORKER_THREADS);
            EncryptionPacketListener.register(this, WORKER_THREADS);
            getServer().getPluginManager().registerEvents(new LoginSkinApplyListener(this), this);
        } else {
            getLogger().warning("Either ProtocolLib or ProtocolSupport have to be installed " + "if you don't use BungeeCord");
        }
    }
    //delay dependency setup because we load the plugin very early where plugins are initialized yet
    getServer().getScheduler().runTask(this, new DelayedAuthHook(this));
    getServer().getPluginManager().registerEvents(new BukkitJoinListener(this), this);
    //register commands using a unique name
    getCommand("premium").setExecutor(new PremiumCommand(this));
    getCommand("cracked").setExecutor(new CrackedCommand(this));
    getCommand("import-auth").setExecutor(new ImportCommand(core));
    if (getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
        //prevents NoClassDef errors if it's not available
        PremiumPlaceholder.register(this);
    }
}
Example 39
Project: hippo-jcr-shell-master  File: CommandHelper.java View source code
/**
     * This method hides the ugly details of reflection. In a nutshell it
     * invokes the doIt() method of the java class associated with the command
     * being executed.
     *
     * @param method The method to execute
     * @param clazz The name of the class to execute.
     * @param args The command line parses into tokens.
     * @return The return value of the method.
     */
public static Object runMethod(final String method, final String clazz, final String[] args) {
    // get the class object.
    Class theClass = null;
    try {
        theClass = Class.forName(clazz);
        if (theClass == null) {
            throw new RuntimeException("theClass is null.");
        }
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
        throw new RuntimeException("Class Not Found: " + clazz);
    }
    // get the constructor object.
    Constructor theConstructor = null;
    try {
        theConstructor = theClass.getConstructor(new Class[0]);
        if (theConstructor == null) {
            throw new RuntimeException("theConstructor is null.");
        }
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
        throw new RuntimeException("Unable to find constructor for " + clazz);
    }
    // get the instance object.
    Command theInstance = null;
    try {
        theInstance = (Command) theConstructor.newInstance((Object[]) new Class[0]);
        if (null == theInstance) {
            throw new RuntimeException("theInstance is null.");
        }
    } catch (InvocationTargetException e) {
        e.getCause().printStackTrace();
        throw new RuntimeException("InvocationTargetException for " + clazz);
    } catch (java.lang.NoClassDefFoundError e) {
        throw new RuntimeException("NoClassDefFoundError for " + clazz);
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException("Unable to load constructor for " + clazz);
    }
    Class[] parameterTypes = new Class[1];
    parameterTypes[0] = java.lang.String[].class;
    // gets the method object.
    Method theMethod = null;
    try {
        if (args == null) {
            theMethod = theClass.getMethod(method);
        } else {
            theMethod = theClass.getMethod(method, parameterTypes);
        }
        if (null == theMethod) {
            throw new RuntimeException("theMethod is null.");
        }
    } catch (Exception e) {
        Method[] methlist = theClass.getDeclaredMethods();
        for (int i = 0; i < methlist.length; i++) {
            Method m = methlist[i];
            System.out.println("name = " + m.getName());
            System.out.println("decl class = " + m.getDeclaringClass());
            Class[] pvec = m.getParameterTypes();
            for (int j = 0; j < pvec.length; j++) {
                System.out.println("param #" + j + " " + pvec[j]);
            }
            Class[] evec = m.getExceptionTypes();
            for (int j = 0; j < evec.length; j++) {
                System.out.println("exc #" + j + " " + evec[j]);
            }
            System.out.println("return type = " + m.getReturnType());
            System.out.println("-----");
        }
        e.printStackTrace();
        throw new RuntimeException("Unable to find test method for " + clazz);
    }
    Object[] params = new Object[1];
    params[0] = args;
    Object theReturnValue;
    try {
        if (args == null) {
            theReturnValue = theMethod.invoke(theInstance);
        } else {
            theReturnValue = theMethod.invoke(theInstance, params);
        }
    } catch (IllegalAccessException e) {
        throw new RuntimeException("IllegalAccessException for " + clazz);
    } catch (InvocationTargetException e) {
        if (e.getCause() instanceof JcrShellShutdownException) {
            throw new JcrShellShutdownException();
        }
        e.getCause().printStackTrace();
        throw new RuntimeException("InvocationTargetException for " + clazz);
    } catch (NoClassDefFoundError e) {
        throw new RuntimeException("NoClassDefFoundError for " + clazz);
    }
    return theReturnValue;
}
Example 40
Project: Nicobar-master  File: ScriptModuleLoaderDependenciesTest.java View source code
@Test
public void failsIfImportFilterExcludesNecessaryPathFromAppPackage() throws ModuleLoadException, IOException, Exception {
    ScriptModuleLoader moduleLoader = setupClassPathDependentWithFilter("java");
    boolean didFail = false;
    Module.forClass(Object.class);
    try {
        exerciseClasspathDependentModule(moduleLoader);
    } catch (java.lang.NoClassDefFoundError e) {
        Assert.assertTrue(e.getMessage().contains("org/jboss/modules/Module"));
        didFail = true;
    }
    Assert.assertTrue(didFail);
}
Example 41
Project: hudson_plugins-master  File: FilePathArchiver.java View source code
@SuppressWarnings("unchecked")
private static void readFromTar(boolean isFlatten, String name, File baseDir, InputStream in) throws IOException {
    TarInputStream t = new TarInputStream(in);
    try {
        TarEntry te;
        while ((te = t.getNextEntry()) != null) {
            File f = new File(baseDir, te.getName());
            if (te.isDirectory()) {
                if (!isFlatten)
                    f.mkdirs();
            } else {
                if (!isFlatten) {
                    File parent = f.getParentFile();
                    if (parent != null)
                        parent.mkdirs();
                } else {
                    f = new File(baseDir, getFileNameWithoutLeadingDirectory(te.getName()));
                }
                OutputStream fos = new FileOutputStream(f);
                try {
                    IOUtils.copy(t, fos);
                } finally {
                    fos.close();
                }
                f.setLastModified(te.getModTime().getTime());
                int mode = te.getMode() & 0777;
                if (mode != 0 && !Functions.isWindows())
                    try {
                        LIBC.chmod(f.getPath(), mode);
                    } catch (NoClassDefFoundError e) {
                    }
            }
        }
    } catch (IOException e) {
        throw new IOException2("Failed to extract " + name, e);
    } finally {
        t.close();
    }
}
Example 42
Project: wonder-master  File: ERXJDBCConnectionAnalyzer.java View source code
/**
	 * Attempts to load JDBCPlugIn or sub-class and verify related configuration.
	 */
public void findPlugin() {
    /** require [targetAdaptor_created] targetAdaptor() != null; * */
    log.info("Trying to create plugin...");
    try {
        _targetAdaptor.setConnectionDictionary(connectionDictionary());
        _targetPlugIn = targetAdaptor().plugIn();
        log.info("Created plugin {}", targetPlugIn().getClass());
    } catch (java.lang.NoClassDefFoundError e) {
        log.info("Error: Failed to load class {} when creating JDBC plugin.", e.getMessage());
        log.info("This is probably a class which is required by the plugin class and can also indicate that the JDBC driver was not found.");
        log.info("Either (a) your classpath is wrong or (b) something is missing from the JRE extensions directory/ies.");
        dumpClasspath();
        dumpExtensionDirectories();
        throw new RuntimeException("JDBC Connection Analysis: Missing class needed by plugin");
    } catch (Exception e) {
        Throwable t = ERXExceptionUtilities.getMeaningfulThrowable(e);
        log.info("Error: Plugin creationg failed.", t);
        throw new RuntimeException("JDBC Connection Analysis: unexpected failure creating plugin");
    }
    if (targetPlugIn().getClass().equals(com.webobjects.jdbcadaptor.JDBCPlugIn.class)) {
        String driverClassName = (String) connectionDictionary().objectForKey(JDBCAdaptor.DriverKey);
        if ((driverClassName == null) || (driverClassName.length() == 0)) {
            log.info("Error: Failed to load custom JDBC plugin and connection dictionary does not include the driver class name under the key {}", JDBCAdaptor.DriverKey);
            log.info("Either \n(a) the plugin is missing from your classpath or \n(b) the connection dictionary has a misspelled '{}' key or \n(c) the plug-in name specified under the '{}' key is incorrect or \n(d) the class name for the JDBC driver under the key '{}' is missing from the connection dictionary or\n(e)the connection dictionary has a misspelled '{}' key", JDBCAdaptor.PlugInKey, JDBCAdaptor.PlugInKey, JDBCAdaptor.DriverKey, JDBCAdaptor.DriverKey);
            dumpClasspath();
            throw new RuntimeException("JDBC Connection Analysis: Missing plugin or driver");
        }
        log.info("WARNING: using generic JDBCPlugIn.");
    }
/** ensure [targetPlugIn_created] targetPlugIn() != null; * */
}
Example 43
Project: nuCommander-master  File: SelfUpdateJob.java View source code
/**
     * Loads all the class files contained in the given JAR file recursively.
     *
     * @param file the JAR file from which to load the classes
     * @throws Exception if an error occurred while loading the classes
     */
private void loadClassRecurse(AbstractFile file) throws Exception {
    if (file.isBrowsable()) {
        AbstractFile[] children = file.ls(directoryOrClassFileFilter);
        for (AbstractFile child : children) loadClassRecurse(child);
    } else {
        // .class file
        String classname = file.getAbsolutePath(false);
        // Strip off the JAR file's path and ".class" extension
        classname = classname.substring(destJar.getAbsolutePath(true).length(), classname.length() - 6);
        // Replace separator characters by '.'
        classname = classname.replace(destJar.getSeparator(), ".");
        try {
            classLoader.loadClass(classname);
            AppLogger.finest("Loaded class " + classname);
        } catch (java.lang.NoClassDefFoundError e) {
            AppLogger.fine("Caught an error while loading class " + classname, e);
        }
    }
}
Example 44
Project: arc_gnu_eclipse-master  File: ARCTerminalTab.java View source code
protected void createTerminalComponent(Composite comp, int i) {
    Composite argsComp = SWTFactory.createComposite(comp, 3, 3, GridData.FILL_BOTH);
    GridData gd = new GridData(GridData.BEGINNING);
    gd.horizontalSpan = 3;
    argsComp.setLayoutData(gd);
    // 5-1
    fPrgmArgumentsLabelCom = new Label(argsComp, SWT.NONE);
    //$NON-NLS-1$
    fPrgmArgumentsLabelCom.setText("COM  Ports:");
    // 5-2 and 5-3
    fPrgmArgumentsComCom = new Combo(argsComp, SWT.READ_ONLY);
    fPrgmArgumentsComCom.setEnabled(fLaunchTerminal);
    List<String> COM = null;
    try {
        COM = COMserialport();
    } catch (java.lang.UnsatisfiedLinkError e) {
        e.printStackTrace();
    } catch (java.lang.NoClassDefFoundError e) {
        e.printStackTrace();
    }
    if (COM != null) {
        for (int ii = 0; ii < COM.size(); ii++) {
            String currentcom = (String) COM.get(ii);
            fPrgmArgumentsComCom.add(currentcom);
        }
    } else {
        fSerialPortAvailable = false;
        fPrgmArgumentsComCom.setEnabled(fSerialPortAvailable);
        fLaunchComButton.setEnabled(fSerialPortAvailable);
    }
    fPrgmArgumentsComCom.setText(fPrgmArgumentsComCom.getItem(0));
    // $NON-NLS-1$ //6-3
    fLaunchComButton = new Button(argsComp, SWT.CHECK);
    fLaunchComButton.setSelection(fLaunchTerminal);
    fLaunchComButton.setText("Launch Terminal");
    fLaunchComButton.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent event) {
            if (fLaunchComButton.getSelection() == true) {
                fLaunchTerminal = true;
                fPrgmArgumentsComCom.setEnabled(fSerialPortAvailable);
                fPrgmArgumentsLabelCom.setEnabled(fSerialPortAvailable);
            } else {
                fLaunchTerminal = false;
                fPrgmArgumentsComCom.setEnabled(false);
                fPrgmArgumentsLabelCom.setEnabled(false);
            }
            updateLaunchConfigurationDialog();
        }

        public void widgetDefaultSelected(SelectionEvent event) {
        }
    });
}
Example 45
Project: VarexJ-master  File: JPF_java_lang_ClassLoader.java View source code
protected static boolean check(MJIEnv env, String cname, byte[] buffer, int offset, int length, FeatureExpr ctx) {
    // throw SecurityExcpetion if the package prefix is java
    checkForProhibitedPkg(env, cname, ctx);
    // throw NoClassDefFoundError if the given class does name might 
    // not be a valid binary name
    checkForIllegalName(env, cname, ctx);
    // throw IndexOutOfBoundsException if buffer length is not consistent
    // with offset
    checkData(env, buffer, offset, length, ctx);
    return !env.hasException();
}
Example 46
Project: sette-tool-master  File: CatgParser.java View source code
@Override
protected void parseSnippet(Snippet snippet, SnippetOutFiles outFiles, SnippetInputsXml inputsXml) throws Exception {
    List<String> outputLines = outFiles.readOutputLines();
    List<String> errorLines = outFiles.readErrorOutputLines();
    if (!errorLines.isEmpty()) {
        // error / warning from CATG
        // check whether there was any exception and get result possibilities according to them
        Set<ResultType> resTypes = errorLines.stream().filter( line -> line.startsWith("Exception in thread \"main\"")).map( line -> {
            Matcher m = EXCEPTION_LINE_PATTERN.matcher(line);
            if (!m.matches()) {
                System.err.println(snippet.getMethod());
                System.err.println("NO MATCH FOR LINE: " + line);
                throw new RuntimeException("SETTE parser problem");
            }
            String exceptionType = m.group(1);
            if (exceptionType.equals("java.lang.NoClassDefFoundError")) {
                return ResultType.NA;
            } else if (exceptionType.equals("java.lang.VerifyError")) {
                return ResultType.EX;
            } else if (exceptionType.endsWith("Exception")) {
                return ResultType.EX;
            } else {
                System.err.println(snippet.getMethod());
                System.err.println(outFiles.errorOutputFile);
                System.err.println("NOT HANDLED EXCEPTION TYPE: " + exceptionType);
                throw new RuntimeException("SETTE parser problem" + snippet.getId() + " - " + getRunnerProjectSettings().getProjectName());
            }
        }).collect(Collectors.toSet());
        if (!resTypes.isEmpty()) {
            // had exception line
            if (resTypes.size() == 1) {
                // exactly one typed exception
                inputsXml.setResultType(resTypes.iterator().next());
            } else {
                // very unlikely to have both NoClassDefFoundError and other exception
                throw new RuntimeException("SETTE parser problem");
            }
        } else {
            List<String> acceptIfFirstLineStartsWith = Arrays.asList("java.io.UTFDataFormatException", "java.io.StreamCorruptedException", "java.io.OptionalDataException");
            if (acceptIfFirstLineStartsWith.stream().anyMatch( prefix -> errorLines.get(0).startsWith(prefix))) {
            // skip
            } else {
                // check whether the other lines are accepted warnings
                for (String errorLine : errorLines) {
                    if (StringUtils.isBlank(errorLine)) {
                    // skip blank lines
                    } else if (!Stream.of(ACCEPTED_ERROR_LINE_PATTERNS).anyMatch( p -> p.matcher(errorLine.trim()).matches())) {
                        System.err.println(ACCEPTED_ERROR_LINE_PATTERNS[0].matcher(errorLine).matches());
                        System.err.println(String.join("\n", errorLines));
                        System.err.println("Unknown line: " + errorLine);
                        throw new RuntimeException("SETTE parser problem: " + snippet.getId() + " - " + getRunnerProjectSettings().getProjectName());
                    }
                }
            }
            // all lines are accepted warnings
            inputsXml.setResultType(ResultType.S);
        }
    } else {
        // no error file, always S
        if (snippet.getRequiredStatementCoverage() == 0) {
            inputsXml.setResultType(ResultType.C);
        } else {
            inputsXml.setResultType(ResultType.S);
        }
    }
    // collect inputs if S
    if (inputsXml.getResultType() == ResultType.S || inputsXml.getResultType() == ResultType.C) {
        // collect inputs
        if (!outputLines.get(0).startsWith("Now testing ")) {
            throw new RuntimeException("File beginning problem: " + outFiles.outputFile);
        }
        Pattern p = Pattern.compile("\\[Input (\\d+)\\]");
        Pattern p2 = Pattern.compile("  (\\w+) param(\\d+) = (.*)");
        int inputNumber = 1;
        for (int i = 1; i < outputLines.size(); inputNumber++) {
            String line = outputLines.get(i);
            Matcher m = p.matcher(line);
            if (m.matches()) {
                if (!m.group(1).equals(String.valueOf(inputNumber))) {
                    System.err.println("Current input should be: " + inputNumber);
                    System.err.println("Current input line: " + line);
                    throw new RuntimeException("File input problem (" + line + "): " + outFiles.outputFile);
                }
                // find end of generated input
                int nextInputLine = -1;
                for (int j = i + 1; j < outputLines.size(); j++) {
                    if (p.matcher(outputLines.get(j)).matches()) {
                        nextInputLine = j;
                        break;
                    }
                }
                if (nextInputLine < 0) {
                    // EOF
                    nextInputLine = outputLines.size();
                }
                int paramCount = snippet.getMethod().getParameterTypes().length;
                InputElement ie = new InputElement();
                for (int j = 0; j < paramCount; j++) {
                    String l = outputLines.get(i + 1 + j + 1);
                    Matcher m2 = p2.matcher(l);
                    if (m2.matches()) {
                        String type = m2.group(1);
                        String value = m2.group(3);
                        ParameterElement pe = new ParameterElement();
                        if (type.equals("String")) {
                            pe.setType(ParameterType.EXPRESSION);
                            pe.setValue("\"" + value + "\"");
                        } else {
                            pe.setType(ParameterType.fromString(type));
                            pe.setValue(value);
                        }
                        ie.getParameters().add(pe);
                    } else {
                        throw new RuntimeException("File input problem (" + l + "): " + outFiles.outputFile);
                    }
                }
                inputsXml.getGeneratedInputs().add(ie);
                i = nextInputLine;
            // TODO now NOT dealing with result and exception
            } else {
                throw new RuntimeException("File input problem (" + line + "): " + outFiles.outputFile);
            }
        }
    }
}
Example 47
Project: dota2-sound-editor-master  File: Main.java View source code
public static void main(String args[]) throws Exception {
    javax.swing.UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    Handler handler = new Handler();
    Thread.setDefaultUncaughtExceptionHandler((UncaughtExceptionHandler) handler);
    //Need to find dota 2 install dir
    if (prefs.getInstallDir().equals("")) {
        JDialog locationCheckDialog = new JDialog();
        locationCheckDialog.setModal(true);
        locationCheckDialog.setAlwaysOnTop(true);
        locationCheckDialog.setTitle("Locate Dota 2");
        locationCheckDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        SteamLocationPanel panel = new SteamLocationPanel(prefs, false, locationCheckDialog);
        locationCheckDialog.add(panel);
        locationCheckDialog.setSize(panel.getPreferredSize());
        locationCheckDialog.setVisible(true);
    }
    String vpkPath = prefs.getVPKPath();
    String installDir = prefs.getInstallDir();
    if (!(vpkPath.equals("")) && !(installDir.equals(""))) {
        try {
            //TODO: Don't automatically run the mainForm in its constructor. Make a .run() method.
            SoundEditorMainForm mainForm = new SoundEditorMainForm(vpkPath, installDir);
        }//TODO: Look into whether this belongs i_n Handler.java
         catch (java.lang.NoClassDefFoundError nce) {
            JFrame errorFrame = new JFrame();
            if (nce.getMessage().contains("info/ata4/vpk/VPKArchive")) {
                JOptionPane.showMessageDialog(errorFrame, "<html><body>Couldn't find a required file. Did you extract the \"lib\" folder as well?" + "<br>Missing file: " + nce.getMessage() + "</body></html>");
            } else {
                JOptionPane.showMessageDialog(errorFrame, "<html><body>A required file could not be found." + "<br>Missing file: " + nce.getMessage() + "</body><html>");
            }
            errorFrame.dispose();
            System.exit(0);
        }
    }
}
Example 48
Project: cruisecontrol-master  File: BuildDetailControllerTest.java View source code
public void testShouldBeAbleToShowFailedTestCasesForFailedBuild() throws Exception {
    prepareRequest(DataUtils.getFailedBuildLbuildAsFile().getName(), "project1");
    ModelAndView mav = this.controller.handleRequest(getRequest(), getResponse());
    BuildCommand buildCommand = (BuildCommand) mav.getModel().get("buildCmd");
    BuildDetail build = getBuildDetail(buildCommand);
    List suites = build.getTestSuites();
    BuildTestSuite suite = (BuildTestSuite) suites.get(0);
    assertEquals(DataUtils.TESTSUITE_IN_BUILD_LBUILD, suite.getName());
    assertEquals(12, suite.getNumberOfTests());
    assertEquals("Get wrong number of passed test cases.", 8, suite.getPassedTestCases().size());
    assertEquals("Get wrong number of failed test cases.", 3, suite.getFailingTestCases().size());
    BuildTestCase testCase = (BuildTestCase) suite.getFailingTestCases().get(0);
    assertEquals("testSomething", testCase.getName());
    assertEquals("3.807", testCase.getDuration());
    assertEquals("net.sourceforge.cruisecontrol.sampleproject.connectfour.PlayingStandTest", testCase.getClassname());
    assertEquals("junit.framework.AssertionFailedError: Error during schema validation \n" + "\tat junit.framework.Assert.fail(Assert.java:47)", testCase.getMessageBody());
    assertEquals(1, suite.getErrorTestCases().size());
    testCase = (BuildTestCase) suite.getErrorTestCases().get(0);
    assertEquals("testFourConnected", testCase.getName());
    assertEquals("0.016", testCase.getDuration());
    assertEquals("net.sourceforge.cruisecontrol.sampleproject.connectfour.PlayingStandTest", testCase.getClassname());
    assertEquals("java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor\n" + "\tat net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:165)", testCase.getMessageBody());
}
Example 49
Project: TotalCrossSDK-master  File: PortConnector.java View source code
private void create(int number, int baudRate, int bits, int parity, int stopBits) throws totalcross.io.IOException {
    try {
        // guich@330_38: use introspection to be able to compile everything without the comm.jar
        // javax.comm.CommPortIdentifier portId = javax.comm.CommPortIdentifier.getPortIdentifier(getPortName(number));
        // get the class
        Class<?> cpi = Class.forName("javax.comm.CommPortIdentifier");
        String portName = getPortName(number);
        System.out.println("Port found: " + portName);
        // get the method getPortIdentifier(String)
        Method mGetPortIdentifier = cpi.getMethod("getPortIdentifier", new Class[] { String.class });
        // invoke the getPortIdentifier(getPortName(number)) method
        Object portId = mGetPortIdentifier.invoke(null, new Object[] { portName });
        // javax.comm.SerialPort port = (javax.comm.SerialPort)portId.open("TotalCross", 1000);
        // get the method getPortIdentifier(String)
        Method mOpen = portId.getClass().getMethod("open", new Class[] { String.class, int.class });
        // invoke the portId.open method
        Object port = mOpen.invoke(portId, new Object[] { "TotalCross", new Integer(1000) });
        // port.setSerialPortParams(baudRate, bits, stopBits, parity?javax.comm.SerialPort.PARITY_EVEN:javax.comm.SerialPort.PARITY_NONE);
        Class<?> cSerialPort = port.getClass().getSuperclass();
        // get the method setSerialPortParams
        Method mSetSerialPortParams = cSerialPort.getMethod("setSerialPortParams", new Class[] { int.class, int.class, int.class, int.class });
        String[] parities = { "PARITY_NONE", "PARITY_EVEN", "PARITY_ODD" };
        Field parityField = cSerialPort.getField(parities[parity]);
        mSetSerialPortParams.invoke(port, new Object[] { new Integer(baudRate), new Integer(bits), new Integer(stopBits), new Integer(parityField.getInt(port)) });
        // port.enableReceiveTimeout(100);
        Method mEnableReceiveTimeout = cSerialPort.getMethod("enableReceiveTimeout", new Class[] { int.class });
        mEnableReceiveTimeout.invoke(port, new Object[] { new Integer(100) });
        // thisInputStream = port.getInputStream();
        Method mGetInputStream = cSerialPort.getMethod("getInputStream");
        thisInputStream = mGetInputStream.invoke(port);
        // thisOutputStream = port.getOutputStream();
        Method mGetOutputStream = cSerialPort.getMethod("getOutputStream");
        thisOutputStream = mGetOutputStream.invoke(port);
        portConnectorRef = port;
    } catch (java.lang.reflect.InvocationTargetException ule) {
        throw new totalcross.io.IOException(ule.getTargetException().getClass().getName() + " - " + ule.getTargetException().getMessage() + "\nThe probable cause is that the port is in use (You must kill HotSync)\nor that the win32com.dll is not accessible in your path. Please add '/TotalCross/etc/tools/commapi' to your path or add '-Djava.library.path=/TotalCross/etc/tools/commapi' to your java.exe command");
    } catch (java.lang.NoClassDefFoundError e) {
        throw new java.lang.NoClassDefFoundError(e.getClass().getName() + " - " + e.getMessage() + "\nCannot find javax.comm.CommPortIdentifier. You must add the /TotalCross3/etc/tools/commapi/comm.jar file to your classpath. If you're not using Windows, then you must download the respective Comm api at http://java.sun.com/products/javacomm");
    } catch (Throwable t) {
        throw new totalcross.io.IOException(t.getClass().getName() + " - " + t.getMessage());
    }
}
Example 50
Project: otter-master  File: ObjectProfiler.java View source code
/**
     * Estimates the full size of the object graph rooted at 'obj'. Duplicate data instances are correctly accounted
     * for. The implementation is not recursive.
     * 
     * @param obj input object instance to be measured
     * @return 'obj' size [0 if 'obj' is null']
     */
public static long sizeof(final Object obj) {
    if (null == obj || isSharedFlyweight(obj)) {
        return 0;
    }
    final IdentityHashMap visited = new IdentityHashMap(80000);
    try {
        return computeSizeof(obj, visited, CLASS_METADATA_CACHE);
    } catch (RuntimeException re) {
        return -1;
    } catch (NoClassDefFoundError ncdfe) {
        return -1;
    }
}
Example 51
Project: oceano-master  File: PluginManagerTest.java View source code
// -----------------------------------------------------------------------------------------------
// Tests which exercise the lifecycle executor when it is dealing with individual goals.
// -----------------------------------------------------------------------------------------------
//TODO: These two tests display a lack of symmetry with respect to the input which is a free form string and the
//      mojo descriptor which comes back. All the free form parsing needs to be done somewhere else, this is
//      really the function of the CLI, and then the pre-processing of that output still needs to be fed into
//      a hinting process which helps flesh out the full specification of the plugin. The plugin manager should
//      only deal in concrete terms -- all version finding mumbo jumbo is a customization to base functionality
//      the plugin manager provides.
public void testRemoteResourcesPlugin() throws Exception {
//TODO: turn an equivalent back on when the RR plugin is released.
/*

        This will not work until the RR plugin is released to get rid of the binding to the reporting exception which is a mistake.
        
        This happpens after removing the reporting API from the core:
        
        java.lang.NoClassDefFoundError: org/apache/maven/reporting/MavenReportException
        
        MavenSession session = createMavenSession( getProject( "project-with-inheritance" ) );       
        String goal = "process";
        
        Plugin plugin = new Plugin();
        plugin.setGroupId( "org.apache.maven.plugins" );
        plugin.setArtifactId( "maven-remote-resources-plugin" );
        plugin.setVersion( "1.0-beta-2" );
        
        MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, session.getCurrentProject(), session.getLocalRepository() );        
        assertPluginDescriptor( mojoDescriptor, "org.apache.maven.plugins", "maven-remote-resources-plugin", "1.0-beta-2" );
        MojoExecution mojoExecution = new MojoExecution( mojoDescriptor );
        pluginManager.executeMojo( session, mojoExecution );
        */
}
Example 52
Project: camus-master  File: CamusSweeper.java View source code
public void run() {
    KafkaCollector collector = null;
    try {
        log.info("Starting runner for " + name);
        collector = new KafkaCollector(props, name, topic);
        log.info("Waiting until input for job " + name + " is ready. Input directories:  " + props.getProperty("input.paths"));
        if (!planner.waitUntilReadyToProcess(props, fileSystem)) {
            throw new JobCancelledException("Job has been cancelled by planner while waiting for input to be ready.");
        }
        log.info("Running " + name + " for input " + props.getProperty("input.paths"));
        collector.run();
    } catch (// Sometimes the error is the Throwable, e.g. java.lang.NoClassDefFoundError
    Throwable // Sometimes the error is the Throwable, e.g. java.lang.NoClassDefFoundError
    e) {
        e.printStackTrace();
        log.error("Failed for " + name + " ,job: " + collector == null ? null : collector.getJob() + " failed for " + props.getProperty("input.paths") + " Exception:" + e.getLocalizedMessage());
        errorQueue.add(new SweeperError(name, props.get("input.paths").toString(), e));
    }
}
Example 53
Project: intellij-community-master  File: GroovycOutputParser.java View source code
public boolean shouldRetry() {
    for (CompilerMessage message : compilerMessages) {
        String text = message.getMessageText();
        if (text.contains("java.lang.NoClassDefFoundError") || text.contains("java.lang.TypeNotPresentException") || text.contains("unable to resolve class")) {
            LOG.debug("Resolve issue: " + message);
            return true;
        }
    }
    return false;
}
Example 54
Project: openicf-master  File: RepliConnectClient.java View source code
protected JSONObject call(JSONObject command) throws RuntimeException {
    log.info("Posting request: {0}", command.toString());
    HttpPost postAction;
    DefaultHttpClient client = new DefaultHttpClient();
    try {
        client = new DefaultHttpClient();
    } catch (java.lang.NoClassDefFoundError ex) {
        throw new ConnectorIOException("Missing Apache HTTPClient Library (or dependency)");
    }
    client.getCredentialsProvider().setCredentials(new AuthScope(_targetHost.getHostName(), _targetHost.getPort()), credentials);
    postAction = new HttpPost(_targetHost.getSchemeName() + "://" + _targetHost.toHostString() + _uri);
    log.info("Constructed URL: {0}", _targetHost.getSchemeName() + "://" + _targetHost.toHostString() + _uri);
    postAction.addHeader("Content-type", "application/JSON");
    //postAction.addHeader("X-Replicon-Security-Context", "User");
    try {
        postAction.setEntity(new StringEntity(command.toString()));
        log.info("Added payload: {0}", command.toString());
        HttpResponse res = client.execute(postAction, _httpContext);
        int statusCode = res.getStatusLine().getStatusCode();
        log.info("HTTP Response Code: {0}", statusCode);
        if (statusCode != 200) {
            throw new org.identityconnectors.framework.common.exceptions.ConnectionFailedException("HTTP code:" + statusCode);
        } else {
            //res.getEntity().writeTo(System.out);
            try {
                Reader reader = new InputStreamReader(res.getEntity().getContent());
                JSONTokener jt = new JSONTokener(reader);
                JSONObject response = new JSONObject(jt);
                log.info("JSONResponse: {0}", response.toString());
                log.info("RepliConnect call Status: {0}", response.getString("Status"));
                if (response.getString("Status").equalsIgnoreCase("Exception")) {
                    throw new RuntimeException("Error in RepliConnect Call: " + response.getString("Message"));
                }
                return response;
            } catch (JSONException ex) {
                log.error("Unable to Tokenize JSON response", ex);
            }
        }
        return null;
    } catch (IOException ex) {
        log.error("Error Occured Posting Request", ex);
        throw new RuntimeException(ex);
    }
}
Example 55
Project: CodenameOne-master  File: RetroWeaver.java View source code
public void visitEnd() {
    if (isEnum) {
        cv.visitField(ACC_PRIVATE + ACC_STATIC + ACC_FINAL + ACC_SYNTHETIC, SERIAL_ID_FIELD, SERIAL_ID_SIGNATURE, null, new Long(0L));
    }
    if (!classLiteralCalls.isEmpty()) {
        // generate synthetic fields and class$ method
        for (String fieldName : classLiteralCalls) {
            FieldVisitor fv = visitField(ACC_STATIC + ACC_SYNTHETIC + (isInterface ? ACC_PUBLIC : ACC_PRIVATE), fieldName, CLASS_FIELD_DESC, null, null);
            fv.visitEnd();
        }
        if (!isInterface) {
            // "class$" method
            MethodVisitor mv = cv.visitMethod(ACC_STATIC + ACC_SYNTHETIC, "class$", "(Ljava/lang/String;)Ljava/lang/Class;", null, null);
            /*mv.visitCode();

                    Label beginTry = new Label();
                    Label endTry = new Label();
                    Label catchBlock = new Label();
                    Label finished = new Label();
                    mv.visitTryCatchBlock(beginTry, endTry, catchBlock, "java/lang/Exception");
                    mv.visitLabel(beginTry);
                    mv.visitVarInsn(ALOAD, 0);
                    mv.visitMethodInsn(INVOKESTATIC, "java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;");        
                    mv.visitLabel(endTry);
                    mv.visitJumpInsn(GOTO, finished);
                    mv.visitLabel(catchBlock);
                    mv.visitInsn(POP);
                    mv.visitLabel(finished);

                    mv.visitInsn(ARETURN);
	    
	            mv.visitMaxs(0, 0);
	            mv.visitEnd();*/
            mv.visitCode();
            Label l0 = new Label();
            Label l1 = new Label();
            Label l2 = new Label();
            mv.visitTryCatchBlock(l0, l1, l2, "java/lang/ClassNotFoundException");
            mv.visitLabel(l0);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitMethodInsn(INVOKESTATIC, "java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;");
            mv.visitLabel(l1);
            mv.visitInsn(ARETURN);
            mv.visitLabel(l2);
            mv.visitVarInsn(ASTORE, 1);
            mv.visitInsn(ACONST_NULL);
            mv.visitInsn(ARETURN);
            /*mv.visitTypeInsn(NEW, "java/lang/NoClassDefFoundError");
                    mv.visitInsn(DUP);
                    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NoClassDefFoundError", "<init>", "()V");
                    mv.visitVarInsn(ALOAD, 1);
                    mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/NoClassDefFoundError", "initCause", "(Ljava/lang/Throwable;)Ljava/lang/Throwable;");
                    mv.visitInsn(ATHROW);*/
            mv.visitMaxs(2, 2);
            mv.visitEnd();
        }
    }
    if (!stripAttributes) {
        RetroWeaverAttribute a = new RetroWeaverAttribute(Weaver.getBuildNumber(), originalClassVersion);
        cv.visitAttribute(a);
    }
    cv.visitEnd();
}
Example 56
Project: figtree-master  File: FigTreeApplication.java View source code
public void run() {
    try {
        // Only override the UI's necessary for ColorChooser and
        // FileChooser:
        Set includes = new HashSet();
        includes.add("ColorChooser");
        includes.add("FileChooser");
        includes.add("Component");
        includes.add("Browser");
        includes.add("Tree");
        includes.add("SplitPane");
        includes.add("TitledBorder");
        try {
            QuaquaManager.setIncludedUIs(includes);
        } catch (java.lang.NoClassDefFoundError ncdfe) {
        }
        UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel");
        lafLoaded = true;
    } catch (Exception e) {
    }
}
Example 57
Project: modeshape-master  File: PdfMetadataSequencer.java View source code
@Override
public boolean execute(Property inputProperty, Node outputNode, Context context) throws Exception {
    Binary binaryValue = inputProperty.getBinary();
    CheckArg.isNotNull(binaryValue, "binary");
    Node sequencedNode = getPdfMetadataNode(outputNode);
    try {
        if (processBasicMetadata(sequencedNode, binaryValue)) {
            processXMPMetadata(sequencedNode, binaryValue);
            return true;
        } else {
            getLogger().warn("Ignoring pdf from node {0} because basic metadata cannot be extracted", inputProperty.getParent().getPath());
            return false;
        }
    } catch (java.lang.NoClassDefFoundError ncdfe) {
        if (ncdfe.getMessage().toLowerCase().contains("bouncycastle")) {
            getLogger().warn("Ignoring pdf from node {0} because it's encrypted and encrypted PDFs are not supported", inputProperty.getParent().getPath());
            return false;
        }
        throw ncdfe;
    }
}
Example 58
Project: jephyr-master  File: ProxyGenerator.java View source code
/**
     * Generate the static initializer method for the proxy class.
     */
private void generateStaticInitializer(ClassVisitor cv) {
    MethodVisitor mv = cv.visitMethod(ACC_STATIC, "<clinit>", "()V", null, null);
    mv.visitCode();
    Label start = new Label();
    mv.visitLabel(start);
    for (List<ProxyMethod> sigmethods : proxyMethods.values()) {
        for (ProxyMethod pm : sigmethods) {
            codeFieldInitialization(pm, mv);
        }
    }
    mv.visitInsn(RETURN);
    Label end = new Label();
    mv.visitLabel(end);
    Label handler1 = new Label();
    mv.visitLabel(handler1);
    mv.visitTryCatchBlock(start, end, handler1, "java/lang/NoSuchMethodException");
    mv.visitVarInsn(ASTORE, 1);
    mv.visitTypeInsn(NEW, "java/lang/NoSuchMethodError");
    mv.visitInsn(DUP);
    mv.visitVarInsn(ALOAD, 1);
    mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Throwable", "getMessage", "()Ljava/lang/String;", false);
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NoSuchMethodError", "<init>", "(Ljava/lang/String;)V", false);
    mv.visitInsn(ATHROW);
    Label handler2 = new Label();
    mv.visitLabel(handler2);
    mv.visitTryCatchBlock(start, end, handler2, "java/lang/ClassNotFoundException");
    mv.visitVarInsn(ASTORE, 1);
    mv.visitTypeInsn(NEW, "java/lang/NoClassDefFoundError");
    mv.visitInsn(DUP);
    mv.visitVarInsn(ALOAD, 1);
    mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Throwable", "getMessage", "()Ljava/lang/String;", false);
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NoClassDefFoundError", "<init>", "(Ljava/lang/String;)V", false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(10, 2);
    mv.visitEnd();
}
Example 59
Project: elexis-3-base-master  File: UserDocboxPreferences.java View source code
public boolean performConnectionTest(javax.xml.ws.Holder<java.lang.String> message) {
    javax.xml.ws.Holder<java.lang.Boolean> _checkAccess_success = new javax.xml.ws.Holder<java.lang.Boolean>();
    try {
        CDACHServices port = getPort();
        port.checkAccess(_checkAccess_success, message);
    } catch (Exception e) {
        message.value = "Verbindungsproblem mit docbox";
        message.value += "\n";
        message.value = e.getMessage();
        return false;
    } catch (java.lang.NoClassDefFoundError e) {
        message.value = "Verbindungsproblem mit docbox";
        message.value += "\n";
        message.value += e.getMessage();
        return false;
    } catch (java.lang.ExceptionInInitializerError e2) {
        message.value = "Verbindungsproblem mit docbox";
        message.value += "\n";
        return false;
    }
    return _checkAccess_success.value;
}
Example 60
Project: jitsi-master  File: OperationSetPersistentPresenceIrcImpl.java View source code
/**
     * Update (from IRC) containing the current presence status and message.
     *
     * @param previousStatus the previous presence status
     * @param status the current presence status
     */
void updatePresenceStatus(final PresenceStatus previousStatus, final PresenceStatus status) {
    // Note: Currently uses general PresenceStatus type parameters because
    // EasyMock throws a java.lang.NoClassDefFoundError: Could not
    // initialize class
    // net.java.sip.communicator.impl.protocol.irc.
    // OperationSetPersistentPresenceIrcImpl$$EnhancerByCGLIB$$403085ac
    // if IrcStatusEnum is used. I'm not sure why, though ...
    fireProviderStatusChangeEvent(previousStatus, status);
}
Example 61
Project: camel-master  File: RunMojo.java View source code
/**
     * Add any relevant project dependencies to the classpath. Indirectly takes
     * includePluginDependencies and ExecutableDependency into consideration.
     *
     * @param path classpath of {@link java.net.URL} objects
     * @throws MojoExecutionException
     */
private void addRelevantPluginDependenciesToClasspath(Set<URL> path) throws MojoExecutionException {
    if (hasCommandlineArgs()) {
        arguments = parseCommandlineArgs();
    }
    try {
        Iterator<Artifact> iter = this.determineRelevantPluginDependencies().iterator();
        while (iter.hasNext()) {
            Artifact classPathElement = iter.next();
            // java.lang.NoClassDefFoundError: org.osgi.vendor.framework property not set
            if (classPathElement.getArtifactId().equals("org.osgi.core")) {
                getLog().debug("Skipping org.osgi.core -> " + classPathElement.getGroupId() + "/" + classPathElement.getArtifactId() + "/" + classPathElement.getVersion());
                continue;
            }
            getLog().debug("Adding plugin dependency artifact: " + classPathElement.getArtifactId() + " to classpath");
            path.add(classPathElement.getFile().toURI().toURL());
        }
    } catch (MalformedURLException e) {
        throw new MojoExecutionException("Error during setting up classpath", e);
    }
}
Example 62
Project: AtomicRNG-master  File: AtomicRNG.java View source code
/**
     * The main function called by the JVM.<br>
     * Most of the action happens in here.
     * @param args
     */
public static void main(String[] args) {
    // Workaround for java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avcodec
    org.bytedeco.javacpp.Loader.load(org.bytedeco.javacpp.avcodec.class);
    /*
         * Automagically get the version from maven.
         */
    BufferedReader reader = new BufferedReader(new InputStreamReader(AtomicRNG.class.getResourceAsStream("/META-INF/maven/" + AtomicRNG.class.getPackage().getName() + "/AtomicRNG/pom.properties")));
    String line;
    try {
        while ((line = reader.readLine()) != null) if (line.substring(0, 8).equals("version=")) {
            version = line.substring(8);
            break;
        }
        reader.close();
    } catch (IOException e) {
        e.printStackTrace();
        System.exit(1);
    }
    /*
         * Startup: Print program name and copyright.
         */
    System.out.println("AtomicRNG v" + version + System.lineSeparator() + "(c) 2015 by Thomas \"V10lator\" Rohloff." + System.lineSeparator());
    /*
         * Parse commandline arguments.
         */
    boolean quiet = false, doubleView = false;
    for (String arg : args) {
        switch(arg) {
            case ("-q"):
                quiet = true;
                break;
            case ("-f"):
                if (// No multiple inits for multiple args.
                EntropyQueue.f == null)
                    EntropyQueue.fileInit();
                break;
            case ("-d"):
                doubleView = true;
                break;
            /*                case("-ef"):
                    experimentalFilter = true;
                    System.out.println("WARNING: Experimental noise filter activated!"+System.lineSeparator());
                    break;*/
            case "-h":
                System.out.println("Arguments:" + System.lineSeparator() + " -q  : Be quiet." + System.lineSeparator() + " -f  : Enable file output." + System.lineSeparator() + " -d  : Enable double view." + System.lineSeparator() + //                            " -ef : Enable experimental filter."+System.lineSeparator()+
                " -v  : Enable video recorder." + System.lineSeparator() + " -h  : Show this help." + System.lineSeparator());
                return;
            default:
                System.out.println("Unknown argument: " + arg + System.lineSeparator() + System.lineSeparator());
                System.exit(1);
        }
    }
    /*
         * Tell the user we're going to initialize the ARV device.
         */
    System.out.print("Initializing Alpha Ray Visualizer... ");
    /*
         * Extract native libraries for use with JNA
         *
        try {
            /*
             * Create tmp dir and register it as JNAs library path.
             *
            FileAttribute<?>[] empty = {};
            Path tmpDir = Files.createTempDirectory("AtomicRNG_", empty);
            tmpDir.toFile().deleteOnExit();
            System.setProperty("jna.library.path", tmpDir.toString());
            
            tmpDir.toFile().deleteOnExit(); // Delete tmp dir on exit.
            
            JarFile file = new JarFile(AtomicRNG.class.getProtectionDomain().getCodeSource().getLocation().getFile()); // Open our jar.
            
            /*
             * Extract all files.
             *
            String[] files = { "xxhash" };
            String[] prefixes = { ".so", "__LICENSE.txt" };
            String jarDir = "resources/";
            Path jarFile;
            String fileName;
            InputStream inStream;
            for(String suffix: files)
                for(String prefix: prefixes) {
                    fileName = suffix+prefix;
                    inStream = file.getInputStream(file.getJarEntry(jarDir+fileName));
                    jarFile = tmpDir.resolve(fileName);
                    jarFile.toFile().deleteOnExit();
                    Files.copy(inStream, jarFile);
                    inStream.close();
                }
            file.close(); // close jar.
            
        } catch (Exception e) {
            System.err.println("error!");
            e.printStackTrace();
            System.exit(1);
        }

        /*
         * Trap Cleanup().run() to be called when the JVM exits.
         */
    Runtime.getRuntime().addShutdownHook(new Cleanup());
    /*
         * Open and start the webcam inside of the ARV device.
         */
    atomicRNGDevice = new OpenCVFrameGrabber(0);
    try {
        atomicRNGDevice.start();
    } catch (Exception e) {
        restartAtomicRNGDevice(e);
    }
    /*
         *  Throw away the first frame cause of hardware init.
         *  The noise filters will handle the rest.
         */
    try {
        atomicRNGDevice.grab().release();
    } catch (org.bytedeco.javacv.FrameGrabber.Exception e) {
        restartAtomicRNGDevice(e);
    }
    /*
         *  Open the Linux RNG and keep it open all the time.
         *  We close it in Cleanup().run().
         */
    EntropyQueue.resetOSrng();
    new EntropyQueue().start();
    /*
         * In case we should draw the window initialize it and set its title.
         */
    String[] stat = null, statOut = null;
    CanvasFrame canvasFrame = null;
    if (!quiet) {
        canvasFrame = new CanvasFrame("AtomicRNG v" + version);
        stat = new String[3];
        stat[0] = "FPS: %1";
        stat[1] = "%2 kb/s (%3 hashes/sec)";
        stat[2] = "Queue: %4";
        statOut = new String[3];
        statOut[0] = "FPS: N/A";
        statOut[1] = "N/A kb/s (N/A hashes/sec)";
        statOut[2] = "Queue: N/A";
        canvasFrame.setDefaultCloseOperation(CanvasFrame.EXIT_ON_CLOSE);
        canvasFrame.getCanvas().addMouseListener(new AtomicMouseListener());
    }
    /*
         * We initialized everything.
         * Tell the user we're ready!
         */
    System.out.println("done!");
    /*
         * A few Variables we'll need inside of the main loop.
         */
    int fpsCount = 0, avgFPS = 0;
    Color yellow = new Color(1.0f, 1.0f, 0.0f, 0.1f);
    BufferedImage statImg = null;
    Font font = new Font("Arial Black", Font.PLAIN, 18);
    long lastFound = System.currentTimeMillis();
    long lastSlice = lastFound;
    /*
         * All right, let's enter the matrix, eh, the main loop I mean...
         */
    while (true) {
        /*
             * Grab a frame from the webcam.
             */
        IplImage img = null;
        try {
            /*
                 * Grab a frame from the webcam.
                 */
            img = atomicRNGDevice.grab();
        } catch (Exception e) {
            restartAtomicRNGDevice(e);
        }
        if (img != null && !img.isNull()) {
            /*
                 * First get the start time of that loop run.
                 */
            long start = System.currentTimeMillis();
            if (!quiet)
                fpsCount++;
            /*
                 * After each 4 seconds...
                 */
            if (start - lastSlice >= 4000L) {
                /*
                     * ...update the windows title with the newest statistics...
                     */
                if (!quiet) {
                    avgFPS = fpsCount >> 2;
                    if (((float) fpsCount / 4.0f) % 2 != 0)
                        avgFPS++;
                    String es = EntropyQueue.getStats();
                    for (int i = 0; i < stat.length; i++) statOut[i] = stat[i].replaceAll("%1", String.valueOf(avgFPS)).replaceAll("%2", String.valueOf((float) (byteCount >> 7) / 4.0f)).replaceAll("%3", String.valueOf((float) hashCount / 4.0f)).replaceAll("%4", es);
                    byteCount = hashCount = fpsCount = 0;
                }
                /*
                     * prepare to count the next 10 seconds and flush /dev/random.
                     */
                lastSlice = start;
            }
            if (randomImageNumber > 0 && start - lastRandomImageSlice >= 3600000L)
                paintRandomImage();
            /*
                 * The width is static, so if it's zero we never asked for it and other infos.
                 * Let's do that.
                 */
            if (firstRun) {
                width = img.width();
                height = img.height();
                int rows = height >> 6, columns = width >> 6;
                int cw = width / columns, ch = height / rows, yi;
                scanners = new ImageScanner[rows][columns];
                for (int y = 0; y < rows; y++) {
                    yi = y * ch;
                    for (int x = 0; x < columns; x++) scanners[y][x] = new ImageScanner(x * cw, yi);
                }
                /*
                     * Calculate the needed window size and paint the red line in the middle.
                     */
                if (!quiet) {
                    if (doubleView) {
                        statXoffset = width + 2;
                        statWidth = statXoffset + width;
                    } else
                        statWidth = width;
                    statImg = new BufferedImage(statWidth, height, BufferedImage.TYPE_3BYTE_BGR);
                    if (doubleView)
                        for (int x = width; x < statXoffset; x++) for (int y = 0; y < height; y++) statImg.setRGB(x, y, Color.RED.getRGB());
                    canvasFrame.setCanvasSize(statWidth, height);
                }
            }
            Graphics graphics = null;
            if (!quiet) {
                graphics = statImg.getGraphics();
                graphics.drawImage(img.getBufferedImage(), 0, 0, null);
                if (doubleView) {
                    graphics.setColor(Color.BLACK);
                    graphics.fillRect(statXoffset, 0, statXoffset + width, height);
                }
            }
            /*
                 * Wrap the frame to a Java BufferedImage and parse it pixel by pixel.
                 */
            ByteBuffer buffer = img.getByteBuffer();
            boolean[][] ignoredPixels = new boolean[width][height];
            for (int x = 0; x < width; x++) for (int y = 0; y < height; y++) ignoredPixels[x][y] = false;
            ArrayList<Pixel>[] impacts = new ArrayList[(height >> 6) * (width >> 6)];
            int c = 0;
            for (ImageScanner[] isa : scanners) for (ImageScanner is : isa) impacts[c++] = is.scan(buffer, img.widthStep(), img.nChannels(), start, ignoredPixels);
            boolean impact = false;
            for (ArrayList<Pixel> list : impacts) if (!list.isEmpty()) {
                for (Pixel pix : list) {
                    toOSrng(pix.x);
                    toOSrng(pix.power);
                    toOSrng(pix.y);
                    if (!quiet) {
                        crosses.add(pix);
                        if (randomImageNumber > 0)
                            randomImagePixels.add(pix);
                    }
                }
                toOSrng((int) (start - lastFound));
                impact = true;
            }
            if (!quiet) {
                Iterator<Pixel> iter = crosses.iterator();
                Pixel pix;
                graphics.setColor(Color.RED);
                //boolean imp = false;
                while (iter.hasNext()) {
                    pix = iter.next();
                    if (start - pix.found > 2000L) {
                        iter.remove();
                        continue;
                    }
                    paintCross(graphics, pix);
                //imp = true;
                }
            /* TODO: Debugging stuff
                    if(imp)
                        try {
                            String fn = String.valueOf(in++);
                            while(fn.length() < 5)
                                fn = "0"+fn;
                            File out = new File("debug/"+fn+".png");
                            ImageIO.write(statImg, "png", out);
                        } catch(IOException e) {
                            e.printStackTrace();
                        }*/
            }
            /*
                 * Write the yellow, transparent text onto the window and update it.
                 */
            if (!quiet) {
                graphics.setColor(yellow);
                if (doubleView) {
                    graphics.setFont(font);
                    graphics.drawString("Raw", width / 2 - 25, 25);
                    graphics.drawString("Filtered", statXoffset + (width / 2 - 50), 25);
                }
                graphics.setFont(smallFont);
                int ty = 1;
                for (String st : statOut) graphics.drawString(st, 5, ty++ * 10);
                graphics.setColor(Color.RED);
                getLock(false);
                if (videoOut != null) {
                    try {
                        ts += avgFPS == 0.0f ? start - lastFound : avgFPS;
                        //TODO: DEBUG!
                        videoOut.setTimestamp((int) ts);
                        videoOut.record(IplImage.createFrom(statImg));
                        lock.set(false);
                    } catch (org.bytedeco.javacv.FrameRecorder.Exception e) {
                        lock.set(false);
                        e.printStackTrace();
                        toggleRecording();
                    }
                    graphics.fillOval(statXoffset + width - 25, height - 25, 20, 20);
                } else {
                    lock.set(false);
                    graphics.drawOval(statXoffset + width - 25, height - 25, 20, 20);
                }
                graphics.setColor(Color.GREEN);
                if (randomImageNumber > 0)
                    graphics.fillOval(statXoffset + width - 50, height - 25, 20, 20);
                else
                    graphics.drawOval(statXoffset + width - 50, height - 25, 20, 20);
                if (!quiet)
                    canvasFrame.showImage(statImg);
            }
            if (impact)
                lastFound = start;
            /*
                 * Release the resources of the frame.
                 */
            img.release();
            firstRun = false;
        }
        try {
            /*
                 * Don't let us burn all CPU in case we're under heavy load.
                 */
            Thread.sleep(2L);
        } catch (InterruptedException e) {
        }
    }
}
Example 63
Project: spring-loaded-master  File: Java8Tests.java View source code
// This variant reloads only the helper (target)
@Test
public void lambdaMethodReferenceInAnotherClass3() throws Exception {
    TypeRegistry typeRegistry = getTypeRegistry("basic..*");
    byte[] sc = loadBytesForClass("basic.LambdaN");
    ReloadableType rtype = typeRegistry.addType("basic.LambdaN", sc);
    byte[] helperBytes = loadBytesForClass("basic.HelperN");
    ReloadableType htype = typeRegistry.addType("basic.HelperN", helperBytes);
    Class<?> simpleClass = rtype.getClazz();
    Result r = runUnguarded(simpleClass, "run");
    r = runUnguarded(simpleClass, "run");
    assertEquals("{15=test3}", r.returnValue);
    //		rtype.loadNewVersion(sc);
    htype.loadNewVersion(helperBytes);
    //		try {
    r = runUnguarded(simpleClass, "run");
    assertEquals("{15=test3}", r.returnValue);
//			fail("did not expect that to work");
//		}
//		catch (Exception e) {
//			e.printStackTrace();
//			//			Caused by: java.lang.NoClassDefFoundError: basic/HelperN$$E2
//			//			at basic.LambdaN$$Lambda$8/2085857771.apply(Unknown Source)
//			//			at java.util.stream.Collectors.lambda$toMap$172(Collectors.java:1320)
//			//			at java.util.stream.Collectors$$Lambda$5/1521118594.accept(Unknown Source)
//			// That happens because LambdaN, which has not been reloaded, is loaded by classloader X, the computed
//			// method to satisfy the lambda is in the executor for the helper, which is in a child classloader - that
//			// is not visible from the one that loaded LambdaN.
//			// However, part of the resolution process in the Java8 handling forces LambdaN to reload, so next
//			// time we go in, the class can be seen because LambdaN$$E2 is in the same classloader. That is
//			// why when we repeat what we just did, it'll work
//		}
//		r = runUnguarded(simpleClass, "run");
//		assertEquals("{15=test3}", r.returnValue);
}
Example 64
Project: maven-shared-master  File: DefaultMavenReportExecutor.java View source code
private MavenReport getConfiguredMavenReport(MojoExecution mojoExecution, PluginDescriptor pluginDescriptor, MavenReportExecutorRequest mavenReportExecutorRequest) throws PluginContainerException, PluginConfigurationException {
    try {
        Mojo mojo = mavenPluginManager.getConfiguredMojo(Mojo.class, mavenReportExecutorRequest.getMavenSession(), mojoExecution);
        return (MavenReport) mojo;
    } catch (ClassCastException e) {
        getLog().warn("skip ClassCastException " + e.getMessage());
        return null;
    } catch (PluginContainerException e) {
        if (e.getCause() != null && e.getCause() instanceof NoClassDefFoundError && e.getMessage().contains("PluginRegistry")) {
            getLog().warn("skip NoClassDefFoundError with PluginRegistry ");
            if (getLog().isDebugEnabled()) {
                getLog().debug(e.getMessage(), e);
            }
            return null;
        }
        throw e;
    }
}
Example 65
Project: eql-master  File: Reflect.java View source code
/**
     * Call a constructor.
     * This is roughly equivalent to {@link java.lang.reflect.Constructor#newInstance(Object...)}.
     * If the wrapped object is a {@link Class}, then this will create a new
     * object of that class. If the wrapped object is any other {@link Object},
     * then this will create a new object of the same type.
     * Just like {@link java.lang.reflect.Constructor#newInstance(Object...)}, this will try to
     * wrap primitive types or unwrap primitive type wrappers if applicable. If
     * several constructors are applicable, by that rule, the first one
     * encountered is called. i.e. when calling <code>
     * on(C.class).create(1, 1);
     * </code> The first of the following constructors will be applied:
     * <code>
     * public C(int param1, Integer param2);
     * public C(Integer param1, int param2);
     * public C(Number param1, Number param2);
     * public C(Number param1, Object param2);
     * public C(int param1, Object param2);
     * </code>
     *
     * @param args The constructor arguments
     * @return The wrapped new object, to be used for further reflection.
     * @throws ReflectException If any reflection exception occurred.
     */
public Reflect create(Object... args) throws ReflectException {
    Class<?>[] types = types(args);
    // matching argument types
    try {
        Constructor<?> constructor = type().getDeclaredConstructor(types);
        return on(constructor, args);
    }// signature if primitive argument types are converted to their wrappers
     catch (NoSuchMethodException e) {
        for (Constructor<?> constructor : type().getConstructors()) {
            if (match(constructor.getParameterTypes(), types)) {
                return on(constructor, args);
            }
        }
        Class<?> type = type();
        try {
            Object o = Ob.createInstance(type);
            if (o != null)
                return on(o);
        } catch (NoClassDefFoundError e1) {
        }
        throw new ReflectException("unable to create bean for " + type());
    }
}
Example 66
Project: Deadlock-Preventer-master  File: CodeGen.java View source code
/* MemberCodeGen overrides this method.
     */
protected void atClassObject2(String cname) throws CompileError {
    int start = bytecode.currentPc();
    bytecode.addLdc(cname);
    bytecode.addInvokestatic("java.lang.Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;");
    int end = bytecode.currentPc();
    bytecode.addOpcode(Opcode.GOTO);
    int pc = bytecode.currentPc();
    // correct later
    bytecode.addIndex(0);
    bytecode.addExceptionHandler(start, end, bytecode.currentPc(), "java.lang.ClassNotFoundException");
    /* -- the following code is for inlining a call to DotClass.fail().

        int var = getMaxLocals();
        incMaxLocals(1);
        bytecode.growStack(1);
        bytecode.addAstore(var);

        bytecode.addNew("java.lang.NoClassDefFoundError");
        bytecode.addOpcode(DUP);
        bytecode.addAload(var);
        bytecode.addInvokevirtual("java.lang.ClassNotFoundException",
                                  "getMessage", "()Ljava/lang/String;");
        bytecode.addInvokespecial("java.lang.NoClassDefFoundError", "<init>",
                                  "(Ljava/lang/String;)V");
        */
    bytecode.growStack(1);
    bytecode.addInvokestatic("javassist.runtime.DotClass", "fail", "(Ljava/lang/ClassNotFoundException;)" + "Ljava/lang/NoClassDefFoundError;");
    bytecode.addOpcode(ATHROW);
    bytecode.write16bit(pc, bytecode.currentPc() - pc + 1);
}
Example 67
Project: gjit-master  File: TreeNodeOrgDump.java View source code
public static byte[] dump() throws Exception {
    ClassWriter cw = new ClassWriter(0);
    FieldVisitor fv;
    MethodVisitor mv;
    AnnotationVisitor av0;
    cw.visit(V1_3, ACC_PUBLIC, "TreeNode", null, "java/lang/Object", new String[] { "groovy/lang/GroovyObject" });
    cw.visitSource("TreeNode.groovy", null);
    {
        fv = cw.visitField(ACC_PUBLIC + ACC_FINAL + ACC_STATIC + ACC_SYNTHETIC, "$ownClass", "Ljava/lang/Class;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE, "left", "Ljava/lang/Object;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE, "right", "Ljava/lang/Object;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE, "item", "I", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE + ACC_FINAL + ACC_STATIC + ACC_SYNTHETIC, "$const$0", "Ljava/lang/Integer;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE + ACC_FINAL + ACC_STATIC + ACC_SYNTHETIC, "$const$1", "Ljava/lang/Integer;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE + ACC_FINAL + ACC_STATIC + ACC_SYNTHETIC, "$const$2", "Ljava/lang/Integer;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE + ACC_FINAL + ACC_STATIC + ACC_SYNTHETIC, "$const$3", "Ljava/lang/Integer;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE + ACC_FINAL + ACC_STATIC + ACC_SYNTHETIC, "$const$4", "Ljava/lang/Integer;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PUBLIC + ACC_STATIC, "$staticMetaClass", "Ljava/lang/ref/SoftReference;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE + ACC_TRANSIENT, "metaClass", "Lgroovy/lang/MetaClass;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PUBLIC + ACC_STATIC, "__timeStamp", "Ljava/lang/Long;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PUBLIC + ACC_STATIC, "__timeStamp__239_neverHappen1216335190359", "Ljava/lang/Long;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$class$TreeNode", "Ljava/lang/Class;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$class$java$lang$Class", "Ljava/lang/Class;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$class$java$lang$Long", "Ljava/lang/Class;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$class$groovy$lang$MetaClass", "Ljava/lang/Class;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$class$java$lang$Integer", "Ljava/lang/Class;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$class$java$lang$System", "Ljava/lang/Class;", null, null);
        fv.visitEnd();
    }
    {
        fv = cw.visitField(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$callSiteArray", "Ljava/lang/ref/SoftReference;", null, null);
        fv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(I)V", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        mv.visitTryCatchBlock(l0, l1, l1, "groovy/lang/GroovyRuntimeException");
        mv.visitLabel(l0);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
        Label l2 = new Label();
        mv.visitLabel(l2);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$getCallSiteArray", "()[Lorg/codehaus/groovy/runtime/callsite/CallSite;");
        mv.visitVarInsn(ASTORE, 2);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(DUP);
        mv.visitMethodInsn(INVOKEVIRTUAL, "TreeNode", "$getStaticMetaClass", "()Lgroovy/lang/MetaClass;");
        mv.visitFieldInsn(PUTFIELD, "TreeNode", "metaClass", "Lgroovy/lang/MetaClass;");
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, "TreeNode", "metaClass", "Lgroovy/lang/MetaClass;");
        mv.visitInsn(DUP);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$get$$class$groovy$lang$MetaClass", "()Ljava/lang/Class;");
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "castToType", "(Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;");
        mv.visitTypeInsn(CHECKCAST, "groovy/lang/MetaClass");
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(SWAP);
        mv.visitFieldInsn(PUTFIELD, "TreeNode", "metaClass", "Lgroovy/lang/MetaClass;");
        mv.visitInsn(POP);
        Label l3 = new Label();
        mv.visitLabel(l3);
        mv.visitLineNumber(14, l3);
        mv.visitVarInsn(ILOAD, 1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "box", "(I)Ljava/lang/Object;");
        mv.visitInsn(DUP);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(SWAP);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "intUnbox", "(Ljava/lang/Object;)I");
        mv.visitFieldInsn(PUTFIELD, "TreeNode", "item", "I");
        mv.visitInsn(POP);
        Label l4 = new Label();
        mv.visitLabel(l4);
        mv.visitInsn(RETURN);
        Label l5 = new Label();
        mv.visitJumpInsn(GOTO, l5);
        mv.visitLabel(l1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "unwrap", "(Lgroovy/lang/GroovyRuntimeException;)Ljava/lang/Throwable;");
        mv.visitInsn(ATHROW);
        mv.visitLabel(l5);
        mv.visitInsn(NOP);
        mv.visitLocalVariable("this", "LTreeNode;", null, l2, l4, 0);
        mv.visitLocalVariable("item", "I", null, l2, l4, 1);
        mv.visitMaxs(3, 3);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(Ljava/lang/Object;Ljava/lang/Object;I)V", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        mv.visitTryCatchBlock(l0, l1, l1, "groovy/lang/GroovyRuntimeException");
        mv.visitLabel(l0);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
        Label l2 = new Label();
        mv.visitLabel(l2);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$getCallSiteArray", "()[Lorg/codehaus/groovy/runtime/callsite/CallSite;");
        mv.visitVarInsn(ASTORE, 4);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(DUP);
        mv.visitMethodInsn(INVOKEVIRTUAL, "TreeNode", "$getStaticMetaClass", "()Lgroovy/lang/MetaClass;");
        mv.visitFieldInsn(PUTFIELD, "TreeNode", "metaClass", "Lgroovy/lang/MetaClass;");
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, "TreeNode", "metaClass", "Lgroovy/lang/MetaClass;");
        mv.visitInsn(DUP);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$get$$class$groovy$lang$MetaClass", "()Ljava/lang/Class;");
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "castToType", "(Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;");
        mv.visitTypeInsn(CHECKCAST, "groovy/lang/MetaClass");
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(SWAP);
        mv.visitFieldInsn(PUTFIELD, "TreeNode", "metaClass", "Lgroovy/lang/MetaClass;");
        mv.visitInsn(POP);
        Label l3 = new Label();
        mv.visitLabel(l3);
        mv.visitLineNumber(30, l3);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitInsn(DUP);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(SWAP);
        mv.visitFieldInsn(PUTFIELD, "TreeNode", "left", "Ljava/lang/Object;");
        mv.visitInsn(POP);
        Label l4 = new Label();
        mv.visitLabel(l4);
        mv.visitLineNumber(31, l4);
        mv.visitVarInsn(ALOAD, 2);
        mv.visitInsn(DUP);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(SWAP);
        mv.visitFieldInsn(PUTFIELD, "TreeNode", "right", "Ljava/lang/Object;");
        mv.visitInsn(POP);
        Label l5 = new Label();
        mv.visitLabel(l5);
        mv.visitLineNumber(32, l5);
        mv.visitVarInsn(ILOAD, 3);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "box", "(I)Ljava/lang/Object;");
        mv.visitInsn(DUP);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(SWAP);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "intUnbox", "(Ljava/lang/Object;)I");
        mv.visitFieldInsn(PUTFIELD, "TreeNode", "item", "I");
        mv.visitInsn(POP);
        Label l6 = new Label();
        mv.visitLabel(l6);
        mv.visitInsn(RETURN);
        Label l7 = new Label();
        mv.visitJumpInsn(GOTO, l7);
        mv.visitLabel(l1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "unwrap", "(Lgroovy/lang/GroovyRuntimeException;)Ljava/lang/Throwable;");
        mv.visitInsn(ATHROW);
        mv.visitLabel(l7);
        mv.visitInsn(NOP);
        mv.visitLocalVariable("this", "LTreeNode;", null, l2, l6, 0);
        mv.visitLocalVariable("left", "Ljava/lang/Object;", null, l2, l6, 1);
        mv.visitLocalVariable("right", "Ljava/lang/Object;", null, l2, l6, 2);
        mv.visitLocalVariable("item", "I", null, l2, l6, 3);
        mv.visitMaxs(3, 5);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC, "bottomUpTree", "(II)Ljava/lang/Object;", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        mv.visitTryCatchBlock(l0, l1, l1, "groovy/lang/GroovyRuntimeException");
        mv.visitLabel(l0);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$getCallSiteArray", "()[Lorg/codehaus/groovy/runtime/callsite/CallSite;");
        mv.visitVarInsn(ASTORE, 2);
        Label l2 = new Label();
        mv.visitLabel(l2);
        mv.visitLineNumber(18, l2);
        mv.visitVarInsn(ILOAD, 1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "box", "(I)Ljava/lang/Object;");
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$const$0", "Ljava/lang/Integer;");
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "compareGreaterThan", "(Ljava/lang/Object;Ljava/lang/Object;)Z");
        Label l3 = new Label();
        mv.visitJumpInsn(IFEQ, l3);
        Label l4 = new Label();
        mv.visitLabel(l4);
        mv.visitLineNumber(19, l4);
        mv.visitVarInsn(ALOAD, 2);
        mv.visitLdcInsn(new Integer(0));
        mv.visitInsn(AALOAD);
        mv.visitVarInsn(ILOAD, 1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "box", "(I)Ljava/lang/Object;");
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$const$1", "Ljava/lang/Integer;");
        mv.visitMethodInsn(INVOKEINTERFACE, "org/codehaus/groovy/runtime/callsite/CallSite", "call", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
        mv.visitInsn(DUP);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "intUnbox", "(Ljava/lang/Object;)I");
        mv.visitVarInsn(ISTORE, 1);
        mv.visitInsn(POP);
        Label l5 = new Label();
        mv.visitLabel(l5);
        mv.visitLineNumber(20, l5);
        mv.visitVarInsn(ALOAD, 2);
        mv.visitLdcInsn(new Integer(1));
        mv.visitInsn(AALOAD);
        mv.visitVarInsn(ILOAD, 0);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "box", "(I)Ljava/lang/Object;");
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$const$2", "Ljava/lang/Integer;");
        mv.visitMethodInsn(INVOKEINTERFACE, "org/codehaus/groovy/runtime/callsite/CallSite", "call", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$get$$class$java$lang$Integer", "()Ljava/lang/Class;");
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "castToType", "(Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;");
        mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
        mv.visitVarInsn(ASTORE, 3);
        Label l6 = new Label();
        mv.visitLabel(l6);
        mv.visitLineNumber(21, l6);
        mv.visitVarInsn(ALOAD, 2);
        mv.visitLdcInsn(new Integer(2));
        mv.visitInsn(AALOAD);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$get$$class$TreeNode", "()Ljava/lang/Class;");
        Label l7 = new Label();
        mv.visitLabel(l7);
        mv.visitLineNumber(21, l7);
        mv.visitVarInsn(ALOAD, 2);
        mv.visitLdcInsn(new Integer(3));
        mv.visitInsn(AALOAD);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$get$$class$TreeNode", "()Ljava/lang/Class;");
        Label l8 = new Label();
        mv.visitLabel(l8);
        mv.visitLineNumber(21, l8);
        mv.visitVarInsn(ALOAD, 2);
        mv.visitLdcInsn(new Integer(4));
        mv.visitInsn(AALOAD);
        mv.visitVarInsn(ALOAD, 3);
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$const$1", "Ljava/lang/Integer;");
        mv.visitMethodInsn(INVOKEINTERFACE, "org/codehaus/groovy/runtime/callsite/CallSite", "call", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
        mv.visitVarInsn(ILOAD, 1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "box", "(I)Ljava/lang/Object;");
        mv.visitMethodInsn(INVOKEINTERFACE, "org/codehaus/groovy/runtime/callsite/CallSite", "callStatic", "(Ljava/lang/Class;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
        Label l9 = new Label();
        mv.visitLabel(l9);
        mv.visitLineNumber(22, l9);
        mv.visitVarInsn(ALOAD, 2);
        mv.visitLdcInsn(new Integer(5));
        mv.visitInsn(AALOAD);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$get$$class$TreeNode", "()Ljava/lang/Class;");
        mv.visitVarInsn(ALOAD, 3);
        mv.visitVarInsn(ILOAD, 1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "box", "(I)Ljava/lang/Object;");
        mv.visitMethodInsn(INVOKEINTERFACE, "org/codehaus/groovy/runtime/callsite/CallSite", "callStatic", "(Ljava/lang/Class;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
        mv.visitVarInsn(ILOAD, 0);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "box", "(I)Ljava/lang/Object;");
        mv.visitMethodInsn(INVOKEINTERFACE, "org/codehaus/groovy/runtime/callsite/CallSite", "callConstructor", "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
        mv.visitInsn(ARETURN);
        Label l10 = new Label();
        mv.visitLabel(l10);
        Label l11 = new Label();
        mv.visitJumpInsn(GOTO, l11);
        mv.visitLabel(l3);
        mv.visitLineNumber(25, l3);
        mv.visitVarInsn(ALOAD, 2);
        mv.visitLdcInsn(new Integer(6));
        mv.visitInsn(AALOAD);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$get$$class$TreeNode", "()Ljava/lang/Class;");
        mv.visitVarInsn(ILOAD, 0);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "box", "(I)Ljava/lang/Object;");
        mv.visitMethodInsn(INVOKEINTERFACE, "org/codehaus/groovy/runtime/callsite/CallSite", "callConstructor", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
        mv.visitInsn(ARETURN);
        mv.visitLabel(l11);
        Label l12 = new Label();
        mv.visitJumpInsn(GOTO, l12);
        mv.visitLabel(l1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "unwrap", "(Lgroovy/lang/GroovyRuntimeException;)Ljava/lang/Throwable;");
        mv.visitInsn(ATHROW);
        mv.visitLabel(l12);
        mv.visitInsn(NOP);
        mv.visitLocalVariable("item", "I", null, l0, l11, 0);
        mv.visitLocalVariable("depth", "I", null, l0, l11, 1);
        mv.visitLocalVariable("item2", "Ljava/lang/Integer;", null, l6, l10, 3);
        mv.visitMaxs(7, 5);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC, "itemCheck", "()I", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        mv.visitTryCatchBlock(l0, l1, l1, "groovy/lang/GroovyRuntimeException");
        mv.visitLabel(l0);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$getCallSiteArray", "()[Lorg/codehaus/groovy/runtime/callsite/CallSite;");
        mv.visitVarInsn(ASTORE, 1);
        Label l2 = new Label();
        mv.visitLabel(l2);
        mv.visitLineNumber(37, l2);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, "TreeNode", "left", "Ljava/lang/Object;");
        mv.visitInsn(ACONST_NULL);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "compareEqual", "(Ljava/lang/Object;Ljava/lang/Object;)Z");
        Label l3 = new Label();
        mv.visitJumpInsn(IFEQ, l3);
        Label l4 = new Label();
        mv.visitLabel(l4);
        mv.visitLineNumber(37, l4);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, "TreeNode", "item", "I");
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "box", "(I)Ljava/lang/Object;");
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$get$$class$java$lang$Integer", "()Ljava/lang/Class;");
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "castToType", "(Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;");
        mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "intUnbox", "(Ljava/lang/Object;)I");
        mv.visitInsn(IRETURN);
        Label l5 = new Label();
        mv.visitJumpInsn(GOTO, l5);
        mv.visitLabel(l3);
        mv.visitLineNumber(38, l3);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitLdcInsn(new Integer(7));
        mv.visitInsn(AALOAD);
        Label l6 = new Label();
        mv.visitLabel(l6);
        mv.visitLineNumber(38, l6);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitLdcInsn(new Integer(8));
        mv.visitInsn(AALOAD);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, "TreeNode", "item", "I");
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "box", "(I)Ljava/lang/Object;");
        Label l7 = new Label();
        mv.visitLabel(l7);
        mv.visitLineNumber(38, l7);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitLdcInsn(new Integer(9));
        mv.visitInsn(AALOAD);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, "TreeNode", "left", "Ljava/lang/Object;");
        mv.visitMethodInsn(INVOKEINTERFACE, "org/codehaus/groovy/runtime/callsite/CallSite", "call", "(Ljava/lang/Object;)Ljava/lang/Object;");
        mv.visitMethodInsn(INVOKEINTERFACE, "org/codehaus/groovy/runtime/callsite/CallSite", "call", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
        Label l8 = new Label();
        mv.visitLabel(l8);
        mv.visitLineNumber(38, l8);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitLdcInsn(new Integer(10));
        mv.visitInsn(AALOAD);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, "TreeNode", "right", "Ljava/lang/Object;");
        mv.visitMethodInsn(INVOKEINTERFACE, "org/codehaus/groovy/runtime/callsite/CallSite", "call", "(Ljava/lang/Object;)Ljava/lang/Object;");
        mv.visitMethodInsn(INVOKEINTERFACE, "org/codehaus/groovy/runtime/callsite/CallSite", "call", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$get$$class$java$lang$Integer", "()Ljava/lang/Class;");
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "castToType", "(Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;");
        mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation", "intUnbox", "(Ljava/lang/Object;)I");
        mv.visitInsn(IRETURN);
        mv.visitLabel(l5);
        Label l9 = new Label();
        mv.visitJumpInsn(GOTO, l9);
        mv.visitLabel(l1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "unwrap", "(Lgroovy/lang/GroovyRuntimeException;)Ljava/lang/Throwable;");
        mv.visitInsn(ATHROW);
        mv.visitLabel(l9);
        mv.visitInsn(NOP);
        mv.visitLocalVariable("this", "LTreeNode;", null, l0, l5, 0);
        mv.visitMaxs(5, 2);
        mv.visitEnd();
    }
    dump_main(cw);
    {
        mv = cw.visitMethod(ACC_PROTECTED + ACC_SYNTHETIC, "$getStaticMetaClass", "()Lgroovy/lang/MetaClass;", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        mv.visitTryCatchBlock(l0, l1, l1, "groovy/lang/GroovyRuntimeException");
        mv.visitLabel(l0);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$getCallSiteArray", "()[Lorg/codehaus/groovy/runtime/callsite/CallSite;");
        mv.visitVarInsn(ASTORE, 1);
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$staticMetaClass", "Ljava/lang/ref/SoftReference;");
        mv.visitVarInsn(ASTORE, 1);
        mv.visitVarInsn(ALOAD, 1);
        Label l2 = new Label();
        mv.visitJumpInsn(IFNULL, l2);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/ref/SoftReference", "get", "()Ljava/lang/Object;");
        mv.visitTypeInsn(CHECKCAST, "groovy/lang/MetaClass");
        mv.visitInsn(DUP);
        mv.visitVarInsn(ASTORE, 1);
        Label l3 = new Label();
        mv.visitJumpInsn(IFNONNULL, l3);
        mv.visitLabel(l2);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "getClass", "()Ljava/lang/Class;");
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/InvokerHelper", "getMetaClass", "(Ljava/lang/Class;)Lgroovy/lang/MetaClass;");
        mv.visitVarInsn(ASTORE, 1);
        mv.visitTypeInsn(NEW, "java/lang/ref/SoftReference");
        mv.visitInsn(DUP);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/ref/SoftReference", "<init>", "(Ljava/lang/Object;)V");
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$staticMetaClass", "Ljava/lang/ref/SoftReference;");
        mv.visitLabel(l3);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitInsn(ARETURN);
        mv.visitInsn(RETURN);
        Label l4 = new Label();
        mv.visitLabel(l4);
        Label l5 = new Label();
        mv.visitJumpInsn(GOTO, l5);
        mv.visitLabel(l1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "unwrap", "(Lgroovy/lang/GroovyRuntimeException;)Ljava/lang/Throwable;");
        mv.visitInsn(ATHROW);
        mv.visitLabel(l5);
        mv.visitInsn(NOP);
        mv.visitLocalVariable("this", "LTreeNode;", null, l0, l4, 0);
        mv.visitMaxs(3, 2);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "getMetaClass", "()Lgroovy/lang/MetaClass;", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        mv.visitTryCatchBlock(l0, l1, l1, "groovy/lang/GroovyRuntimeException");
        mv.visitLabel(l0);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$getCallSiteArray", "()[Lorg/codehaus/groovy/runtime/callsite/CallSite;");
        mv.visitVarInsn(ASTORE, 1);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, "TreeNode", "metaClass", "Lgroovy/lang/MetaClass;");
        mv.visitInsn(DUP);
        Label l2 = new Label();
        mv.visitJumpInsn(IFNULL, l2);
        mv.visitInsn(ARETURN);
        mv.visitLabel(l2);
        mv.visitInsn(POP);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(DUP);
        mv.visitMethodInsn(INVOKEVIRTUAL, "TreeNode", "$getStaticMetaClass", "()Lgroovy/lang/MetaClass;");
        mv.visitFieldInsn(PUTFIELD, "TreeNode", "metaClass", "Lgroovy/lang/MetaClass;");
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, "TreeNode", "metaClass", "Lgroovy/lang/MetaClass;");
        mv.visitInsn(ARETURN);
        mv.visitInsn(RETURN);
        Label l3 = new Label();
        mv.visitLabel(l3);
        Label l4 = new Label();
        mv.visitJumpInsn(GOTO, l4);
        mv.visitLabel(l1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "unwrap", "(Lgroovy/lang/GroovyRuntimeException;)Ljava/lang/Throwable;");
        mv.visitInsn(ATHROW);
        mv.visitLabel(l4);
        mv.visitInsn(NOP);
        mv.visitLocalVariable("this", "LTreeNode;", null, l0, l3, 0);
        mv.visitMaxs(2, 2);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "setMetaClass", "(Lgroovy/lang/MetaClass;)V", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        mv.visitTryCatchBlock(l0, l1, l1, "groovy/lang/GroovyRuntimeException");
        mv.visitLabel(l0);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$getCallSiteArray", "()[Lorg/codehaus/groovy/runtime/callsite/CallSite;");
        mv.visitVarInsn(ASTORE, 2);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitFieldInsn(PUTFIELD, "TreeNode", "metaClass", "Lgroovy/lang/MetaClass;");
        mv.visitInsn(RETURN);
        Label l2 = new Label();
        mv.visitLabel(l2);
        mv.visitInsn(RETURN);
        Label l3 = new Label();
        mv.visitJumpInsn(GOTO, l3);
        mv.visitLabel(l1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "unwrap", "(Lgroovy/lang/GroovyRuntimeException;)Ljava/lang/Throwable;");
        mv.visitInsn(ATHROW);
        mv.visitLabel(l3);
        mv.visitInsn(NOP);
        mv.visitLocalVariable("this", "LTreeNode;", null, l0, l2, 0);
        mv.visitLocalVariable("mc", "Lgroovy/lang/MetaClass;", null, l0, l2, 1);
        mv.visitMaxs(2, 3);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "invokeMethod", "(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        mv.visitTryCatchBlock(l0, l1, l1, "groovy/lang/GroovyRuntimeException");
        mv.visitLabel(l0);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$getCallSiteArray", "()[Lorg/codehaus/groovy/runtime/callsite/CallSite;");
        mv.visitVarInsn(ASTORE, 3);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKEVIRTUAL, "TreeNode", "getMetaClass", "()Lgroovy/lang/MetaClass;");
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitVarInsn(ALOAD, 2);
        mv.visitMethodInsn(INVOKEINTERFACE, "groovy/lang/MetaObjectProtocol", "invokeMethod", "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;");
        mv.visitInsn(ARETURN);
        mv.visitInsn(RETURN);
        Label l2 = new Label();
        mv.visitLabel(l2);
        Label l3 = new Label();
        mv.visitJumpInsn(GOTO, l3);
        mv.visitLabel(l1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "unwrap", "(Lgroovy/lang/GroovyRuntimeException;)Ljava/lang/Throwable;");
        mv.visitInsn(ATHROW);
        mv.visitLabel(l3);
        mv.visitInsn(NOP);
        mv.visitLocalVariable("this", "LTreeNode;", null, l0, l2, 0);
        mv.visitLocalVariable("method", "Ljava/lang/String;", null, l0, l2, 1);
        mv.visitLocalVariable("arguments", "Ljava/lang/Object;", null, l0, l2, 2);
        mv.visitMaxs(4, 4);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "getProperty", "(Ljava/lang/String;)Ljava/lang/Object;", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        mv.visitTryCatchBlock(l0, l1, l1, "groovy/lang/GroovyRuntimeException");
        mv.visitLabel(l0);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$getCallSiteArray", "()[Lorg/codehaus/groovy/runtime/callsite/CallSite;");
        mv.visitVarInsn(ASTORE, 2);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKEVIRTUAL, "TreeNode", "getMetaClass", "()Lgroovy/lang/MetaClass;");
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitMethodInsn(INVOKEINTERFACE, "groovy/lang/MetaClass", "getProperty", "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;");
        mv.visitInsn(ARETURN);
        mv.visitInsn(RETURN);
        Label l2 = new Label();
        mv.visitLabel(l2);
        Label l3 = new Label();
        mv.visitJumpInsn(GOTO, l3);
        mv.visitLabel(l1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "unwrap", "(Lgroovy/lang/GroovyRuntimeException;)Ljava/lang/Throwable;");
        mv.visitInsn(ATHROW);
        mv.visitLabel(l3);
        mv.visitInsn(NOP);
        mv.visitLocalVariable("this", "LTreeNode;", null, l0, l2, 0);
        mv.visitLocalVariable("property", "Ljava/lang/String;", null, l0, l2, 1);
        mv.visitMaxs(3, 3);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "setProperty", "(Ljava/lang/String;Ljava/lang/Object;)V", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        mv.visitTryCatchBlock(l0, l1, l1, "groovy/lang/GroovyRuntimeException");
        mv.visitLabel(l0);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$getCallSiteArray", "()[Lorg/codehaus/groovy/runtime/callsite/CallSite;");
        mv.visitVarInsn(ASTORE, 3);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKEVIRTUAL, "TreeNode", "getMetaClass", "()Lgroovy/lang/MetaClass;");
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitVarInsn(ALOAD, 2);
        mv.visitMethodInsn(INVOKEINTERFACE, "groovy/lang/MetaClass", "setProperty", "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V");
        mv.visitInsn(RETURN);
        mv.visitInsn(RETURN);
        Label l2 = new Label();
        mv.visitLabel(l2);
        mv.visitInsn(RETURN);
        Label l3 = new Label();
        mv.visitJumpInsn(GOTO, l3);
        mv.visitLabel(l1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "unwrap", "(Lgroovy/lang/GroovyRuntimeException;)Ljava/lang/Throwable;");
        mv.visitInsn(ATHROW);
        mv.visitLabel(l3);
        mv.visitInsn(NOP);
        mv.visitLocalVariable("this", "LTreeNode;", null, l0, l2, 0);
        mv.visitLocalVariable("property", "Ljava/lang/String;", null, l0, l2, 1);
        mv.visitLocalVariable("value", "Ljava/lang/Object;", null, l0, l2, 2);
        mv.visitMaxs(4, 4);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_STATIC, "<clinit>", "()V", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        mv.visitTryCatchBlock(l0, l1, l1, "groovy/lang/GroovyRuntimeException");
        mv.visitLabel(l0);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$get$$class$TreeNode", "()Ljava/lang/Class;");
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$get$$class$java$lang$Class", "()Ljava/lang/Class;");
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "castToType", "(Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;");
        mv.visitTypeInsn(CHECKCAST, "java/lang/Class");
        mv.visitInsn(DUP);
        mv.visitTypeInsn(CHECKCAST, "java/lang/Class");
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$ownClass", "Ljava/lang/Class;");
        mv.visitInsn(POP);
        mv.visitTypeInsn(NEW, "java/lang/Integer");
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(0));
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Integer", "<init>", "(I)V");
        mv.visitInsn(DUP);
        mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$const$0", "Ljava/lang/Integer;");
        mv.visitInsn(POP);
        mv.visitTypeInsn(NEW, "java/lang/Integer");
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(1));
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Integer", "<init>", "(I)V");
        mv.visitInsn(DUP);
        mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$const$1", "Ljava/lang/Integer;");
        mv.visitInsn(POP);
        mv.visitTypeInsn(NEW, "java/lang/Integer");
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(2));
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Integer", "<init>", "(I)V");
        mv.visitInsn(DUP);
        mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$const$2", "Ljava/lang/Integer;");
        mv.visitInsn(POP);
        mv.visitTypeInsn(NEW, "java/lang/Integer");
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(10));
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Integer", "<init>", "(I)V");
        mv.visitInsn(DUP);
        mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$const$3", "Ljava/lang/Integer;");
        mv.visitInsn(POP);
        mv.visitTypeInsn(NEW, "java/lang/Integer");
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(4));
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Integer", "<init>", "(I)V");
        mv.visitInsn(DUP);
        mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$const$4", "Ljava/lang/Integer;");
        mv.visitInsn(POP);
        mv.visitTypeInsn(NEW, "java/lang/Long");
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Long(1216335190359L));
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Long", "<init>", "(J)V");
        mv.visitInsn(DUP);
        mv.visitTypeInsn(CHECKCAST, "java/lang/Long");
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "__timeStamp", "Ljava/lang/Long;");
        mv.visitInsn(POP);
        mv.visitTypeInsn(NEW, "java/lang/Long");
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Long(0L));
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Long", "<init>", "(J)V");
        mv.visitInsn(DUP);
        mv.visitTypeInsn(CHECKCAST, "java/lang/Long");
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "__timeStamp__239_neverHappen1216335190359", "Ljava/lang/Long;");
        mv.visitInsn(POP);
        mv.visitInsn(RETURN);
        mv.visitInsn(RETURN);
        Label l2 = new Label();
        mv.visitJumpInsn(GOTO, l2);
        mv.visitLabel(l1);
        mv.visitMethodInsn(INVOKESTATIC, "org/codehaus/groovy/runtime/ScriptBytecodeAdapter", "unwrap", "(Lgroovy/lang/GroovyRuntimeException;)Ljava/lang/Throwable;");
        mv.visitInsn(ATHROW);
        mv.visitLabel(l2);
        mv.visitInsn(NOP);
        mv.visitMaxs(4, 0);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "this$2$bottomUpTree", "(II)Ljava/lang/Object;", null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(ILOAD, 1);
        mv.visitVarInsn(ILOAD, 2);
        mv.visitMethodInsn(INVOKESPECIAL, "TreeNode", "bottomUpTree", "(II)Ljava/lang/Object;");
        mv.visitInsn(ARETURN);
        mv.visitMaxs(3, 3);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "super$1$wait", "()V", null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "wait", "()V");
        mv.visitInsn(RETURN);
        mv.visitMaxs(1, 1);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "super$1$toString", "()Ljava/lang/String;", null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "toString", "()Ljava/lang/String;");
        mv.visitInsn(ARETURN);
        mv.visitMaxs(1, 1);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "super$1$wait", "(J)V", null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(LLOAD, 1);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "wait", "(J)V");
        mv.visitInsn(RETURN);
        mv.visitMaxs(3, 3);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "super$1$wait", "(JI)V", null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(LLOAD, 1);
        mv.visitVarInsn(ILOAD, 3);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "wait", "(JI)V");
        mv.visitInsn(RETURN);
        mv.visitMaxs(4, 4);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "super$1$notify", "()V", null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "notify", "()V");
        mv.visitInsn(RETURN);
        mv.visitMaxs(1, 1);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "super$1$notifyAll", "()V", null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "notifyAll", "()V");
        mv.visitInsn(RETURN);
        mv.visitMaxs(1, 1);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "super$1$getClass", "()Ljava/lang/Class;", null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "getClass", "()Ljava/lang/Class;");
        mv.visitInsn(ARETURN);
        mv.visitMaxs(1, 1);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "super$1$equals", "(Ljava/lang/Object;)Z", null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "equals", "(Ljava/lang/Object;)Z");
        mv.visitInsn(IRETURN);
        mv.visitMaxs(2, 2);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "super$1$clone", "()Ljava/lang/Object;", null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "clone", "()Ljava/lang/Object;");
        mv.visitInsn(ARETURN);
        mv.visitMaxs(1, 1);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "super$1$hashCode", "()I", null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "hashCode", "()I");
        mv.visitInsn(IRETURN);
        mv.visitMaxs(1, 1);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC + ACC_SYNTHETIC, "super$1$finalize", "()V", null, null);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "finalize", "()V");
        mv.visitInsn(RETURN);
        mv.visitMaxs(1, 1);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$get$$class$TreeNode", "()Ljava/lang/Class;", null, null);
        mv.visitCode();
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$class$TreeNode", "Ljava/lang/Class;");
        mv.visitInsn(DUP);
        Label l0 = new Label();
        mv.visitJumpInsn(IFNONNULL, l0);
        mv.visitInsn(POP);
        mv.visitLdcInsn("TreeNode");
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "class$", "(Ljava/lang/String;)Ljava/lang/Class;");
        mv.visitInsn(DUP);
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$class$TreeNode", "Ljava/lang/Class;");
        mv.visitLabel(l0);
        mv.visitInsn(ARETURN);
        mv.visitMaxs(2, 0);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$get$$class$java$lang$Class", "()Ljava/lang/Class;", null, null);
        mv.visitCode();
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$class$java$lang$Class", "Ljava/lang/Class;");
        mv.visitInsn(DUP);
        Label l0 = new Label();
        mv.visitJumpInsn(IFNONNULL, l0);
        mv.visitInsn(POP);
        mv.visitLdcInsn("java.lang.Class");
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "class$", "(Ljava/lang/String;)Ljava/lang/Class;");
        mv.visitInsn(DUP);
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$class$java$lang$Class", "Ljava/lang/Class;");
        mv.visitLabel(l0);
        mv.visitInsn(ARETURN);
        mv.visitMaxs(2, 0);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$get$$class$java$lang$Long", "()Ljava/lang/Class;", null, null);
        mv.visitCode();
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$class$java$lang$Long", "Ljava/lang/Class;");
        mv.visitInsn(DUP);
        Label l0 = new Label();
        mv.visitJumpInsn(IFNONNULL, l0);
        mv.visitInsn(POP);
        mv.visitLdcInsn("java.lang.Long");
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "class$", "(Ljava/lang/String;)Ljava/lang/Class;");
        mv.visitInsn(DUP);
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$class$java$lang$Long", "Ljava/lang/Class;");
        mv.visitLabel(l0);
        mv.visitInsn(ARETURN);
        mv.visitMaxs(2, 0);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$get$$class$groovy$lang$MetaClass", "()Ljava/lang/Class;", null, null);
        mv.visitCode();
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$class$groovy$lang$MetaClass", "Ljava/lang/Class;");
        mv.visitInsn(DUP);
        Label l0 = new Label();
        mv.visitJumpInsn(IFNONNULL, l0);
        mv.visitInsn(POP);
        mv.visitLdcInsn("groovy.lang.MetaClass");
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "class$", "(Ljava/lang/String;)Ljava/lang/Class;");
        mv.visitInsn(DUP);
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$class$groovy$lang$MetaClass", "Ljava/lang/Class;");
        mv.visitLabel(l0);
        mv.visitInsn(ARETURN);
        mv.visitMaxs(2, 0);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$get$$class$java$lang$Integer", "()Ljava/lang/Class;", null, null);
        mv.visitCode();
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$class$java$lang$Integer", "Ljava/lang/Class;");
        mv.visitInsn(DUP);
        Label l0 = new Label();
        mv.visitJumpInsn(IFNONNULL, l0);
        mv.visitInsn(POP);
        mv.visitLdcInsn("java.lang.Integer");
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "class$", "(Ljava/lang/String;)Ljava/lang/Class;");
        mv.visitInsn(DUP);
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$class$java$lang$Integer", "Ljava/lang/Class;");
        mv.visitLabel(l0);
        mv.visitInsn(ARETURN);
        mv.visitMaxs(2, 0);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$get$$class$java$lang$System", "()Ljava/lang/Class;", null, null);
        mv.visitCode();
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$class$java$lang$System", "Ljava/lang/Class;");
        mv.visitInsn(DUP);
        Label l0 = new Label();
        mv.visitJumpInsn(IFNONNULL, l0);
        mv.visitInsn(POP);
        mv.visitLdcInsn("java.lang.System");
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "class$", "(Ljava/lang/String;)Ljava/lang/Class;");
        mv.visitInsn(DUP);
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$class$java$lang$System", "Ljava/lang/Class;");
        mv.visitLabel(l0);
        mv.visitInsn(ARETURN);
        mv.visitMaxs(2, 0);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_STATIC + ACC_SYNTHETIC, "class$", "(Ljava/lang/String;)Ljava/lang/Class;", null, null);
        mv.visitCode();
        Label l0 = new Label();
        Label l1 = new Label();
        mv.visitTryCatchBlock(l0, l1, l1, "java/lang/ClassNotFoundException");
        mv.visitLabel(l0);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESTATIC, "java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;");
        mv.visitInsn(ARETURN);
        mv.visitLabel(l1);
        mv.visitVarInsn(ASTORE, 1);
        mv.visitTypeInsn(NEW, "java/lang/NoClassDefFoundError");
        mv.visitInsn(DUP);
        mv.visitVarInsn(ALOAD, 1);
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/ClassNotFoundException", "getMessage", "()Ljava/lang/String;");
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NoClassDefFoundError", "<init>", "(Ljava/lang/String;)V");
        mv.visitInsn(ATHROW);
        mv.visitMaxs(3, 2);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$createCallSiteArray", "()Lorg/codehaus/groovy/runtime/callsite/CallSiteArray;", null, null);
        mv.visitCode();
        mv.visitTypeInsn(NEW, "org/codehaus/groovy/runtime/callsite/CallSiteArray");
        mv.visitInsn(DUP);
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$ownClass", "Ljava/lang/Class;");
        mv.visitLdcInsn(new Integer(40));
        mv.visitTypeInsn(ANEWARRAY, "java/lang/String");
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(0));
        mv.visitLdcInsn("minus");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(1));
        mv.visitLdcInsn("multiply");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(2));
        mv.visitLdcInsn("<$constructor$>");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(3));
        mv.visitLdcInsn("bottomUpTree");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(4));
        mv.visitLdcInsn("minus");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(5));
        mv.visitLdcInsn("bottomUpTree");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(6));
        mv.visitLdcInsn("<$constructor$>");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(7));
        mv.visitLdcInsn("minus");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(8));
        mv.visitLdcInsn("plus");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(9));
        mv.visitLdcInsn("itemCheck");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(10));
        mv.visitLdcInsn("itemCheck");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(11));
        mv.visitLdcInsn("currentTimeMillis");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(12));
        mv.visitLdcInsn("length");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(13));
        mv.visitLdcInsn("toInteger");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(14));
        mv.visitLdcInsn("getAt");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(15));
        mv.visitLdcInsn("max");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(16));
        mv.visitLdcInsn("plus");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(17));
        mv.visitLdcInsn("plus");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(18));
        mv.visitLdcInsn("itemCheck");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(19));
        mv.visitLdcInsn("bottomUpTree");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(20));
        mv.visitLdcInsn("println");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(21));
        mv.visitLdcInsn("bottomUpTree");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(22));
        mv.visitLdcInsn("leftShift");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(23));
        mv.visitLdcInsn("plus");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(24));
        mv.visitLdcInsn("minus");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(25));
        mv.visitLdcInsn("iterator");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(26));
        mv.visitLdcInsn("plus");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(27));
        mv.visitLdcInsn("itemCheck");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(28));
        mv.visitLdcInsn("bottomUpTree");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(29));
        mv.visitLdcInsn("plus");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(30));
        mv.visitLdcInsn("itemCheck");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(31));
        mv.visitLdcInsn("bottomUpTree");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(32));
        mv.visitLdcInsn("println");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(33));
        mv.visitLdcInsn("multiply");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(34));
        mv.visitLdcInsn("plus");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(35));
        mv.visitLdcInsn("currentTimeMillis");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(36));
        mv.visitLdcInsn("println");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(37));
        mv.visitLdcInsn("itemCheck");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(38));
        mv.visitLdcInsn("println");
        mv.visitInsn(AASTORE);
        mv.visitInsn(DUP);
        mv.visitLdcInsn(new Integer(39));
        mv.visitLdcInsn("minus");
        mv.visitInsn(AASTORE);
        mv.visitMethodInsn(INVOKESPECIAL, "org/codehaus/groovy/runtime/callsite/CallSiteArray", "<init>", "(Ljava/lang/Class;[Ljava/lang/String;)V");
        mv.visitInsn(ARETURN);
        mv.visitMaxs(7, 0);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$getCallSiteArray", "()[Lorg/codehaus/groovy/runtime/callsite/CallSite;", null, null);
        mv.visitCode();
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$callSiteArray", "Ljava/lang/ref/SoftReference;");
        Label l0 = new Label();
        mv.visitJumpInsn(IFNULL, l0);
        mv.visitFieldInsn(GETSTATIC, "TreeNode", "$callSiteArray", "Ljava/lang/ref/SoftReference;");
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/ref/SoftReference", "get", "()Ljava/lang/Object;");
        mv.visitTypeInsn(CHECKCAST, "org/codehaus/groovy/runtime/callsite/CallSiteArray");
        mv.visitInsn(DUP);
        mv.visitVarInsn(ASTORE, 0);
        Label l1 = new Label();
        mv.visitJumpInsn(IFNONNULL, l1);
        mv.visitLabel(l0);
        mv.visitMethodInsn(INVOKESTATIC, "TreeNode", "$createCallSiteArray", "()Lorg/codehaus/groovy/runtime/callsite/CallSiteArray;");
        mv.visitVarInsn(ASTORE, 0);
        mv.visitTypeInsn(NEW, "java/lang/ref/SoftReference");
        mv.visitInsn(DUP);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/ref/SoftReference", "<init>", "(Ljava/lang/Object;)V");
        mv.visitFieldInsn(PUTSTATIC, "TreeNode", "$callSiteArray", "Ljava/lang/ref/SoftReference;");
        mv.visitLabel(l1);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, "org/codehaus/groovy/runtime/callsite/CallSiteArray", "array", "[Lorg/codehaus/groovy/runtime/callsite/CallSite;");
        mv.visitInsn(ARETURN);
        mv.visitMaxs(3, 1);
        mv.visitEnd();
    }
    cw.visitEnd();
    return cw.toByteArray();
}
Example 68
Project: groovy-core-master  File: AsmClassGenerator.java View source code
protected void createSyntheticStaticFields() {
    if (referencedClasses.isEmpty()) {
        return;
    }
    MethodVisitor mv;
    for (String staticFieldName : referencedClasses.keySet()) {
        // generate a field node
        FieldNode fn = controller.getClassNode().getDeclaredField(staticFieldName);
        if (fn != null) {
            boolean type = fn.getType().redirect() == ClassHelper.CLASS_Type;
            boolean modifiers = fn.getModifiers() == ACC_STATIC + ACC_SYNTHETIC;
            if (!type || !modifiers) {
                String text = "";
                if (!type)
                    text = " with wrong type: " + fn.getType() + " (java.lang.Class needed)";
                if (!modifiers)
                    text = " with wrong modifiers: " + fn.getModifiers() + " (" + (ACC_STATIC + ACC_SYNTHETIC) + " needed)";
                throwException("tried to set a static synthetic field " + staticFieldName + " in " + controller.getClassNode().getName() + " for class resolving, but found already a node of that" + " name " + text);
            }
        } else {
            cv.visitField(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, staticFieldName, "Ljava/lang/Class;", null, null);
        }
        mv = cv.visitMethod(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$get$" + staticFieldName, "()Ljava/lang/Class;", null, null);
        mv.visitCode();
        mv.visitFieldInsn(GETSTATIC, controller.getInternalClassName(), staticFieldName, "Ljava/lang/Class;");
        mv.visitInsn(DUP);
        Label l0 = new Label();
        mv.visitJumpInsn(IFNONNULL, l0);
        mv.visitInsn(POP);
        mv.visitLdcInsn(BytecodeHelper.getClassLoadingTypeDescription(referencedClasses.get(staticFieldName)));
        mv.visitMethodInsn(INVOKESTATIC, controller.getInternalClassName(), "class$", "(Ljava/lang/String;)Ljava/lang/Class;", false);
        mv.visitInsn(DUP);
        mv.visitFieldInsn(PUTSTATIC, controller.getInternalClassName(), staticFieldName, "Ljava/lang/Class;");
        mv.visitLabel(l0);
        mv.visitInsn(ARETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
    }
    mv = cv.visitMethod(ACC_STATIC + ACC_SYNTHETIC, "class$", "(Ljava/lang/String;)Ljava/lang/Class;", null, null);
    Label l0 = new Label();
    mv.visitLabel(l0);
    mv.visitVarInsn(ALOAD, 0);
    mv.visitMethodInsn(INVOKESTATIC, "java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;", false);
    Label l1 = new Label();
    mv.visitLabel(l1);
    mv.visitInsn(ARETURN);
    Label l2 = new Label();
    mv.visitLabel(l2);
    mv.visitVarInsn(ASTORE, 1);
    mv.visitTypeInsn(NEW, "java/lang/NoClassDefFoundError");
    mv.visitInsn(DUP);
    mv.visitVarInsn(ALOAD, 1);
    mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/ClassNotFoundException", "getMessage", "()Ljava/lang/String;", false);
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NoClassDefFoundError", "<init>", "(Ljava/lang/String;)V", false);
    mv.visitInsn(ATHROW);
    // br using l2 as the 2nd param seems create the right table entry
    mv.visitTryCatchBlock(l0, l2, l2, "java/lang/ClassNotFoundException");
    mv.visitMaxs(3, 2);
}
Example 69
Project: Fudan-Sakai-master  File: AssessmentService.java View source code
public ContentResource createCopyOfContentResource(String resourceId, String filename, String toContext) {
    // trouble using Validator, so use string replacement instead
    // java.lang.NoClassDefFoundError: org/sakaiproject/util/Validator
    filename = filename.replaceAll("http://", "http:__");
    ContentResource cr_copy = null;
    try {
        // create a copy of the resource
        ContentResource cr = AssessmentService.getContentHostingService().getResource(resourceId);
        String escapedName = escapeResourceName(filename);
        if (toContext != null && !toContext.equals("")) {
            cr_copy = AssessmentService.getContentHostingService().addAttachmentResource(escapedName, toContext, ToolManager.getTool("sakai.samigo").getTitle(), cr.getContentType(), cr.getContent(), cr.getProperties());
        } else {
            cr_copy = AssessmentService.getContentHostingService().addAttachmentResource(escapedName, ToolManager.getCurrentPlacement().getContext(), ToolManager.getTool("sakai.samigo").getTitle(), cr.getContentType(), cr.getContent(), cr.getProperties());
        }
    } catch (IdInvalidException e) {
        log.warn(e.getMessage());
    } catch (PermissionException e) {
        log.warn(e.getMessage());
    } catch (IdUnusedException e) {
        log.warn(e.getMessage());
    } catch (TypeException e) {
        log.warn(e.getMessage());
    } catch (InconsistentException e) {
        log.warn(e.getMessage());
    } catch (IdUsedException e) {
        log.warn(e.getMessage());
    } catch (OverQuotaException e) {
        log.warn(e.getMessage());
    } catch (ServerOverloadException e) {
        log.warn(e.getMessage());
    }
    return cr_copy;
}
Example 70
Project: bugvm-master  File: TypeDecl.java View source code
// Declared in Java2Rewrites.jrag at line 147
public MethodDecl createStaticClassMethod() {
    if (createStaticClassMethod != null)
        return createStaticClassMethod;
    // static synthetic Class class$(String name) {
    //   try {
    //     return java.lang.Class.forName(name);
    //   } catch(java.lang.ClassNotFoundException e) {
    //     throw new java.lang.NoClassDefFoundError(e.getMessage());
    //   }
    // }
    createStaticClassMethod = new MethodDecl(new Modifiers(new List().add(new Modifier("public")).add(new Modifier("static"))), lookupType("java.lang", "Class").createQualifiedAccess(), "class$", new List().add(new ParameterDeclaration(new Modifiers(new List()), lookupType("java.lang", "String").createQualifiedAccess(), "name")), new List(), new Opt(new Block(new List().add(new TryStmt(new Block(new List().add(new ReturnStmt(new Opt(lookupType("java.lang", "Class").createQualifiedAccess().qualifiesAccess(new MethodAccess("forName", new List().add(new VarAccess("name")))))))), new List().add(new CatchClause(new ParameterDeclaration(new Modifiers(new List()), lookupType("java.lang", "ClassNotFoundException").createQualifiedAccess(), "e"), new Block(new List().add(new ThrowStmt(new ClassInstanceExpr(lookupType("java.lang", "NoClassDefFoundError").createQualifiedAccess(), new List().add(new VarAccess("e").qualifiesAccess(new MethodAccess("getMessage", new List()))), new Opt())))))), new Opt()))))) {

        public boolean isConstant() {
            return true;
        }
    };
    return addMemberMethod(createStaticClassMethod);
}
Example 71
Project: evosuite-master  File: FunctionalMockStatement.java View source code
@Override
public void execute() throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException, CodeUnderTestException {
    // First create the listener
    listener = new EvoInvocationListener(retval.getGenericClass());
    //then create the mock
    Object ret;
    try {
        logger.debug("Mockito: create mock for {}", targetClass);
        ret = mock(targetClass, withSettings().invocationListeners(listener));
        //ret = mockCreator.invoke(null,targetClass,withSettings().invocationListeners(listener));
        //execute all "when" statements
        int index = 0;
        logger.debug("Mockito: going to mock {} different methods", mockedMethods.size());
        for (MethodDescriptor md : mockedMethods) {
            if (!md.shouldBeMocked()) {
                //no need to mock a method that returns void
                logger.debug("Mockito: method {} cannot be mocked", md.getMethodName());
                continue;
            }
            //target method, eg foo.aMethod(...)
            Method method = md.getMethod();
            // this is needed if method is protected: it couldn't be called here, although fine in
            // the generated JUnit tests
            method.setAccessible(true);
            //target inputs
            Object[] targetInputs = new Object[md.getNumberOfInputParameters()];
            for (int i = 0; i < targetInputs.length; i++) {
                logger.debug("Mockito: executing matcher {}/{}", (1 + i), targetInputs.length);
                targetInputs[i] = md.executeMatcher(i);
            }
            logger.debug("Mockito: going to invoke method {} with {} matchers", method.getName(), targetInputs.length);
            if (!method.getDeclaringClass().isAssignableFrom(ret.getClass())) {
                String msg = "Mismatch between callee's class " + ret.getClass() + " and method's class " + method.getDeclaringClass();
                msg += "\nTarget class classloader " + targetClass.getClassLoader() + " vs method's classloader " + method.getDeclaringClass().getClassLoader();
                throw new EvosuiteError(msg);
            }
            //actual call foo.aMethod(...)
            Object targetMethodResult;
            try {
                if (targetInputs.length == 0) {
                    targetMethodResult = method.invoke(ret);
                } else {
                    targetMethodResult = method.invoke(ret, targetInputs);
                }
            } catch (InvocationTargetException e) {
                logger.error("Invocation of mocked {}.{}() threw an exception. " + "This means the method was not mocked", targetClass.getName(), method.getName());
                throw e;
            } catch (IllegalArgumentException e) {
                logger.error("IAE on <" + method + "> when called with " + Arrays.toString(targetInputs));
                throw e;
            }
            //when(...)
            logger.debug("Mockito: call 'when'");
            OngoingStubbing<Object> retForThen = Mockito.when(targetMethodResult);
            //thenReturn(...)
            Object[] thenReturnInputs = null;
            try {
                int size = Math.min(md.getCounter(), Properties.FUNCTIONAL_MOCKING_INPUT_LIMIT);
                thenReturnInputs = new Object[size];
                for (int i = 0; i < thenReturnInputs.length; i++) {
                    //the position in flat parameter list
                    int k = i + index;
                    if (k >= parameters.size()) {
                        //throw new RuntimeException("EvoSuite ERROR: index " + k + " out of " + parameters.size());
                        throw new CodeUnderTestException(new FalsePositiveException("EvoSuite ERROR: index " + k + " out of " + parameters.size()));
                    }
                    VariableReference parameterVar = parameters.get(i + index);
                    thenReturnInputs[i] = parameterVar.getObject(scope);
                    CodeUnderTestException codeUnderTestException = null;
                    if (thenReturnInputs[i] == null && method.getReturnType().isPrimitive()) {
                        codeUnderTestException = new CodeUnderTestException(new NullPointerException());
                    } else if (thenReturnInputs[i] != null && !TypeUtils.isAssignable(thenReturnInputs[i].getClass(), method.getReturnType())) {
                        codeUnderTestException = new CodeUnderTestException(new UncompilableCodeException("Cannot assign " + parameterVar.getVariableClass().getName() + " to " + method.getReturnType()));
                    }
                    if (codeUnderTestException != null) {
                        throw codeUnderTestException;
                    }
                    thenReturnInputs[i] = fixBoxing(thenReturnInputs[i], method.getReturnType());
                }
            } catch (Exception e) {
                retForThen.thenThrow(new RuntimeException("Failed to setup mock: " + e.getMessage()));
                throw e;
            }
            //final call when(...).thenReturn(...)
            logger.debug("Mockito: executing 'thenReturn'");
            if (thenReturnInputs == null || thenReturnInputs.length == 0) {
                retForThen.thenThrow(new RuntimeException("No valid return value"));
            } else if (thenReturnInputs.length == 1) {
                retForThen.thenReturn(thenReturnInputs[0]);
            } else {
                Object[] values = Arrays.copyOfRange(thenReturnInputs, 1, thenReturnInputs.length);
                retForThen.thenReturn(thenReturnInputs[0], values);
            }
            index += thenReturnInputs == null ? 0 : thenReturnInputs.length;
        }
    } catch (CodeUnderTestException e) {
        throw e;
    } catch (java.lang.NoClassDefFoundError e) {
        AtMostOnceLogger.error(logger, "Cannot use Mockito on " + targetClass + " due to failed class initialization: " + e.getMessage());
        return;
    } catch (Throwable t) {
        AtMostOnceLogger.error(logger, "Failed to use Mockito on " + targetClass + ": " + t.getMessage());
        throw new EvosuiteError(t);
    }
    //finally, activate the listener
    listener.activate();
    try {
        retval.setObject(scope, ret);
    } catch (CodeUnderTestException e) {
        throw e;
    } catch (Throwable e) {
        throw new EvosuiteError(e);
    }
}
Example 72
Project: elki-master  File: DocumentParameters.java View source code
protected static Constructor<?> getConstructor(final Class<?> cls) {
    try {
        return cls.getConstructor(Parameterization.class);
    } catch (java.lang.NoClassDefFoundError e) {
        return null;
    } catch (RuntimeException e) {
        LOG.warning("RuntimeException: ", e);
        return null;
    } catch (Exception e) {
        return null;
    } catch (java.lang.Error e) {
        LOG.warning("Error: ", e);
        return null;
    }
}
Example 73
Project: openbd-core-master  File: JavaPlatform.java View source code
@Override
public void initialiseTagSystem(xmlCFML configFile) {
    try {
        com.naryx.tagfusion.cfm.mail.cfIMAP.init(configFile);
    } catch (java.lang.NoClassDefFoundError e) {
        cfEngine.thisInstance.TagChecker.replaceTag("CFMAIL", "com.naryx.tagfusion.cfm.tag.cfDisabledMailTag");
        cfEngine.thisInstance.TagChecker.replaceTag("CFIMAP", "com.naryx.tagfusion.cfm.tag.cfDisabledMailTag");
        cfEngine.thisInstance.TagChecker.replaceTag("CFPOP", "com.naryx.tagfusion.cfm.tag.cfDisabledMailTag");
        cfEngine.log("CFMAIL, CFIMAP, and CFPOP disabled: JavaMail not found on classpath");
    }
    if (cfEngine.WINDOWS)
        com.naryx.tagfusion.cfm.registry.cfREGISTRY.init(configFile);
    com.naryx.tagfusion.cfm.tag.awt.cfCHART.init(configFile);
    com.naryx.tagfusion.cfm.schedule.cfSCHEDULE.init(configFile);
    com.naryx.tagfusion.cfm.tag.net.cfMULTICAST.init(configFile);
    try {
        com.naryx.tagfusion.cfm.document.cfDOCUMENT.init(configFile);
    } catch (NoClassDefFoundError e) {
        cfEngine.log("CFDOCUMENT tag disabled: " + e.toString());
        cfEngine.thisInstance.TagChecker.replaceTag("CFDOCUMENT", "com.naryx.tagfusion.cfm.document.cfDisabledDocumentTag");
    }
}
Example 74
Project: proxyhotswap-master  File: CtClassJavaProxyGenerator.java View source code
/**
	 * Generate the static initializer method for the proxy class.
	 */
private MethodInfo generateStaticInitializer() throws IOException {
    MethodInfo minfo = new MethodInfo(initMethodName, "()V", ACC_STATIC);
    int localSlot0 = 1;
    short pc, tryBegin = 0, tryEnd;
    DataOutputStream out = new DataOutputStream(minfo.code);
    out.writeByte(opc_iconst_1);
    out.writeByte(opc_putstatic);
    out.writeShort(cp.getFieldRef(dotToSlash(className), initFieldName, "Z"));
    for (List<ProxyMethod> sigmethods : proxyMethods.values()) {
        for (ProxyMethod pm : sigmethods) {
            pm.codeFieldInitialization(out);
        }
    }
    out.writeByte(opc_return);
    tryEnd = pc = (short) minfo.code.size();
    minfo.exceptionTable.add(new ExceptionTableEntry(tryBegin, tryEnd, pc, cp.getClass("java/lang/NoSuchMethodException")));
    code_astore(localSlot0, out);
    out.writeByte(opc_new);
    out.writeShort(cp.getClass("java/lang/NoSuchMethodError"));
    out.writeByte(opc_dup);
    code_aload(localSlot0, out);
    out.writeByte(opc_invokevirtual);
    out.writeShort(cp.getMethodRef("java/lang/Throwable", "getMessage", "()Ljava/lang/String;"));
    out.writeByte(opc_invokespecial);
    out.writeShort(cp.getMethodRef("java/lang/NoSuchMethodError", "<init>", "(Ljava/lang/String;)V"));
    out.writeByte(opc_athrow);
    pc = (short) minfo.code.size();
    minfo.exceptionTable.add(new ExceptionTableEntry(tryBegin, tryEnd, pc, cp.getClass("java/lang/ClassNotFoundException")));
    code_astore(localSlot0, out);
    out.writeByte(opc_new);
    out.writeShort(cp.getClass("java/lang/NoClassDefFoundError"));
    out.writeByte(opc_dup);
    code_aload(localSlot0, out);
    out.writeByte(opc_invokevirtual);
    out.writeShort(cp.getMethodRef("java/lang/Throwable", "getMessage", "()Ljava/lang/String;"));
    out.writeByte(opc_invokespecial);
    out.writeShort(cp.getMethodRef("java/lang/NoClassDefFoundError", "<init>", "(Ljava/lang/String;)V"));
    out.writeByte(opc_athrow);
    if (minfo.code.size() > 65535) {
        throw new IllegalArgumentException("code size limit exceeded");
    }
    minfo.maxStack = 10;
    minfo.maxLocals = (short) (localSlot0 + 1);
    minfo.declaredExceptions = new short[0];
    return minfo;
}
Example 75
Project: mvel-master  File: ASMAccessorOptimizer.java View source code
private void ldcClassConstant(Class cls) {
    if (OPCODES_VERSION == Opcodes.V1_4) {
        assert debug("LDC \"" + cls.getName() + "\"");
        mv.visitLdcInsn(cls.getName());
        mv.visitMethodInsn(INVOKESTATIC, "java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;");
        Label l4 = new Label();
        mv.visitJumpInsn(GOTO, l4);
        mv.visitTypeInsn(NEW, "java/lang/NoClassDefFoundError");
        mv.visitInsn(DUP_X1);
        mv.visitInsn(SWAP);
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Throwable", "getMessage", "()Ljava/lang/String;");
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/NoClassDefFoundError", "<init>", "(Ljava/lang/String;)V");
        mv.visitInsn(ATHROW);
        mv.visitLabel(l4);
    } else {
        assert debug("LDC " + getType(cls));
        mv.visitLdcInsn(getType(cls));
    }
}
Example 76
Project: bazel-master  File: JavacTurbineTest.java View source code
@Test
public void maskProcessorClasspath() throws Exception {
    addSourceLines("MyAnnotation.java", "public @interface MyAnnotation {}");
    addSourceLines("Hello.java", "@MyAnnotation class Hello {}");
    // create a jar containing only HostClasspathProcessor
    Path processorJar = createClassJar("libprocessor.jar", HostClasspathProcessor.class);
    optionsBuilder.addProcessors(ImmutableList.of(HostClasspathProcessor.class.getName()));
    optionsBuilder.addProcessorPathEntries(ImmutableList.of(processorJar.toString()));
    optionsBuilder.addClassPathEntries(ImmutableList.<String>of());
    compile();
    Map<String, byte[]> outputs = collectOutputs();
    assertThat(outputs.keySet()).contains("result.txt");
    String text = new String(outputs.get("result.txt"), UTF_8);
    assertThat(text).contains("java.lang.NoClassDefFoundError:" + " com/google/devtools/build/java/turbine/javac/JavacTurbine");
}
Example 77
Project: javassist-master  File: JvstTest2.java View source code
private void testDotClass2(String cname, boolean java5) throws Exception {
    CtClass cc = sloader.makeClass(cname);
    CtClass cc3 = sloader.makeClass("test2.DotClass3");
    if (java5)
        cc.getClassFile2().setVersionToJava5();
    CtMethod m = CtNewMethod.make("public int test() {" + "  return test2.DotClass3.class.getName().length(); }", cc);
    cc.addMethod(m);
    cc.writeFile();
    // don't execute cc3.writeFile();
    Object obj = make(cc.getName());
    try {
        assertEquals(15, invoke(obj, "test"));
    } catch (java.lang.reflect.InvocationTargetException e) {
        Throwable t = e.getCause();
        assertTrue(t instanceof java.lang.NoClassDefFoundError);
    }
}
Example 78
Project: PTP-master  File: TAUAnalysisTab.java View source code
private void initDBCombo(String selected) {
    String[] dbs = null;
    try {
        dbs = PerfDMFUIPlugin.getPerfDMFView().getDatabaseNames();
    } catch (java.lang.NoClassDefFoundError e) {
        System.out.println(Messages.TAUAnalysisTab_WarnTauJarsNotFound);
    }
    dbCombo.clearSelection();
    dbCombo.removeAll();
    if (dbs == null || dbs.length < 1) {
        dbCombo.add(ITAULaunchConfigurationConstants.NODB);
        dbCombo.select(0);
        return;
    }
    for (int i = 0; i < dbs.length; i++) {
        dbCombo.add(dbs[i]);
    //System.out.println(dbs[i]);
    }
    if (selected == null || dbCombo.indexOf(selected) < 0)
        dbCombo.select(0);
    else
        dbCombo.select(dbCombo.indexOf(selected));
}
Example 79
Project: restx-master  File: Factory.java View source code
static synchronized Iterable<? extends FactoryMachine> getMachines() {
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    if (classLoader == null) {
        classLoader = FactoryMachinesServiceLoader.class.getClassLoader();
    }
    Iterable<? extends FactoryMachine> factoryMachines = serviceLoaderMachines.get(classLoader);
    if (factoryMachines == null) {
        try {
            factoryMachines = ImmutableList.copyOf(ServiceLoader.load(FactoryMachine.class));
            serviceLoaderMachines.put(classLoader, factoryMachines);
        } catch (ServiceConfigurationError e) {
            if (e.getMessage().endsWith("not found") || e.getMessage().indexOf("java.lang.NoClassDefFoundError") != -1) {
                String resources = "";
                try {
                    resources = "\n\n\t\t>> If the problem persists, check these resources:" + "\n\t\t\t- " + Joiner.on("\n\t\t\t- ").join(Iterators.forEnumeration(classLoader.getResources("META-INF/services/restx.factory.FactoryMachine")));
                } catch (IOException e1) {
                }
                throw new RuntimeException(e.getMessage() + "." + "\n\t\t>> This may be because you renamed or removed it." + "\n\t\t>> Try to clean and rebuild your application and reload/relaunch." + resources + "\n", e);
            } else {
                throw e;
            }
        }
    }
    return factoryMachines;
}
Example 80
Project: scheduling-master  File: RMNodeStarter.java View source code
/**
     * Creates a new instance of this class and calls registersInRm method.
     * @param args The arguments needed to join the Resource Manager
     */
public static void main(String[] args) {
    try {
        args = JVMPropertiesPreloader.overrideJVMProperties(args);
        CookieBasedProcessTreeKiller.registerKillChildProcessesOnShutdown("node");
        RMNodeStarter passiveStarter = new RMNodeStarter();
        String baseNodeName = passiveStarter.configure(args);
        passiveStarter.createNodesAndConnect(baseNodeName);
    } catch (Throwable t) {
        System.err.println("A major problem occurred when trying to start a node and register it into the Resource Manager, see the stacktrace below");
        if (t instanceof java.lang.NoClassDefFoundError) {
            System.err.println("Unable to load a class definition, maybe the classpath is not accessible");
        }
        t.printStackTrace(System.err);
        System.exit(-2);
    }
}
Example 81
Project: fastjson-master  File: TypeUtils.java View source code
private static void addBaseClassMappings() {
    mappings.put("byte", byte.class);
    mappings.put("short", short.class);
    mappings.put("int", int.class);
    mappings.put("long", long.class);
    mappings.put("float", float.class);
    mappings.put("double", double.class);
    mappings.put("boolean", boolean.class);
    mappings.put("char", char.class);
    mappings.put("[byte", byte[].class);
    mappings.put("[short", short[].class);
    mappings.put("[int", int[].class);
    mappings.put("[long", long[].class);
    mappings.put("[float", float[].class);
    mappings.put("[double", double[].class);
    mappings.put("[boolean", boolean[].class);
    mappings.put("[char", char[].class);
    mappings.put("[B", byte[].class);
    mappings.put("[S", short[].class);
    mappings.put("[I", int[].class);
    mappings.put("[J", long[].class);
    mappings.put("[F", float[].class);
    mappings.put("[D", double[].class);
    mappings.put("[C", char[].class);
    mappings.put("[Z", boolean[].class);
    Class<?>[] classes = new Class[] { Object.class, java.lang.Cloneable.class, loadClass("java.lang.AutoCloseable"), java.lang.Exception.class, java.lang.RuntimeException.class, java.lang.IllegalAccessError.class, java.lang.IllegalAccessException.class, java.lang.IllegalArgumentException.class, java.lang.IllegalMonitorStateException.class, java.lang.IllegalStateException.class, java.lang.IllegalThreadStateException.class, java.lang.IndexOutOfBoundsException.class, java.lang.InstantiationError.class, java.lang.InstantiationException.class, java.lang.InternalError.class, java.lang.InterruptedException.class, java.lang.LinkageError.class, java.lang.NegativeArraySizeException.class, java.lang.NoClassDefFoundError.class, java.lang.NoSuchFieldError.class, java.lang.NoSuchFieldException.class, java.lang.NoSuchMethodError.class, java.lang.NoSuchMethodException.class, java.lang.NullPointerException.class, java.lang.NumberFormatException.class, java.lang.OutOfMemoryError.class, java.lang.SecurityException.class, java.lang.StackOverflowError.class, java.lang.StringIndexOutOfBoundsException.class, java.lang.TypeNotPresentException.class, java.lang.VerifyError.class, java.lang.StackTraceElement.class, java.util.HashMap.class, java.util.Hashtable.class, java.util.TreeMap.class, java.util.IdentityHashMap.class, java.util.WeakHashMap.class, java.util.LinkedHashMap.class, java.util.HashSet.class, java.util.LinkedHashSet.class, java.util.TreeSet.class, java.util.concurrent.TimeUnit.class, java.util.concurrent.ConcurrentHashMap.class, loadClass("java.util.concurrent.ConcurrentSkipListMap"), loadClass("java.util.concurrent.ConcurrentSkipListSet"), java.util.concurrent.atomic.AtomicInteger.class, java.util.concurrent.atomic.AtomicLong.class, java.util.Collections.EMPTY_MAP.getClass(), java.util.BitSet.class, java.util.Calendar.class, java.util.Date.class, java.util.Locale.class, java.util.UUID.class, java.sql.Time.class, java.sql.Date.class, java.sql.Timestamp.class, java.text.SimpleDateFormat.class, com.alibaba.fastjson.JSONObject.class, loadClass("java.awt.Rectangle"), loadClass("java.awt.Point"), loadClass("java.awt.Font"), loadClass("java.awt.Color"), loadClass("org.springframework.remoting.support.RemoteInvocation"), loadClass("org.springframework.remoting.support.RemoteInvocationResult") };
    for (Class clazz : classes) {
        if (clazz == null) {
            continue;
        }
        mappings.put(clazz.getName(), clazz);
    }
}
Example 82
Project: japid42-master  File: JapidRenderer.java View source code
private static RendererClass getRendererClassWithoutRefresh(String name) {
    RendererClass rc = japidClasses.get(name);
    if (rc == null)
        throw new JapidTemplateNotFoundException(name, "classpath and " + flattern(templateRoots));
    else {
        if (rc.getClz() == null || (playClassloaderChanged() && !rc.getContributor().startsWith("jar"))) {
            compileAndLoad(name, rc);
        // try {
        // new TemplateClassLoader(parentClassLoader).loadClass(name);
        // } catch (java.lang.NoClassDefFoundError e) {
        // // the class presented when the class was compiled but it
        // could not be found at runtime.
        // // we need to recompile the class
        // compileAndLoad(name, rc);
        // } catch (ClassNotFoundException e) {
        // compileAndLoad(name, rc);
        // } catch (Exception e) {
        // throw new RuntimeException(e);
        // }
        }
    }
    return rc;
}
Example 83
Project: Electric8-master  File: FileMenu.java View source code
/**
     * This method implements the command to quit Electric.
     */
public static boolean quitCommand() {
    Collection<RenameAndSaveLibraryTask> saveTasks = preventLoss(null, 0, null);
    if (saveTasks == null)
        return true;
    try {
        new QuitJob(saveTasks);
    } catch (java.lang.NoClassDefFoundError e) {
        return true;
    } catch (Exception e) {
        return false;
    }
    return true;
}
Example 84
Project: ikvm-openjdk-master  File: SourceClass.java View source code
/**
     * Get helper method for class literal lookup.
     */
public MemberDefinition getClassLiteralLookup(long fwhere) {
    // If we have already created a lookup method, reuse it.
    if (lookup != null) {
        return lookup;
    }
    // again.
    if (outerClass != null) {
        lookup = outerClass.getClassLiteralLookup(fwhere);
        return lookup;
    }
    // If we arrive here, there was no existing 'class$' method.
    ClassDefinition c = this;
    boolean needNewClass = false;
    if (isInterface()) {
        // The top-level type is an interface.  Try to find an existing
        // inner class in which to create the helper method.  Any will do.
        c = findLookupContext();
        if (c == null) {
            // The interface has no inner classes.  Create an anonymous
            // inner class to hold the helper method, as an interface must
            // not have any methods.  The tests above for prior creation
            // of a 'class$' method assure that only one such class is
            // allocated for each outermost class containing a class
            // literal embedded somewhere within.  Part of fix for 4055017.
            needNewClass = true;
            IdentifierToken sup = new IdentifierToken(fwhere, idJavaLangObject);
            IdentifierToken interfaces[] = {};
            IdentifierToken t = new IdentifierToken(fwhere, idNull);
            int mod = M_PUBLIC | M_ANONYMOUS | M_STATIC | M_SYNTHETIC;
            c = (SourceClass) toplevelEnv.makeClassDefinition(toplevelEnv, fwhere, t, null, mod, sup, interfaces, this);
        }
    }
    // The name of the class-getter stub is "class$"
    Identifier idDClass = Identifier.lookup(prefixClass);
    Type strarg[] = { Type.tString };
    // Some sanity checks of questionable value.
    //
    // This check became useless after matchMethod() was modified
    // to not return synthetic methods.
    //
    //try {
    //    lookup = c.matchMethod(toplevelEnv, c, idDClass, strarg);
    //} catch (ClassNotFound ee) {
    //    throw new CompilerError("unexpected missing class");
    //} catch (AmbiguousMember ee) {
    //    throw new CompilerError("synthetic name clash");
    //}
    //if (lookup != null && lookup.getClassDefinition() == c) {
    //    // Error if method found was not inherited.
    //    throw new CompilerError("unexpected duplicate");
    //}
    // Some sanity checks of questionable value.
    /*  // The helper function looks like this.
         *  // It simply maps a checked exception to an unchecked one.
         *  static Class class$(String class$) {
         *    try { return Class.forName(class$); }
         *    catch (ClassNotFoundException forName) {
         *      throw new NoClassDefFoundError(forName.getMessage());
         *    }
         *  }
         */
    long w = c.getWhere();
    IdentifierToken arg = new IdentifierToken(w, idDClass);
    Expression e = new IdentifierExpression(arg);
    Expression a1[] = { e };
    Identifier idForName = Identifier.lookup("forName");
    e = new MethodExpression(w, new TypeExpression(w, Type.tClassDesc), idForName, a1);
    Statement body = new ReturnStatement(w, e);
    // map the exceptions
    Identifier idClassNotFound = Identifier.lookup("java.lang.ClassNotFoundException");
    Identifier idNoClassDefFound = Identifier.lookup("java.lang.NoClassDefFoundError");
    Type ctyp = Type.tClass(idClassNotFound);
    Type exptyp = Type.tClass(idNoClassDefFound);
    Identifier idGetMessage = Identifier.lookup("getMessage");
    e = new IdentifierExpression(w, idForName);
    e = new MethodExpression(w, e, idGetMessage, new Expression[0]);
    Expression a2[] = { e };
    e = new NewInstanceExpression(w, new TypeExpression(w, exptyp), a2);
    Statement handler = new CatchStatement(w, new TypeExpression(w, ctyp), new IdentifierToken(idForName), new ThrowStatement(w, e));
    Statement handlers[] = { handler };
    body = new TryStatement(w, body, handlers);
    Type mtype = Type.tMethod(Type.tClassDesc, strarg);
    IdentifierToken args[] = { arg };
    // Use default (package) access.  If private, an access method would
    // be needed in the event that the class literal belonged to an interface.
    // Also, making it private tickles bug 4098316.
    lookup = toplevelEnv.makeMemberDefinition(toplevelEnv, w, c, null, M_STATIC | M_SYNTHETIC, mtype, idDClass, args, null, body);
    // check it now.
    if (needNewClass) {
        if (c.getClassDeclaration().getStatus() == CS_CHECKED) {
            throw new CompilerError("duplicate check");
        }
        c.getClassDeclaration().setDefinition(c, CS_PARSED);
        Expression argsX[] = {};
        Type argTypesX[] = {};
        try {
            ClassDefinition sup = toplevelEnv.getClassDefinition(idJavaLangObject);
            c.checkLocalClass(toplevelEnv, null, new Vset(), sup, argsX, argTypesX);
        } catch (ClassNotFound ee) {
        }
        ;
    }
    return lookup;
}
Example 85
Project: ptii-master  File: MoMLParser.java View source code
/** End an element. This method pops the current container from
     *  the stack, if appropriate, and also adds specialized properties
     *  to the container, such as <i>_doc</i>, if appropriate.
     *  Ælfred will call this method at the end of each element
     *  (including EMPTY elements).
     *  @param elementName The element type name.
     *  @exception Exception If thrown while adding properties.
     */
public void endElement(String elementName) throws Exception {
    // done last?
    if (_filterList != null) {
        Iterator filters = _filterList.iterator();
        while (filters.hasNext()) {
            MoMLFilter filter = (MoMLFilter) filters.next();
            filter.filterEndElement(_current, elementName, _currentCharData, _xmlFileName);
        }
    }
    if (((Integer) _ifElementStack.peek()).intValue() > 1) {
        _ifElementStack.push(((Integer) _ifElementStack.pop()).intValue() - 1);
    } else if (_skipElement <= 0) {
        // FIXME: Instead of doing string comparisons, do a hash lookup.
        if (elementName.equals("configure")) {
            // Count configure tags so that they can nest.
            _configureNesting--;
            if (_configureNesting < 0) {
                throw new XmlException("Internal Error: _configureNesting is " + _configureNesting + " which is <0, which indicates a nesting bug", _currentExternalEntity(), _getLineNumber(), _getColumnNumber());
            }
        } else if (elementName.equals("doc")) {
            // Count doc tags so that they can nest.
            _docNesting--;
            if (_docNesting < 0) {
                throw new XmlException("Internal Error: _docNesting is " + _docNesting + " which is <0, which indicates a nesting bug", _currentExternalEntity(), _getLineNumber(), _getColumnNumber());
            }
        }
        if ((_configureNesting > 0) || (_docNesting > 0)) {
            // Inside a configure or doc tag.
            // Simply replicate the element in the current
            // character buffer.
            _currentCharData.append("</");
            _currentCharData.append(elementName);
            _currentCharData.append(">");
            return;
        }
    }
    if (_skipRendition) {
        if (elementName.equals("rendition")) {
            _skipRendition = false;
        }
    } else if (_skipElement > 0) {
        if (elementName.equals(_skipElementName)) {
            // Nested element name.  Have to count so we properly
            // close the skipping.
            _skipElement--;
        }
    } else if (((Integer) _ifElementStack.peek()).intValue() > 1) {
    } else if (elementName.equals("if") && ((Integer) _ifElementStack.peek()).intValue() == 1) {
        _ifElementStack.pop();
    } else if (elementName.equals("configure")) {
        try {
            Configurable castCurrent = (Configurable) _current;
            String previousSource = castCurrent.getConfigureSource();
            String previousText = castCurrent.getConfigureText();
            castCurrent.configure(_base, _configureSource, _currentCharData.toString());
            // Propagate to derived classes and instances.
            try {
                // This has the side effect of marking the value
                // overridden.
                _current.propagateValue();
            } catch (IllegalActionException ex) {
                castCurrent.configure(_base, previousSource, previousText);
                throw ex;
            }
        } catch (NoClassDefFoundError e) {
        }
    } else {
        // to move into here to handle undo
        if (elementName.equals("doc")) {
            // NOTE: for the undo of a doc element, all work is done here
            if ((_currentDocName == null) && (_docNesting == 0)) {
                _currentDocName = "_doc";
            }
            // For undo need to know if a previous doc attribute with this
            // name existed
            Documentation previous = (Documentation) _current.getAttribute(_currentDocName);
            String previousValue = null;
            if (previous != null) {
                previousValue = previous.getValueAsString();
            }
            // Cf. What is done with parameter values.
            if (!_currentCharData.toString().equals(previousValue)) {
                if (previous != null) {
                    String newString = _currentCharData.toString();
                    // If the newString is an empty list, then
                    // this will have the side effect of deleting
                    // the doc element by calling setContainer(null)
                    // in a change request. Since this is done in
                    // a change request, it will be done after
                    // propagation, as it should be.
                    previous.setExpression(newString);
                    // not overridden the value of the doc tag.
                    try {
                        // This has the side effect of marking the
                        // value overridden.
                        previous.propagateValue();
                    } catch (IllegalActionException ex) {
                        previous.setExpression(previousValue);
                        throw ex;
                    }
                } else {
                    Documentation doc = new Documentation(_current, _currentDocName);
                    doc.setValue(_currentCharData.toString());
                    // Propagate. This has the side effect of marking
                    // the object overridden from its class definition.
                    doc.propagateExistence();
                    // Propagate value. This has the side effect of marking
                    // the object overridden from its class definition.
                    doc.propagateValue();
                }
            }
            if (_undoEnabled) {
                _undoContext.appendUndoMoML("<doc name=\"" + _currentDocName + "\">");
                if (previous != null) {
                    _undoContext.appendUndoMoML(previousValue);
                }
                _undoContext.appendUndoMoML("</doc>\n");
            }
            _currentDocName = null;
        } else if (elementName.equals("group")) {
            // Process link requests that have accumulated in
            // this element.
            _processPendingRequests();
            try {
                _namespace = (String) _namespaces.pop();
                _namespaceTranslationTable = (Map) _namespaceTranslations.pop();
            } catch (EmptyStackException ex) {
                _namespace = _DEFAULT_NAMESPACE;
            }
            try {
                _linkRequests = (List) _linkRequestStack.pop();
            } catch (EmptyStackException ex) {
                _linkRequests = null;
            }
            try {
                _deleteRequests = (List) _deleteRequestStack.pop();
            } catch (EmptyStackException ex) {
                _deleteRequests = null;
            }
        } else if (elementName.equals("class") || elementName.equals("entity") || elementName.equals("model")) {
            // Process link requests that have accumulated in
            // this element.
            _processPendingRequests();
            try {
                _current = (NamedObj) _containers.pop();
            } catch (EmptyStackException ex) {
                _current = null;
            }
            try {
                _namespace = (String) _namespaces.pop();
                _namespaceTranslationTable = (Map) _namespaceTranslations.pop();
            } catch (EmptyStackException ex) {
                _namespace = _DEFAULT_NAMESPACE;
            }
            try {
                _linkRequests = (List) _linkRequestStack.pop();
            } catch (EmptyStackException ex) {
                _linkRequests = null;
            }
            try {
                _deleteRequests = (List) _deleteRequestStack.pop();
            } catch (EmptyStackException ex) {
                _deleteRequests = null;
            }
        } else if (elementName.equals("property") || elementName.equals("director") || elementName.equals("port") || elementName.equals("relation") || elementName.equals("rendition") || elementName.equals("vertex")) {
            try {
                _current = (NamedObj) _containers.pop();
            } catch (EmptyStackException ex) {
                _current = null;
            }
            try {
                _namespace = (String) _namespaces.pop();
                _namespaceTranslationTable = (Map) _namespaceTranslations.pop();
            } catch (EmptyStackException ex) {
                _namespace = _DEFAULT_NAMESPACE;
            }
        }
    }
    // Handle the undoable aspect, if undo is enabled.
    // FIXME: How should _skipElement and _undoEnable interact?
    // If we are skipping an element, are we sure that we want
    // to add it to the undoContext?
    String undoMoML = null;
    // undo might have been disabled part way through the current element.
    if (_undoContext != null && _undoContext.hasUndoMoML()) {
        // Get the result from this element, as we'll be pushing
        // it onto the stack of children MoML for the parent context
        undoMoML = _undoContext.generateUndoEntry();
        if (_undoDebug) {
            System.out.println("Completed element: " + elementName + "\n" + _undoContext.getUndoMoML());
        }
    }
    // Otherwise, we don't restore undo at the next level up.
    try {
        // Reset the undo context to the parent.
        // NOTE: if this is the top context, then doing a pop here
        // will cause the EmptyStackException
        _undoContext = (UndoContext) _undoContexts.pop();
        _undoEnabled = _undoContext.isUndoable();
    } catch (EmptyStackException ex) {
        if (_undoDebug) {
            System.out.println("Reached top level of undo " + "context stack");
        }
    }
    // undo entries.
    if (undoMoML != null) {
        _undoContext.pushUndoEntry(undoMoML);
    }
}
Example 86
Project: fitNevis-master  File: CommandRunnerTest.java View source code
public void testClassNotFound() throws Exception {
    CommandRunner runner = new CommandRunner("java BadClass", null);
    runner.run();
    assertHasRegexp("java.lang.NoClassDefFoundError", runner.getError());
    assertEquals("", runner.getOutput());
    assertTrue(0 != runner.getExitCode());
}
Example 87
Project: android_libcore-master  File: NoClassDefFoundErrorTest.java View source code
/**
     * @tests java.lang.NoClassDefFoundError#NoClassDefFoundError()
     */
@TestTargetNew(level = TestLevel.COMPLETE, notes = "", method = "NoClassDefFoundError", args = {})
public void test_Constructor() {
    NoClassDefFoundError e = new NoClassDefFoundError();
    assertNull(e.getMessage());
    assertNull(e.getLocalizedMessage());
    assertNull(e.getCause());
}
Example 88
Project: captaindebug-master  File: RegexValidatorTest.java View source code
/**
	 * Test method for
	 * {@link com.captaindebug.errortrack.validator.RegexValidator#validate(java.lang.String)}
	 */
@Test
public void testValidate_exception_found() throws Exception {
    boolean result = instance.validate("catalina.out:Exception in thread \"Studio Teletype\" java.lang.NoClassDefFoundError: org/apache/log4j/spi/ThrowableInformation");
    assertTrue(result);
}
Example 89
Project: webservices-xmlschema-master  File: XmlSchemaBundleTest.java View source code
@Test(expected = java.lang.NoClassDefFoundError.class)
public void testInternalsExcluded() {
    new DummyInternalClass();
}
Example 90
Project: gwt-log-master  File: Log.java View source code
private static ServerLog tryJDK14() {
    try {
        return new ServerLogImplJDK14();
    } catch (NoClassDefFoundError e) {
    } catch (Throwable e) {
        e.printStackTrace();
    }
    return null;
}
Example 91
Project: platform2-master  File: EJBWizardClassCreator.java View source code
public void initialize(String originalClassName) throws Exception {
    try {
        initialize(Class.forName(originalClassName));
    } catch (java.lang.NoClassDefFoundError e) {
        e.printStackTrace();
        initialize(Class.forName(originalClassName + entityBeanClassSuffix));
    }
}
Example 92
Project: mondrian-master  File: XmlUtil.java View source code
/**
     * Get the Xerces version being used.
     *
     * @return Xerces version being used
     */
public static String getXercesVersion() {
    try {
        return org.apache.xerces.impl.Version.getVersion();
    } catch (java.lang.NoClassDefFoundError ex) {
        return "Xerces-J 2.2.0";
    }
}