2012/8/20 Peter Cipov <pci...@kerio.com>:
> Hello,
> I have encountered ambiguous feature/bug of request
>
> ...servlet code ...
>
> throw new LoginException(String.format("Login failed for user %s from IP %s
> (%s)",
>                 principalName,
>                 request.getRemoteAddr(),
>                 type
>         ), ex);
>
> ..................
>
> throws java.lang.NullPointerException
>         at
> org.apache.coyote.http11.Http11AprProcessor.actionInternal(Http11AprProcessor.java:272)
>         at
> org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:834)
>         at org.apache.coyote.Request.action(Request.java:346)
>         at
> org.apache.catalina.connector.Request.getRemoteAddr(Request.java:1280)
>         at
> org.apache.catalina.connector.RequestFacade.getRemoteAddr(RequestFacade.java:517)
>
>
> but this equivalent code works as it should
>
> ...servlet code ...
>
> String remoteAddr = request.getRemoteAddr();
>
> throw new LoginException(String.format("Login failed for user %s from IP %s
> (%s)",
>                 principalName,
>                 remoteAddr,
>                 type
>         ), ex);
>
> ..................
>
> Is this correct behavior ?

1. It depends on version of Tomcat and on which connector you are using.

If it is some old version of Tomcat 5.5 (your are not saying what you
are using) and an APR connector (as can be confirmed from your stack
trace), then yes, it is known behaviour that was fixed a year ago.

2. If you are using request object outside of its request processing
cycle, it is also a known behaviour. (You do not have access to the
socket if it is not the thread responding to the request).

If it is none of the above, then yes - that would be a bug, but you
have to provide a recipe (e.g. a simple web application) on how to
reproduce it.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to