You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stephan Windmüller <st...@tu-dortmund.de> on 2012/01/10 09:51:26 UTC

Unable to render exceptions thrown in AppModule

Hello!

In the  AppModule class we defined a custom component transaction
filter. When this filter throws an exception, it is not rendered with
the exception report page, instead we are getting this stacktrace:

----

java.lang.NullPointerException
	org.apache.tapestry5.internal.services.assets.CompressionAnalyzerImpl.isCompressable(CompressionAnalyzerImpl.java:34)
	[...]
	org.apache.tapestry5.internal.services.ResponseCompressionAnalyzerImpl.isCompressable(ResponseCompressionAnalyzerImpl.java:65)
	[...]
	org.apache.tapestry5.internal.gzip.BufferedGZipOutputStream.openResponseOutputStream(BufferedGZipOutputStream.java:77)
	org.apache.tapestry5.internal.gzip.BufferedGZipOutputStream.checkForCutover(BufferedGZipOutputStream.java:70)
	org.apache.tapestry5.internal.gzip.BufferedGZipOutputStream.write(BufferedGZipOutputStream.java:116)
	[...]
	org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:852)
	[...]
	org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171)

----

Does anyone know what causes this? Other errors are rendered correctly.

Regards
 Stephan


Re: Unable to render exceptions thrown in AppModule

Posted by Stephan Windmüller <st...@tu-dortmund.de>.
Am 10.01.2012 17:22, schrieb Howard Lewis Ship:

>> In the  AppModule class we defined a custom component transaction
>> filter. When this filter throws an exception, it is not rendered with
>> the exception report page, instead we are getting this stacktrace:
> Order counts; your filter needs to be ordered after Tapestry's
> "ErrorFilter" contribution; otherwise, there's nothing to catch the
> exception and report it.

For each of my handlers I added "after:ErrorFilter"

-----
configuration.add("ajaxComponentTransactionFilter",
ajaxComponentTransactionFilter, "after:ErrorFilter");
configuration.add("componentTransactionFilter",
componentTransactionFilter, "after:ErrorFilter");
configuration.add("pageTransactionFilter", pageTransactionFilter,
"after:ErrorFilter");
-----

but this did not change anything, I am still getting the stacktrace page
from JBoss.

- Stephan


Re: Unable to render exceptions thrown in AppModule

Posted by Josh Canfield <jo...@gmail.com>.
In GZipEnabledResponse

  @Override
    public ServletOutputStream getOutputStream() throws IOException
    {
        if (contentLengthSet || isCompressionDisabled())
            return super.getOutputStream();

        String contentType = getContentType();

        return new BufferedGZipOutputStream(contentType, response,
cutover, analyzer);
    }

In my case I'm using a Resteasy filter which calls getOutputStream
early in the processing of the request, before my code has had a
chance to set the content type.

One solution would be to have the BufferedGZipOutputStream take some
proxy object that it can call getContentType on instead of evaluating
it before the OutputStream is created. Perhaps it could delay it all
the way to when the first bytes are written. Actually, it's pass the
response, it could probably just grab the content-type from there?

Josh

