aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2015-11-27 10:41:52 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2015-11-27 10:41:52 +0100
commit8a1401930c74d768289755252477a2e08581d3b6 (patch)
tree5cf67bbd4cdb7c81b0e2d12158b89dbb25097231 /id/server/idserverlib/src/main/java
parentb4eb04513297cff81d0e52ca0020cf23f009b6d8 (diff)
downloadmoa-id-spss-8a1401930c74d768289755252477a2e08581d3b6.tar.gz
moa-id-spss-8a1401930c74d768289755252477a2e08581d3b6.tar.bz2
moa-id-spss-8a1401930c74d768289755252477a2e08581d3b6.zip
fix possible DB cleanup errors
Diffstat (limited to 'id/server/idserverlib/src/main/java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AssertionStorage.java30
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java50
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBExceptionStoreImpl.java30
3 files changed, 56 insertions, 54 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AssertionStorage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AssertionStorage.java
index 704adc80d..3b97f3b08 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AssertionStorage.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AssertionStorage.java
@@ -145,22 +145,22 @@ public class AssertionStorage {
query.setTimestamp("timeout", expioredate);
results = query.list();
session.getTransaction().commit();
- }
-
- if (results.size() != 0) {
- for(AssertionStore result : results) {
- try {
- cleanDelete(result);
- Logger.info("Remove stored information with ID: " + result.getArtifact()
- + " after timeout.");
- } catch (HibernateException e){
- Logger.warn("Sessioninformation with ID=" + result.getArtifact()
- + " not removed after timeout! (Error during Database communication)", e);
- }
-
- }
- }
+ if (results.size() != 0) {
+ for(AssertionStore result : results) {
+ try {
+ cleanDelete(result);
+ Logger.info("Remove stored information with ID: " + result.getArtifact()
+ + " after timeout.");
+
+ } catch (HibernateException e){
+ Logger.warn("Sessioninformation with ID=" + result.getArtifact()
+ + " not removed after timeout! (Error during Database communication)", e);
+ }
+
+ }
+ }
+ }
}
public void remove(String artifact) {
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java
index 829383cb4..d1582b883 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java
@@ -693,19 +693,20 @@ public class AuthenticationSessionStoreage {
//send transaction
tx.commit();
+
+ Logger.trace("Found entries: " + result.size());
+
+ //Assertion requires an unique artifact
+ if (result.size() != 1) {
+ Logger.trace("No entries found.");
+ return false;
+
+ } else {
+ cleanDelete(result.get(0));
+ return true;
+ }
}
- Logger.trace("Found entries: " + result.size());
-
- //Assertion requires an unique artifact
- if (result.size() != 1) {
- Logger.trace("No entries found.");
- return false;
-
- } else {
- cleanDelete(result.get(0));
- return true;
- }
} catch (Exception e) {
if (tx != null && !tx.wasCommitted())
tx.rollback();
@@ -1024,21 +1025,22 @@ public class AuthenticationSessionStoreage {
query.setTimestamp("timeoutupdate", expioredateupdate);
results = query.list();
tx.commit();
- }
-
- if (results.size() != 0) {
- for(AuthenticatedSessionStore result : results) {
- try {
- cleanDelete(result);
- Logger.info("Authenticated session with sessionID=" + result.getSessionid()
- + " after session timeout.");
- } catch (HibernateException e){
- Logger.warn("Authenticated session with sessionID=" + result.getSessionid()
- + " not removed after timeout! (Error during Database communication)", e);
- }
- }
+ if (results.size() != 0) {
+ for(AuthenticatedSessionStore result : results) {
+ try {
+ cleanDelete(result);
+ Logger.info("Authenticated session with sessionID=" + result.getSessionid()
+ + " after session timeout.");
+
+ } catch (HibernateException e){
+ Logger.warn("Authenticated session with sessionID=" + result.getSessionid()
+ + " not removed after timeout! (Error during Database communication)", e);
+ }
+ }
+ }
}
+
} catch (Exception e) {
if (tx != null && !tx.wasCommitted())
tx.rollback();
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBExceptionStoreImpl.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBExceptionStoreImpl.java
index 054ad1014..4cddd141b 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBExceptionStoreImpl.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/DBExceptionStoreImpl.java
@@ -126,22 +126,22 @@ public class DBExceptionStoreImpl implements IExceptionStore {
query.setTimestamp("timeout", expioredate);
results = query.list();
session.getTransaction().commit();
- }
-
- if (results.size() != 0) {
- for(ExceptionStore result : results) {
- try {
- MOASessionDBUtils.delete(result);
- Logger.info("Remove Exception with ID=" + result.getExid()
- + " after timeout.");
- } catch (HibernateException e){
- Logger.warn("Exception with ID=" + result.getExid()
- + " not removed after timeout! (Error during Database communication)", e);
- }
-
- }
- }
+ if (results.size() != 0) {
+ for(ExceptionStore result : results) {
+ try {
+ MOASessionDBUtils.delete(result);
+ Logger.info("Remove Exception with ID=" + result.getExid()
+ + " after timeout.");
+
+ } catch (HibernateException e){
+ Logger.warn("Exception with ID=" + result.getExid()
+ + " not removed after timeout! (Error during Database communication)", e);
+ }
+
+ }
+ }
+ }
}
@SuppressWarnings("rawtypes")