19
19
20
20
package org .audit4j .core ;
21
21
22
- import java .io .File ;
23
22
import java .io .IOException ;
24
23
import java .net .DatagramSocket ;
25
24
import java .net .ServerSocket ;
29
28
import org .audit4j .core .dto .AuditEvent ;
30
29
import org .audit4j .core .exception .ConfigurationException ;
31
30
import org .audit4j .core .exception .TroubleshootException ;
32
- import org .audit4j .core .exception .ValidationException ;
33
- import org .slf4j .Logger ;
34
- import org .slf4j .LoggerFactory ;
35
31
36
32
/**
37
33
* The Class TroubleshootManager.
40
36
*/
41
37
public final class TroubleshootManager {
42
38
43
- /** The Constant LOG. */
44
- private static final Logger LOG = LoggerFactory .getLogger (ValidationException .class );
45
-
46
39
/** The Constant MIN_PORT_NUMBER. */
47
40
public static final int MIN_PORT_NUMBER = 1100 ;
48
41
@@ -51,16 +44,17 @@ public final class TroubleshootManager {
51
44
52
45
/**
53
46
* Troubleshoot event.
54
- *
55
- * @param event the event
47
+ *
48
+ * @param event
49
+ * the event
56
50
*/
57
51
static void troubleshootEvent (AuditEvent event ) {
58
52
if (event == null ) {
59
53
throw new TroubleshootException (
60
54
"Invalid Audit event type,\n Audit4j: Audit Event should not null, This event will not be logged by the Audit4j." );
61
55
} else if (event .getActor () == null ) {
62
56
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 "
64
58
+ "Audit4j:WARN you should make a your own AuditMetaData implementation. \n "
65
59
+ "Audit4j:WARN otherwise actor will be hard coded as \" " + CoreConstants .DEFAULT_ACTOR
66
60
+ "\" in the audit log. " + "\n Audit4j: See " + ErrorURL .NULL_ACTOR + " for further details." );
@@ -72,13 +66,14 @@ static void troubleshootEvent(AuditEvent event) {
72
66
73
67
/**
74
68
* Troubleshoot configuration.
75
- *
76
- * @param e the e
69
+ *
70
+ * @param e
71
+ * the e
77
72
*/
78
73
public static void troubleshootConfiguration (ConfigurationException e ) {
79
74
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 );
82
77
ConfigUtil .generateConfigFromText ();
83
78
} else if (e .getId ().equals ("CONF_002" )) {
84
79
throw new TroubleshootException ("Configuration file currupted or invalid configuration.\n "
@@ -124,22 +119,6 @@ static boolean isPortAvailable(final int port) {
124
119
return false ;
125
120
}
126
121
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
-
143
122
/**
144
123
* Checks if is jD k_ n_ or higher.
145
124
*
0 commit comments