You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@clerezza.apache.org by "Daniel Spicar (JIRA)" <ji...@apache.org> on 2011/05/18 17:57:47 UTC

[jira] [Created] (CLEREZZA-535) NullPointerException when requesting SSP rendered pages without supplying accept header

NullPointerException when requesting SSP rendered pages without supplying accept header
---------------------------------------------------------------------------------------

                 Key: CLEREZZA-535
                 URL: https://issues.apache.org/jira/browse/CLEREZZA-535
             Project: Clerezza
          Issue Type: Bug
            Reporter: Daniel Spicar


When requesting a page without specifying the accept header a nullpointer exception is thrown and a server error returned.

Example using CURL:

curl http://localhost:8080/dashboard/overview

returns: 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 Server Error</title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /dashboard/overview. Reason:
<pre>    Server Error</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>                                     
</body>
</html>

The problem can be traced back to the resultDocModifier which seems to be either null or the cause for the NPE. When all references to resultDocModifier are removed in the template (SSP) and no other templates that use the resultDocModifier are rendered (e.g. beware of rendering global menu) the NPE does not happen and the result is as expected.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Re: [jira] [Commented] (CLEREZZA-535) NullPointerException when requesting SSP rendered pages without supplying accept header

Posted by Hasan Hasan <ha...@trialox.org>.
Hi Reto

some more information

In the invocation of writeTo of GenericGraphNodeMBW

