Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2021-01-14 18:32:50 +0000
committerRyan D. Brooks2021-01-15 04:23:21 +0000
commit1ee47c493c0cad98e51efef051123e14d4447004 (patch)
tree22b51a257d510c56dc171f5a017e42077e23697c
parent864a166d80c54708cf77a9f317a71c0f6f1e784f (diff)
downloadorg.eclipse.osee-1ee47c493c0cad98e51efef051123e14d4447004.tar.gz
org.eclipse.osee-1ee47c493c0cad98e51efef051123e14d4447004.tar.xz
org.eclipse.osee-1ee47c493c0cad98e51efef051123e14d4447004.zip
refactor[TW18593]: Remove JaxRsExceptions.asOseeException
-rw-r--r--plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java108
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java23
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AttributeResourceTest.java19
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/IntegerAttributeTest.java9
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/MappedAttributeDataProvider.java37
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/utils/AttributeResourceProcessor.java17
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/PurgeBranchHttpRequestOperation.java7
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeTypesExportOperation.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/AttributeTaggingOperation.java9
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperation.java13
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java8
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java19
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionUtility.java7
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsExceptions.java55
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/OAuth2Transport.java9
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java7
16 files changed, 86 insertions, 267 deletions
diff --git a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
index 1c616e2e45b..94d2fe3e761 100644
--- a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
+++ b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
@@ -48,7 +48,6 @@ import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.type.ResultSets;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.eclipse.osee.jaxrs.client.JaxRsWebTarget;
/**
@@ -88,101 +87,63 @@ public class AccountClientImpl implements AccountClient {
data.setScheme(scheme);
URI uri = UriBuilder.fromUri(baseUri).path(ACCOUNTS).path(ACCOUNT_LOGIN).build();
- try {
- return newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(data),
- AccountSessionData.class);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ return newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(data), AccountSessionData.class);
}
@Override
public boolean logout(AccountSessionData session) {
URI uri = UriBuilder.fromUri(baseUri).path(ACCOUNTS).path(ACCOUNT_LOGOUT).build();
- try {
- Response response = newTarget(uri).request().post(Entity.json(session));
- return Status.OK.getStatusCode() == response.getStatus();
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ Response response = newTarget(uri).request().post(Entity.json(session));
+ return Status.OK.getStatusCode() == response.getStatus();
}
@Override
public AccountInfoData createAccount(String userName, AccountInput input) {
URI uri = UriBuilder.fromUri(baseUri).path(ACCOUNTS).path(ACCOUNT_USERNAME_TEMPLATE).build(userName);
- try {
- return newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(input), AccountInfoData.class);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ return newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(input), AccountInfoData.class);
}
@Override
public boolean deleteAccount(Long accountId) {
URI uri = UriBuilder.fromUri(baseUri).path(ACCOUNTS).path(ACCOUNT_ID_TEMPLATE).build(accountId);
- try {
- Response response = newTarget(uri).request().delete();
- return Status.OK.getStatusCode() == response.getStatus();
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ Response response = newTarget(uri).request().delete();
+ return Status.OK.getStatusCode() == response.getStatus();
}
@Override
public ResultSet<AccountSessionDetailsData> getAccountSessionDataByUniqueField(String accountId) {
URI uri =
UriBuilder.fromUri(baseUri).path(ACCOUNTS).path(ACCOUNT_ID_TEMPLATE).path(ACCOUNT_SESSSIONS).build(accountId);
- try {
- AccountSessionDetailsData[] data =
- newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(AccountSessionDetailsData[].class);
- return ResultSets.newResultSet(data);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ AccountSessionDetailsData[] data =
+ newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(AccountSessionDetailsData[].class);
+ return ResultSets.newResultSet(data);
}
@Override
public ResultSet<AccountInfoData> getAllAccounts() {
URI uri = UriBuilder.fromUri(baseUri).path(ACCOUNTS).build();
- try {
- AccountInfoData[] accounts =
- newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(AccountInfoData[].class);
- return ResultSets.newResultSet(accounts);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ AccountInfoData[] accounts = newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(AccountInfoData[].class);
+ return ResultSets.newResultSet(accounts);
}
@Override
public AccountDetailsData getAccountDetailsById(Long accountId) {
URI uri = UriBuilder.fromUri(baseUri).path(ACCOUNTS).path(ACCOUNT_ID_TEMPLATE).build(accountId);
- try {
- return newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(AccountDetailsData.class);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ return newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(AccountDetailsData.class);
}
@Override
public AccountPreferencesData getAccountPreferencesById(Long accountId) {
URI uri = UriBuilder.fromUri(baseUri).path(ACCOUNTS).path(ACCOUNT_ID_TEMPLATE).path(ACCOUNT_PREFERENCES).build(
accountId);
- try {
- return newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(AccountPreferencesData.class);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ return newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(AccountPreferencesData.class);
}
@Override
public AccountWebPreferences getAccountWebPreferencesByUniqueField(ArtifactId accountId) {
URI uri = UriBuilder.fromUri(baseUri).path(ACCOUNTS).path(ACCOUNT_PREFERENCES).path(ACCOUNT_ID_TEMPLATE).build(
accountId.getId());
- try {
- return newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(AccountWebPreferences.class);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ return newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(AccountWebPreferences.class);
}
@Override
@@ -204,30 +165,18 @@ public class AccountClientImpl implements AccountClient {
URI uri =
UriBuilder.fromUri(baseUri).path(ACCOUNTS).path(ACCOUNT_ID_TEMPLATE).path(ACCOUNT_ACTIVE).build(accountId);
- try {
- AccountActiveData data = newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(AccountActiveData.class);
- return data.isActive();
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ AccountActiveData data = newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(AccountActiveData.class);
+ return data.isActive();
}
private boolean setAccountActive(URI uri) {
- try {
- Response response = newTarget(uri).request().put(null);
- return Status.OK.getStatusCode() == response.getStatus();
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ Response response = newTarget(uri).request().put(null);
+ return Status.OK.getStatusCode() == response.getStatus();
}
private boolean setAccountInActive(URI uri) {
- try {
- Response response = newTarget(uri).request().delete();
- return Status.OK.getStatusCode() == response.getStatus();
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ Response response = newTarget(uri).request().delete();
+ return Status.OK.getStatusCode() == response.getStatus();
}
@Override
@@ -237,24 +186,15 @@ public class AccountClientImpl implements AccountClient {
AccountPreferencesInput input = new AccountPreferencesInput();
input.setMap(preferences);
- try {
- Response response = newTarget(uri).request().put(Entity.json(input));
- return Status.OK.getStatusCode() == response.getStatus();
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ Response response = newTarget(uri).request().put(Entity.json(input));
+ return Status.OK.getStatusCode() == response.getStatus();
}
private ResultSet<SubscriptionData> getSubscriptionsForAccount(Long accountId) {
URI uri =
UriBuilder.fromUri(baseUri).path("subscriptions").path("for-account").path("{account-id}").build(accountId);
- try {
- SubscriptionData[] data =
- newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(SubscriptionData[].class);
- return ResultSets.newResultSet(data);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ SubscriptionData[] data = newTarget(uri).request(MediaType.APPLICATION_JSON_TYPE).get(SubscriptionData[].class);
+ return ResultSets.newResultSet(data);
}
@Override
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
index c8e9f330df2..1bd93d741c6 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
@@ -45,7 +45,6 @@ import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
import org.eclipse.osee.framework.core.model.cache.BranchFilter;
import org.eclipse.osee.framework.jdk.core.type.HashCollection;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.skynet.core.UserManager;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -123,8 +122,8 @@ public class ArtifactQueryTest {
// Should exist
Set<Artifact> searchedArtifacts = new LinkedHashSet<>();
for (BranchId branch : BranchManager.getBranches(new BranchFilter(BranchType.BASELINE))) {
- List<Artifact> results = ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.SoftwareRequirementMsWord, branch,
- DeletionFlag.INCLUDE_DELETED);
+ List<Artifact> results = ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.SoftwareRequirementMsWord,
+ branch, DeletionFlag.INCLUDE_DELETED);
searchedArtifacts.addAll(results);
}
// make sure at least one artifact exists
@@ -156,17 +155,18 @@ public class ArtifactQueryTest {
try {
ArtifactQuery.getArtifactListFromCriteria(COMMON, 1000, criteria);
Assert.fail("Should have thrown an exception as the attribute type are not taggable");
- } catch (OseeCoreException e) {
- Assert.assertTrue(e.getMessage(), Boolean.TRUE);
+ } catch (Exception ex) {
+ Assert.assertTrue(ex.getMessage(), Boolean.TRUE);
}
try {
ArtifactQuery.getArtifactListFromTypeAndAttribute(CoreArtifactTypes.User, CoreAttributeTypes.FavoriteBranch,
"common", COMMON);
Assert.fail("Should have thrown an exception as the attribute type are not taggable");
- } catch (OseeCoreException e) {
- Assert.assertTrue(e.getMessage(), Boolean.TRUE);
+ } catch (Exception ex) {
+ Assert.assertTrue(ex.getMessage(), Boolean.TRUE);
}
+
// test against a couple attributes types that are taggable; do not expect exception
criteria.clear();
criteria.add(
@@ -174,18 +174,17 @@ public class ArtifactQueryTest {
try {
ArtifactQuery.getArtifactListFromCriteria(COMMON, 1000, criteria);
Assert.assertTrue("This attribute type is taggable", Boolean.TRUE);
- } catch (OseeCoreException e) {
- Assert.fail(e.getMessage());
+ } catch (Exception ex) {
+ Assert.fail(ex.getMessage());
}
try {
ArtifactQuery.getArtifactListFromTypeAndAttribute(CoreArtifactTypes.User, CoreAttributeTypes.Notes, "My Notes",
COMMON);
Assert.assertTrue("This attribute type is taggable", Boolean.TRUE);
- } catch (OseeCoreException e) {
- Assert.fail(e.getMessage());
+ } catch (Exception ex) {
+ Assert.fail(ex.getMessage());
}
-
}
@Test
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AttributeResourceTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AttributeResourceTest.java
index 9d2835dd9e1..153be1fda21 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AttributeResourceTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AttributeResourceTest.java
@@ -31,7 +31,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -63,11 +62,11 @@ public class AttributeResourceTest {
@Test
public void testGetArtifactFromGUIDDeleted() {
- Artifact newArtifact = ArtifactTypeManager.addArtifact(CoreArtifactTypes.SoftwareRequirementMsWord, workingBranch);
- newArtifact.setSoleAttributeFromString(CoreAttributeTypes.WordTemplateContent,
- String.format(
- "<w:p wsp:rsidR=\"006A3C0C\" wsp:rsidRDefault=\"006A3C0C\" wsp:rsidP=\"00E54E52\"><w:r><w:t>%s</w:t></w:r></w:p>",
- testString));
+ Artifact newArtifact =
+ ArtifactTypeManager.addArtifact(CoreArtifactTypes.SoftwareRequirementMsWord, workingBranch);
+ newArtifact.setSoleAttributeFromString(CoreAttributeTypes.WordTemplateContent, String.format(
+ "<w:p wsp:rsidR=\"006A3C0C\" wsp:rsidRDefault=\"006A3C0C\" wsp:rsidP=\"00E54E52\"><w:r><w:t>%s</w:t></w:r></w:p>",
+ testString));
TransactionId txId = newArtifact.persist(getClass().getSimpleName());
List<Integer> attrIds = newArtifact.getAttributeIds(CoreAttributeTypes.WordTemplateContent);
String output = loadAttributeValue(attrIds.get(0), txId, newArtifact);
@@ -86,10 +85,6 @@ public class AttributeResourceTest {
URI uri = UriBuilder.fromUri(appServer).path("orcs").path("branch").path(artifact.getBranch().getIdString()).path(
"artifact").path(artifact.getIdString()).path("attribute").path(String.valueOf(attrId)).path("version").path(
String.valueOf(transactionId)).path("text").build();
- try {
- return JaxRsClient.newClient().target(uri).request(MediaType.TEXT_PLAIN).get(String.class);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ return JaxRsClient.newClient().target(uri).request(MediaType.TEXT_PLAIN).get(String.class);
}
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/IntegerAttributeTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/IntegerAttributeTest.java
index f10d1eaa4fd..bfa5ce781fb 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/IntegerAttributeTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/IntegerAttributeTest.java
@@ -31,7 +31,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -92,10 +91,6 @@ public class IntegerAttributeTest {
URI uri = UriBuilder.fromUri(appServer).path("orcs").path("branch").path(artifact.getBranch().getIdString()).path(
"artifact").path(artifact.getIdString()).path("attribute").path(String.valueOf(attrId)).path("version").path(
String.valueOf(transactionId)).path("text").build();
- try {
- return JaxRsClient.newClient().target(uri).request(MediaType.TEXT_PLAIN).get(String.class);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ return JaxRsClient.newClient().target(uri).request(MediaType.TEXT_PLAIN).get(String.class);
}
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/MappedAttributeDataProvider.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/MappedAttributeDataProvider.java
index d6cf3ed37a5..eaefdde3de5 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/MappedAttributeDataProvider.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/providers/MappedAttributeDataProvider.java
@@ -33,7 +33,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
import org.eclipse.osee.framework.skynet.core.attribute.utils.BinaryContentUtils;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.eclipse.osee.orcs.rest.client.OseeClient;
import org.eclipse.osee.orcs.rest.model.ResourcesEndpoint;
@@ -107,24 +106,18 @@ public class MappedAttributeDataProvider extends AbstractAttributeDataProvider i
boolean compressOnSave = false;
String resourceName = String.format("%s.zip", getAttribute().getArtifact().getGuid());
- try {
- Response response = endpoint.saveResource(new ByteArrayInputStream(compressed),
- BinaryContentUtils.ATTRIBUTE_RESOURCE_PROTOCOL, resourceId, resourceName, overwriteAllowed,
- compressOnSave);
- String location = BinaryContentUtils.getAttributeLocation(response);
- if (location != null) {
- this.remoteUri = location;
- this.localUri = null;
- }
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
+ Response response = endpoint.saveResource(new ByteArrayInputStream(compressed),
+ BinaryContentUtils.ATTRIBUTE_RESOURCE_PROTOCOL, resourceId, resourceName, overwriteAllowed,
+ compressOnSave);
+ String location = BinaryContentUtils.getAttributeLocation(response);
+ if (location != null) {
+ this.remoteUri = location;
+ this.localUri = null;
}
} finally {
Lib.close(inputStream);
}
}
- } catch (OseeCoreException ex) {
- throw ex; // keep exceptions of type OseeCoreException from being unnecessarily wrapped
} catch (Exception ex) {
OseeCoreException.wrapAndThrow(ex);
}
@@ -137,16 +130,12 @@ public class MappedAttributeDataProvider extends AbstractAttributeDataProvider i
String path = BinaryContentUtils.asResourcePath(remoteUri);
ResourcesEndpoint endpoint = getResourcesEndpoint();
- try {
- Response response = endpoint.deleteResource(path);
- if (Status.OK.getStatusCode() == response.getStatus()) {
- remoteUri = null;
- if (isBackingFileValid()) {
- backingFile.delete(true, null);
- }
+ Response response = endpoint.deleteResource(path);
+ if (Status.OK.getStatusCode() == response.getStatus()) {
+ remoteUri = null;
+ if (isBackingFileValid()) {
+ backingFile.delete(true, null);
}
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
}
}
} catch (Exception ex) {
@@ -202,7 +191,7 @@ public class MappedAttributeDataProvider extends AbstractAttributeDataProvider i
ZipEntry entry = zipInputStream.getNextEntry();
file = OseeData.getIFile(entry.getName(), zipInputStream, true);
} catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
+ throw OseeCoreException.wrap(ex);
} finally {
Lib.close(inputStream);
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/utils/AttributeResourceProcessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/utils/AttributeResourceProcessor.java
index e5ab3b67ab3..b56ed6135f3 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/utils/AttributeResourceProcessor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/utils/AttributeResourceProcessor.java
@@ -19,12 +19,12 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.eclipse.osee.framework.core.data.GammaId;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
import org.eclipse.osee.framework.skynet.core.attribute.providers.DataStore;
import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.eclipse.osee.orcs.rest.client.OseeClient;
import org.eclipse.osee.orcs.rest.model.ResourcesEndpoint;
@@ -74,8 +74,6 @@ public class AttributeResourceProcessor {
resourceId, resourceName, overwriteAllowed, compressOnSave);
String location = BinaryContentUtils.getAttributeLocation(response);
dataStore.setLocator(location);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
} finally {
Lib.close(inputStream);
}
@@ -121,21 +119,16 @@ public class AttributeResourceProcessor {
}
}
} catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
+ throw OseeCoreException.wrap(ex);
}
}
public void purge(DataStore dataStore) {
ResourcesEndpoint endpoint = getResourcesEndpoint();
String path = BinaryContentUtils.asResourcePath(dataStore.getLocator());
- try {
- Response response = endpoint.deleteResource(path);
- if (Status.OK.getStatusCode() == response.getStatus()) {
- dataStore.clear();
- }
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
+ Response response = endpoint.deleteResource(path);
+ if (Status.OK.getStatusCode() == response.getStatus()) {
+ dataStore.clear();
}
}
-
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/PurgeBranchHttpRequestOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/PurgeBranchHttpRequestOperation.java
index 10f9bba6c77..e940845e9d3 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/PurgeBranchHttpRequestOperation.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/PurgeBranchHttpRequestOperation.java
@@ -27,7 +27,6 @@ import org.eclipse.osee.framework.skynet.core.event.model.BranchEvent;
import org.eclipse.osee.framework.skynet.core.event.model.BranchEventType;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.eclipse.osee.orcs.rest.client.OseeClient;
import org.eclipse.osee.orcs.rest.model.BranchEndpoint;
@@ -71,7 +70,7 @@ public final class PurgeBranchHttpRequestOperation extends AbstractOperation {
branch.setArchived(archived);
OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.StateUpdated, branch));
}
- } catch (Exception ex) {
+ } catch (RuntimeException ex) {
try {
branch.setBranchState(currentState);
branch.setArchived(archived);
@@ -79,7 +78,7 @@ public final class PurgeBranchHttpRequestOperation extends AbstractOperation {
} catch (Exception ex2) {
log(ex2);
}
- throw JaxRsExceptions.asOseeException(ex);
+ throw ex;
}
}
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeTypesExportOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeTypesExportOperation.java
index 6ce6aea57c9..9c5cbd2925a 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeTypesExportOperation.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/OseeTypesExportOperation.java
@@ -19,9 +19,9 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.eclipse.osee.orcs.rest.model.TypesEndpoint;
/**
@@ -52,7 +52,7 @@ public class OseeTypesExportOperation extends AbstractOperation {
}
}
} catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
+ throw OseeCoreException.wrap(ex);
}
}
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/AttributeTaggingOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/AttributeTaggingOperation.java
index 998081bfc69..2d1e2f025b5 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/AttributeTaggingOperation.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/AttributeTaggingOperation.java
@@ -18,7 +18,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.eclipse.osee.orcs.rest.client.OseeClient;
import org.eclipse.osee.orcs.rest.model.IndexResources;
import org.eclipse.osee.orcs.rest.model.IndexerEndpoint;
@@ -42,10 +41,6 @@ public class AttributeTaggingOperation extends AbstractOperation {
IndexResources data = new IndexResources();
data.setWaitForIndexerToComplete(true);
data.setGammaIds(Lists.newArrayList(gammaIds));
- try {
- endpoint.indexResources(data);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ endpoint.indexResources(data);
}
-}
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperation.java
index 99f1ffa4584..4ec8036da20 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperation.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/PurgeTransactionOperation.java
@@ -27,7 +27,6 @@ import org.eclipse.osee.framework.jdk.core.util.Collections;
import org.eclipse.osee.framework.skynet.core.event.model.TransactionEvent;
import org.eclipse.osee.framework.skynet.core.internal.Activator;
import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.eclipse.osee.orcs.rest.client.OseeClient;
import org.eclipse.osee.orcs.rest.model.TransactionEndpoint;
@@ -68,15 +67,11 @@ public class PurgeTransactionOperation extends AbstractOperation {
TransactionEndpoint txEndpoint = client.getTransactionEndpoint();
String deleteTxs = Collections.toString(",", txIdsToDelete);
- try {
- Response result = txEndpoint.purgeTxs(deleteTxs);
- if (Status.OK.getStatusCode() == result.getStatus()) {
- for (PurgeTransactionListener listener : listeners) {
- listener.onPurgeTransactionSuccess(txIdsToDelete, transEventAndIds);
- }
+ Response result = txEndpoint.purgeTxs(deleteTxs);
+ if (Status.OK.getStatusCode() == result.getStatus()) {
+ for (PurgeTransactionListener listener : listeners) {
+ listener.onPurgeTransactionSuccess(txIdsToDelete, transEventAndIds);
}
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
}
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java
index af8ea1d50b5..d901d68f75c 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java
@@ -41,7 +41,6 @@ import org.eclipse.osee.framework.ui.skynet.compare.CompareHandler;
import org.eclipse.osee.framework.ui.skynet.compare.CompareItem;
import org.eclipse.osee.framework.ui.swt.ImageManager;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.eclipse.osee.jdbc.JdbcStatement;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
@@ -146,12 +145,7 @@ public class WasIsCompareEditorAction extends Action {
URI uri = UriBuilder.fromUri(appServer).path("orcs").path("branch").path(artifact.getBranch().getIdString()).path(
"artifact").path(artifact.getIdString()).path("attribute").path(String.valueOf(attrId)).path("version").path(
String.valueOf(transactionId)).path("text").build();
- try {
- return JaxRsClient.newClient().target(uri).request(MediaType.TEXT_PLAIN).get(String.class);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
-
+ return JaxRsClient.newClient().target(uri).request(MediaType.TEXT_PLAIN).get(String.class);
}
protected static ISelectionProvider getSelectionProvider() {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java
index 5e6dcfc3b3e..aeedc6fdd1d 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java
@@ -28,7 +28,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
import org.eclipse.osee.framework.skynet.core.change.Change;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.osee.framework.ui.skynet.internal.ServiceUtil;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.eclipse.osee.orcs.rest.client.OseeClient;
import org.eclipse.osee.orcs.rest.model.TransactionEndpoint;
@@ -63,17 +62,13 @@ public class ReplaceArtifactWithBaselineOperation extends AbstractOperation {
monitor.worked(1);
Artifact sourceArtifact =
ArtifactQuery.getHistoricalArtifactOrNull(artifact, txRecord, DeletionFlag.INCLUDE_DELETED);
- try {
- if (sourceArtifact != null) {
- UserId userId = UserManager.getUser();
- TransactionEndpoint.replaceWithBaselineTxVersion(userId, branch, txRecord, sourceArtifact,
- ReplaceArtifactWithBaselineOperation.class.getSimpleName());
- monitor.done();
- } else {
- artifact.deleteAndPersist(getClass().getSimpleName());
- }
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
+ if (sourceArtifact != null) {
+ UserId userId = UserManager.getUser();
+ TransactionEndpoint.replaceWithBaselineTxVersion(userId, branch, txRecord, sourceArtifact,
+ ReplaceArtifactWithBaselineOperation.class.getSimpleName());
+ monitor.done();
+ } else {
+ artifact.deleteAndPersist(getClass().getSimpleName());
}
}
persistAndReloadArtifacts();
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionUtility.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionUtility.java
index 663c3bfc98b..f3ff1239d23 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionUtility.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/util/DbConnectionUtility.java
@@ -23,7 +23,6 @@ import org.eclipse.osee.framework.server.ide.api.client.ClientEndpoint;
import org.eclipse.osee.framework.server.ide.api.model.IdeVersion;
import org.eclipse.osee.framework.ui.plugin.OseeUiActivator;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
/**
* @author Donald G Dunne
@@ -116,11 +115,7 @@ public class DbConnectionUtility {
IdeVersion clientResult = null;
ClientEndpoint client = getClientEndpoint();
if (client != null) {
- try {
- clientResult = client.getSupportedVersions();
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ clientResult = client.getSupportedVersions();
}
return clientResult != null ? clientResult.getVersions() : Collections.<String> emptySet();
}
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsExceptions.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsExceptions.java
index aa17a19c4fd..69cd15a4788 100644
--- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsExceptions.java
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsExceptions.java
@@ -16,8 +16,6 @@ package org.eclipse.osee.jaxrs.client;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.client.ResponseProcessingException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
@@ -40,59 +38,6 @@ public final class JaxRsExceptions {
return Boolean.valueOf(header);
}
- public static OseeCoreException asOseeException(Throwable th) {
- OseeCoreException toReturn;
- if (th instanceof ResponseProcessingException) {
- toReturn = asOseeException((ResponseProcessingException) th);
- } else if (th instanceof WebApplicationException) {
- toReturn = asOseeException((WebApplicationException) th);
- } else if (th instanceof OseeCoreException) {
- toReturn = (OseeCoreException) th;
- } else {
- toReturn = new OseeCoreException(th.getCause(), th.getLocalizedMessage());
- }
- return toReturn;
- }
-
- private static OseeCoreException asOseeException(ResponseProcessingException ex) {
- Response response = ex.getResponse();
- OseeCoreException toReturn;
- if (response.hasEntity()) {
- toReturn = asOseeException(response);
- } else {
- Throwable cause = ex.getCause();
- String message = buildExceptionMessage(response.getStatus(), cause, ex.getMessage());
- toReturn = new OseeCoreException(cause, message);
- }
- return toReturn;
- }
-
- private static OseeCoreException asOseeException(WebApplicationException ex) {
- Response response = ex.getResponse();
- OseeCoreException toReturn;
- if (response.hasEntity()) {
- toReturn = asOseeException(response);
- } else {
- Throwable cause = ex.getCause();
- String message = buildExceptionMessage(response.getStatus(), cause, ex.getMessage());
- toReturn = new OseeCoreException(cause, message);
- }
- return toReturn;
- }
-
- private static String buildExceptionMessage(int statusCode, Throwable cause, String exMessage) {
- StringBuilder sb = new StringBuilder();
- sb.append("JAX-RS Client Exception caught - ").append(statusCode);
- String message = cause == null ? exMessage : cause.getMessage();
- if (message == null && cause != null) {
- message = "exception cause class: " + cause.getClass().getName();
- }
- if (message != null) {
- sb.append(", message: ").append(message);
- }
- return sb.toString();
- }
-
public static OseeCoreException asOseeException(Response response) {
String message = "";
String httpStatus = "";
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/OAuth2Transport.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/OAuth2Transport.java
index 11f28aebc27..fc6c43fafd1 100644
--- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/OAuth2Transport.java
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/OAuth2Transport.java
@@ -32,7 +32,6 @@ import org.apache.cxf.rs.security.oauth2.grants.refresh.RefreshTokenGrant;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
import org.eclipse.osee.jaxrs.client.JaxRsClient.JaxRsClientBuilder;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.eclipse.osee.jaxrs.client.JaxRsWebTarget;
import org.eclipse.osee.jaxrs.client.internal.ext.OAuth2Flows.OwnerCredentials;
@@ -68,12 +67,8 @@ public class OAuth2Transport {
}
public Response sendAccessConfirmation(OwnerCredentials owner, String sessionCookie, String confirmUri, Form form) {
- try {
- return newTargetBuilder(owner, confirmUri, sessionCookie).accept(MediaType.APPLICATION_JSON_TYPE).post(
- Entity.form(form));
- } catch (WebApplicationException ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ return newTargetBuilder(owner, confirmUri, sessionCookie).accept(MediaType.APPLICATION_JSON_TYPE).post(
+ Entity.form(form));
}
public AccessTokenValidation sendTokenValidationRequest(OwnerCredentials owner, Consumer client, String sessionCookie, String tokenValidationUri, Form form) {
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
index ca1f8e2a15e..f61959a51db 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
@@ -30,7 +30,6 @@ import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.server.ide.api.client.ClientEndpoint;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.eclipse.osee.jaxrs.client.JaxRsWebTarget;
import org.eclipse.osee.orcs.rest.client.OseeClient;
import org.eclipse.osee.orcs.rest.client.QueryBuilder;
@@ -129,11 +128,7 @@ public class OseeClientImpl implements OseeClient, QueryExecutor {
SearchRequest params = new SearchRequest(branch, predicates, requestType, fromTx, includeDeleted);
JaxRsWebTarget resource = client.target(searchUriBuilder.build(branch.getIdString()));
- try {
- return resource.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(params), SearchResponse.class);
- } catch (Exception ex) {
- throw JaxRsExceptions.asOseeException(ex);
- }
+ return resource.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(params), SearchResponse.class);
}
@Override

Back to the top