kevdoran commented on code in PR #5943:
URL: https://github.com/apache/nifi/pull/5943#discussion_r856236860


##########
nifi-nar-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/main/java/org/apache/nifi/reporting/azure/loganalytics/AbstractAzureLogAnalyticsReportingTask.java:
##########
@@ -136,7 +136,7 @@ protected void sendToLogAnalytics(final HttpPost request, 
final String workspace
 
         final int bodyLength = rawJson.getBytes(UTF8).length;
         final ZonedDateTime zNow = ZonedDateTime.now(ZoneOffset.UTC);
-        final String nowRfc1123 = 
zNow.format(DateTimeFormatter.RFC_1123_DATE_TIME);
+        final String nowRfc1123 = 
zNow.format(DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss O"));

Review Comment:
   In taking a closer look, this is correct, and also I noticed a static 
formatter is defined (and unused) at the top of the class. Can we use that?
   ```suggestion
           final String nowRfc1123 = zNow.format(RFC_1123_DATE_TIME);
   ```
   
   Also, perhaps it's worth adding a comment for the static formatter 
explaining why it is necessary to use that instead of 
`DateTimeFormatter.RFC_1123_DATE_TIME`, to avoid confusion and possible 
regression for future maintainers. Something like:
   
   ```java
   // DateTimeFormatter.RFC_1123_DATE_TIME does not work in every case, such as 
when a
   // two-digit day of month is always required, so we are defining our own 
formatter here.
   private static final DateTimeFormatter RFC_1123_DATE_TIME = DateTimeFormatter
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to