Yes, try/catching errors there is a good idea. I will fix it, and log
the exception.

musachy

On Sat, Jun 7, 2008 at 1:58 PM, Dale Newfield <[EMAIL PROTECTED]> wrote:
> Struts Two wrote:
>>
>> Hi:
>> I think this is because an existing bug in struts 2. I have been
>> experienceing the same issue for sometime. There are two JIRA issues opened
>> for this. You can refer to : WW-2633 and WW-2642 .
>
> My problem appears to be related to yours, but with a different source.
>  Both are due to urls that this code can't handle, but those urls have
> different sources.  The following patch both extends Musachy's detection to
> detect my issue as well, and adds a try/catch block so that any exception
> thrown because of a URI that File cannot handle is swallowed and the
> processing continues.  I would like to find the source of the bad url, but
> this patch to xwork will at least prevent that bad url from being a
> showstopper for me.
>
> So, should I just add this patch to WW-2633, or should I open a new issue?
>
> -Dale
>
> Index:
> src/java/com/opensymphony/xwork2/validator/DefaultValidatorFactory.java
> ===================================================================
> --- src/java/com/opensymphony/xwork2/validator/DefaultValidatorFactory.java
>    (revision 1783)
> +++ src/java/com/opensymphony/xwork2/validator/DefaultValidatorFactory.java
>    (working copy)
> @@ -98,8 +98,9 @@
>             Iterator<URL> urls = ClassLoaderUtil.getResources("",
> DefaultValidatorFactory.class, false);
>             while (urls.hasNext()) {
>                 URL u = urls.next();
> +                try {
>                 URI uri = new URI(u.toExternalForm().replaceAll(" ",
> "%20"));
> -                if ("file".equalsIgnoreCase(uri.getScheme())) {
> +                    if (!uri.isOpaque() &&
> "file".equalsIgnoreCase(uri.getScheme())) {
>                     File f = new File(uri);
>                     FilenameFilter filter = new FilenameFilter() {
>                         public boolean accept(File file, String fileName) {
> @@ -108,6 +109,10 @@
>                     };
>                     files.addAll(Arrays.asList(f.listFiles(filter)));
>                 }
> +                } catch (IllegalArgumentException e) {
> +                  e.printStackTrace();
> +                  // swallow
> +                }
>             }
>         } catch (URISyntaxException e) {
>             e.printStackTrace();
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to