You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Norris <CN...@widen.com> on 2007/03/06 17:46:58 UTC

Asset Service/JS file throws exception in Perl5Matcher

We've found an obscure and hard to repeat bug in our app that is caused
when a page tries to load a javascript file.  The code that causes it is
located just inside the body tag:

 

<body class="contentBody" id="Body">
<script type="text/javascript"
src="/assets/static/org/apache/tapestry/contrib/palette/PaletteFunctions
.js"></script>

 

 

The error the browser reports is a syntax error.  On a GET with the URL
https://www.domain.com/assets/static/org/apache/tapestry/contrib/palette
/PaletteFunctions.js, the file returned is actually a Tapestry Error
page, not a javascript file.  Digging through the logs revealed an error
throw when trying to retrieve the PaletteFunctions.js file:

 

java.lang.ArrayIndexOutOfBoundsException: 25

            at
org.apache.oro.text.regex.Perl5Matcher.__interpret(Unknown Source)

            at org.apache.oro.text.regex.Perl5Matcher.contains(Unknown
Source)

            at org.apache.oro.text.regex.Perl5Matcher.contains(Unknown
Source)

            at
org.apache.tapestry.util.RegexpMatcher.contains(RegexpMatcher.java:106)

            at
org.apache.tapestry.asset.ResourceMatcherImpl.containsResource(ResourceM
atcherImpl.java:71)

            at
$ResourceMatcher_11127c1ee2e.containsResource($ResourceMatcher_11127c1ee
2e.java)

            at
org.apache.tapestry.asset.AssetService.service(AssetService.java:218)

            at
$IEngineService_11127c1ed2e.service($IEngineService_11127c1ed2e.java)

 

I did not expect to see an ArrayIndexOutOfBoundsException there.  We put
a copy of RegexpMatcher on our classpath to get some more info,
specifically what the path and pattern strings were that it was using.
The path was "/org/apache/tapestry/contrib/palette/PaletteFunctions.js"
and the pattern was "^/org/apache/tapestry/.*.css".  I wrote a small
class to execute code almost identical to that of the RegexpMatcher:

 

            String s_pattern = "^/org/apache/tapestry/.*.css";

            String path =
"/org/apache/tapestry/contrib/palette/PaletteFunctions.js";

            Perl5Compiler compiler = new Perl5Compiler();

            Pattern pattern = compiler.compile(s_pattern,
Perl5Compiler.SINGLELINE_MASK | Perl5Compiler.READ_ONLY_MASK);

            Perl5Matcher matcher = new Perl5Matcher();

            System.out.println(matcher.contains(path, pattern));

 

No exception is thrown.  We can't even get this error to show up
reliably.  It seems like closing your browser and restarting your
session makes it go away.  This is the kind of bug that drives me
insane.