diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java index fe87f43..5ccc559 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java @@ -204,18 +204,22 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen PublicationReport report = manager.commitSafely(publish); LOG.info("PublicationReport: " + report); Record registered = report.getTheRecord(); - - if(registered==null) - throw new Exception(report.prettyPrint()); // String link = "toTest"; CommitReport cRep = new CommitReport(); - cRep.setRecordId(registered.getId()); + + if(registered!=null) + cRep.setRecordId(registered.getId()); + cRep.setReport(report.prettyPrint()); switch (report.getStatus()) { case PASSED: cRep.setState(STATE.OK); + if(cRep.getRecordId()==null) { + LOG.error("The record id is null!!!"); + throw new Exception("Invalid record id"); + } break; case WARNING: cRep.setState(STATE.WARN); @@ -235,7 +239,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen } catch (Exception e) { LOG.error("Error on commiting data: ", e); throw new Exception( - "Error occurred on saving data, try again or contact the support. Error: " + e.getMessage()); + "Error occurred on saving data. Error: " + e.getMessage()); } finally { // if(manager!=null) { // try { diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java index 38ecc7d..9e0b07c 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java @@ -29,7 +29,7 @@ public class CommitReport implements Serializable { } public STATE state = STATE.UNKNOWN; - public long recordId; + public Long recordId; public String msg; public String report; @@ -79,7 +79,7 @@ public class CommitReport implements Serializable { * * @return the record id */ - public long getRecordId() { + public Long getRecordId() { return recordId; }