On Tue, Jan 10, 2012 at 4:36 PM, Howard Lewis Ship <hl...@gmail.com> wrote:
> On Tue, Jan 10, 2012 at 11:59 AM, Josh Canfield <jo...@gmail.com> wrote:
>> The actual error reported is caused by what looks like a defect:
>>
>> java.lang.NullPointerException
>>       org.apache.tapestry5.internal.services.assets.CompressionAnalyzerImpl.isCompressable
>>
>> The code:
>>
>> public boolean isCompressable(String contentType)
>>    {
>>        assert contentType != null;
>>
>>        int x = contentType.indexOf(';');
>> ...
>>
>> The assertion here is not helpful when you get a null contentType passed in...
>>
>> I'm going to change this to return false if contentType == null.
>
> I'd prefer to know, first, why the contentType was null.
>
>>
>> Josh
>>
>> On Tue, Jan 10, 2012 at 8:22 AM, Howard Lewis Ship <hl...@gmail.com> wrote:
>>> Order counts; your filter needs to be ordered after Tapestry's
>>> "ErrorFilter" contribution; otherwise, there's nothing to catch the
>>> exception and report it.
>>>
>>> On Tue, Jan 10, 2012 at 1:10 AM, Stephan Windmüller
>>> <st...@tu-dortmund.de> wrote:
>>>> Am 10.01.2012 09:51, schrieb Stephan Windmüller:
>>>>
>>>>> In the  AppModule class we defined a custom component transaction
>>>>> filter. When this filter throws an exception, it is not rendered with
>>>>> the exception report page, instead we are getting this stacktrace:
>>>>
>>>> Forgot to mention: We are using Tapestry 5.3.1.
>>>>
>>>> - Stephan
>>>>
>>>
>>>
>>>
>>> --
>>> Howard M. Lewis Ship
>>>
>>> Creator of Apache Tapestry
>>>
>>> The source for Tapestry training, mentoring and support. Contact me to
>>> learn how I can get you up and productive in Tapestry fast!
>>>
>>> (971) 678-5210
>>> http://howardlewisship.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Unable to render exceptions thrown in AppModule

Posted by Igor Drobiazko <ig...@gmail.com>.
I experienced this exception once and it took me a while to find the cause.

Some of the junior team members ignored svn merge conflicts in a css file
and committed something like this:

<<<<<<< .mine
Bla
=======
Bla bla
>>>>>>> .r5338

This caused a NPE when the css file was compressed because the content type
was null.

On Wed, Jan 11, 2012 at 1:36 AM, Howard Lewis Ship <hl...@gmail.com> wrote:

> On Tue, Jan 10, 2012 at 11:59 AM, Josh Canfield <jo...@gmail.com>
> wrote:
> > The actual error reported is caused by what looks like a defect:
> >
> > java.lang.NullPointerException
> >
> org.apache.tapestry5.internal.services.assets.CompressionAnalyzerImpl.isCompressable
> >
> > The code:
> >
> > public boolean isCompressable(String contentType)
> >    {
> >        assert contentType != null;
> >
> >        int x = contentType.indexOf(';');
> > ...
> >
> > The assertion here is not helpful when you get a null contentType passed
> in...
> >
> > I'm going to change this to return false if contentType == null.
>
> I'd prefer to know, first, why the contentType was null.
>
> >
> > Josh
> >
> > On Tue, Jan 10, 2012 at 8:22 AM, Howard Lewis Ship <hl...@gmail.com>
> wrote:
> >> Order counts; your filter needs to be ordered after Tapestry's
> >> "ErrorFilter" contribution; otherwise, there's nothing to catch the
> >> exception and report it.
> >>
> >> On Tue, Jan 10, 2012 at 1:10 AM, Stephan Windmüller
> >> <st...@tu-dortmund.de> wrote:
> >>> Am 10.01.2012 09:51, schrieb Stephan Windmüller:
> >>>
> >>>> In the  AppModule class we defined a custom component transaction
> >>>> filter. When this filter throws an exception, it is not rendered with
> >>>> the exception report page, instead we are getting this stacktrace:
> >>>
> >>> Forgot to mention: We are using Tapestry 5.3.1.
> >>>
> >>> - Stephan
> >>>
> >>
> >>
> >>
> >> --
> >> Howard M. Lewis Ship
> >>
> >> Creator of Apache Tapestry
> >>
> >> The source for Tapestry training, mentoring and support. Contact me to
> >> learn how I can get you up and productive in Tapestry fast!
> >>
> >> (971) 678-5210
> >> http://howardlewisship.com
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Best regards,

Igor Drobiazko
http://tapestry5.de
http://twitter.com/drobiazko

Re: Unable to render exceptions thrown in AppModule

Posted by Howard Lewis Ship <hl...@gmail.com>.
On Tue, Jan 10, 2012 at 11:59 AM, Josh Canfield <jo...@gmail.com> wrote:
> The actual error reported is caused by what looks like a defect:
>
> java.lang.NullPointerException
>       org.apache.tapestry5.internal.services.assets.CompressionAnalyzerImpl.isCompressable
>
> The code:
>
> public boolean isCompressable(String contentType)
>    {
>        assert contentType != null;
>
>        int x = contentType.indexOf(';');
> ...
>
> The assertion here is not helpful when you get a null contentType passed in...
>
> I'm going to change this to return false if contentType == null.

I'd prefer to know, first, why the contentType was null.

>
> Josh
>
> On Tue, Jan 10, 2012 at 8:22 AM, Howard Lewis Ship <hl...@gmail.com> wrote:
>> Order counts; your filter needs to be ordered after Tapestry's
>> "ErrorFilter" contribution; otherwise, there's nothing to catch the
>> exception and report it.
>>
>> On Tue, Jan 10, 2012 at 1:10 AM, Stephan Windmüller
>> <st...@tu-dortmund.de> wrote:
>>> Am 10.01.2012 09:51, schrieb Stephan Windmüller:
>>>
>>>> In the  AppModule class we defined a custom component transaction
>>>> filter. When this filter throws an exception, it is not rendered with
>>>> the exception report page, instead we are getting this stacktrace:
>>>
>>> Forgot to mention: We are using Tapestry 5.3.1.
>>>
>>> - Stephan
>>>
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator of Apache Tapestry
>>
>> The source for Tapestry training, mentoring and support. Contact me to
>> learn how I can get you up and productive in Tapestry fast!
>>
>> (971) 678-5210
>> http://howardlewisship.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Unable to render exceptions thrown in AppModule

Posted by Josh Canfield <jo...@gmail.com>.
The actual error reported is caused by what looks like a defect:

java.lang.NullPointerException
       org.apache.tapestry5.internal.services.assets.CompressionAnalyzerImpl.isCompressable

The code:

public boolean isCompressable(String contentType)
    {
        assert contentType != null;

        int x = contentType.indexOf(';');
...

The assertion here is not helpful when you get a null contentType passed in...

I'm going to change this to return false if contentType == null.

Josh

On Tue, Jan 10, 2012 at 8:22 AM, Howard Lewis Ship <hl...@gmail.com> wrote:
> Order counts; your filter needs to be ordered after Tapestry's
> "ErrorFilter" contribution; otherwise, there's nothing to catch the
> exception and report it.
>
> On Tue, Jan 10, 2012 at 1:10 AM, Stephan Windmüller
> <st...@tu-dortmund.de> wrote:
>> Am 10.01.2012 09:51, schrieb Stephan Windmüller:
>>
>>> In the  AppModule class we defined a custom component transaction
>>> filter. When this filter throws an exception, it is not rendered with
>>> the exception report page, instead we are getting this stacktrace:
>>
>> Forgot to mention: We are using Tapestry 5.3.1.
>>
>> - Stephan
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Unable to render exceptions thrown in AppModule

Posted by Howard Lewis Ship <hl...@gmail.com>.
Order counts; your filter needs to be ordered after Tapestry's
"ErrorFilter" contribution; otherwise, there's nothing to catch the
exception and report it.

On Tue, Jan 10, 2012 at 1:10 AM, Stephan Windmüller
<st...@tu-dortmund.de> wrote:
> Am 10.01.2012 09:51, schrieb Stephan Windmüller:
>
>> In the  AppModule class we defined a custom component transaction
>> filter. When this filter throws an exception, it is not rendered with
>> the exception report page, instead we are getting this stacktrace:
>
> Forgot to mention: We are using Tapestry 5.3.1.
>
> - Stephan
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Unable to render exceptions thrown in AppModule

Posted by Stephan Windmüller <st...@tu-dortmund.de>.
Am 10.01.2012 09:51, schrieb Stephan Windmüller:

> In the  AppModule class we defined a custom component transaction
> filter. When this filter throws an exception, it is not rendered with
> the exception report page, instead we are getting this stacktrace:

Forgot to mention: We are using Tapestry 5.3.1.

- Stephan