You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "mrick@renovosoftware.com" <mr...@renovosoftware.com> on 2012/12/07 17:00:54 UTC

Intermittent NPE from DataSqueezer.unsqueeze() in T4.1.6

Sorry for how old of a version this is in regards to (4.1.6), but this is the
version which the company I work for uses, and I am tasked with getting it
to work as intended.

After reviewing the logs from one of our clients, I noticed a number of
exceptions being thrown by the  DataSqueezer, like the one below:

org.apache.hivemind.ApplicationRuntimeException: Unable to convert null back
into an object in If component.
[context:/pages/scheduling/VisitationConfirmationPage.html, line 27]
	at org.apache.tapestry.components.IfBean.readValue(IfBean.java:190)
	at org.apache.tapestry.components.IfBean.evaluateCondition(IfBean.java:143)
	at org.apache.tapestry.components.IfBean.renderComponent(IfBean.java:66)
	at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:724)
	at
org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:187)
....
Caused by: java.lang.NullPointerException
	at
org.apache.tapestry.util.io.DataSqueezerImpl.unsqueeze(DataSqueezerImpl.java:161)
	at $DataSqueezer_13b18c2666e.unsqueeze($DataSqueezer_13b18c2666e.java)
	at
com.renovo.visitation3.extjs.grid.services.PersistentSqueezerFilter.unsqueeze(PersistentSqueezerFilter.java:55)
	at
$DataSqueezerFilter_13b18c26670.unsqueeze($DataSqueezerFilter_13b18c26670.java)
	at $DataSqueezer_13b18c26672.unsqueeze($DataSqueezer_13b18c26672.java)
	at
org.apache.tapestry.data.NullDataSqueezerFilter.unsqueeze(NullDataSqueezerFilter.java:40)
	at $DataSqueezer_13b18c26672.unsqueeze($DataSqueezer_13b18c26672.java)
	at $DataSqueezer_13b18c264b8.unsqueeze($DataSqueezer_13b18c264b8.java)
	at org.apache.tapestry.components.IfBean.readValue(IfBean.java:182)
	... 55 more

The line actually throwing the exception is as follows, in case that helps:
    public Object unsqueeze(String string)
    {
        SqueezeAdaptor adaptor = null;

        if (string.equals(NULL_PREFIX)) // Line 166; NPE here
            return null;
        else if (string.length() <= 0)
            return null;
        
        int offset = string.charAt(0) - FIRST_ADAPTOR_OFFSET;

        if (offset >= 0 && offset < _adaptorByPrefix.length)
            adaptor = _adaptorByPrefix[offset];

        // If the adaptor is not otherwise recognized, the it is simply
        // an encoded String (the StringAdaptor may not have added
        // a prefix).

        if (adaptor == null)
            return string;

        // Adaptor should never be null, because we always supply
        // an adaptor for String

        return adaptor.unsqueeze(this, string);
    }

I was able to replicate this exception by using tamper data to remove the
hidden input field associated with the id for the given @If span from my
POST, but have not been able to replicate this exception in any other way.

If it's the case that some users are deliberately doing what I did to
replicate this issue, I don't think there's a whole lot I can do about it,
but I was wondering if anyone else has any idea what might be causing this
exception to be thrown other than the user intentionally sending bad data to
our application.



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Intermittent-NPE-from-DataSqueezer-unsqueeze-in-T4-1-6-tp5718545.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Intermittent NPE from DataSqueezer.unsqueeze() in T4.1.6

Posted by Matt Rick <mr...@renovosoftware.com>.
I didn't notice until after submitting that my html got mangled... oops...





--
View this message in context: http://tapestry.1045711.n5.nabble.com/Intermittent-NPE-from-DataSqueezer-unsqueeze-in-T4-1-6-tp5718545p5718581.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Intermittent NPE from DataSqueezer.unsqueeze() in T4.1.6

Posted by Matt Rick <mr...@renovosoftware.com>.
The page where I found this happening the most was the following:

<body jwcid="@VisitationLayout" title="message:confirmation"
currentPage="Confirmation" 
	professional="ognl:isProfessional">

  <form jwcid="visitorForm">
    
    
    	
     
    ...

The first "@If" was the one that was missing from the hidden inputs
(although since it was the first one in the file, there's no reason to
assume that it was the only one to go missing).

What struck me as interesting is that the hidden storing the evaluated
Boolean expression was missing, but the form id must have been in the hidden
containing the form ids, as that threw a different exception when I tried
removing that.

