Java 8 IllegalClassFormatException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 IllegalClassFormatException class.

This code example shows how to use the following methods:initCause
 
		try { 
			classFileDumper.dump(classname, classfileBuffer);
			return instrumenter.instrument(classfileBuffer, classname);
		} catch (final Exception ex) {
			final IllegalClassFormatException wrapper = new IllegalClassFormatException(
					ex.getMessage());
			wrapper.initCause(ex);
			// Report this, as the exception is ignored by the JVM: 
			logger.logExeption(wrapper);
			throw wrapper;
		} 
	} 
 
	/** 
	 * Checks whether this class should be instrumented. 
	 *  
	 * @param loader 
	 *            loader for the class 
	 * @param classname 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
            } else { 
                log.fine(className + " is already transformed with " + getClass().getSimpleName());
            } 
            return clazz.toBytecode();
        } catch (Exception e) {
            throw new IllegalClassFormatException(e.getMessage());
        } finally { 
            Thread.currentThread().setContextClassLoader(previous);
        } 
    } 
 
    protected abstract boolean isAlreadyTransformed(CtClass clazz) throws Exception;
 
    protected abstract void transform(CtClass clazz) throws Exception;
 
    protected static Class<?> loadClas(CtClass clazz, String annotationClassname) throws ClassNotFoundException {
        return clazz.getClassPool().getClassLoader().loadClass(annotationClassname);
    } 
 
    protected static void addAnnotation(CtClass clazz, CtMethod method, String annotationClassName) throws Exception {
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:initCause
      ContractAnalyzer contracts =
          extractContracts(new ClassReader(contractBytecode));
      return instrumentWithContracts(bytecode, contracts);
    } catch (Throwable t) {
      /* If the class file contains errors, ASM will just crash. */ 
      IllegalClassFormatException e = new IllegalClassFormatException();
      e.initCause(t);
      throw e;
    } 
  } 
 
  /** 
   * Instruments the specified class with debug information. 
   */ 
  @Requires("bytecode != null") 
  @Ensures("result != null") 
  public byte[] transformWithDebug(byte[] bytecode)
      throws IllegalClassFormatException {
    try { 
      return instrumentWithDebug(bytecode);
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
		try { 
			t.transform(classLoader, "org.jacoco.Sample", null, null, null);
			fail("IllegalClassFormatException expected."); 
		} catch (IllegalClassFormatException e) {
			assertEquals("Error while instrumenting class org.jacoco.Sample.", 
					e.getMessage());
		} 
		recorder.assertException(IllegalClassFormatException.class,
				"Error while instrumenting class org.jacoco.Sample.", 
				IOException.class);
		recorder.clear();
	} 
 
	@Test
	public void testRedefinedClass() throws Exception {
		CoverageTransformer t = createTransformer();
		// Just pick any non-system class outside our namespace 
		final Class<?> target = JaCoCo.class;
		assertNull(t.transform(classLoader, target.getName(), target, null,
				getClassData(target)));
3
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 IllegalClassFormatException Methods: