You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2018/09/30 16:51:04 UTC

[1/9] logging-log4j-audit git commit: [LOG4J2-2443] Remove unused exceptions

Repository: logging-log4j-audit
Updated Branches:
  refs/heads/master f4dee64be -> d9663a73b


[LOG4J2-2443] Remove unused exceptions


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/5c5c875d
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/5c5c875d
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/5c5c875d

Branch: refs/heads/master
Commit: 5c5c875d324898ea51d9a1797a34bf60e62c517c
Parents: c2bfa53
Author: Andrei Ivanov <an...@arnia.ro>
Authored: Sun Sep 16 16:03:32 2018 +0300
Committer: Andrei Ivanov <an...@arnia.ro>
Committed: Sun Sep 16 16:03:32 2018 +0300

----------------------------------------------------------------------
 .../exception/InvalidEnvironmentException.java  | 41 --------------------
 .../api/exception/InvalidSiteException.java     | 41 --------------------
 .../exception/InvalidEnvironmentException.java  | 41 --------------------
 .../jpa/exception/InvalidSiteException.java     | 41 --------------------
 4 files changed, 164 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/5c5c875d/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/InvalidEnvironmentException.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/InvalidEnvironmentException.java b/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/InvalidEnvironmentException.java
deleted file mode 100644
index 0135015..0000000
--- a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/InvalidEnvironmentException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.catalog.api.exception;
-
-/**
- *
- */
-public class InvalidEnvironmentException extends RuntimeException {
-
-    private static final long serialVersionUID = 5430017753467095045L;
-
-    public InvalidEnvironmentException() {
-        super();
-    }
-
-    public InvalidEnvironmentException(String msg) {
-        super(msg);
-    }
-
-    public InvalidEnvironmentException(Throwable t) {
-        super(t);
-    }
-
-    public InvalidEnvironmentException(String msg, Throwable t) {
-        super(msg, t);
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/5c5c875d/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/InvalidSiteException.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/InvalidSiteException.java b/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/InvalidSiteException.java
deleted file mode 100644
index 17296d1..0000000
--- a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/InvalidSiteException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.catalog.api.exception;
-
-/**
- *
- */
-public class InvalidSiteException extends RuntimeException {
-
-    private static final long serialVersionUID = -705205114100982089L;
-
-    public InvalidSiteException() {
-        super();
-    }
-
-    public InvalidSiteException(String msg) {
-        super(msg);
-    }
-
-    public InvalidSiteException(Throwable t) {
-        super(t);
-    }
-
-    public InvalidSiteException(String msg, Throwable t) {
-        super(msg, t);
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/5c5c875d/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/exception/InvalidEnvironmentException.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/exception/InvalidEnvironmentException.java b/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/exception/InvalidEnvironmentException.java
deleted file mode 100644
index 014d2ad..0000000
--- a/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/exception/InvalidEnvironmentException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.catalog.jpa.exception;
-
-/**
- *
- */
-public class InvalidEnvironmentException extends RuntimeException {
-
-    private static final long serialVersionUID = 5430017753467095045L;
-
-    public InvalidEnvironmentException() {
-        super();
-    }
-
-    public InvalidEnvironmentException(String msg) {
-        super(msg);
-    }
-
-    public InvalidEnvironmentException(Throwable t) {
-        super(t);
-    }
-
-    public InvalidEnvironmentException(String msg, Throwable t) {
-        super(msg, t);
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/5c5c875d/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/exception/InvalidSiteException.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/exception/InvalidSiteException.java b/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/exception/InvalidSiteException.java
deleted file mode 100644
index 9744ff1..0000000
--- a/log4j-catalog/log4j-catalog-jpa/src/main/java/org/apache/logging/log4j/catalog/jpa/exception/InvalidSiteException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.catalog.jpa.exception;
-
-/**
- *
- */
-public class InvalidSiteException extends RuntimeException {
-
-    private static final long serialVersionUID = -705205114100982089L;
-
-    public InvalidSiteException() {
-        super();
-    }
-
-    public InvalidSiteException(String msg) {
-        super(msg);
-    }
-
-    public InvalidSiteException(Throwable t) {
-        super(t);
-    }
-
-    public InvalidSiteException(String msg, Throwable t) {
-        super(msg, t);
-    }
-}


[3/9] logging-log4j-audit git commit: [LOG4J2-2443] Remove unused exception

Posted by rg...@apache.org.
[LOG4J2-2443] Remove unused exception


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/b3f088ef
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/b3f088ef
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/b3f088ef

Branch: refs/heads/master
Commit: b3f088ef893921ffa42a2c9a6e6559a4cd3569cd
Parents: a27bd76
Author: Andrei Ivanov <an...@arnia.ro>
Authored: Sun Sep 16 16:14:49 2018 +0300
Committer: Andrei Ivanov <an...@arnia.ro>
Committed: Sun Sep 16 16:14:49 2018 +0300

----------------------------------------------------------------------
 .../api/exception/DuplicateNameException.java   | 41 --------------------
 1 file changed, 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b3f088ef/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/DuplicateNameException.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/DuplicateNameException.java b/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/DuplicateNameException.java
deleted file mode 100644
index e8a8e92..0000000
--- a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/DuplicateNameException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.catalog.api.exception;
-
-/**
- *
- */
-public class DuplicateNameException extends RuntimeException {
-
-    private static final long serialVersionUID = 1031387508145563656L;
-
-    public DuplicateNameException() {
-        super();
-    }
-
-    public DuplicateNameException(String msg) {
-        super(msg);
-    }
-
-    public DuplicateNameException(Throwable t) {
-        super(t);
-    }
-
-    public DuplicateNameException(String msg, Throwable t) {
-        super(msg, t);
-    }
-}


[5/9] logging-log4j-audit git commit: [LOG4J2-2443] Consistent throwning of ConstraintValidationException for valitation errors

Posted by rg...@apache.org.
[LOG4J2-2443] Consistent throwning of ConstraintValidationException for valitation errors


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/bf545f37
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/bf545f37
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/bf545f37

Branch: refs/heads/master
Commit: bf545f37122cd080d17278f8516e2091a04c75fa
Parents: 13f0581
Author: Andrei Ivanov <an...@arnia.ro>
Authored: Sun Sep 16 16:31:09 2018 +0300
Committer: Andrei Ivanov <an...@arnia.ro>
Committed: Sun Sep 16 16:31:09 2018 +0300

----------------------------------------------------------------------
 .../org/apache/logging/log4j/audit/AbstractEventLogger.java | 9 +++++----
 .../org/apache/logging/log4j/audit/AuditLoggerTest.java     | 4 ++--
 2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/bf545f37/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
----------------------------------------------------------------------
diff --git a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
index da2254a..8f9a5e6 100644
--- a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
+++ b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
@@ -25,6 +25,7 @@ import org.apache.logging.log4j.catalog.api.Attribute;
 import org.apache.logging.log4j.catalog.api.Constraint;
 import org.apache.logging.log4j.catalog.api.Event;
 import org.apache.logging.log4j.catalog.api.EventAttribute;
+import org.apache.logging.log4j.catalog.api.exception.ConstraintValidationException;
 import org.apache.logging.log4j.catalog.api.plugins.ConstraintPlugins;
 import org.apache.logging.log4j.message.StructuredDataMessage;
 
@@ -146,7 +147,7 @@ public abstract class AbstractEventLogger {
             errors.append("Event ").append(eventName).append(" is missing required attribute(s) ").append(missingAttributes.toString());
         }
         if (errors.length() > 0) {
-            throw new AuditException(errors.toString());
+            throw new ConstraintValidationException(errors.toString());
         }
         List<String> attributeNames = catalogManager.getAttributeNames(eventName, event.getCatalogId());
         StringBuilder buf = new StringBuilder();
@@ -159,7 +160,7 @@ public abstract class AbstractEventLogger {
             }
         }
         if (buf.length() > 0) {
-            throw new AuditException("Event " + eventName + " contains invalid attribute(s) " + buf.toString());
+            throw new ConstraintValidationException("Event " + eventName + " contains invalid attribute(s) " + buf.toString());
         }
 
         List<String> reqCtxAttrs = catalogManager.getRequiredContextAttributes(eventName, event.getCatalogId());
@@ -175,7 +176,7 @@ public abstract class AbstractEventLogger {
                 }
             }
             if (sb.length() > 0) {
-                throw new IllegalStateException("Event " + msg.getId().getName() +
+                throw new ConstraintValidationException("Event " + msg.getId().getName() +
                         " is missing required RequestContextMapping values for " + sb.toString());
             }
         }
@@ -193,7 +194,7 @@ public abstract class AbstractEventLogger {
             }
         }
         if (errors.length() > 0) {
-            throw new AuditException("Event " + eventName + " has incorrect data in the Thread Context: " + errors.toString());
+            throw new ConstraintValidationException("Event " + eventName + " has incorrect data in the Thread Context: " + errors.toString());
         }
         msg.putAll(attributes);
         try {

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/bf545f37/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java
----------------------------------------------------------------------
diff --git a/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java b/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java
index abe6eb8..0749829 100644
--- a/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java
+++ b/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java
@@ -22,7 +22,7 @@ import org.apache.logging.log4j.audit.catalog.CatalogManager;
 import org.apache.logging.log4j.audit.catalog.CatalogManagerImpl;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.audit.catalog.StringCatalogReader;
-import org.apache.logging.log4j.audit.exception.AuditException;
+import org.apache.logging.log4j.catalog.api.exception.ConstraintValidationException;
 import org.apache.logging.log4j.core.Appender;
 import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.config.Configuration;
@@ -99,7 +99,7 @@ public class AuditLoggerTest {
         assertTrue("No toAccount", msg.contains("toAccount=\"123456\""));
     }
 
-    @Test(expected = AuditException.class)
+    @Test(expected = ConstraintValidationException.class)
     public void testBadAttribute() {
         ThreadContext.put("companyId", "12345");
         ThreadContext.put("ipAddress", "127.0.0.1");


[2/9] logging-log4j-audit git commit: [LOG4J2-2443] optimize imports

Posted by rg...@apache.org.
[LOG4J2-2443] optimize imports


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/a27bd764
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/a27bd764
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/a27bd764

Branch: refs/heads/master
Commit: a27bd7642be15b41bbc5d63ddf17257f982623f3
Parents: 5c5c875
Author: Andrei Ivanov <an...@arnia.ro>
Authored: Sun Sep 16 16:14:40 2018 +0300
Committer: Andrei Ivanov <an...@arnia.ro>
Committed: Sun Sep 16 16:14:40 2018 +0300

----------------------------------------------------------------------
 .../org/apache/logging/log4j/catalog/api/dao/CatalogDao.java     | 4 ----
 1 file changed, 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/a27bd764/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/dao/CatalogDao.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/dao/CatalogDao.java b/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/dao/CatalogDao.java
index 09d1337..de7e238 100644
--- a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/dao/CatalogDao.java
+++ b/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/dao/CatalogDao.java
@@ -19,15 +19,11 @@ package org.apache.logging.log4j.catalog.api.dao;
 import java.util.Map;
 
 import org.apache.logging.log4j.catalog.api.Attribute;
-import org.apache.logging.log4j.catalog.api.CatalogData;
 import org.apache.logging.log4j.catalog.api.CatalogReader;
 import org.apache.logging.log4j.catalog.api.CatalogWriter;
 import org.apache.logging.log4j.catalog.api.Category;
-import org.apache.logging.log4j.catalog.api.Constraint;
 import org.apache.logging.log4j.catalog.api.Event;
 import org.apache.logging.log4j.catalog.api.Product;
-import org.apache.logging.log4j.catalog.api.exception.DuplicateNameException;
-import org.apache.logging.log4j.catalog.api.exception.NameNotFoundException;
 
 /**
  * Provides access to the Catalog.


[6/9] logging-log4j-audit git commit: [LOG4J2-2443] move ConstraintValidationException in the log4j-audit-api module as it's the only place it was used and make it extend AuditException

Posted by rg...@apache.org.
[LOG4J2-2443] move ConstraintValidationException in the log4j-audit-api module as it's the only place it was used and make it extend AuditException


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/063c2580
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/063c2580
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/063c2580

Branch: refs/heads/master
Commit: 063c2580fac4975b3dc47c2a32a6763ae9379cc2
Parents: bf545f3
Author: Andrei Ivanov <an...@arnia.ro>
Authored: Sun Sep 16 16:44:05 2018 +0300
Committer: Andrei Ivanov <an...@arnia.ro>
Committed: Sun Sep 16 16:44:05 2018 +0300

----------------------------------------------------------------------
 .../log4j/audit/AbstractEventLogger.java        |  4 +-
 .../logging/log4j/audit/LogEventFactory.java    |  2 +-
 .../ConstraintValidationException.java          | 37 ++++++++++++++++++
 .../logging/log4j/audit/AuditLoggerTest.java    |  2 +-
 .../logging/log4j/audit/TransferTest.java       |  3 +-
 .../ConstraintValidationException.java          | 41 --------------------
 6 files changed, 41 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/063c2580/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
----------------------------------------------------------------------
diff --git a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
index 8f9a5e6..2b74236 100644
--- a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
+++ b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
@@ -25,7 +25,7 @@ import org.apache.logging.log4j.catalog.api.Attribute;
 import org.apache.logging.log4j.catalog.api.Constraint;
 import org.apache.logging.log4j.catalog.api.Event;
 import org.apache.logging.log4j.catalog.api.EventAttribute;
-import org.apache.logging.log4j.catalog.api.exception.ConstraintValidationException;
+import org.apache.logging.log4j.audit.exception.ConstraintValidationException;
 import org.apache.logging.log4j.catalog.api.plugins.ConstraintPlugins;
 import org.apache.logging.log4j.message.StructuredDataMessage;
 
@@ -33,8 +33,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import static org.apache.logging.log4j.catalog.api.constant.Constants.*;
-
 /**
  * This class is used to log events generated remotely.
  */

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/063c2580/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java
----------------------------------------------------------------------
diff --git a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java
index 85f2692..5914fff 100644
--- a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java
+++ b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java
@@ -43,7 +43,7 @@ import org.apache.logging.log4j.audit.annotation.RequestContextConstraints;
 import org.apache.logging.log4j.audit.annotation.Required;
 import org.apache.logging.log4j.audit.exception.AuditException;
 import org.apache.logging.log4j.audit.util.NamingUtils;
-import org.apache.logging.log4j.catalog.api.exception.ConstraintValidationException;
+import org.apache.logging.log4j.audit.exception.ConstraintValidationException;
 import org.apache.logging.log4j.catalog.api.plugins.ConstraintPlugins;
 import org.apache.logging.log4j.message.StructuredDataMessage;
 import org.apache.logging.log4j.spi.ExtendedLogger;

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/063c2580/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/exception/ConstraintValidationException.java
----------------------------------------------------------------------
diff --git a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/exception/ConstraintValidationException.java b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/exception/ConstraintValidationException.java
new file mode 100644
index 0000000..8ca2dfd
--- /dev/null
+++ b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/exception/ConstraintValidationException.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.audit.exception;
+
+/**
+ *
+ */
+public class ConstraintValidationException extends AuditException {
+
+    private static final long serialVersionUID = 2142398619256674767L;
+
+    public ConstraintValidationException(String msg) {
+        super(msg);
+    }
+
+    public ConstraintValidationException(Throwable t) {
+        super(t);
+    }
+
+    public ConstraintValidationException(String msg, Throwable t) {
+        super(msg, t);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/063c2580/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java
----------------------------------------------------------------------
diff --git a/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java b/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java
index 0749829..9e8b18d 100644
--- a/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java
+++ b/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java
@@ -22,7 +22,7 @@ import org.apache.logging.log4j.audit.catalog.CatalogManager;
 import org.apache.logging.log4j.audit.catalog.CatalogManagerImpl;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.audit.catalog.StringCatalogReader;
-import org.apache.logging.log4j.catalog.api.exception.ConstraintValidationException;
+import org.apache.logging.log4j.audit.exception.ConstraintValidationException;
 import org.apache.logging.log4j.core.Appender;
 import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.config.Configuration;

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/063c2580/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/TransferTest.java
----------------------------------------------------------------------
diff --git a/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/TransferTest.java b/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/TransferTest.java
index 7c5ce5e..647e350 100644
--- a/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/TransferTest.java
+++ b/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/TransferTest.java
@@ -24,8 +24,7 @@ import java.util.Map;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.ThreadContext;
 import org.apache.logging.log4j.audit.event.Transfer;
-import org.apache.logging.log4j.audit.exception.AuditException;
-import org.apache.logging.log4j.catalog.api.exception.ConstraintValidationException;
+import org.apache.logging.log4j.audit.exception.ConstraintValidationException;
 import org.apache.logging.log4j.core.Appender;
 import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.config.Configuration;

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/063c2580/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/ConstraintValidationException.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/ConstraintValidationException.java b/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/ConstraintValidationException.java
deleted file mode 100644
index b65b5bd..0000000
--- a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/ConstraintValidationException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.catalog.api.exception;
-
-/**
- *
- */
-public class ConstraintValidationException extends RuntimeException {
-
-    private static final long serialVersionUID = 2142398619256674767L;
-
-    public ConstraintValidationException() {
-        super();
-    }
-
-    public ConstraintValidationException(String msg) {
-        super(msg);
-    }
-
-    public ConstraintValidationException(Throwable t) {
-        super(t);
-    }
-
-    public ConstraintValidationException(String msg, Throwable t) {
-        super(msg, t);
-    }
-}


[7/9] logging-log4j-audit git commit: Merge branch 'master' of https://github.com/apache/logging-log4j-audit into LOG4J2-2443

Posted by rg...@apache.org.
Merge branch 'master' of https://github.com/apache/logging-log4j-audit into LOG4J2-2443


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/ff477a08
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/ff477a08
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/ff477a08

Branch: refs/heads/master
Commit: ff477a08524592d64b4f7e84e2ff880bd7d55dbb
Parents: 063c258 f4dee64
Author: Andrei Ivanov <an...@arnia.ro>
Authored: Mon Sep 24 11:00:09 2018 +0300
Committer: Andrei Ivanov <an...@arnia.ro>
Committed: Mon Sep 24 11:00:09 2018 +0300

----------------------------------------------------------------------
 .../log4j/audit/AbstractEventLogger.java        | 69 ++++++++++++--------
 .../logging/log4j/audit/LogEventFactory.java    | 37 ++++++++---
 .../log4j/audit/catalog/CatalogManagerImpl.java | 33 ++++++----
 .../log4j/audit/generator/ClassGenerator.java   | 13 +++-
 .../audit/generator/InterfacesGenerator.java    |  8 +++
 .../log4j/audit/rest/RequestContextFilter.java  | 21 +++---
 .../rest/RequestContextHandlerInterceptor.java  | 22 ++++---
 .../logging/log4j/audit/AuditLoggerTest.java    | 56 ++++++++++++----
 .../logging/log4j/audit/BaseEventTest.java      | 39 +++++++++++
 .../apache/logging/log4j/audit/LoginTest.java   | 55 ++++++++++++++++
 .../logging/log4j/audit/TransferTest.java       | 58 +++++++++-------
 .../apache/logging/log4j/audit/event/Login.java |  6 ++
 .../src/test/resources/basicCatalog.json        |  5 ++
 .../logging/log4j/audit/plugin/AuditMojo.java   |  7 ++
 .../src/site/markdown/index.md                  |  2 +
 src/changes/changes.xml                         | 26 ++++++++
 16 files changed, 353 insertions(+), 104 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/ff477a08/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
----------------------------------------------------------------------
diff --cc log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
index 2b74236,5de2844..dc16b16
--- a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
+++ b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
@@@ -192,8 -205,9 +206,9 @@@ public abstract class AbstractEventLogg
              }
          }
          if (errors.length() > 0) {
 -            throw new AuditException("Event " + eventName + " has incorrect data in the Thread Context: " + errors.toString());
 +            throw new ConstraintValidationException("Event " + eventName + " has incorrect data in the Thread Context: " + errors.toString());
          }
+ 
          msg.putAll(attributes);
          try {
              logEvent(msg);

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/ff477a08/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/ff477a08/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java
----------------------------------------------------------------------
diff --cc log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java
index 9e8b18d,5b075d5..c038c98
--- a/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java
+++ b/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/AuditLoggerTest.java
@@@ -22,7 -22,9 +22,9 @@@ import org.apache.logging.log4j.audit.c
  import org.apache.logging.log4j.audit.catalog.CatalogManagerImpl;
  import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.audit.catalog.StringCatalogReader;
 -import org.apache.logging.log4j.audit.exception.AuditException;
 +import org.apache.logging.log4j.audit.exception.ConstraintValidationException;
+ import org.apache.logging.log4j.catalog.api.CatalogReader;
+ import org.apache.logging.log4j.catalog.api.dao.ClassPathCatalogReader;
  import org.apache.logging.log4j.core.Appender;
  import org.apache.logging.log4j.core.LoggerContext;
  import org.apache.logging.log4j.core.config.Configuration;
@@@ -99,8 -111,21 +111,21 @@@ public class AuditLoggerTest 
          assertTrue("No toAccount", msg.contains("toAccount=\"123456\""));
      }
  
 -    @Test(expected = AuditException.class)
 +    @Test(expected = ConstraintValidationException.class)
-     public void testBadAttribute() {
+     public void testMissingRequestContextAttribute() {
+         auditLogger = buildAuditLogger(catalogReader);
+ 
+         Map<String, String> properties = new HashMap<String, String>();
+         properties.put("toAccount", "123456");
+         properties.put("fromAccount", "111111");
+         properties.put("amount", "111.55");
+         auditLogger.logEvent("transfer", properties);
+     }
+ 
 -    @Test(expected = AuditException.class)
++    @Test(expected = ConstraintValidationException.class)
+     public void testMissingEventAttribute() {
+         auditLogger = buildAuditLogger(catalogReader);
+ 
          ThreadContext.put("companyId", "12345");
          ThreadContext.put("ipAddress", "127.0.0.1");
          ThreadContext.put("environment", "dev");

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/ff477a08/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/TransferTest.java
----------------------------------------------------------------------


[4/9] logging-log4j-audit git commit: [LOG4J2-2443] Remove unused exception, seems to be a duplicate of CatalogModificationException

Posted by rg...@apache.org.
[LOG4J2-2443] Remove unused exception, seems to be a duplicate of CatalogModificationException


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/13f05815
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/13f05815
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/13f05815

Branch: refs/heads/master
Commit: 13f058151de0f6a45136073f347750c177cbbf54
Parents: b3f088e
Author: Andrei Ivanov <an...@arnia.ro>
Authored: Sun Sep 16 16:17:31 2018 +0300
Committer: Andrei Ivanov <an...@arnia.ro>
Committed: Sun Sep 16 16:17:31 2018 +0300

----------------------------------------------------------------------
 .../api/exception/CatalogWriteException.java    | 41 --------------------
 1 file changed, 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/13f05815/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/CatalogWriteException.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/CatalogWriteException.java b/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/CatalogWriteException.java
deleted file mode 100644
index 4f44501..0000000
--- a/log4j-catalog/log4j-catalog-api/src/main/java/org/apache/logging/log4j/catalog/api/exception/CatalogWriteException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.catalog.api.exception;
-
-/**
- *
- */
-public class CatalogWriteException extends CatalogException {
-
-    private static final long serialVersionUID = -373722489224872918L;
-
-    public CatalogWriteException() {
-        super();
-    }
-
-    public CatalogWriteException(String msg) {
-        super(msg);
-    }
-
-    public CatalogWriteException(Throwable t) {
-        super(t);
-    }
-
-    public CatalogWriteException(String msg, Throwable t) {
-        super(msg, t);
-    }
-}


[8/9] logging-log4j-audit git commit: [LOG4J2-2443] change leftover AuditException to ConstraintValidationException

Posted by rg...@apache.org.
[LOG4J2-2443] change leftover AuditException to ConstraintValidationException


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/b9492fa5
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/b9492fa5
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/b9492fa5

Branch: refs/heads/master
Commit: b9492fa5b6958129965f3d292ab7ac568adcb7bf
Parents: ff477a0
Author: Andrei Ivanov <an...@arnia.ro>
Authored: Mon Sep 24 11:05:09 2018 +0300
Committer: Andrei Ivanov <an...@arnia.ro>
Committed: Mon Sep 24 11:05:09 2018 +0300

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/audit/AbstractEventLogger.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b9492fa5/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
----------------------------------------------------------------------
diff --git a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
index dc16b16..f027668 100644
--- a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
+++ b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/AbstractEventLogger.java
@@ -191,7 +191,7 @@ public abstract class AbstractEventLogger {
             }
         }
         if (errors.length() > 0) {
-            throw new AuditException("Event " + eventName +
+            throw new ConstraintValidationException("Event " + eventName +
                                              " is missing required Thread Context values for " + errors.toString());
         }
 


[9/9] logging-log4j-audit git commit: LOG4J2-2443 - Fix inconsistencies in validation exceptions.

Posted by rg...@apache.org.
LOG4J2-2443 -  Fix inconsistencies in validation exceptions.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/d9663a73
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/d9663a73
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/d9663a73

Branch: refs/heads/master
Commit: d9663a73b0db8861dd557f52bf587fe2135333fa
Parents: b9492fa
Author: Ralph Goers <rg...@apache.org>
Authored: Sun Sep 30 09:50:55 2018 -0700
Committer: Ralph Goers <rg...@apache.org>
Committed: Sun Sep 30 09:50:55 2018 -0700

----------------------------------------------------------------------
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/d9663a73/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7b7256f..6cf078b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -31,6 +31,9 @@
          - "remove" - Removed
     -->
     <release version="1.0.1" date="YYYY-MM-DD" description="Release 1.0.1">
+      <action issue="LOG4J2-2443" dev="rgoers" type="fix" due-to="Andrei Ivanov">
+        Fix inconsistencies in validation exceptions.
+      </action>
       <action issue="LOG4J2-2440" dev="rgoers" type="fix" due-to="Andrei Ivanov">
         AuditEvents should provide some basic toString().
       </action>