diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/datavalidationv2/results/ValidationResultBuilder.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/datavalidationv2/results/ValidationResultBuilder.java index 7ab77aef07..8e858ad449 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/datavalidationv2/results/ValidationResultBuilder.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/datavalidationv2/results/ValidationResultBuilder.java @@ -29,6 +29,8 @@ import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.ws.rs.core.UriInfo; + +import java.util.TimeZone; import java.util.stream.Collectors; import java.text.SimpleDateFormat; import org.json.JSONObject; @@ -70,7 +72,9 @@ public ValidationResultDTO build(UriInfo uriInfo, Project project, metaJson.put("ingestionResult", validationResult.getIngestionResult()); // Same validation string as in validationController to parse time provided by GE String formatDateString = "yyyy-MM-dd'T'hh:mm:ss.SSSSSSX"; - String validationTime = new SimpleDateFormat(formatDateString).format(validationResult.getValidationTime()); + SimpleDateFormat isoFormat = new SimpleDateFormat(formatDateString); + isoFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + String validationTime = isoFormat.format(validationResult.getValidationTime()); metaJson.put("validationTime", validationTime); dto.setMeta(metaJson.toString()); dto.setValidationTime(validationTime); diff --git a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/datavalidationv2/reports/ValidationReportController.java b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/datavalidationv2/reports/ValidationReportController.java index 9f92e2ad6b..0ec57ec94e 100644 --- a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/datavalidationv2/reports/ValidationReportController.java +++ b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/datavalidationv2/reports/ValidationReportController.java @@ -68,6 +68,7 @@ import java.util.List; import java.util.Optional; import java.util.Set; +import java.util.TimeZone; import java.util.logging.Level; import java.util.logging.Logger; @@ -263,7 +264,9 @@ public ValidationReport convertReportDTOToPersistent(Users user, Featuregroup fe JSONObject reportMeta = new JSONObject(reportDTO.getMeta()); String validationTimeString = reportMeta.getString("validation_time"); String formatDateString = "yyyyMMdd'T'HHmmss.SSS"; - validationTime = new SimpleDateFormat(formatDateString).parse( + SimpleDateFormat isoFormat = new SimpleDateFormat(formatDateString); + isoFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + validationTime = isoFormat.parse( validationTimeString.substring(0, validationTimeString.length() - 4)); } catch (JSONException | ParseException exception) { validationTime = new Date(); @@ -311,6 +314,7 @@ private Inode registerValidationReportToDisk(Users user, Featuregroup featuregro udfso.mkdir(reportDirPath.toString()); } SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HHmmss"); + formatter.setTimeZone(TimeZone.getTimeZone("UTC")); String fileName = String.format("validation_report_%s.json", formatter.format(validationTime)); Path reportPath = new Path(reportDirPath, fileName); if (udfso.exists(reportPath)) { @@ -318,9 +322,8 @@ private Inode registerValidationReportToDisk(Users user, Featuregroup featuregro Level.SEVERE, String.format("Validation report with file name %s already exists.", fileName)); } udfso.create(reportPath, reportJSON.toString()); - Inode inode = inodeController.getInodeAtPath(reportPath.toString()); - - return inode; + + return inodeController.getInodeAtPath(reportPath.toString()); } catch (DatasetException | HopsSecurityException | IOException e) { throw new FeaturestoreException(RESTCodes.FeaturestoreErrorCode.ERROR_SAVING_ON_DISK_VALIDATION_REPORT, Level.WARNING, e.getMessage());