diff options
author | donald.g.dunne | 2017-04-26 21:41:45 +0000 |
---|---|---|
committer | Donald Dunne | 2017-04-26 23:28:53 +0000 |
commit | e05fc088946efa1c4b8ecabcbb702434fe9bf91e (patch) | |
tree | a263904937405288752075de0f10126b9b92a87f | |
parent | 9d9288055ff758fb72c8e405b5501c61734cb3d8 (diff) | |
download | org.eclipse.osee-e05fc088946efa1c4b8ecabcbb702434fe9bf91e.tar.gz org.eclipse.osee-e05fc088946efa1c4b8ecabcbb702434fe9bf91e.tar.xz org.eclipse.osee-e05fc088946efa1c4b8ecabcbb702434fe9bf91e.zip |
bug[ats_ATS371114]: Duplicate Active attributes loaded for User0.25.0.v201704270110-NR
- Add better error logging to better determine what is happening
Change-Id: Iac92c3f6ae28791a42aa991471218bd8483fd480
-rw-r--r-- | plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java index 8b7738d4f91..ee56a45b37a 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java @@ -639,19 +639,35 @@ public class Artifact extends FullyNamedIdentity<String> implements IArtifact, A List<Attribute<T>> soleAttributes = getAttributes(attributeType); if (soleAttributes.isEmpty()) { if (!isAttributeTypeValid(attributeType)) { - throw new OseeArgumentException("The attribute type %s is not valid for artifacts of type [%s]", - attributeType, getArtifactTypeName()); + throw new OseeArgumentException( + "The attribute type %s is not valid for artifacts of type [%s] on artifact [%s] on branch [%s]", + attributeType, getArtifactTypeName(), toStringWithId(), getBranch()); } throw new AttributeDoesNotExist("Attribute of type [%s] could not be found on artifact [%s] on branch [%s]", - attributeType, this, getBranch()); + attributeType, toStringWithId(), getBranch()); } else if (soleAttributes.size() > 1) { - throw new MultipleAttributesExist( - "Attribute [%s] must have exactly one instance. It currently has %d for artifact [%s]", attributeType, - soleAttributes.size(), getGuid()); + String errMsg = String.format( + "Attribute [%s] must have exactly one instance. It currently has %d for artifact %s; Attributes [%s]", + attributeType, soleAttributes.size(), toStringWithId(), getAttributeString(soleAttributes)); + throw new MultipleAttributesExist(errMsg); } return soleAttributes.iterator().next().getValue(); } + private <T> String getAttributeString(List<Attribute<T>> attributes) { + StringBuilder sb = new StringBuilder(); + for (Attribute<T> attr : attributes) { + sb.append("attribute id=["); + sb.append(attr.getId()); + sb.append("] gamma=["); + sb.append(attr.getGammaId()); + sb.append("] "); + } + String result = sb.toString(); + System.err.println(result); + return result; + } + /** * Return sole attribute string value for given attribute type name. Handles AttributeDoesNotExist case by returning * defaultReturnValue.<br> |