The logs I was auditing are from a high-profile public-facing server, so it
is not terribly unlikely that this was the result of malicious actions on
the part of the user and not a bug (there were, in fact, indications that at
the time this was occurring at least one user was attempting to break in,
apparently unsuccessfully, thank goodness).



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Intermittent-NPE-from-DataSqueezer-unsqueeze-in-T4-1-6-tp5718545p5718580.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Intermittent NPE from DataSqueezer.unsqueeze() in T4.1.6

Posted by Howard Lewis Ship <hl...@gmail.com>.
This code is so long in the past (5+ years?) that it is hard to recollect
what's going on here.

I can't think of anything that would cause this normally. I'd have to check
the rendered markup page to see if anything odd is going on there.



On Fri, Dec 7, 2012 at 8:00 AM, mrick@renovosoftware.com <
mrick@renovosoftware.com> wrote:

> Sorry for how old of a version this is in regards to (4.1.6), but this is
> the
> version which the company I work for uses, and I am tasked with getting it
> to work as intended.
>
> After reviewing the logs from one of our clients, I noticed a number of
> exceptions being thrown by the  DataSqueezer, like the one below:
>
> org.apache.hivemind.ApplicationRuntimeException: Unable to convert null
> back
> into an object in If component.
> [context:/pages/scheduling/VisitationConfirmationPage.html, line 27]
>         at org.apache.tapestry.components.IfBean.readValue(IfBean.java:190)
>         at
> org.apache.tapestry.components.IfBean.evaluateCondition(IfBean.java:143)
>         at
> org.apache.tapestry.components.IfBean.renderComponent(IfBean.java:66)
>         at
> org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:724)
>         at
>
> org.apache.tapestry.services.impl.DefaultResponseBuilder.render(DefaultResponseBuilder.java:187)
> ....
> Caused by: java.lang.NullPointerException
>         at
>
> org.apache.tapestry.util.io.DataSqueezerImpl.unsqueeze(DataSqueezerImpl.java:161)
>         at
> $DataSqueezer_13b18c2666e.unsqueeze($DataSqueezer_13b18c2666e.java)
>         at
>
> com.renovo.visitation3.extjs.grid.services.PersistentSqueezerFilter.unsqueeze(PersistentSqueezerFilter.java:55)
>         at
>
> $DataSqueezerFilter_13b18c26670.unsqueeze($DataSqueezerFilter_13b18c26670.java)
>         at
> $DataSqueezer_13b18c26672.unsqueeze($DataSqueezer_13b18c26672.java)
>         at
>
> org.apache.tapestry.data.NullDataSqueezerFilter.unsqueeze(NullDataSqueezerFilter.java:40)
>         at
> $DataSqueezer_13b18c26672.unsqueeze($DataSqueezer_13b18c26672.java)
>         at
> $DataSqueezer_13b18c264b8.unsqueeze($DataSqueezer_13b18c264b8.java)
>         at org.apache.tapestry.components.IfBean.readValue(IfBean.java:182)
>         ... 55 more
>
> The line actually throwing the exception is as follows, in case that helps:
>     public Object unsqueeze(String string)
>     {
>         SqueezeAdaptor adaptor = null;
>
>         if (string.equals(NULL_PREFIX)) // Line 166; NPE here
>             return null;
>         else if (string.length() <= 0)
>             return null;
>
>         int offset = string.charAt(0) - FIRST_ADAPTOR_OFFSET;
>
>         if (offset >= 0 && offset < _adaptorByPrefix.length)
>             adaptor = _adaptorByPrefix[offset];
>
>         // If the adaptor is not otherwise recognized, the it is simply
>         // an encoded String (the StringAdaptor may not have added
>         // a prefix).
>
>         if (adaptor == null)
>             return string;
>
>         // Adaptor should never be null, because we always supply
>         // an adaptor for String
>
>         return adaptor.unsqueeze(this, string);
>     }
>
> I was able to replicate this exception by using tamper data to remove the
> hidden input field associated with the id for the given @If span from my
> POST, but have not been able to replicate this exception in any other way.
>
> If it's the case that some users are deliberately doing what I did to
> replicate this issue, I don't think there's a whole lot I can do about it,
> but I was wondering if anyone else has any idea what might be causing this
> exception to be thrown other than the user intentionally sending bad data
> to
> our application.
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Intermittent-NPE-from-DataSqueezer-unsqueeze-in-T4-1-6-tp5718545.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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