public void writeTo(GraphNode node, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
throws IOException, WebApplicationException {
...
}

If accept header is not set
the mediaType param is application/xhtml+xml

and headers.getAcceptableMediaTypes()
returns a list with a single element */* which is then assigned to renderer

what do you suggest to solve this issue?

cheers
hasan

On Wed, May 18, 2011 at 8:01 PM, Hasan Hasan <ha...@trialox.org> wrote:

> Hi Reto
>
> 2011/5/18 Reto Bachmann-Gmür (JIRA) <ji...@apache.org>
>
>
>>    [
>> https://issues.apache.org/jira/browse/CLEREZZA-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13035488#comment-13035488]
>>
>> Reto Bachmann-Gmür commented on CLEREZZA-535:
>> ---------------------------------------------
>>
>> Hi Hasan,
>>
>> Looking at the patch I have the impression this merely prevents the
>> symptom rather than resolving the problem. The resultdocmodifier is no
>> longer null, but the result is never modified. What is the value of
>> MediaType wen no accept-header is set?
>>
>
>
> In GenericGraphNodeMBW.java writeTo()
>
> if (!(rendererMediaType.getType().equals("application") &&
> rendererMediaType.getSubtype().equals("xhtml+xml"))) {
>  httpHeaders.putSingle(HttpHeaders.CONTENT_TYPE, rendererMediaType);
> renderer.render(node, getUserContext(), uriInfo, httpHeaders,
> sharedRenderingValues, entityStream);
> } else {
> ...
>
> The rendererMediaType is */*
>
> I think renderer.render will cause ResultDocModifier to be invoked
>
> Hasan
>
>
>
>>
>> Cheers,
>> Reto
>>
>> > NullPointerException when requesting SSP rendered pages without
>> supplying accept header
>> >
>> ---------------------------------------------------------------------------------------
>> >
>> >                 Key: CLEREZZA-535
>> >                 URL: https://issues.apache.org/jira/browse/CLEREZZA-535
>> >             Project: Clerezza
>> >          Issue Type: Bug
>> >            Reporter: Daniel Spicar
>> >            Assignee: Hasan
>> >              Labels: resultDocModifier
>> >
>> > When requesting a page without specifying the accept header a
>> nullpointer exception is thrown and a server error returned.
>> > Example using CURL:
>> > curl http://localhost:8080/dashboard/overview
>> > returns:
>> > <html>
>> > <head>
>> > <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
>> > <title>Error 500 Server Error</title>
>> > </head>
>> > <body>
>> > <h2>HTTP ERROR: 500</h2>
>> > <p>Problem accessing /dashboard/overview. Reason:
>> > <pre>    Server Error</pre></p>
>> > <hr /><i><small>Powered by Jetty://</small></i>
>> > </body>
>> > </html>
>> > The problem can be traced back to the resultDocModifier which seems to
>> be either null or the cause for the NPE. When all references to
>> resultDocModifier are removed in the template (SSP) and no other templates
>> that use the resultDocModifier are rendered (e.g. beware of rendering global
>> menu) the NPE does not happen and the result is as expected.
>>
>> --
>> This message is automatically generated by JIRA.
>> For more information on JIRA, see: http://www.atlassian.com/software/jira
>>
>
>

Re: [jira] [Commented] (CLEREZZA-535) NullPointerException when requesting SSP rendered pages without supplying accept header

Posted by Hasan Hasan <ha...@trialox.org>.
Hi Reto

2011/5/18 Reto Bachmann-Gmür (JIRA) <ji...@apache.org>

>
>    [
> https://issues.apache.org/jira/browse/CLEREZZA-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13035488#comment-13035488]
>
> Reto Bachmann-Gmür commented on CLEREZZA-535:
> ---------------------------------------------
>
> Hi Hasan,
>
> Looking at the patch I have the impression this merely prevents the symptom
> rather than resolving the problem. The resultdocmodifier is no longer null,
> but the result is never modified. What is the value of MediaType wen no
> accept-header is set?
>


In GenericGraphNodeMBW.java writeTo()

if (!(rendererMediaType.getType().equals("application") &&
rendererMediaType.getSubtype().equals("xhtml+xml"))) {
httpHeaders.putSingle(HttpHeaders.CONTENT_TYPE, rendererMediaType);
renderer.render(node, getUserContext(), uriInfo, httpHeaders,
sharedRenderingValues, entityStream);
} else {
...

The rendererMediaType is */*

I think renderer.render will cause ResultDocModifier to be invoked

Hasan



>
> Cheers,
> Reto
>
> > NullPointerException when requesting SSP rendered pages without supplying
> accept header
> >
> ---------------------------------------------------------------------------------------
> >
> >                 Key: CLEREZZA-535
> >                 URL: https://issues.apache.org/jira/browse/CLEREZZA-535
> >             Project: Clerezza
> >          Issue Type: Bug
> >            Reporter: Daniel Spicar
> >            Assignee: Hasan
> >              Labels: resultDocModifier
> >
> > When requesting a page without specifying the accept header a nullpointer
> exception is thrown and a server error returned.
> > Example using CURL:
> > curl http://localhost:8080/dashboard/overview
> > returns:
> > <html>
> > <head>
> > <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
> > <title>Error 500 Server Error</title>
> > </head>
> > <body>
> > <h2>HTTP ERROR: 500</h2>
> > <p>Problem accessing /dashboard/overview. Reason:
> > <pre>    Server Error</pre></p>
> > <hr /><i><small>Powered by Jetty://</small></i>
> > </body>
> > </html>
> > The problem can be traced back to the resultDocModifier which seems to be
> either null or the cause for the NPE. When all references to
> resultDocModifier are removed in the template (SSP) and no other templates
> that use the resultDocModifier are rendered (e.g. beware of rendering global
> menu) the NPE does not happen and the result is as expected.
>
> --
> This message is automatically generated by JIRA.
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>

[jira] [Updated] (CLEREZZA-535) NullPointerException when requesting SSP rendered pages without supplying accept header

Posted by "Tommaso Teofili (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CLEREZZA-535?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tommaso Teofili updated CLEREZZA-535:
-------------------------------------

    Fix Version/s: 0.2-incubating
    
> NullPointerException when requesting SSP rendered pages without supplying accept header
> ---------------------------------------------------------------------------------------
>
>                 Key: CLEREZZA-535
>                 URL: https://issues.apache.org/jira/browse/CLEREZZA-535
>             Project: Clerezza
>          Issue Type: Bug
>            Reporter: Daniel Spicar
>            Assignee: Hasan
>              Labels: resultDocModifier
>             Fix For: 0.2-incubating
>
>
> When requesting a page without specifying the accept header a nullpointer exception is thrown and a server error returned.
> Example using CURL:
> curl http://localhost:8080/dashboard/overview
> returns: 
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
> <title>Error 500 Server Error</title>
> </head>
> <body>
> <h2>HTTP ERROR: 500</h2>
> <p>Problem accessing /dashboard/overview. Reason:
> <pre>    Server Error</pre></p>
> <hr /><i><small>Powered by Jetty://</small></i>                                     
> </body>
> </html>
> The problem can be traced back to the resultDocModifier which seems to be either null or the cause for the NPE. When all references to resultDocModifier are removed in the template (SSP) and no other templates that use the resultDocModifier are rendered (e.g. beware of rendering global menu) the NPE does not happen and the result is as expected.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CLEREZZA-535) NullPointerException when requesting SSP rendered pages without supplying accept header

Posted by "Reto Bachmann-Gmür (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLEREZZA-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13035488#comment-13035488 ] 

Reto Bachmann-Gmür commented on CLEREZZA-535:
---------------------------------------------

Hi Hasan,

Looking at the patch I have the impression this merely prevents the symptom rather than resolving the problem. The resultdocmodifier is no longer null, but the result is never modified. What is the value of MediaType wen no accept-header is set?

Cheers,
Reto

> NullPointerException when requesting SSP rendered pages without supplying accept header
> ---------------------------------------------------------------------------------------
>
>                 Key: CLEREZZA-535
>                 URL: https://issues.apache.org/jira/browse/CLEREZZA-535
>             Project: Clerezza
>          Issue Type: Bug
>            Reporter: Daniel Spicar
>            Assignee: Hasan
>              Labels: resultDocModifier
>
> When requesting a page without specifying the accept header a nullpointer exception is thrown and a server error returned.
> Example using CURL:
> curl http://localhost:8080/dashboard/overview
> returns: 
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
> <title>Error 500 Server Error</title>
> </head>
> <body>
> <h2>HTTP ERROR: 500</h2>
> <p>Problem accessing /dashboard/overview. Reason:
> <pre>    Server Error</pre></p>
> <hr /><i><small>Powered by Jetty://</small></i>                                     
> </body>
> </html>
> The problem can be traced back to the resultDocModifier which seems to be either null or the cause for the NPE. When all references to resultDocModifier are removed in the template (SSP) and no other templates that use the resultDocModifier are rendered (e.g. beware of rendering global menu) the NPE does not happen and the result is as expected.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CLEREZZA-535) NullPointerException when requesting SSP rendered pages without supplying accept header

Posted by "Hasan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLEREZZA-535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13035591#comment-13035591 ] 

Hasan commented on CLEREZZA-535:
--------------------------------

In the invocation of writeTo of GenericGraphNodeMBW

public void writeTo(GraphNode node, Class<?> type, Type genericType,
			Annotation[] annotations, MediaType mediaType,
			MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
			throws IOException, WebApplicationException {
...

if (!(rendererMediaType.getType().equals("application") && rendererMediaType.getSubtype().equals("xhtml+xml"))) {
	httpHeaders.putSingle(HttpHeaders.CONTENT_TYPE, rendererMediaType);
	renderer.render(node, getUserContext(), uriInfo, httpHeaders, sharedRenderingValues, entityStream);
} else {
...

}

}

If accept header is not set
the mediaType param is application/xhtml+xml

and headers.getAcceptableMediaTypes() returns a list with a single element */* which is then assigned to renderer thus the rendererMediaType is */*

what do you suggest to solve this issue?


> NullPointerException when requesting SSP rendered pages without supplying accept header
> ---------------------------------------------------------------------------------------
>
>                 Key: CLEREZZA-535
>                 URL: https://issues.apache.org/jira/browse/CLEREZZA-535
>             Project: Clerezza
>          Issue Type: Bug
>            Reporter: Daniel Spicar
>            Assignee: Hasan
>              Labels: resultDocModifier
>
> When requesting a page without specifying the accept header a nullpointer exception is thrown and a server error returned.
> Example using CURL:
> curl http://localhost:8080/dashboard/overview
> returns: 
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
> <title>Error 500 Server Error</title>
> </head>
> <body>
> <h2>HTTP ERROR: 500</h2>
> <p>Problem accessing /dashboard/overview. Reason:
> <pre>    Server Error</pre></p>
> <hr /><i><small>Powered by Jetty://</small></i>                                     
> </body>
> </html>
> The problem can be traced back to the resultDocModifier which seems to be either null or the cause for the NPE. When all references to resultDocModifier are removed in the template (SSP) and no other templates that use the resultDocModifier are rendered (e.g. beware of rendering global menu) the NPE does not happen and the result is as expected.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (CLEREZZA-535) NullPointerException when requesting SSP rendered pages without supplying accept header

Posted by "Hasan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CLEREZZA-535?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hasan reassigned CLEREZZA-535:
------------------------------

    Assignee: Hasan

> NullPointerException when requesting SSP rendered pages without supplying accept header
> ---------------------------------------------------------------------------------------
>
>                 Key: CLEREZZA-535
>                 URL: https://issues.apache.org/jira/browse/CLEREZZA-535
>             Project: Clerezza
>          Issue Type: Bug
>            Reporter: Daniel Spicar
>            Assignee: Hasan
>              Labels: resultDocModifier
>
> When requesting a page without specifying the accept header a nullpointer exception is thrown and a server error returned.
> Example using CURL:
> curl http://localhost:8080/dashboard/overview
> returns: 
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
> <title>Error 500 Server Error</title>
> </head>
> <body>
> <h2>HTTP ERROR: 500</h2>
> <p>Problem accessing /dashboard/overview. Reason:
> <pre>    Server Error</pre></p>
> <hr /><i><small>Powered by Jetty://</small></i>                                     
> </body>
> </html>
> The problem can be traced back to the resultDocModifier which seems to be either null or the cause for the NPE. When all references to resultDocModifier are removed in the template (SSP) and no other templates that use the resultDocModifier are rendered (e.g. beware of rendering global menu) the NPE does not happen and the result is as expected.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (CLEREZZA-535) NullPointerException when requesting SSP rendered pages without supplying accept header

Posted by "Hasan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CLEREZZA-535?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hasan resolved CLEREZZA-535.
----------------------------

    Resolution: Fixed

ResultDocModifier.init is invoked irrespective of media type 

> NullPointerException when requesting SSP rendered pages without supplying accept header
> ---------------------------------------------------------------------------------------
>
>                 Key: CLEREZZA-535
>                 URL: https://issues.apache.org/jira/browse/CLEREZZA-535
>             Project: Clerezza
>          Issue Type: Bug
>            Reporter: Daniel Spicar
>            Assignee: Hasan
>              Labels: resultDocModifier
>
> When requesting a page without specifying the accept header a nullpointer exception is thrown and a server error returned.
> Example using CURL:
> curl http://localhost:8080/dashboard/overview
> returns: 
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
> <title>Error 500 Server Error</title>
> </head>
> <body>
> <h2>HTTP ERROR: 500</h2>
> <p>Problem accessing /dashboard/overview. Reason:
> <pre>    Server Error</pre></p>
> <hr /><i><small>Powered by Jetty://</small></i>                                     
> </body>
> </html>
> The problem can be traced back to the resultDocModifier which seems to be either null or the cause for the NPE. When all references to resultDocModifier are removed in the template (SSP) and no other templates that use the resultDocModifier are rendered (e.g. beware of rendering global menu) the NPE does not happen and the result is as expected.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira