abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Berry <chriswbe...@gmail.com>
Subject Re: error during sendError
Date Thu, 13 Sep 2007 04:13:40 GMT
Hmmmm.
It was there in my checkout today.
I did a svn co of /trunk.
It is marked 0.3.0-incubating-SNAPSHOT
Thanks!
-- Chris  

On Sep 12, 2007, at 11:07 PM, James M Snell wrote:

> Fixed in the trunk.  This does not appear to be applicable to 0.3.0
> (sendError was not added to AbstractRequestHandler until after the  
> 0.3.0
> branch was created).
>
> - James
>
> Chris Berry wrote:
>> Greetings,
>> I have another one ;-)
>> When I make a request with an explicitly incorrect URI (e.g. /a/b/ 
>> c/d/e)
>> An Exception is thrown on the Error exit, as shown below.
>> Which results in a 500 instead of a 404.
>>
>> The offending code is shown below....
>>
>> BTW: I tried just setting it to "utf-8", but it then throws a NPE  
>> later
>> on (see below).
>> I can just comment out this JUnit for now, but I thought you might  
>> want
>> to know...
>> Cheers,
>> -- Chris
>> ============
>> In AbstractRequestHandler
>> ------------------------------------
>>   private void sendError(RequestContext request,
>>                          HttpResponse response, int code,
>>                          String message) throws
>> UnsupportedEncodingException,
>>     IOException {
>>     response.setStatus(code);
>>     OutputStream out = response.getOutputStream();
>>
>>    // the following line should not be using  
>> request.getAcceptCharset()
>>    //  since OutputStreamWriter doesn't understand  "utf-8, *;q=0.5"
>>     OutputStreamWriter writer = new OutputStreamWriter(out,
>> request.getAcceptCharset());
>>
>>     // TODO: should we wrap this in some nice HTML?
>>
>>     // workaround.
>>     // It looks like  Messages.get("NOT.FOUND") is returning null in
>> notfound()
>>     if ( message == null )
>>         message = "";
>>
>>     writer.write(message);
>>     writer.close();
>>     out.close();
>>   }
>>
>> =================
>> In MethodHelper
>> ------------------------
>>   public static RequestOptions createDefaultRequestOptions() {
>>     RequestOptions options = new RequestOptions();
>>     options.setAcceptEncoding(
>>       "gzip",
>>       "deflate");
>>     options.setAccept(
>>       "application/atom+xml;type=entry",
>>       "application/atom+xml;type=feed",
>>       "application/atom+xml",
>>       "application/atomsvc+xml",
>>       "application/atomcat+xml",
>>       "application/xml",
>>       "text/xml",
>>       "*/*");
>>
>>     // temporary workaround
>>     //options.setAcceptCharset( "utf-8", "*;q=0.5");
>>     options.setAcceptCharset( "utf-8" );
>>
>>     return options;
>>   }
>>
>>
>> ============
>> dogstar:~/homeaway/pstore/cwb-newAbdera cberry$ java -version
>> java version "1.5.0_07"
>> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-164)
>> Java HotSpot(TM) Client VM (build 1.5.0_07-87, mixed mode, sharing)
>>
>> ===============
>> Exception 1
>>
>> [09/12/07 20:47:49:138] DEBUG - header                     - >> "GET
>> /hcdata/v1/a/b/c/d/e HTTP/1.1[\r][\n]"
>> [09/12/07 20:47:49:138] DEBUG - HttpMethodBase             -  
>> Adding Host
>> request header
>> [09/12/07 20:47:49:153] DEBUG - header                     - >>
>> "Connection: close[\r][\n]"
>> [09/12/07 20:47:49:154] DEBUG - header                     - >>
>> "Accept-Encoding: gzip, deflate[\r][\n]"
>> [09/12/07 20:47:49:154] DEBUG - header                     - >>
>> "Accept-Charset: utf-8, *;q=0.5[\r][\n]"
>> [09/12/07 20:47:49:155] DEBUG - header                     - >>  
>> "Accept:
>> application/atom+xml;type=entry, application/atom+xml;type=feed,
>> application/atom+xml, application/atomsvc+xml, application/atomcat 
>> +xml,
>> application/xml, text/xml, */*[\r][\n]"
>> [09/12/07 20:47:49:156] DEBUG - header                     - >>
>> "User-Agent: Abdera/v0.3.0-incubating-SNAPSHOT[\r][\n]"
>> [09/12/07 20:47:49:156] DEBUG - header                     - >>  
>> "Host:
>> localhost:40506[\r][\n]"
>> [09/12/07 20:47:49:156] DEBUG - header                     - >>  
>> "[\r][\n]"
>> [09/12/07 20:47:50:27] DEBUG - DefaultServiceContext      - Returning
>> org.apache.abdera.protocol.server.impl.SimpleSubjectResolver@538b14 a 
>> s
>> instance of {1}.
>> [09/12/07 20:47:50:32] DEBUG - DefaultServiceContext      - Returning
>> org.apache.abdera.protocol.server.impl.DefaultRequestHandlerManager@b 
>> b613c
>> as instance of {1}.
>> [09/12/07 20:47:50:33] DEBUG - AbderaServlet              -  
>> Processing
>> request
>> [09/12/07 20:47:50:34] DEBUG - AbderaServlet              - Handler -
>> org.apache.abdera.protocol.server.impl.DefaultRequestHandler@ae0e27
>> [09/12/07 20:47:50:35] DEBUG - AbstractRequestHandler     -  
>> Processing
>> the request
>> [09/12/07 20:47:50:35] DEBUG - AbstractRequestHandler     - Using
>> provider: com.homeaway.hcdata.store.StoreProvider@8202f4
>> [09/12/07 20:47:50:47] ERROR - AbstractRequestHandler     - Error
>> producing output
>> java.io.UnsupportedEncodingException: utf-8, *;q=0.5
>>         at sun.io.Converters.getConverterClass(Converters.java:218)
>>         at sun.io.Converters.newConverter(Converters.java:251)
>>         at
>> sun.io.CharToByteConverter.getConverter(CharToByteConverter.java:68)
>>         at
>> sun.nio.cs.StreamEncoder$ConverterSE.<init>(StreamEncoder.java:189)
>>         at
>> sun.nio.cs.StreamEncoder$ConverterSE.<init>(StreamEncoder.java:172)
>>         at
>> sun.nio.cs.StreamEncoder.forOutputStreamWriter(StreamEncoder.java:72)
>>         at java.io.OutputStreamWriter.<init> 
>> (OutputStreamWriter.java:82)
>>         at
>> org.apache.abdera.protocol.server.impl.AbstractRequestHandler.sendErr 
>> or(AbstractRequestHandler.java:156)
>>
>>         at
>> org.apache.abdera.protocol.server.impl.AbstractRequestHandler.notfoun 
>> d(AbstractRequestHandler.java:179)
>>
>>         at
>> org.apache.abdera.protocol.server.impl.AbstractRequestHandler.precond 
>> itions(AbstractRequestHandler.java:90)
>>
>>         at
>> org.apache.abdera.protocol.server.impl.AbstractRequestHandler.process 
>> (AbstractRequestHandler.java:60)
>>
>>         at
>> org.apache.abdera.protocol.server.servlet.AbderaServlet.service 
>> (AbderaServlet.java:98)
>>
>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java: 
>> 802)
>>         at
>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java: 
>> 491)
>>         at
>> org.mortbay.jetty.servlet.ServletHandler.handle 
>> (ServletHandler.java:367)
>>         at
>> org.mortbay.jetty.handler.HandlerWrapper.handle 
>> (HandlerWrapper.java:139)
>>         at org.mortbay.jetty.Server.handle(Server.java:285)
>>         at
>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java: 
>> 457)
>>         at
>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete 
>> (HttpConnection.java:751)
>>
>>         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java: 
>> 500)
>>         at org.mortbay.jetty.HttpParser.parseAvailable 
>> (HttpParser.java:209)
>>         at org.mortbay.jetty.HttpConnection.handle 
>> (HttpConnection.java:357)
>>         at
>> org.mortbay.jetty.bio.SocketConnector$Connection.run 
>> (SocketConnector.java:217)
>>
>>         at
>> org.mortbay.thread.BoundedThreadPool$PoolThread.run 
>> (BoundedThreadPool.java:475)
>>
>> [09/12/07 20:47:50:51] DEBUG - AbstractRequestHandler     - Releasing
>> provider: com.homeaway.hcdata.store.StoreProvider@8202f4
>>
>> ==============
>> Exception 2
>>
>> [09/12/07 21:16:48:171] ERROR - AbstractRequestHandler     - Error
>> producing output
>> java.lang.NullPointerException
>>         at java.io.Writer.write(Writer.java:126)
>>         at
>> org.apache.abdera.protocol.server.impl.AbstractRequestHandler.sendErr 
>> or(AbstractRequestHandler.java:158)
>>
>>         at
>> org.apache.abdera.protocol.server.impl.AbstractRequestHandler.notfoun 
>> d(AbstractRequestHandler.java:179)
>>
>>         at
>> org.apache.abdera.protocol.server.impl.AbstractRequestHandler.precond 
>> itions(AbstractRequestHandler.java:90)
>>
>>         at
>> org.apache.abdera.protocol.server.impl.AbstractRequestHandler.process 
>> (AbstractRequestHandler.java:60)
>>
>>         at
>> org.apache.abdera.protocol.server.servlet.AbderaServlet.service 
>> (AbderaServlet.java:98)
>>
>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java: 
>> 802)
>>         at
>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java: 
>> 491)
>>         at
>> org.mortbay.jetty.servlet.ServletHandler.handle 
>> (ServletHandler.java:367)
>>         at
>> org.mortbay.jetty.handler.HandlerWrapper.handle 
>> (HandlerWrapper.java:139)
>>         at org.mortbay.jetty.Server.handle(Server.java:285)
>>         at
>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java: 
>> 457)
>>         at
>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete 
>> (HttpConnection.java:751)
>>
>>         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java: 
>> 500)
>>         at org.mortbay.jetty.HttpParser.parseAvailable 
>> (HttpParser.java:209)
>>         at org.mortbay.jetty.HttpConnection.handle 
>> (HttpConnection.java:357)
>>         at
>> org.mortbay.jetty.bio.SocketConnector$Connection.run 
>> (SocketConnector.java:217)
>>
>>         at
>> org.mortbay.thread.BoundedThreadPool$PoolThread.run 
>> (BoundedThreadPool.java:475)
>>
>>
>>
>> S'all good  ---   chriswberry at gmail dot com
>>
>>
>>
>>

S'all good  ---   chriswberry at gmail dot com




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message