[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tomcat-dev
Subject:    DO NOT REPLY [Bug 52563] New: Incorrect behavior while checking the thread binding in DirContextURLS
From:       bugzilla () apache ! org
Date:       2012-01-31 3:02:24
Message-ID: bug-52563-78 () https ! issues ! apache ! org/bugzilla/
[Download RAW message or body]

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

             Bug #: 52563
           Summary: Incorrect behavior while checking the thread binding
                    in DirContextURLStreamHandler
           Product: Tomcat 7
           Version: trunk
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: xhhsld@gmail.com
    Classification: Unclassified


In the get method of DirContextURLStreamHandler class, it seems that binding
value with thread are not processed correctly. Now its value will be only
returned if no binding value on the current thread context classloader and it
has no parent classloader, think that the value will not be returned in most
scenarios.
Think that the code logic should be something like :
a. Check whether a value is binding on the current thread context classloader,
if does then return.
b. Check whether a value is binding with the current thread, if does then
return.
c. Check the classloader hierarchy to find a binding value.


public static DirContext get() { 

        DirContext result = null; 

        Thread currentThread = Thread.currentThread(); 
        ClassLoader currentCL = currentThread.getContextClassLoader(); 

        // Checking CL binding 
        result = clBindings.get(currentCL); 
        if (result != null) 
            return result; 

        // Checking thread biding 
        result = threadBindings.get(currentThread);

        // Checking parent CL binding 
        currentCL = currentCL.getParent(); 
        while (currentCL != null) { 
            result = clBindings.get(currentCL); 
            if (result != null) 
                return result; 
            currentCL = currentCL.getParent(); 
        } 

        if (result == null) 
            throw new IllegalStateException("Illegal class loader binding"); 

        return result; 

    }

-- 
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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic