Copilot commented on code in PR #7352:
URL: https://github.com/apache/hbase/pull/7352#discussion_r2390861970


##########
hbase-common/src/test/java/org/apache/hadoop/hbase/TimedOutTestsListener.java:
##########
@@ -67,13 +67,13 @@ public void testFailure(Failure failure) throws Exception {
     output.flush();
   }
 
-  @SuppressWarnings("JavaUtilDate")
   public static String buildThreadDiagnosticString() {
     StringWriter sw = new StringWriter();
     PrintWriter output = new PrintWriter(sw);
 
-    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss,SSS");
-    output.println(String.format("Timestamp: %s", dateFormat.format(new 
Date())));
+    DateTimeFormatter formatter =
+      DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss,SSS 
Z").withZone(ZoneId.systemDefault());

Review Comment:
   The DateTimeFormatter should be declared as a static final field to avoid 
recreating it on every method call. This would improve performance and follow 
best practices for immutable formatters.



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