Author: prabath
Date: Sat Mar 1 10:10:10 2008
New Revision: 14396
Log:
findbugs fixes
Modified:
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDProviderData.java
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityDefaultUserStoreAdmin.java
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityDefaultUserStoreReader.java
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/OpenIDConsumer.java
Modified:
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDProviderData.java
==============================================================================
---
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDProviderData.java
(original)
+++
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDProviderData.java
Sat Mar 1 10:10:10 2008
@@ -6,6 +6,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import org.openid4java.message.MessageException;
import org.openid4java.message.ax.FetchResponse;
@@ -35,7 +36,7 @@
ClaimsAdmin claimsAdmin = null;
claims = new HashMap();
-
+
claimsAdmin = new ClaimsAdmin();
supportedClaims = claimsAdmin.getAllMappedEnabledClaims();
@@ -63,9 +64,10 @@
ClaimsAdmin claimsAdmin = null;
Iterator iterator = null;
Map map = null;
+ Entry entry = null;
claims = new HashMap();
-
+
claimsAdmin = new ClaimsAdmin();
supportedClaims = claimsAdmin.getAllMappedEnabledClaims();
@@ -82,9 +84,9 @@
String val = null;
while (iterator.hasNext()) {
- key = (String) iterator.next();
- val = (String) requiredClaims.get(key);
- map.put(claimsAdmin.getMappedOpenIDTag(val), key);
+ entry = (Entry) iterator.next();
+ val = (String) entry.getValue();
+ map.put(claimsAdmin.getMappedOpenIDTag(val), entry.getKey());
}
return populateAttributeValues(map.keySet(), userId, claims, map);
@@ -180,14 +182,14 @@
Map claimValues) throws MessageException {
Iterator iterator = null;
- String key = null;
OpenIDClaim claim = null;
+ Entry entry = null;
iterator = claimValues.entrySet().iterator();
while (iterator.hasNext()) {
- key = (String) iterator.next();
- claim = (OpenIDClaim) claimValues.get(key);
+ entry = (Entry) iterator.next();
+ claim = (OpenIDClaim) entry.getValue();
response.addAttribute(claim.openIDTag, claim.claimValue);
}
@@ -204,14 +206,14 @@
Map claimValues) throws MessageException {
Iterator iterator = null;
- String key = null;
+ Entry entry = null;
OpenIDClaim claim = null;
iterator = claimValues.entrySet().iterator();
while (iterator.hasNext()) {
- key = (String) iterator.next();
- claim = (OpenIDClaim) claimValues.get(key);
+ entry = (Entry) iterator.next();
+ claim = (OpenIDClaim) entry.getValue();
response.addAttribute(claim.openIDTag, claim.typeUri,
claim.claimValue);
}
Modified:
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityDefaultUserStoreAdmin.java
==============================================================================
---
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityDefaultUserStoreAdmin.java
(original)
+++
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityDefaultUserStoreAdmin.java
Sat Mar 1 10:10:10 2008
@@ -65,6 +65,7 @@
Connection dbConnection = null;
boolean isDefaultProfile = true;
+ PreparedStatement sqlStatement = null;
try {
@@ -76,8 +77,6 @@
dbConnection.setAutoCommit(false);
- PreparedStatement sqlStatement = null;
-
sqlStatement = dbConnection
.prepareStatement("insert into user_profile_values
(attr_name, attr_value, profile_id, id) values (?, ?, ?, ?)");
@@ -104,7 +103,7 @@
}
}
}
-
+
sqlStatement.close();
sqlStatement = dbConnection
@@ -123,8 +122,6 @@
if (profileName == null && isDefaultProfile)
profileName = "Default Profile";
-
- sqlStatement.close();
dbConnection.commit();
@@ -141,6 +138,9 @@
throw new UserManagerException("errorModifyingUserStore", e);
} finally {
try {
+ if (sqlStatement != null) {
+ sqlStatement.close();
+ }
if (dbConnection != null) {
dbConnection.close();
}
@@ -179,8 +179,6 @@
sqlStatement.setString(5, UUIDGenerator.getUUID());
sqlStatement.executeUpdate();
-
- sqlStatement.close();
dbConnection.commit();
@@ -195,6 +193,9 @@
throw new UserManagerException("errorModifyingUserStore", e);
} finally {
try {
+ if (sqlStatement != null) {
+ sqlStatement.close();
+ }
if (dbConnection != null) {
dbConnection.close();
}
@@ -219,6 +220,7 @@
Connection dbConnection = null;
String profileId = null;
+ PreparedStatement sqlStatement = null;
try {
@@ -230,8 +232,6 @@
dbConnection.setAutoCommit(false);
- PreparedStatement sqlStatement = null;
-
sqlStatement = dbConnection
.prepareStatement("select profile_id from user_profile
where user_id=? and profile_name=?");
@@ -251,7 +251,7 @@
throw new UserManagerException("errorModifyingUserStore");
sqlStatement.close();
-
+
sqlStatement = dbConnection
.prepareStatement("delete from user_profile_values where
profile_id=?");
@@ -281,8 +281,6 @@
}
}
- sqlStatement.close();
-
dbConnection.commit();
} catch (SQLException e) {
@@ -296,6 +294,9 @@
throw new UserManagerException("errorModifyingUserStore", e);
} finally {
try {
+ if (sqlStatement != null) {
+ sqlStatement.close();
+ }
if (dbConnection != null) {
dbConnection.close();
}
Modified:
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityDefaultUserStoreReader.java
==============================================================================
---
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityDefaultUserStoreReader.java
(original)
+++
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/users/IdentityDefaultUserStoreReader.java
Sat Mar 1 10:10:10 2008
@@ -77,13 +77,14 @@
props.put(name, value);
}
- sqlStatement.close();
-
} catch (SQLException e) {
log.debug(e);
throw new UserManagerException("errorReadingFromUserStore", e);
} finally {
try {
+ if (sqlStatement != null) {
+ sqlStatement.close();
+ }
if (dbConnection != null) {
dbConnection.close();
}
@@ -125,8 +126,6 @@
propNames = (String[]) lst.toArray(new String[lst.size()]);
- sqlStatement.close();
-
if (propNames == null)
return new String[0];
@@ -135,6 +134,9 @@
throw new UserManagerException("errorReadingFromUserStore", e);
} finally {
try {
+ if (sqlStatement != null) {
+ sqlStatement.close();
+ }
if (dbConnection != null) {
dbConnection.close();
}
@@ -177,13 +179,14 @@
name = rs.getString(1);
}
- sqlStatement.close();
-
} catch (SQLException e) {
log.debug(e);
throw new UserManagerException("errorReadingFromUserStore", e);
} finally {
try {
+ if (sqlStatement != null) {
+ sqlStatement.close();
+ }
if (dbConnection != null) {
dbConnection.close();
}
@@ -227,13 +230,14 @@
profileNames.add(rs.getString(1));
}
- sqlStatement.close();
-
} catch (SQLException e) {
log.debug(e);
throw new UserManagerException("errorReadingFromUserStore", e);
} finally {
try {
+ if (sqlStatement != null) {
+ sqlStatement.close();
+ }
if (dbConnection != null) {
dbConnection.close();
}
@@ -279,13 +283,14 @@
props.put(name, value);
}
- sqlStatement.close();
-
} catch (SQLException e) {
log.debug(e);
throw new UserManagerException("errorReadingFromUserStore", e);
} finally {
try {
+ if (sqlStatement != null) {
+ sqlStatement.close();
+ }
if (dbConnection != null) {
dbConnection.close();
}
Modified:
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/OpenIDConsumer.java
==============================================================================
---
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/OpenIDConsumer.java
(original)
+++
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/OpenIDConsumer.java
Sat Mar 1 10:10:10 2008
@@ -5,6 +5,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@@ -431,7 +432,6 @@
extension = authSuccess.getExtension(AxMessage.OPENID_NS_AX);
if (extension != null && extension instanceof FetchResponse) {
-
fetchResp = (FetchResponse) extension;
setOpenIDInfocardReqAttributes(fetchResp, request);
}
@@ -521,14 +521,14 @@
Iterator iterator = null;
Map attributes = null;
- String key = null;
+ Entry entry = null;
attributes = response.getAttributes();
iterator = attributes.entrySet().iterator();
while (iterator.hasNext()) {
- key = (String) iterator.next();
- request.setAttribute(key, attributes.get(key));
+ entry = (Entry) iterator.next();
+ request.setAttribute((String)entry.getKey(), entry.getValue());
}
}
_______________________________________________
Identity-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/identity-dev