Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2011-08-03 19:40:17 +0000
committerRyan D. Brooks2011-08-03 19:40:17 +0000
commit0783b58cce6c815a3bda232b3ff703e33ff74253 (patch)
tree1582491b8d0b763b21419aa3a41b876bc76bcde0 /plugins
parent3ae4b4e26658854aac1204d7522c60f64c61799d (diff)
downloadorg.eclipse.osee-0783b58cce6c815a3bda232b3ff703e33ff74253.tar.gz
org.eclipse.osee-0783b58cce6c815a3bda232b3ff703e33ff74253.tar.xz
org.eclipse.osee-0783b58cce6c815a3bda232b3ff703e33ff74253.zip
refactor: Remove superfluous null checks of IOseeStatement
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/UserDataStore.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/task/CleanJoinTablesServerTask.java3
-rw-r--r--plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateArtifactVersionTxOperation.java12
-rw-r--r--plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateRelationsTxOperation.java8
-rw-r--r--plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/CompressedContentFix.java13
-rw-r--r--plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/OseeInfoDbItem.java10
-rw-r--r--plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java14
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java4
8 files changed, 20 insertions, 48 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/UserDataStore.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/UserDataStore.java
index 536f356fc3c..757f340ac76 100644
--- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/UserDataStore.java
+++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/UserDataStore.java
@@ -43,9 +43,7 @@ public class UserDataStore {
} catch (OseeCoreException ex) {
OseeLog.logf(ServerActivator.class, Level.SEVERE, ex, "Unable to find userId [%s] in OSEE database.", userId);
} finally {
- if (chStmt != null) {
- chStmt.close();
- }
+ chStmt.close();
}
return toReturn;
}
diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/task/CleanJoinTablesServerTask.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/task/CleanJoinTablesServerTask.java
index 21f287cd291..6b32f6608a4 100644
--- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/task/CleanJoinTablesServerTask.java
+++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/task/CleanJoinTablesServerTask.java
@@ -68,11 +68,10 @@ public class CleanJoinTablesServerTask implements IServerTask {
private void deleteFromJoinCleanup() throws OseeCoreException {
List<Integer[]> queryIds = new ArrayList<Integer[]>();
- IOseeStatement chStmt = null;
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
boolean isAlive = false;
ISessionManager manager = ServerActivator.getSessionManager();
try {
- chStmt = ConnectionHandler.getStatement();
chStmt.runPreparedQuery(SELECT_SESSION_FROM_JOIN);
String prevSessionId = "";
diff --git a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateArtifactVersionTxOperation.java b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateArtifactVersionTxOperation.java
index 0dda1cc6e55..2f9b90cab8a 100644
--- a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateArtifactVersionTxOperation.java
+++ b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateArtifactVersionTxOperation.java
@@ -118,9 +118,7 @@ public class ConsolidateArtifactVersionTxOperation extends AbstractDbTxOperation
ModificationType.getMod(chStmt.getInt("mod_type")), TxChange.getChangeType(chStmt.getInt("tx_current"))));
}
} finally {
- if (chStmt != null) {
- chStmt.close();
- }
+ chStmt.close();
}
}
@@ -249,9 +247,7 @@ public class ConsolidateArtifactVersionTxOperation extends AbstractDbTxOperation
}
}
} finally {
- if (chStmt != null) {
- chStmt.close();
- }
+ chStmt.close();
}
}
@@ -305,9 +301,7 @@ public class ConsolidateArtifactVersionTxOperation extends AbstractDbTxOperation
previuosTransactionId = transactionId;
}
} finally {
- if (chStmt != null) {
- chStmt.close();
- }
+ chStmt.close();
}
writeAddressingChanges(archived, true);
diff --git a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateRelationsTxOperation.java b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateRelationsTxOperation.java
index 645e3c2abfc..94e56e2dbaf 100644
--- a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateRelationsTxOperation.java
+++ b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/operation/ConsolidateRelationsTxOperation.java
@@ -131,9 +131,7 @@ public class ConsolidateRelationsTxOperation extends AbstractDbTxOperation {
}
}
} finally {
- if (chStmt != null) {
- chStmt.close();
- }
+ chStmt.close();
}
}
@@ -189,9 +187,7 @@ public class ConsolidateRelationsTxOperation extends AbstractDbTxOperation {
writeAddressingBackup(obsoleteGammaId, transactionId, netGammaId, modType, txCurrent);
}
} finally {
- if (chStmt != null) {
- chStmt.close();
- }
+ chStmt.close();
}
gammaJoin.delete();
}
diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/CompressedContentFix.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/CompressedContentFix.java
index 984ab136a58..d28c677ffaf 100644
--- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/CompressedContentFix.java
+++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/conversion/CompressedContentFix.java
@@ -94,7 +94,7 @@ public class CompressedContentFix {
try {
initializeData();
doWork(time);
- } catch (OseeCoreException ex) {
+ } catch (Exception ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
} finally {
clear();
@@ -193,10 +193,9 @@ public class CompressedContentFix {
return resourceExists;
}
- private void doWork(long time) {
- IOseeStatement chStmt = null;
+ private void doWork(long time) throws Exception {
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
try {
- chStmt = ConnectionHandler.getStatement();
chStmt.runPreparedQuery(FIND_ALL_NATIVE_CONTENT_SQL);
int count = 0;
while (chStmt.next() && execute) {
@@ -219,12 +218,8 @@ public class CompressedContentFix {
}
}
}
- } catch (Exception ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
} finally {
- if (chStmt != null) {
- chStmt.close();
- }
+ chStmt.close();
}
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/OseeInfoDbItem.java b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/OseeInfoDbItem.java
index baac0132e37..a8e835b2683 100644
--- a/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/OseeInfoDbItem.java
+++ b/plugins/org.eclipse.osee.framework.ui.admin/src/org/eclipse/osee/framework/ui/admin/dbtabletab/OseeInfoDbItem.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.ui.admin.dbtabletab;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
import org.eclipse.osee.framework.database.core.ConnectionHandler;
import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.logging.OseeLevel;
@@ -42,20 +43,17 @@ public class OseeInfoDbItem extends DbItem {
return 100;
}
- public boolean exists(String key) {
+ public boolean exists(String key) throws OseeDataStoreException {
boolean toReturn = false;
- IOseeStatement chStmt = null;
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
try {
- chStmt = ConnectionHandler.getStatement();
String query = "SELECT * FROM " + getTableName() + " WHERE OSEE_KEY = " + returnTic(key);
chStmt.runPreparedQuery(query);
toReturn = chStmt.next();
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
} finally {
- if (chStmt != null) {
- chStmt.close();
- }
+ chStmt.close();
}
return toReturn;
}
diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java
index 7ed0a7ea3dc..e535f3854fb 100644
--- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java
+++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java
@@ -106,11 +106,8 @@ public class GraphLoader {
if (source != null) {
connect(source, txModel);
} else {
- OseeLog.logf(
- Activator.class,
- Level.SEVERE,
- "Invalid parent transaction id of [%s] for branch [%s]", parentTxId,
- branchModel.getBranch());
+ OseeLog.logf(Activator.class, Level.SEVERE,
+ "Invalid parent transaction id of [%s] for branch [%s]", parentTxId, branchModel.getBranch());
// StubBranchModel stubModel = graphCache.getStubBranchModel();
// TxModel stubTxModel = stubModel.addTx(parentTxId);
// graphCache.addTxModel(stubTxModel);
@@ -145,9 +142,8 @@ public class GraphLoader {
private static List<TxData> getTxData(int queryId) throws OseeCoreException {
List<TxData> txDatas = new ArrayList<TxData>();
- IOseeStatement chStmt = null;
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
try {
- chStmt = ConnectionHandler.getStatement();
chStmt.runPreparedQuery(GET_TRANSACTION_DATA, queryId);
while (chStmt.next()) {
Branch branch = BranchManager.getBranch(chStmt.getInt("branch_id"));
@@ -158,9 +154,7 @@ public class GraphLoader {
txDatas.add(txData);
}
} finally {
- if (chStmt != null) {
- chStmt.close();
- }
+ chStmt.close();
}
return txDatas;
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java
index dde76babe25..e46921eb65c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/preferences/DataSourceDetails.java
@@ -128,9 +128,7 @@ public class DataSourceDetails extends PreferencePage implements IWorkbenchPrefe
builder.append(AHTML.addRowSpanMultiColumnTable(Lib.exceptionToString(ex), 3));
} finally {
builder.append(AHTML.endMultiColumnTable());
- if (chStmt != null) {
- chStmt.close();
- }
+ chStmt.close();
}
return builder.toString().replaceAll("\n", "<br/>");
}

Back to the top