MikeThomsen commented on a change in pull request #3481: NIFI-6305: RecordPath 
Standalone Functions: format() and toDate() allow time zone argument
URL: https://github.com/apache/nifi/pull/3481#discussion_r285401395
 
 

 ##########
 File path: 
nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/functions/Format.java
 ##########
 @@ -57,14 +66,22 @@ public Format(final RecordPathSegment recordPath, final 
RecordPathSegment dateFo
                 });
     }
 
-    private java.text.DateFormat getDateFormat(final RecordPathSegment 
dateFormatSegment, final RecordPathEvaluationContext context) {
+    private java.text.DateFormat getDateFormat(final RecordPathSegment 
dateFormatSegment, final RecordPathSegment timeZoneID, final 
RecordPathEvaluationContext context) {
         final String dateFormatString = 
RecordPathUtils.getFirstStringValue(dateFormatSegment, context);
         if (dateFormatString == null || dateFormatString.isEmpty()) {
             return null;
         }
 
         try {
-            return DataTypeUtils.getDateFormat(dateFormatString);
+            if (timeZoneID == null) {
+                return DataTypeUtils.getDateFormat(dateFormatString);
+            } else {
+                final String timeZoneStr = 
RecordPathUtils.getFirstStringValue(timeZoneID, context);
+                if (timeZoneStr == null || timeZoneStr.isEmpty()) {
 
 Review comment:
   Should use `StringUtils.isEmpty(String)`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to