Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4716

HelloWorldTest throws NullPointerException

    Details

      Description

      estHelloWorld(example.HelloWorldTest)  Time elapsed: 0.053 sec  <<< ERROR!
      java.lang.NullPointerException
      	at com.opensymphony.xwork2.ActionSupport.getLocale(ActionSupport.java:68)
      	at com.opensymphony.xwork2.TextProviderSupport.getLocale(TextProviderSupport.java:329)
      	at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:204)
      	at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:119)
      	at com.opensymphony.xwork2.ActionSupport.getText(ActionSupport.java:86)
      	at example.HelloWorld.execute(HelloWorld.java:33)
      	at example.HelloWorldTest.testHelloWorld(HelloWorldTest.java:31)
      	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 junit.framework.TestCase.runTest(TestCase.java:176)
      	at junit.framework.TestCase.runBare(TestCase.java:141)
      	at junit.framework.TestResult$1.protect(TestResult.java:122)
      	at junit.framework.TestResult.runProtected(TestResult.java:142)
      	at junit.framework.TestResult.run(TestResult.java:125)
      	at junit.framework.TestCase.run(TestCase.java:129)
      	at junit.framework.TestSuite.runTest(TestSuite.java:252)
      	at junit.framework.TestSuite.run(TestSuite.java:247)
      	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
      	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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
      	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
      	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
      

        Activity

        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build Struts-archetypes-JDK7-master #4 (See https://builds.apache.org/job/Struts-archetypes-JDK7-master/4/)
        WW-4716 Uses proper way to create actions (lukaszlenart: rev a691a13b7be4f87a6fe8babdd587e88894a7ad60)

        • (edit) struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/LoginTest.java
        • (edit) struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Struts-archetypes-JDK7-master #4 (See https://builds.apache.org/job/Struts-archetypes-JDK7-master/4/ ) WW-4716 Uses proper way to create actions (lukaszlenart: rev a691a13b7be4f87a6fe8babdd587e88894a7ad60) (edit) struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/LoginTest.java (edit) struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build Struts-JDK7-master #557 (See https://builds.apache.org/job/Struts-JDK7-master/557/)
        WW-4716 Allows create actions with all dependencies injected (lukaszlenart: rev 6f7fcaa338672cb391a307cd1f199606423822e9)

        • (edit) plugins/testng/src/main/java/org/apache/struts2/StrutsTestCase.java
        • (edit) plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Struts-JDK7-master #557 (See https://builds.apache.org/job/Struts-JDK7-master/557/ ) WW-4716 Allows create actions with all dependencies injected (lukaszlenart: rev 6f7fcaa338672cb391a307cd1f199606423822e9) (edit) plugins/testng/src/main/java/org/apache/struts2/StrutsTestCase.java (edit) plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 6f7fcaa338672cb391a307cd1f199606423822e9 in struts's branch refs/heads/master from Lukasz Lenart
        [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=6f7fcaa ]

        WW-4716 Allows create actions with all dependencies injected

        Show
        jira-bot ASF subversion and git services added a comment - Commit 6f7fcaa338672cb391a307cd1f199606423822e9 in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=6f7fcaa ] WW-4716 Allows create actions with all dependencies injected
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        ActionSupport class requires to inject some external dependencies to work properly. It isn't possible to simply instantiate an action with new operator, to use it properly some beans must be injected. I have added a helper method to allow create actions, i.e. createAction(Class) or a workaround can be used HelloWorld hello_world = container.inject(HelloWorld.class)

        Show
        lukaszlenart Lukasz Lenart added a comment - ActionSupport class requires to inject some external dependencies to work properly. It isn't possible to simply instantiate an action with new operator, to use it properly some beans must be injected. I have added a helper method to allow create actions, i.e. createAction(Class) or a workaround can be used HelloWorld hello_world = container.inject(HelloWorld.class)

          People

          • Assignee:
            lukaszlenart Lukasz Lenart
            Reporter:
            lukaszlenart Lukasz Lenart
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development