Allon Mureinik has uploaded a new change for review.

Change subject: core: AuditLogDAOTest date format
......................................................................

core: AuditLogDAOTest date format

Since SimpleDateFormat is inherently not thread-safe and some runners
may run different tests in different thread, it's a potential bug to use
a static instance of it.

Additionally, this issue is picked up by recent version of FindBugs and
Coverity, generating noise.

Change-Id: I41384f1f061bcffbc08c2f0fda8633d2f42bd5a9
Signed-off-by: Allon Mureinik <[email protected]>
---
M 
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/AuditLogDAOTest.java
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/16/25116/1

diff --git 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/AuditLogDAOTest.java
 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/AuditLogDAOTest.java
index 54af8e6..42ec895 100644
--- 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/AuditLogDAOTest.java
+++ 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/AuditLogDAOTest.java
@@ -31,11 +31,13 @@
     private static final Guid VM_TEMPLATE_ID = new 
Guid("1b85420c-b84c-4f29-997e-0eb674b40b79");
     private static final long EXISTING_ENTRY_ID = 44291;
     private static final long EXTERNAL_ENTRY_ID = 44296;
-    private static final SimpleDateFormat EXPECTED_DATE_FORMAT = new 
SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     private static final int FILTERED_COUNT = 5;
     private static final int TOTAL_COUNT = 6;
-
     private AuditLogDAO dao;
+
+    /** Note that {@link SimpleDateFormat} is inherently not thread-safe, and 
should not be static */
+    private final SimpleDateFormat EXPECTED_DATE_FORMAT = new 
SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
     private AuditLog newAuditLog;
     private AuditLog existingAuditLog;
     private AuditLog externalAuditLog;


-- 
To view, visit http://gerrit.ovirt.org/25116
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I41384f1f061bcffbc08c2f0fda8633d2f42bd5a9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to