Commit 7b5291fbde4e4bbe724f4678a15722fe4bf3db78

Authored by Fernando Ribeiro
Exists in DSpace52++

Merge branch 'Tid_fix' into 'DSpace52++'

Fixed dc.date.issue Null Pointer Exception

See merge request !18
dspace-api/src/main/java/pt/uminho/sdum/dspace/curationtasks/Tid.java
... ... @@ -18,7 +18,7 @@ public class Tid extends Distributor {
18 18 private static final int YMD = 1;
19 19 private static final int YM = 2;
20 20 private static final int Y = 3;
21   -
  21 + private static final DateValidator dv = new DateValidator("2013-08-07", "2013-07", "2012");
22 22 // Check if THESIS deposited after 2013 has TID
23 23 @Override
24 24 protected String processItem(Item item) throws SQLException {
... ... @@ -31,10 +31,9 @@ public class Tid extends Distributor {
31 31 String tid = item.getMetadata("dc.identifier.tid");
32 32 String sDate = item.getMetadata("dc.date.issued");
33 33  
34   - DateValidator dv = new DateValidator("2013-08-07", "2013-07", "2012");
35 34  
36 35 if (type != null && (type.equals("masterThesis") || type.equals("doctoralThesis"))) {
37   - if (dv.verifyAfter(sDate) && (tid == null || tid.isEmpty())) {
  36 + if (sDate != null && dv.verifyAfter(sDate) && (tid == null || tid.isEmpty())) {
38 37 if (item.isArchived() && !item.isWithdrawn()) {
39 38 res.append("<a href=\"http://hdl.handle.net/");
40 39 res.append(handle);
... ...
dspace-jspui/src/main/java/org/dspace/app/webui/jsptag/ItemTag.java
... ... @@ -473,7 +473,8 @@ public class ItemTag extends TagSupport
473 473 String label = null;
474 474 try
475 475 {
476   - if(field.equals("dc.date.issued") && item.getMetadata("dc.type").endsWith("Thesis"))
  476 + String dctype = item.getMetadata("dc.type");
  477 + if(field.equals("dc.date.issued") && dctype != null && dctype.endsWith("Thesis"))
477 478 label = I18nUtil.getMessage("metadata."
478 479 + ("default".equals(this.style) ? "" : this.style + ".") + field + "_thesis",
479 480 context);
... ... @@ -486,7 +487,8 @@ public class ItemTag extends TagSupport
486 487 {
487 488 // if there is not a specific translation for the style we
488 489 // use the default one
489   - if(field.equals("dc.date.issued") && item.getMetadata("dc.type").endsWith("Thesis"))
  490 + String dctype = item.getMetadata("dc.type");
  491 + if(field.equals("dc.date.issued") && dctype != null && dctype.endsWith("Thesis"))
490 492 label = LocaleSupport.getLocalizedMessage(pageContext,
491 493 "metadata." + field + "_thesis");
492 494 else
... ...