You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/07/16 11:38:51 UTC

DO NOT REPLY [Bug 49600] New: Bad exception thrown by ProxyDirContext.lookup

https://issues.apache.org/bugzilla/show_bug.cgi?id=49600

           Summary: Bad exception thrown by ProxyDirContext.lookup
           Product: Tomcat 7
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: mguillemot@yahoo.fr


Created an attachment (id=25766)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25766)
Unit tests illustrating the problems

Two problems with exception thrown by ProxyDirContext.lookup

- ProxyDirContext.lookup throws notFoundException when the entry doesn't exist.
notFoundException is a field and therefore initialized at ProxyDirContext
creation.

The consequence is that the exception thrown contains a stacktrace that has
nothing to do with the current execution stack. This makes difficult to find
the root cause of a problem. If this is really an optimization (what is the
gain), then what about making this field static?

- ProxyDirContext.lookup is not consistent: for the same call it may throw
NamingException or NameNotFoundException depending whether the cache has been
used or not.

Problems occur in Tomcat 6 and 7.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49600] Bad exception thrown by ProxyDirContext.lookup

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49600

--- Comment #1 from Mark Thomas <ma...@apache.org> 2010-07-21 14:05:57 EDT ---
The gain by using notFoundException is in GC. It prevents exception objects
being created for resources that don't exist. I agree it could be static (final
too).

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49600] Bad exception thrown by ProxyDirContext.lookup

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49600

--- Comment #4 from Mark Thomas <ma...@apache.org> 2010-07-22 09:42:03 EDT ---
No, I didn't write the original code but I trust that Remy had a good reason
for this particular optimisation.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49600] Bad exception thrown by ProxyDirContext.lookup

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49600

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #2 from Mark Thomas <ma...@apache.org> 2010-07-21 16:33:07 EDT ---
Thanks for the test case. I kept the "not Found" test (with a minor
modification" but not the strack trace test.

The returned exceptions have been made consistent for 7.0.x and will be
included in 7.0.1 onwards.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 49600] Bad exception thrown by ProxyDirContext.lookup

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49600

--- Comment #3 from Marc Guillemot <mg...@yahoo.fr> 2010-07-22 02:50:00 EDT ---
Can you explain why GC gain are considered at this special place in detriment
of a correct exception? 

For me if GC gain is an argument, then there are so many other places in Tomcat
where it should apply. This starts with the BaseDirContext.lookup that you've
fixed to address the "not Found" point of this case.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org