Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-10-04 18:32:56 +0000
committerDonald Dunne2016-10-04 20:00:25 +0000
commit0357dc0151a4c7e13bb41405324d959fc3457cd2 (patch)
tree9deae626d5d66f6f074b839f43e69b7e8d961e9b /plugins
parentb40430058c62856bcd4645aeb17d3135e1efb4f1 (diff)
downloadorg.eclipse.osee-0357dc0151a4c7e13bb41405324d959fc3457cd2.tar.gz
org.eclipse.osee-0357dc0151a4c7e13bb41405324d959fc3457cd2.tar.xz
org.eclipse.osee-0357dc0151a4c7e13bb41405324d959fc3457cd2.zip
bug[ats_ATS317938]: ArtifactEditorInput gives NullPointerException
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorInput.java20
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorInputFactory.java16
2 files changed, 24 insertions, 12 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorInput.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorInput.java
index 87cd9b133fa..4822a280ceb 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorInput.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorInput.java
@@ -30,6 +30,7 @@ public class ArtifactEditorInput implements IEditorInput, IPersistableElement {
private Long savedBranchUuid;
private Long savedArtUuid;
private String savedTitle;
+ private boolean attemptedReload = false;
public ArtifactEditorInput(Artifact artifact) {
this.artifact = artifact;
@@ -87,7 +88,7 @@ public class ArtifactEditorInput implements IEditorInput, IPersistableElement {
if (type.isAssignableFrom(getClass())) {
return (T) getArtifact();
} else if (type.isAssignableFrom(Artifact.class)) {
- return (T) artifact;
+ return (T) getArtifact();
}
}
Object obj = null;
@@ -96,11 +97,11 @@ public class ArtifactEditorInput implements IEditorInput, IPersistableElement {
}
public Artifact getArtifact() {
- return artifact;
+ return loadArtifact();
}
public boolean isReadOnly() {
- return artifact == null || artifact.isReadOnly();
+ return getArtifact() == null || getArtifact().isReadOnly();
}
public void setArtifact(Artifact art) {
@@ -118,9 +119,16 @@ public class ArtifactEditorInput implements IEditorInput, IPersistableElement {
}
public Artifact loadArtifact() {
- if (artifact == null) {
- artifact =
- ArtifactQuery.getArtifactFromId(savedArtUuid.intValue(), TokenFactory.createBranch(savedBranchUuid));
+ if (artifact == null && !attemptedReload) {
+ if (savedArtUuid != null && savedBranchUuid != null) {
+ try {
+ artifact =
+ ArtifactQuery.getArtifactFromId(savedArtUuid.intValue(), TokenFactory.createBranch(savedBranchUuid));
+ } catch (Exception ex) {
+ // do nothing
+ }
+ }
+ attemptedReload = true;
}
return artifact;
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorInputFactory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorInputFactory.java
index 520b828f308..1ffe352de57 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorInputFactory.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/artifact/editor/ArtifactEditorInputFactory.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.framework.ui.skynet.artifact.editor;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.ui.IElementFactory;
import org.eclipse.ui.IMemento;
@@ -47,12 +48,15 @@ public class ArtifactEditorInputFactory implements IElementFactory {
public static void saveState(IMemento memento, ArtifactEditorInput input) {
String title = input.getName();
- String artUuid = input.getArtifact().getUuid().toString();
- long branchUuid = input.getArtifact().getBranchId();
- if (Strings.isValid(artUuid) && branchUuid > 0 && Strings.isValid(title)) {
- memento.putString(BRANCH_KEY, String.valueOf(branchUuid));
- memento.putString(ART_UUID, artUuid);
- memento.putString(TITLE, title);
+ Artifact artifact = input.getArtifact();
+ if (artifact != null) {
+ String artUuid = artifact.getUuid().toString();
+ long branchUuid = artifact.getBranchId();
+ if (Strings.isValid(artUuid) && branchUuid > 0 && Strings.isValid(title)) {
+ memento.putString(BRANCH_KEY, String.valueOf(branchUuid));
+ memento.putString(ART_UUID, artUuid);
+ memento.putString(TITLE, title);
+ }
}
}

Back to the top