File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
src/main/java/org/audit4j/core Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -53,11 +53,16 @@ public static void troubleshootEvent(AuditEvent event) {
53
53
throw new TroubleshootException (
54
54
"Invalid Audit event type,\n Audit4j: Audit Event should not null, This event will not be logged by the Audit4j." );
55
55
} else if (event .getActor () == null ) {
56
- event .setActor (CoreConstants .DEFAULT_ACTOR );
57
- Log .warn ("Audit4j:WARN If you are not parsing the actor to the AuditEvent,\n "
58
- + "Audit4j:WARN you should make a your own AuditMetaData implementation. \n "
59
- + "Audit4j:WARN otherwise actor will be hard coded as \" " + CoreConstants .DEFAULT_ACTOR
60
- + "\" in the audit log. " + "\n Audit4j: See " + ErrorURL .NULL_ACTOR + " for further details." );
56
+ if (Context .getConfig ().getMetaData ().getClass ().equals (DummyMetaData .class )) {
57
+ event .setActor (CoreConstants .DEFAULT_ACTOR );
58
+ Log .warn ("Audit4j:WARN If you are not parsing the actor to the AuditEvent,\n "
59
+ + "Audit4j:WARN you should make a your own AuditMetaData implementation. \n "
60
+ + "Audit4j:WARN otherwise actor will be hard coded as \" " + CoreConstants .DEFAULT_ACTOR
61
+ + "\" in the audit log. " + "\n Audit4j: See " + ErrorURL .NULL_ACTOR + " for further details." );
62
+
63
+ } else {
64
+ event .setActor (Context .getConfig ().getMetaData ().getActor ());
65
+ }
61
66
} else if (event .getOrigin () == null ) {
62
67
throw new TroubleshootException (
63
68
"Invalid Audit event type,\n Audit4j: origin should not null, This event will not be logged by the Audit4j." );
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ private ValidationManager() {
52
52
* the validation exception
53
53
*/
54
54
public static void validateEvent (AuditEvent event ) throws ValidationException {
55
- if (event == null || event .getActor () == null || event . getOrigin () == null ) {
55
+ if (event == null || event .getActor () == null ) {
56
56
throw new ValidationException ("Invalid Input" , ValidationException .VALIDATION_LEVEL_WARN );
57
57
}
58
58
}
You can’t perform that action at this time.
0 commit comments