Changeset 2461

Show
Ignore:
Timestamp:
09/18/08 11:45:07 (4 months ago)
Author:
dbuss
Message:

findbugs changes #818

Location:
trunk/otis
Files:
22 modified

Legend:

Unmodified
Added
Removed
  • trunk/otis/config/otis-config.server.xml

    r2455 r2461  
    139139                                                        attrIDOk = "Query part not allowed in attr ID URI"; 
    140140                                                } 
    141                                                 else if (attrURI.getRawFragment() != null) 
    142                                                 { 
    143                                                         attrIDOk = "Fragment part not allowed in attr ID URI"; 
    144                                                 } 
     141//                                              else if (attrURI.getRawFragment() != null) 
     142//                                              { 
     143//                                                      attrIDOk = "Fragment part not allowed in attr ID URI"; 
     144//                                              } 
    145145                                                else 
    146146                                                { 
  • trunk/otis/src/org/bandit/otis/api/IRole.java

    r2430 r2461  
    2626 * methods. 
    2727 */ 
    28 public interface IRole extends IConfigurable 
     28public interface IRole 
    2929{ 
    3030        /** 
  • trunk/otis/src/org/bandit/otis/impl/CommonRole.java

    r2447 r2461  
    3636public  class CommonRole implements IRole 
    3737{ 
    38         Map<String, ?>                                          m_settings; 
     38//      Map<String, ?>                                          m_settings; 
    3939        private Map<String, Object>     m_members; 
    4040         
    4141        private void _init(String roleId) throws AuthSessionException 
    4242        { 
    43                 m_settings = null; 
    4443                m_members = new HashMap<String, Object>(); 
    4544                 
     
    183182                Object value  = m_members.get(name); 
    184183                 
    185                 if ( value == null && m_settings != null) 
    186                 { 
     184//              if ( value == null && m_settings != null) 
     185                //{ 
    187186                        /* Todo: find policy for mapping item, map item, save cached value in map */ 
    188                 } 
     187                //} 
    189188                 
    190189                if ( name.equals(IRole.roleId) && value != null) 
     
    203202        } 
    204203         
    205          
    206         public void configure( 
    207                 Map<String, ?> mapSettings) throws AuthSessionException 
    208         { 
    209                 m_settings = mapSettings; 
    210         } 
    211  
    212204        public String getRoleActivationMethod() throws AuthSessionException 
    213205        { 
     
    280272        } 
    281273         
     274        public int hashCode() { 
     275                return super.hashCode(); 
     276        }   
     277 
    282278        public boolean equals(Object o) 
    283279        { 
  • trunk/otis/src/org/bandit/otis/impl/CommonRolesCache.java

    r2447 r2461  
    2020import java.util.Map; 
    2121 
    22 import org.bandit.otis.api.IConfigurable; 
    2322import org.bandit.otis.api.IRole; 
    2423import org.bandit.otis.api.AuthSessionException; 
     
    3029 * @exclude 
    3130 */ 
    32 public  class CommonRolesCache implements IConfigurable 
     31public  class CommonRolesCache 
    3332{ 
    34         private Map<String, ?>                  m_settings; 
    3533         
    3634        private HashMap<String, CommonTTLCache> m_caches; 
     
    3836        public CommonRolesCache() 
    3937        { 
    40                 m_settings = null; 
    4138                m_caches = new HashMap<String, CommonTTLCache>(); 
    4239        } 
     
    177174        /** 
    178175         * External mechanism for invalidating the cache. 
    179          * @throws AuthSessionException 
    180176         */ 
    181177        public void clear(String cacheName) 
     
    191187        } 
    192188 
    193         public void configure( 
    194                 Map<String, ?> mapSettings) throws AuthSessionException 
    195         { 
    196                 m_settings = mapSettings; 
    197         } 
    198          
     189 
    199190} 
  • trunk/otis/src/org/bandit/otis/impl/CommonTTLCache.java

    r2430 r2461  
    3131 * @exclude 
    3232 */ 
    33 public class CommonTTLCache implements IConfigurable 
     33public class CommonTTLCache 
    3434{ 
    35         private Map<String, ?>                  m_settings; 
    36         private static Iterable<Object> m_empty; 
    3735        CacheObject m_cache; 
    3836         
    3937        private void _init(int ttlSeconds) 
    4038        { 
    41                 m_settings = null; 
    4239                ArrayList<CacheObject>  cache = new ArrayList<CacheObject>(); 
    4340                long expire = java.lang.Long.MAX_VALUE; 
     
    4946                        cacheElement = new CacheObject(cache, ttlSeconds); 
    5047                m_cache = cacheElement; 
    51                 m_empty = new CacheIter(null); 
    5248        } 
    5349         
     
    110106                } 
    111107                 
    112                 return m_empty; 
     108                return new CacheIter(null); 
    113109        } 
    114110         
     
    184180        } 
    185181 
    186         public void configure( 
    187                 Map<String, ?> mapSettings) throws AuthSessionException 
    188         { 
    189                 m_settings = mapSettings; 
    190         } 
    191          
    192182        /** 
    193183         * wrapper for the real  object, allows us to remember caching parameters 
     
    196186         * 
    197187         */ 
    198         private class CacheObject  
     188        private static class CacheObject  
    199189        { 
    200190                private Object m_obj; 
     
    258248                 * Create a new ImmutableIterator 
    259249                 */ 
    260         private class CacheIter implements Iterator<Object>, Iterable<Object> 
     250        private static class CacheIter implements Iterator<Object>, Iterable<Object> 
    261251        { 
    262252                private Iterator<?> _realIterator; 
  • trunk/otis/src/org/bandit/otis/impl/LocalAuthSession.java

    r2430 r2461  
    3232import org.eclipse.higgins.idas.api.IFilter; 
    3333import org.eclipse.higgins.idas.api.ISimpleAttrValue; 
    34 import org.eclipse.higgins.idas.api.ITypedValue; 
    3534import org.eclipse.higgins.idas.api.IdASException; 
    3635import org.eclipse.higgins.idas.common.ContextSpecificFilterExtension; 
     
    7372        private CommonRolesCache                        m_roleCache; 
    7473        private long                                                    m_lastAccessTime = java.lang.Long.MAX_VALUE; 
    75         private static Iterator<IRole>  m_empty; 
    7674        private String                                                  m_strOriginatorLocationName = null; 
    7775        private String                                                  m_strOriginatorLocationAddress = null; 
     
    131129                this.configure( settings); 
    132130 
    133                 m_empty = (Iterator<IRole>) (new EmptyIterator()); 
    134  
    135131                m_roleCache = new CommonRolesCache(); 
    136132                m_authMethodsUsedList = new ArrayList(); 
     
    234230                if ((configAuthMethodSettings = (Map)methodItem.getMethodSettings()) != null) 
    235231                { 
    236                         Iterator        settingsIter = configAuthMethodSettings.keySet().iterator(); 
    237                         while (settingsIter.hasNext()) 
    238                         { 
    239                                 String  strKey = (String)settingsIter.next(); 
    240                                 authMethodSettings.put( strKey, configAuthMethodSettings.get( strKey)); 
    241                         } 
     232                        authMethodSettings.putAll( configAuthMethodSettings); 
    242233                } 
    243234                if (authMethodSettings.get( Constants.AUTH_METHOD_CONTEXT_REGISTRY) == null && 
     
    776767                        // just let it slide, return an empty cache 
    777768                } 
    778                 return m_empty; 
     769                return (Iterator<IRole>) (new EmptyIterator()); 
    779770        } 
    780771 
     
    951942                CommonRolesCache roleCache) throws AuthSessionException 
    952943        { 
    953                 final String[] totalParamNames =        {"authSession", "cacheName", "roleCache", "authmethods"}; 
    954                  
    955944                if (getSettings() ==  null) 
    956945                        throw new AuthSessionException("No policy configured for :" + this.getClass().getName()); 
     
    11101099                                                                                else 
    11111100                                                                                { 
    1112                                                                                         if ( data == null) 
    1113                                                                                                 m_log.error("Non Simple Value found  found on Attr: " + attr.getAttrID().toString() + " while evaluating rule: " ); 
    1114                                                                                         else 
    1115                                                                                                 m_log.error("Unknown data type: "+ data.getClass().getCanonicalName() +  
    1116                                                                                                         " found on Attr: " + attr.getAttrID().toString() + " while evaluating rule: " ); 
     1101                                                                                        m_log.error("Non Simple Value found  found on Attr: " + attr.getAttrID().toString() + " while evaluating rule: " ); 
    11171102                                                                                } 
    11181103                                                                        } // end of attr value iter loop 
     
    15651550         * 
    15661551         */ 
    1567         private class EmptyIterator implements Iterator<IRole> 
     1552        private static class EmptyIterator implements Iterator<IRole> 
    15681553        { 
    15691554                public boolean hasNext() 
     
    16191604                                                m_log.debug("NULL event information values array not allowed when information name array is non-null"); 
    16201605                                        } 
    1621                                         if (strEventInfoNames.length != strEventInfoValues.length) 
     1606                                        else 
    16221607                                        { 
    1623                                                 m_log.debug("Number of event information names (" + strEventInfoNames.length + ") does not " + 
    1624                                                                                         "match the number of event information values (" + strEventInfoValues.length + ")"); 
    1625                                         } 
    1626                                         for (int iLoop = 0; iLoop < strEventInfoNames.length; iLoop++) 
    1627                                         { 
    1628                                                 m_auditRecord.addEventInfo( strEventInfoNames [iLoop], strEventInfoValues [iLoop]); 
     1608                                                if (strEventInfoNames.length != strEventInfoValues.length) 
     1609                                                { 
     1610                                                        m_log.debug("Number of event information names (" + strEventInfoNames.length + ") does not " + 
     1611                                                                                                "match the number of event information values (" + strEventInfoValues.length + ")"); 
     1612                                                } 
     1613                                                for (int iLoop = 0; iLoop < strEventInfoNames.length; iLoop++) 
     1614                                                { 
     1615                                                        m_auditRecord.addEventInfo( strEventInfoNames [iLoop], strEventInfoValues [iLoop]); 
     1616                                                } 
    16291617                                        } 
    16301618                                } 
  • trunk/otis/src/org/bandit/otis/impl/OtisAuditAppender.java

    r2237 r2461  
    9696                int             iMajorStatusCode; 
    9797                int             iMinorStatusCode; 
     98                int    iReadLen; 
    9899                 
    99100                putInt( iRecordLen + 20, ucBuf, 0); 
     
    114115                        // Peek at the return buffer to get buffer size needed 
    115116                         
    116                         m_inputStream.read( ucBuf, 0, 4); 
     117                        iReadLen = m_inputStream.read( ucBuf, 0, 4); 
    117118                        iResponseLen = getInt( ucBuf, 0) - 4; 
    118119                        if (ucBuf.length < iResponseLen) 
     
    121122                        } 
    122123                         
    123                         m_inputStream.read(ucBuf, 0, iResponseLen); 
     124                        iReadLen = m_inputStream.read(ucBuf, 0, iResponseLen); 
     125                        if ( iReadLen != iResponseLen) 
     126                                throw new AuditException( ""); 
    124127                        iMajorStatusCode = getInt(ucBuf, 0); 
    125128                        iMinorStatusCode = getInt(ucBuf, 4); 
  • trunk/otis/src/org/bandit/otis/impl/OtisAuditRecord.java

    r2237 r2461  
    2323 
    2424import java.util.Map; 
    25 import java.util.HashMap; 
    26 import java.util.List; 
    27 import java.util.ArrayList; 
    28 import java.util.Iterator; 
    2925 
    3026import java.util.Date; 
  • trunk/otis/src/org/bandit/otis/impl/RemoteAuthSession.java

    r2455 r2461  
    14381438                         
    14391439                        Document        responseDoc = response.getResponseBodyDoc(); 
    1440                         Map             properties = new HashMap(); 
    14411440                        Element propertyElement; 
    14421441                        if (responseDoc != null) 
  • trunk/otis/src/org/bandit/otis/impl/RemoteEndPointClient.java

    r2417 r2461  
    7373                m_endPoint =  setting.trim(); 
    7474//              _checkOptions(); 
    75         } 
    76          
    77         /** 
    78          * make sure we really cleanup, including any parents 
    79          */  
    80         protected void finalize() throws Throwable  
    81         { 
    82             try  
    83             { 
    84                   
    85             }  
    86             finally  
    87             { 
    88                 super.finalize(); 
    89             } 
    9075        } 
    9176         
  • trunk/otis/src/org/bandit/otis/impl/SAMLPolicyAuthMethod.java

    r2416 r2461  
    5757public class SAMLPolicyAuthMethod extends CommonAuthMethod 
    5858{ 
    59         private static URI ISSUER_URI; 
     59        private static URI ISSUER_URI =  URI.create("urn:issuer");; 
    6060         
    6161        private Log             m_log = LogFactory.getLog( SAMLPolicyAuthMethod.class.getName()); 
    6262        private String m_authEntityId; 
    6363         
    64         static  { 
    65                 try 
    66                 { 
    67                         ISSUER_URI = new URI("urn:issuer"); 
    68                 } 
    69                 catch (Exception e) 
    70                 { 
    71                         // nothing to see, do, buy, photograph, or eat here.  Your code reached this point and you didn't even get  
    72                         // a lousy t-shirt.    
    73                 } 
    74         } 
    7564        public SAMLPolicyAuthMethod() 
    7665        { 
     66                 
    7767        } 
    7868         
  • trunk/otis/src/org/bandit/otis/impl/UsernamePasswordAuthMethod.java

    r2416 r2461  
    113113                strPassword = (String)value; 
    114114                 
    115                 // Make sure we got both a username and password 
    116                  
    117                 if (strUserName == null) 
    118                 { 
    119                         throwException( "No value specified for authentication material '" + Constants.AUTH_MATERIAL_USERNAME + "'"); 
    120                 } 
    121                 if (strPassword == null) 
    122                 { 
    123                         throwException( "No value specified for authentication material '" + Constants.AUTH_MATERIAL_PASSWORD + "'"); 
    124                 } 
    125                  
    126115                try 
    127116                { 
  • trunk/otis/src/org/bandit/otis/server/AuditLogHandler.java

    r2433 r2461  
    1818import javax.servlet.http.HttpServletRequest; 
    1919 
    20 import org.bandit.otis.api.AuthSessionException; 
    2120import org.bandit.otis.utils.Constants; 
    2221 
     
    3130 
    3231import java.util.Map; 
    33 import java.util.HashMap; 
    3432import java.util.ArrayList; 
    3533 
     
    371369                if (iHttpResponseCode != HttpServletResponse.SC_OK) 
    372370                { 
    373                         responseMap.put( Constants.TEMPLATE_HTTP_RESPONSE_CODE, new Integer( iHttpResponseCode));  
     371                        responseMap.put( Constants.TEMPLATE_HTTP_RESPONSE_CODE,  Integer.valueOf( iHttpResponseCode));  
    374372                } 
    375373                return( strTemplateFile); 
  • trunk/otis/src/org/bandit/otis/server/AuthenticatedSessionHandler.java

    r2433 r2461  
    589589                } 
    590590                 
    591                 authMaterialMap.put( Constants.TEMPLATE_MUST_GATHER_ALL_CHILDREN, new Boolean( authMaterial.mustGatherAllChildren())); 
     591                authMaterialMap.put( Constants.TEMPLATE_MUST_GATHER_ALL_CHILDREN,  Boolean.valueOf( authMaterial.mustGatherAllChildren())); 
    592592                if ((childAuthMaterials = authMaterial.getChildMaterials()) != null) 
    593593                { 
     
    14741474                        UriBuilder requestURI = new UriBuilder(request.getRequestURL()); 
    14751475 
    1476                         requestURI.setPath(request.getRequestURI().toString()); 
     1476                        requestURI.setPath(request.getRequestURI()); 
    14771477                        requestURI.terminatePathAfter((String)nounList.get(0)); 
    14781478                        strNounURL = requestURI.buildString(); 
     
    15971597                if (iHttpResponseCode != HttpServletResponse.SC_OK) 
    15981598                { 
    1599                         responseMap.put( Constants.TEMPLATE_HTTP_RESPONSE_CODE, new Integer( iHttpResponseCode));  
     1599                        responseMap.put( Constants.TEMPLATE_HTTP_RESPONSE_CODE,  Integer.valueOf( iHttpResponseCode));  
    16001600                } 
    16011601                if (strSessionID != null) 
  • trunk/otis/src/org/bandit/otis/server/EntityHandler.java

    r2453 r2461  
    831831                                if (strNodeElementName.equals( RESTConstants.REST_ATTRIBUTE_ELEMENT)) 
    832832                                { 
    833                                         this.addAttribute( strSessionID, "Entity='" + strEntityID + "'", entity, (Element)childNode, false, responseMap); 
     833                                        this.addAttribute( strSessionID, "Entity='" + strEntityID, entity, (Element)childNode, false, responseMap); 
    834834                                } 
    835835                                else 
     
    19921992                                                        else 
    19931993                                                        { 
    1994                                                                 Map             attrMap = (Map)attrs.get( 0); 
    1995                                                                 Iterator        attrMapIter = attrMap.keySet().iterator(); 
    1996                                                                 while (attrMapIter.hasNext()) 
    1997                                                                 { 
    1998                                                                         String  strKey = (String)attrMapIter.next(); 
    1999                                                                         responseMap.put( strKey, attrMap.get( strKey)); 
    2000                                                                 } 
     1994                                                                responseMap.putAll( (Map)attrs.get( 0) ); 
    20011995                                                        } 
    20021996                                                }