struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Zepernick <>
Subject RE: NPE when running unit test with struts rest plugin
Date Mon, 09 Nov 2020 13:38:02 GMT
Thank you very much, this has resolved the issue!  I have created a ticket in Jira.

Paul R Zepernick | Sr Programmer Analyst
HealthSmart |

-----Original Message-----
From: Lukasz Lenart <>
Sent: Saturday, November 7, 2020 8:51 AM
To: Struts Users Mailing List <>
Subject: Re: NPE when running unit test with struts rest plugin

NOTICE: This email originated from outside of the organization. Do not click links or open
attachments unless you recognize the sender and know the content is safe.

śr., 4 lis 2020 o 17:29 Paul Zepernick
<> napisał(a):
> I have posted an example project that reproduces the error in the
> junit test
> 0a40628a56f25adceefb52%7C0%7C0%7C637403538520826158%7CUnknown%7CTWFpbG
> Zsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%
> 3D%7C1000&amp;sdata=R67dd6goXC0LKd7SiGGclmYcU0rsUDn1i53CyzjLmVw%3D&amp
> ;reserved=0

I think I have found the problem, mapping is not set in getActionProxy(), you can fix it by
overriding it like this:

    protected ActionProxy getActionProxy(String uri) {
        ActionMapping mapping = getActionMapping(request);
        String namespace = mapping.getNamespace();
        String name = mapping.getName();
        String method = mapping.getMethod();

        Configuration config = configurationManager.getConfiguration();
        ActionProxy proxy =
                namespace, name, method, new HashMap<String,
Object>(), true, false);


        // this is normally done in onSetUp(), but we are using Struts internal
        // objects (proxy and action invocation)
        // so we have to hack around so it works


        return proxy;

Fee free to open a JIRA ticket and as I'm going to prepare yet another 2.5.x release I can
address this issue

+ 48 606 323 122
+ 51b18c36edb9455e56dc08d8832422d3%7C2ce547c5e80a40628a56f25adceefb52%7C
+ 0%7C0%7C637403538520826158%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDA
+ iLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=jWn%2
+ B4tFUL53LvuprGz8l6bNEMWrX8d1FMLqlR1m5tJI%3D&amp;reserved=0

To unsubscribe, e-mail:
For additional commands, e-mail:

Disclaimer: This communication and any files transmitted with it may contain information that
is privileged, confidential and/or exempt from disclosure under applicable law. If you are
not the intended recipient, you are hereby notified that any disclosure, copying, distribution,
or use of the information contained herein (including any reliance thereon) is strictly prohibited.
If you received this communication in error, please immediately contact the sender and destroy
the material in its entirety, whether in electronic or hard copy format. Thank you.
View raw message