Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan E. Cook2017-08-28 11:24:03 -0400
committerMegumi Telles2017-08-29 09:38:59 -0400
commit428effd20ed3ba07428ebd62b0b832c9d2ae1eb6 (patch)
treef841f67dda74501c3bf00a35bbaf9462a4152678
parentc971ebbb17d58f28360b716188a69319393860bf (diff)
downloadorg.eclipse.osee-428effd20ed3ba07428ebd62b0b832c9d2ae1eb6.tar.gz
org.eclipse.osee-428effd20ed3ba07428ebd62b0b832c9d2ae1eb6.tar.xz
org.eclipse.osee-428effd20ed3ba07428ebd62b0b832c9d2ae1eb6.zip
bug: Fix Cast Exception in DateAttribute
Signed-off-by: Morgan E. Cook <morgan.e.cook@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/DateAttribute.java23
1 files changed, 10 insertions, 13 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/DateAttribute.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/DateAttribute.java
index e46bc9c340..c15feda1af 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/DateAttribute.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/DateAttribute.java
@@ -13,8 +13,10 @@ package org.eclipse.osee.framework.skynet.core.attribute;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.logging.Level;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
/**
* @author Robert A. Fisher
@@ -27,11 +29,6 @@ public class DateAttribute extends CharacterBackedAttribute<Date> {
public final DateFormat MMDDYYYYHHMMSSAMPM = new SimpleDateFormat("MMM dd,yyyy hh:mm:ss a");
public final DateFormat ALLDATETIME = new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy");
- /**
- * Return current date or null if not set
- *
- * @return date or null if not set
- */
@Override
public Date getValue() throws OseeCoreException {
Object value = getAttributeDataProvider().getValue();
@@ -48,14 +45,15 @@ public class DateAttribute extends CharacterBackedAttribute<Date> {
}
}
- /**
- * Sets date
- *
- * @param value value or null to clear
- */
@Override
public boolean subClassSetValue(Date value) throws OseeCoreException {
- return getAttributeDataProvider().setValue(value != null ? value.getTime() : "");
+ if (value == null) {
+ OseeLog.log(this.getClass(), Level.SEVERE,
+ String.format("AttributeType [%s] GammId [%s] - DateAttribute.subClassSetValue had a null value",
+ getAttributeType(), getGammaId()));
+ return false;
+ }
+ return getAttributeDataProvider().setValue(value.getTime());
}
@Override
@@ -78,8 +76,7 @@ public class DateAttribute extends CharacterBackedAttribute<Date> {
* @return formated date
*/
public String getAsFormattedString(DateFormat dateFormat) throws OseeCoreException {
- Date date = getValue();
- return date != null ? dateFormat.format(date) : "";
+ return dateFormat.format(getValue());
}
} \ No newline at end of file

Back to the top