diff options
author | Branden Phillips | 2020-06-25 18:00:35 +0000 |
---|---|---|
committer | Branden Phillips | 2020-06-25 21:50:02 +0000 |
commit | c6121504e7aa8998de20236f5d74a41689e8326c (patch) | |
tree | 3f094d0a9db235d25b6c887120533a4e59d559d3 | |
parent | 0b280985b4a4425b131c6238c569e745461e462c (diff) | |
download | org.eclipse.osee-c6121504e7aa8998de20236f5d74a41689e8326c.tar.gz org.eclipse.osee-c6121504e7aa8998de20236f5d74a41689e8326c.tar.xz org.eclipse.osee-c6121504e7aa8998de20236f5d74a41689e8326c.zip |
feature[TW17492]: Catch query error on guids in server publishing
Change-Id: I8bfd3cb8a767c90fa23cc11c3ed576a7e33da2fa
Signed-off-by: Branden Phillips <branden.w.phillips@boeing.com>
-rw-r--r-- | plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/publishing/MSWordTemplatePublisher.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/publishing/MSWordTemplatePublisher.java b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/publishing/MSWordTemplatePublisher.java index 766d82c5c23..c31bd08a4b9 100644 --- a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/publishing/MSWordTemplatePublisher.java +++ b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/publishing/MSWordTemplatePublisher.java @@ -840,7 +840,8 @@ public class MSWordTemplatePublisher { String id = ""; if (!unknownIds.isEmpty()) { - String description = "Contains the following unknown GUIDs: " + unknownIds; + String description = String.format( + "Artifact contains the following unknown GUIDs: %s (Delete or fix OSEE Link from Artifact)", unknownIds); errorLog.add( new PublishingArtifactError(artifact.getId(), artifact.getName(), artifact.getArtifactType(), description)); } @@ -869,13 +870,19 @@ public class MSWordTemplatePublisher { protected void addLinkNotInPublishErrors(WordMLWriter wordMl) { if (!hyperlinkedIds.isEmpty()) { for (Map.Entry<String, ArtifactReadable> link : hyperlinkedIds.entrySet()) { + String description; ArtifactReadable artWithLink = link.getValue(); String idString = link.getKey(); - ArtifactReadable linkedArt = - orcsApi.getQueryFactory().fromBranch(publishingOptions.branch).andGuid(idString).getArtifact(); - String description = String.format( - "Artifact is linking to the following Artifact Id that is not contained in this document: %s (Guid: %s)", - linkedArt.getId(), idString); + try { + ArtifactReadable linkedArt = + orcsApi.getQueryFactory().fromBranch(publishingOptions.branch).andGuid(idString).getArtifact(); + description = String.format( + "Artifact is linking to the following Artifact Id that is not contained in this document: %s (Guid: %s)", + linkedArt.getId(), idString); + } catch (Exception ex) { + description = String.format( + "Artifact contains the following unknown GUID: %s (Delete or fix OSEE Link from Artifact)", idString); + } errorLog.add(new PublishingArtifactError(artWithLink.getId(), artWithLink.getName(), artWithLink.getArtifactType(), description)); } |