Re: BUG in struts-2.5.15

2018-02-15 Thread Yasser Zamani


On 2/15/2018 7:32 PM, liemngu...@ups.com.INVALID wrote:
> Here is the output:
> 
> COPY ME:
> weblogic.utils.zip.ZipURLConnection:zip:C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar!/struts-default.xml
> 

Thanks! I have a candidate solution (correcting url to "file:/" when
protocol is empty; like Spring Framework [1]) but my JDK here then says
"Unknown protocol: zip". Could you please also run following block to
see if your context there already knows zip protocol?

import com.opensymphony.xwork2.util.ClassLoaderUtil;
import com.opensymphony.xwork2.util.fs.JarEntryRevision;
import com.opensymphony.xwork2.util.fs.Revision;
Iterator strutsDefaultXmls =

public String execute() throws Exception {
ClassLoaderUtil.getResources("struts-default.xml", this.getClass(), true);
while (strutsDefaultXmls.hasNext()) {
URL url = strutsDefaultXmls.next();
URL url2 = new URL(url.getProtocol(), url.getHost(),
url.getPort(), "file:/" + url.getFile());
Revision r = JarEntryRevision.build(url2);
System.out.println("COPY ME: " + r.needsReloading());
}


[1]
https://github.com/spring-projects/spring-framework/blob/aa4bcedad37a9a084e96298f087fec4889c59cdc/spring-core/src/main/java/org/springframework/util/ResourceUtils.java#L316

> 
> Also, below is URL connection object that is passed to
> StrutsJarURLConnection.openConnection(URL url):
> 

Yes I saw ... Thanks!

Sincerely,
Yasser.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Conversion Error Interceptor prevent errors for empty values

2018-02-15 Thread Paul Zepernick
Yasser,

Thanks for pointing me to the right class.  After debugging, I found the 
problem was in my template and it was including the option body in the value 
when trying to set it to empty.  There is no issue with the Interceptor and it 
is working as documented.  Thanks for your help.

Paul R. Zepernick
Sr. Programmer Analyst
HealthSmart Benefit Solutions

-Original Message-
From: Yasser Zamani [mailto:yasser.zam...@live.com] On Behalf Of Yasser Zamani
Sent: Wednesday, February 14, 2018 11:41 AM
To: user@struts.apache.org
Subject: Re: Conversion Error Interceptor prevent errors for empty values



On 2/14/2018 5:13 PM, Paul Zepernick wrote:
> Yes, I have it happening on 2.5.14.1.  I have a select box pointing at a 
> Integer like this: auditForm.incorrectAuditReason.id  I am using the rest 
> plugin which is including it in the stack.  I have attached the source from 
> Maven.  Where is the check being done in the code?  I see the check for 
> shouldAddError() always returning true.
>

No you should check
`org.apache.struts2.interceptor.StrutsConversionErrorInterceptor`
(prefixed with `Struts`) instead. Could you put a break point on it's 
`shouldAddError` method and see what happens when you post 
auditForm.incorrectAuditReason.id?

> I have attempted to override the default interceptor by adding this in my 
> package and overriding the shouldAddError(), but it continues to call the 
> default Struts ConversionErrorInterceptor.
>
>  class="com.hs.iws.struts2.IwsConversionErrorInterceptor"/>
>
I think you should define your stack including your new interceptor and ref it 
in your action definition.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




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.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: BUG in struts-2.5.15

2018-02-15 Thread Martin Gainty
mg>below


From: liemngu...@ups.com.INVALID 
Sent: Wednesday, February 14, 2018 5:20 PM
To: user@struts.apache.org
Subject: Re: BUG in struts-2.5.15

Martin Gainty,

I found 
"C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar".
 I believe struts-default.xml is within struts2-core.jar (renamed from 
struts2-core-2.5.15.jar).

I believe this bug is similar to https://issues.apache.org/jira/browse/WW-4901 
in struts-2.5.14.1 and struts-2.5.14.

When I tested upgrading to struts-2.5.14.1 (or struts-2.5.14), I see similar 
error described in WW-4901.

Struts-2.5.13 did not have this bug.

I thought this bug is fixed in struts-2.5.15. Somehow, I still see it in 
struts-2.5.15 when deploying to Weblogic server.

MG>yes if you see ClassCastException your bug is same as WW-4901
MG>its Lukasz call on whether or not to revert 2.5.15 to working 2.5.13 
codebase..i would ping him for next steps

Thanks,
Liem.


From: Martin Gainty 
Subject: Re: BUG in struts-2.5.15
Date: 2018/02/14 21:09:55
List: 
user@struts.apache.org








From: liemngu...@ups.com.INVALID 

Sent: Wednesday, February 14, 2018 10:43 AM

To: user@struts.apache.org

Subject: BUG in struts-2.5.15



Hi all,



Testing your upcoming struts-2.5.15, when starting Weblogic server (Weblogic 
server version 12.2.1.2.0, JDK v 1.8.0_101), we see exception below.



MG>asking the obvious ..do you have:



C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar!/struts-default.xml



MG>located on your WINDOWS-OS Weblogic server?




Re: BUG in struts-2.5.15

2018-02-15 Thread Yasser Zamani


On 2/14/2018 7:13 PM, liemngu...@ups.com.INVALID wrote:
> Hi all,
> 
> Testing your upcoming struts-2.5.15, when starting Weblogic server (Weblogic 
> server version 12.2.1.2.0, JDK v 1.8.0_101), we see exception below.
> 
> Thanks,
> Liem.
> 
> 
> 2018-02-14 10:28:37.194 WARN  - Could not create JarEntryRevision for 
> [zip:C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar!/struts-default.xml]!
> java.net.MalformedURLException: unknown protocol: c
> at java.net.URL.(URL.java:600) ~[?:1.8.0_101]
> at java.net.URL.(URL.java:490) ~[?:1.8.0_101]
> at java.net.URL.(URL.java:439) ~[?:1.8.0_101]
> at 
> java.net.JarURLConnection.parseSpecs(JarURLConnection.java:175) ~[?:1.8.0_101]
> at 
> java.net.JarURLConnection.(JarURLConnection.java:158) ~[?:1.8.0_101]
> at 
> com.opensymphony.xwork2.util.fs.StrutsJarURLConnection.(StrutsJarURLConnection.java:44)
>  ~[struts2-core.jar:2.5.15]
> at 
> com.opensymphony.xwork2.util.fs.StrutsJarURLConnection.openConnection(StrutsJarURLConnection.java:99)
>  ~[struts2-core.jar:2.5.15]
> at 
> com.opensymphony.xwork2.util.fs.JarEntryRevision.build(JarEntryRevision.java:42)
>  [struts2-core.jar:2.5.15]
> at 
> com.opensymphony.xwork2.util.fs.DefaultFileManager.monitorFile(DefaultFileManager.java:94)
>  [struts2-core.jar:2.5.15]


Hi Liem,

Thank you so much for your report and nice catch!

It seems weblogic is commerical and so I cannot try this myself then may
I ask you to run following code in your action then examine output and
reply me every line starting with "COPY ME:"?

import com.opensymphony.xwork2.util.ClassLoaderUtil;

public String execute() throws Exception {
Iterator strutsDefaultXmls =
ClassLoaderUtil.getResources("struts-default.xml", this.getClass(), true);
while (strutsDefaultXmls.hasNext()) {
URLConnection conn = strutsDefaultXmls.next().openConnection();
System.out.println("COPY ME: " + conn.toString());
conn.getInputStream().close();
}

These two days I tried to make StrutsJarURLConnection even more
decoupled from container (e.g. weblogic) but could not pass tests so far :(

The issue is, JDK's JarURLConnection expects url of jars in
jar:!/{entry} format but weblogic reports them as zip:C:/... then
JDK is going to convert C:/... to url then sees it does not know any
protocol named c.

So I'm interested to know if "conn.toString" above contains "jar" or not
i.e. does weblogic report them as jars or not.

I also would like to say it seems it's just a warning and does not block
your app functionality; Only "reloading configs runtime when jar
changes" won't work as expected.

Thanks in advance!


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: BUG in struts-2.5.15

2018-02-15 Thread Yasser Zamani


On 2/15/2018 7:15 PM, Martin Gainty wrote:
> I found 
> "C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar".
>  I believe struts-default.xml is within struts2-core.jar (renamed from 
> struts2-core-2.5.15.jar).
> 
> I believe this bug is similar to 
> https://issues.apache.org/jira/browse/WW-4901 in struts-2.5.14.1 and 
> struts-2.5.14.
> 

No I do not think it's same, as IBM WebSphere (that issue container) and
Oracle WebLogic (your issue container) are slightly different. That was
a Class Cast issue, your one is Unknown Protocol.

However, both issues are because different containers (e.g. tomcat,
weblogic, websphere) report jar resources as different url formats and
connections :(


> When I tested upgrading to struts-2.5.14.1 (or struts-2.5.14), I see similar 
> error described in WW-4901.
> 
> Struts-2.5.13 did not have this bug.
> 

Struts 2.5.13 does not throw this warning but also it's "runtime config
reloading when jars change" does not work. In next versions (2.5.14,
2.5.15) this starts working :) but seems we have to make it completely
independent from underlying container :(

> I thought this bug is fixed in struts-2.5.15. Somehow, I still see it in 
> struts-2.5.15 when deploying to Weblogic server.
> 
> MG>yes if you see ClassCastException your bug is same as WW-4901
> MG>its Lukasz call on whether or not to revert 2.5.15 to working 2.5.13 
> codebase..i would ping him for next steps

Please consider it's just a warning it seems. It does not break your app
functionalty; Only "runtime config reloading when jars change" feature
does not work as expected for you. You can consider your current status
equal to Struts 2.5.13 i.e. Struts 2.5.13 also has this issue :)

Regards.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: BUG in struts-2.5.15

2018-02-15 Thread liemnguyen
Yasser Zamani,

Run your test codes below:
private void testStruts2()
{
  try {
Iterator strutsDefaultXmls = 
ClassLoaderUtil.getResources("struts-default.xml", this.getClass(), true);
while (strutsDefaultXmls.hasNext())
{
  URLConnection conn = strutsDefaultXmls.next().openConnection();
  System.out.println("COPY ME: " + conn.toString()); 
conn.getInputStream().close();
}
  } catch (Exception e) {
e.printStackTrace();
  }
}

Here is the output:
COPY ME: 
weblogic.utils.zip.ZipURLConnection:zip:C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar!/struts-default.xml



Also, below is URL connection object that is passed to 
StrutsJarURLConnection.openConnection(URL url):
url-type=java.net.URL
url.toString=zip:C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar!/struts-default.xml
url.getProtocol=zip
url.getPath=C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar!/struts-default.xml
url.getPort=-1
url.getQuery=null
url.getFile=C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar!/struts-default.xml
url.getHost=
url.getRef=null
url.getAuthority=
url.getDefaultPort=-1

Thanks,
Liem.



  *   From: Yasser Zamani 
Subject: Re: BUG in struts-2.5.15
Date: 2018/02/15 15:12:39
List: 
user@struts.apache.org


*

[https://lists.apache.org/images/quote.png]



On 2/14/2018 7:13 PM, liemngu...@ups.com.INVALID wrote:

> Hi all,

>

> Testing your upcoming struts-2.5.15, when starting Weblogic server (Weblogic 
> server version 12.2.1.2.0, JDK v 1.8.0_101), we see exception below.

>

> Thanks,

> Liem.

> 

>

> 2018-02-14 10:28:37.194 WARN  - Could not create JarEntryRevision for 
> [zip:C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar!/struts-default.xml]!

> java.net.MalformedURLException: unknown protocol: c

> at java.net.URL.(URL.java:600) ~[?:1.8.0_101]

> at java.net.URL.(URL.java:490) ~[?:1.8.0_101]

> at java.net.URL.(URL.java:439) ~[?:1.8.0_101]

> at 
> java.net.JarURLConnection.parseSpecs(JarURLConnection.java:175) ~[?:1.8.0_101]

> at 
> java.net.JarURLConnection.(JarURLConnection.java:158) ~[?:1.8.0_101]

> at 
> com.opensymphony.xwork2.util.fs.StrutsJarURLConnection.(StrutsJarURLConnection.java:44)
>  ~[struts2-core.jar:2.5.15]

> at 
> com.opensymphony.xwork2.util.fs.StrutsJarURLConnection.openConnection(StrutsJarURLConnection.java:99)
>  ~[struts2-core.jar:2.5.15]

> at 
> com.opensymphony.xwork2.util.fs.JarEntryRevision.build(JarEntryRevision.java:42)
>  [struts2-core.jar:2.5.15]

> at 
> com.opensymphony.xwork2.util.fs.DefaultFileManager.monitorFile(DefaultFileManager.java:94)
>  [struts2-core.jar:2.5.15]





Hi Liem,



Thank you so much for your report and nice catch!



It seems weblogic is commerical and so I cannot try this myself then may

I ask you to run following code in your action then examine output and

reply me every line starting with "COPY ME:"?



import com.opensymphony.xwork2.util.ClassLoaderUtil;



public String execute() throws Exception {

Iterator strutsDefaultXmls =

ClassLoaderUtil.getResources("struts-default.xml", this.getClass(), true);

while (strutsDefaultXmls.hasNext()) {

URLConnection conn = strutsDefaultXmls.next().openConnection();

System.out.println("COPY ME: " + conn.toString());

conn.getInputStream().close();

}



These two days I tried to make StrutsJarURLConnection even more

decoupled from container (e.g. weblogic) but could not pass tests so far :(



The issue is, JDK's JarURLConnection expects url of jars in

jar:!/{entry} format but weblogic reports them as zip:C:/... then

JDK is going to convert C:/... to url then sees it does not know any

protocol named c.



So I'm interested to know if "conn.toString" above contains "jar" or not

i.e. does weblogic report them as jars or not.



I also would like to say it seems it's just a warning and does not block

your app functionality; Only "reloading configs runtime when jar

changes" won't work as expected.



Thanks in advance!






RE: BUG in struts-2.5.15

2018-02-15 Thread liemnguyen
To Struts developers:

Below is URL connection object that is passed to 
StrutsJarURLConnection.openConnection(URL url):
url-type=java.net.URL
url.toString=zip:C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar!/struts-default.xml
url.getProtocol=zip
url.getPath=C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar!/struts-default.xml
url.getPort=-1
url.getQuery=null
url.getFile=C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar!/struts-default.xml
url.getHost=
url.getRef=null
url.getAuthority=
url.getDefaultPort=-1

Thanks,
Liem.

From: NGUYEN LIEM (APP1LXN)
Sent: Wednesday, February 14, 2018 10:48 AM
To: 'user@struts.apache.org' ; 'd...@struts.apache.org' 
; 'iss...@struts.apache.org' 
Subject: BUG in struts-2.5.15

Hi all,

Testing your upcoming struts-2.5.15, when starting Weblogic server (Weblogic 
server version 12.2.1.2.0, JDK v 1.8.0_101), we see exception below.


Thanks,
Liem.


2018-02-14 10:28:37.194 WARN  - Could not create JarEntryRevision for 
[zip:C:/Oracle/Middleware/Oracle_Home12.2.1.0.0/user_projects/domains/iwa_local_domain/servers/AdminServer/tmp/_WL_user/IWA/zfd81u/war/WEB-INF/lib/struts2-core.jar!/struts-default.xml]!
java.net.MalformedURLException: unknown protocol: c
at java.net.URL.(URL.java:600) ~[?:1.8.0_101]
at java.net.URL.(URL.java:490) ~[?:1.8.0_101]
at java.net.URL.(URL.java:439) ~[?:1.8.0_101]
at 
java.net.JarURLConnection.parseSpecs(JarURLConnection.java:175) ~[?:1.8.0_101]
at java.net.JarURLConnection.(JarURLConnection.java:158) 
~[?:1.8.0_101]
at 
com.opensymphony.xwork2.util.fs.StrutsJarURLConnection.(StrutsJarURLConnection.java:44)
 ~[struts2-core.jar:2.5.15]
at 
com.opensymphony.xwork2.util.fs.StrutsJarURLConnection.openConnection(StrutsJarURLConnection.java:99)
 ~[struts2-core.jar:2.5.15]
at 
com.opensymphony.xwork2.util.fs.JarEntryRevision.build(JarEntryRevision.java:42)
 [struts2-core.jar:2.5.15]
at 
com.opensymphony.xwork2.util.fs.DefaultFileManager.monitorFile(DefaultFileManager.java:94)
 [struts2-core.jar:2.5.15]
at 
com.opensymphony.xwork2.util.fs.DefaultFileManager.loadFile(DefaultFileManager.java:73)
 [struts2-core.jar:2.5.15]
at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1054)
 [struts2-core.jar:2.5.15]
at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:198)
 [struts2-core.jar:2.5.15]
at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:165)
 [struts2-core.jar:2.5.15]
at 
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:166)
 [struts2-core.jar:2.5.15]
at 
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
 [struts2-core.jar:2.5.15]
at 
org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:957) 
[struts2-core.jar:2.5.15]
at 
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:463)
 [struts2-core.jar:2.5.15]
at 
org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496) 
[struts2-core.jar:2.5.15]
at 
org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:73)
 [struts2-core.jar:2.5.15]
at 
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:61)
 [struts2-core.jar:2.5.15]
at 
weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:400)
 [com.oracle.weblogic.servlet.jar:12.2.1.0]
at 
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
 [com.oracle.weblogic.security.subject.jar:12.2.1.0]
at 
weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:196)
 [com.oracle.weblogic.security.subject.jar:12.2.1.0]
at 
weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
 [com.oracle.weblogic.servlet.jar:12.2.1.0]
at 
weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71) 
[com.oracle.weblogic.servlet.jar:12.2.1.0]
at