Uploaded image for project: 'Commons Sandbox'
  1. Commons Sandbox
  2. SANDBOX-277

[javaflow] Uninitialized local variable related bug

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Javaflow
    • Labels:
      None

      Description

      Executing this test class:

      ------------------------------------------------------------------------------------------------------------------------------------------------
      package test;

      import java.net.URL;

      import org.apache.commons.javaflow.Continuation;
      import org.apache.commons.javaflow.ContinuationClassLoader;

      public class TestNullBug
      {
      public static class Test implements Runnable
      {
      public class NullLocalVariable
      {
      public void method1()

      { Integer result= null; if (result != 0) result= 1; }

      }
      public void run()

      { NullLocalVariable bug1= new NullLocalVariable(); }

      }

      public static void main(String[] args) throws Exception
      {
      ContinuationClassLoader classLoader= new ContinuationClassLoader(new URL[] {}, TestNullBug.Test.class.getClassLoader());
      classLoader.addLoaderPackageRoot(TestNullBug.Test.class.getPackage().getName());
      Runnable test= (Runnable) classLoader.loadClass(TestNullBug.Test.class.getName()).newInstance();
      Continuation.startWith(test);
      }
      }
      ------------------------------------------------------------------------------------------------------------------------------------------------

      I get the following stacktrace:

      Exception in thread "main" java.lang.NoClassDefFoundError: null
      at test.TestNullBug$Test.run(TestNullBug.java:23)
      at org.apache.commons.javaflow.bytecode.StackRecorder.execute(StackRecorder.java:104)
      at org.apache.commons.javaflow.Continuation.continueWith(Continuation.java:182)
      at org.apache.commons.javaflow.Continuation.startWith(Continuation.java:136)
      at org.apache.commons.javaflow.Continuation.startWith(Continuation.java:107)
      at test.TestNullBug.main(TestNullBug.java:32)
      Caused by: java.lang.ClassNotFoundException: null
      at org.apache.commons.javaflow.ContinuationClassLoader.findClass(ContinuationClassLoader.java:419)
      at org.apache.commons.javaflow.ContinuationClassLoader.loadClass(ContinuationClassLoader.java:306)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
      ... 6 more

        Attachments

        1. ContinuationMethodAdapter.java
          15 kB
          Valery Silaev

          Activity

            People

            • Assignee:
              tcurdt Torsten Curdt
              Reporter:
              paton Fernando Petrola
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: