[
https://jira.duraspace.org/browse/DS-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21158#action_21158
]
Mark Diggory commented on DS-815:
---------------------------------
I think its important to reflect that all these classes that attempt to enforce
the values they are instantiated with are valid. I think maybe it'd be better
if we actually had something like a DCFormatException and were able to deal
with it being thrown when attempting to instantiate the DCDate off the value. I
think exceptions should happen as early as possible, and value parsing should
happen as early as possible, in the setter/constructor not in the getter. In
the case where the value is coming out of the database and validation fails,
the UI could detect the failure and create a warning to the user that the
format was incorrect and should be corrected. Likewise, during Submission, it
would be possible to start to enforce field value validation by the exceptions.
Though, In looking at DCDate, DCName, etc. I'm wondering why these are
actually not actually backing the "Value" object (string) in the
DCValue/MetadataValue object instead of making the DSpace Apps responsible for
wrapping the values for use in the UI/OAI/etc. It seems that we could make a
better case for Value Format Control across the whole system. And likewise,
consolidate the validation enforcement into the Domain Model rather than being
in the application layer. Properly implemented, the DSpace MetadataValue would
enforce the values set were valid and generate exceptions if it was not, then
each application layer would not need to replicate this logic. Thus it would be
consistent across all applications and be one codebase. IMO, now thats an
appropriate application of DRY because of the big win it will provide for all
apps.
> DCDate throws NullPointerException with mangled dates
> -----------------------------------------------------
>
> Key: DS-815
> URL: https://jira.duraspace.org/browse/DS-815
> Project: DSpace
> Issue Type: Bug
> Components: DSpace API
> Affects Versions: 1.7.0
> Environment: CentOS 5.4 with OpenJDK 64-Bit Server VM (build
> 1.6.0-b09, mixed mode)
> Reporter: Àlex Magaz Graça
> Assignee: Mark H. Wood
> Attachments: DCDate_test_mangled_date.patch
>
>
> DCDate.get*() methods throw a NullPointerException if the object has been
> constructed with a wrong date like "[17--?]" (DCDateTest patch attached):
> java.lang.NullPointerException
> at org.dspace.content.DCDate.getYear(DCDate.java:298)
> at org.dspace.content.DCDateTest.testDCDateString(DCDateTest.java:301)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at java.lang.reflect.Method.invoke(Method.java:616)
> at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
> at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at java.lang.reflect.Method.invoke(Method.java:616)
> at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
> at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
> It makes the browse by issue date fail in JSPUI.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.duraspace.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide. Store less, Store more with what you own, Move data to
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel