James Phillpotts created ARIES-1755:
---------------------------------------

             Summary: IllegalArgumentException on weaving
                 Key: ARIES-1755
                 URL: https://issues.apache.org/jira/browse/ARIES-1755
             Project: Aries
          Issue Type: Bug
          Components: SPI Fly
    Affects Versions: spifly-1.0.8
            Reporter: James Phillpotts


On weaving a jar that contains a utility loading class like this (this example 
is an enum, but the same happens if it's a class, anonymous inner class, etc.):

{code:java}
public enum Loader {
    LOADER;
    public <S> S load(Class<S> type) {
        Iterator<S> services = ServiceLoader.load(type).iterator();
        return services.hasNext() ? services.next() : null;
    }
}
{code}

The weaving throws this exception:

{noformat}
java.lang.IllegalArgumentException: value null
        at org.objectweb.asm.ClassWriter.newConstItem(ClassWriter.java:1057)
        at org.objectweb.asm.MethodWriter.visitLdcInsn(MethodWriter.java:1126)
        at 
org.apache.aries.spifly.weaver.TCCLSetterVisitor$TCCLSetterMethodVisitor.visitMethodInsn(TCCLSetterVisitor.java:194)
        at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1416)
        at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1017)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:693)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:506)
        at org.apache.aries.spifly.statictool.Main.weaveDir(Main.java:196)
        at org.apache.aries.spifly.statictool.Main.weaveJar(Main.java:96)
        at org.apache.aries.spifly.statictool.Main.main(Main.java:73)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
        at java.lang.Thread.run(Thread.java:745)
{noformat}

This happens regardless of whether static or dynamic weaving is used.

I'll attach a sample project.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to