Skip to content

Commit 9c3a2a5

Browse files
committed
Fixed defects 00004:00003
1 parent 4b9ae3e commit 9c3a2a5

File tree

3 files changed

+14
-35
lines changed

3 files changed

+14
-35
lines changed

src/main/java/org/audit4j/core/SimpleLayout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class SimpleLayout implements Layout {
3838
@Override
3939
public String format(AuditEvent event) {
4040
final StringBuilder buff = new StringBuilder();
41-
buff.append(AuditUtil.timeStampToString(event.getTimestamp(), "MM/dd/yyyy HH:mm:ss"));
41+
buff.append(AuditUtil.dateToString(event.getTimestamp(), "MM/dd/yyyy HH:mm:ss"));
4242
buff.append(CoreConstants.PIPE);
4343
buff.append(event.getUuid().toString());
4444
buff.append(CoreConstants.PIPE);

src/main/java/org/audit4j/core/TroubleshootManager.java

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package org.audit4j.core;
2121

22-
import java.io.File;
2322
import java.io.IOException;
2423
import java.net.DatagramSocket;
2524
import java.net.ServerSocket;
@@ -29,9 +28,6 @@
2928
import org.audit4j.core.dto.AuditEvent;
3029
import org.audit4j.core.exception.ConfigurationException;
3130
import org.audit4j.core.exception.TroubleshootException;
32-
import org.audit4j.core.exception.ValidationException;
33-
import org.slf4j.Logger;
34-
import org.slf4j.LoggerFactory;
3531

3632
/**
3733
* The Class TroubleshootManager.
@@ -40,9 +36,6 @@
4036
*/
4137
public final class TroubleshootManager {
4238

43-
/** The Constant LOG. */
44-
private static final Logger LOG = LoggerFactory.getLogger(ValidationException.class);
45-
4639
/** The Constant MIN_PORT_NUMBER. */
4740
public static final int MIN_PORT_NUMBER = 1100;
4841

@@ -51,16 +44,17 @@ public final class TroubleshootManager {
5144

5245
/**
5346
* Troubleshoot event.
54-
*
55-
* @param event the event
47+
*
48+
* @param event
49+
* the event
5650
*/
5751
static void troubleshootEvent(AuditEvent event) {
5852
if (event == null) {
5953
throw new TroubleshootException(
6054
"Invalid Audit event type,\n Audit4j: Audit Event should not null, This event will not be logged by the Audit4j.");
6155
} else if (event.getActor() == null) {
6256
event.setActor(CoreConstants.DEFAULT_ACTOR);
63-
LOG.warn("Audit4j:WARN If you are not parsing the actor to the AuditEvent,\n"
57+
Log.warn("Audit4j:WARN If you are not parsing the actor to the AuditEvent,\n"
6458
+ "Audit4j:WARN you should make a your own AuditMetaData implementation. \n"
6559
+ "Audit4j:WARN otherwise actor will be hard coded as \"" + CoreConstants.DEFAULT_ACTOR
6660
+ "\" in the audit log. " + "\nAudit4j: See " + ErrorURL.NULL_ACTOR + " for further details.");
@@ -72,13 +66,14 @@ static void troubleshootEvent(AuditEvent event) {
7266

7367
/**
7468
* Troubleshoot configuration.
75-
*
76-
* @param e the e
69+
*
70+
* @param e
71+
* the e
7772
*/
7873
public static void troubleshootConfiguration(ConfigurationException e) {
7974
if (e.getId().equals("CONF_001")) {
80-
System.err.println("Audit4j:WARN Initial confguration file not found. \n" + "Audit4j: Creating a new configuration file - "
81-
+ CoreConstants.CONFIG_FILE_NAME);
75+
System.err.println("Audit4j:WARN Initial confguration file not found. \n"
76+
+ "Audit4j: Creating a new configuration file - " + CoreConstants.CONFIG_FILE_NAME);
8277
ConfigUtil.generateConfigFromText();
8378
} else if (e.getId().equals("CONF_002")) {
8479
throw new TroubleshootException("Configuration file currupted or invalid configuration.\n"
@@ -124,22 +119,6 @@ static boolean isPortAvailable(final int port) {
124119
return false;
125120
}
126121

127-
/**
128-
* Checks if is file already exists.
129-
*
130-
* @param path
131-
* the path
132-
* @return true, if is file already exists
133-
*/
134-
public static boolean isFileAlreadyExists(String path) {
135-
File file = new File(path);
136-
if (file.exists()) {
137-
return true;
138-
} else {
139-
return false;
140-
}
141-
}
142-
143122
/**
144123
* Checks if is jD k_ n_ or higher.
145124
*

src/main/java/org/audit4j/core/dto/AuditBase.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
package org.audit4j.core.dto;
2121

2222
import java.io.Serializable;
23-
import java.sql.Timestamp;
23+
import java.util.Date;
2424

2525
/**
2626
* The Class AuditBaseDto.
@@ -39,7 +39,7 @@ public class AuditBase implements Serializable {
3939
private Long uuid;
4040

4141
/** The timestamp. */
42-
private Timestamp timestamp;
42+
private Date timestamp;
4343

4444
/**
4545
* Gets the audit id.
@@ -84,7 +84,7 @@ public void setUuid(final Long uuid) {
8484
*
8585
* @return the timestamp
8686
*/
87-
public Timestamp getTimestamp() {
87+
public Date getTimestamp() {
8888
return timestamp;
8989
}
9090

@@ -94,7 +94,7 @@ public Timestamp getTimestamp() {
9494
* @param timestamp
9595
* the new timestamp
9696
*/
97-
public void setTimestamp(Timestamp timestamp) {
97+
public void setTimestamp(Date timestamp) {
9898
this.timestamp = timestamp;
9999
}
100100
}

0 commit comments

Comments
 (0)