dependency updates
This commit is contained in:
1154
.editorconfig
Normal file
1154
.editorconfig
Normal file
File diff suppressed because it is too large
Load Diff
@ -62,7 +62,7 @@ limitations under the License.
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>slf4j-jdk14</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -95,4 +95,4 @@ limitations under the License.
|
|||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public abstract class AbstractController<T extends Serializable> extends CommonA
|
|||||||
|
|
||||||
private final Class<T> entityClass;
|
private final Class<T> entityClass;
|
||||||
|
|
||||||
public AbstractController(Class<T> clazz) {
|
protected AbstractController(Class<T> clazz) {
|
||||||
this.entityClass = clazz;
|
this.entityClass = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,24 +68,21 @@ public abstract class AbstractController<T extends Serializable> extends CommonA
|
|||||||
*/
|
*/
|
||||||
@Lock(LockType.READ)
|
@Lock(LockType.READ)
|
||||||
public T find(Object id, String... subGraphItems) {
|
public T find(Object id, String... subGraphItems) {
|
||||||
EntityGraph graph = this.em.createEntityGraph(entityClass);
|
EntityGraph<T> graph = this.em.createEntityGraph(entityClass);
|
||||||
for (String subGraphItem : subGraphItems) {
|
for (String subGraphItem : subGraphItems) {
|
||||||
graph.addSubgraph(subGraphItem);
|
graph.addSubgraph(subGraphItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map hints = new HashMap<>();
|
Map<String, Object> hints = new HashMap<>();
|
||||||
hints.put("javax.persistence.loadgraph", graph);
|
hints.put("javax.persistence.loadgraph", graph);
|
||||||
|
|
||||||
T entity = (T) em.find(entityClass, id, hints);
|
return em.find(entityClass, id, hints);
|
||||||
return entity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Lock(LockType.READ)
|
@Lock(LockType.READ)
|
||||||
public List<T> find(String queryName, Map<String, Object> parameterMap) throws ControllerException {
|
public List<T> find(String queryName, Map<String, Object> parameterMap) {
|
||||||
Query query = em.createNamedQuery(queryName);
|
Query query = em.createNamedQuery(queryName);
|
||||||
parameterMap.entrySet().forEach((entry) -> {
|
parameterMap.entrySet().forEach(entry -> query.setParameter(entry.getKey(), entry.getValue()));
|
||||||
query.setParameter(entry.getKey(), entry.getValue());
|
|
||||||
});
|
|
||||||
return query.getResultList();
|
return query.getResultList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
* Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -15,52 +15,50 @@
|
|||||||
*/
|
*/
|
||||||
package de.muehlencord.shared.db;
|
package de.muehlencord.shared.db;
|
||||||
|
|
||||||
import de.muehlencord.shared.util.DateUtil;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.util.Date;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does not work, cannot Spring independent inject current username - implemented in AbstractController manually
|
* Does not work, cannot Spring independent inject current username - implemented in AbstractController manually
|
||||||
|
*
|
||||||
* @author Joern Muehlencord (joern@muehlencord.de)
|
* @author Joern Muehlencord (joern@muehlencord.de)
|
||||||
*/
|
*/
|
||||||
public class AuditListener {
|
public class AuditListener {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(AuditListener.class);
|
private static final Logger logger = LoggerFactory.getLogger(AuditListener.class);
|
||||||
|
|
||||||
// @PrePersist
|
// @PrePersist
|
||||||
public void prePersist(Auditable auditable) {
|
public void prePersist(Auditable auditable) {
|
||||||
Audit audit = auditable.getAudit();
|
Audit audit = auditable.getAudit();
|
||||||
|
|
||||||
if (audit == null) {
|
if (audit == null) {
|
||||||
audit = new Audit();
|
audit = new Audit();
|
||||||
auditable.setAudit(audit);
|
auditable.setAudit(audit);
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalDateTime now = LocalDateTime.now(ZoneOffset.UTC);
|
LocalDateTime now = LocalDateTime.now(ZoneOffset.UTC);
|
||||||
audit.setCreatedOn(now);
|
audit.setCreatedOn(now);
|
||||||
audit.setLastUpdatedOn(now);
|
audit.setLastUpdatedOn(now);
|
||||||
// audit.setCreatedBy(LoggedUser.get()); // TODO where to get the user from
|
// audit.setCreatedBy(LoggedUser.get()); // TODO where to get the user from
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
LOGGER.debug("prePersist executed");
|
logger.debug("prePersist executed");
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @PreUpdate
|
}
|
||||||
public void preUpdate(Auditable auditable) {
|
|
||||||
Audit audit = auditable.getAudit();
|
|
||||||
|
|
||||||
LocalDateTime now = LocalDateTime.now(ZoneOffset.UTC);
|
// @PreUpdate
|
||||||
// Date now = DateUtil.getCurrentTimeInUTC();
|
public void preUpdate(Auditable auditable) {
|
||||||
audit.setLastUpdatedOn(now);
|
Audit audit = auditable.getAudit();
|
||||||
// audit.setUpdatedBy(LoggedUser.get()); // TODO where to get the user from
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
|
||||||
LOGGER.debug("preUpdate executed");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// TODO where to get the user from
|
||||||
|
LocalDateTime now = LocalDateTime.now(ZoneOffset.UTC);
|
||||||
|
audit.setLastUpdatedOn(now);
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("preUpdate executed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,48 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
|
||||||
|
|
||||||
Licensed 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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
|
||||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
|
|
||||||
debug="false">
|
|
||||||
|
|
||||||
<appender name="consoleAppender" class="org.apache.log4j.ConsoleAppender">
|
|
||||||
<layout class="org.apache.log4j.PatternLayout">
|
|
||||||
<param name="ConversionPattern" value="%d{ISO8601} %-5p [%c] %m%n" />
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<category name="de.muehlencord">
|
|
||||||
<priority value="DEBUG"/>
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<category name="com.sun">
|
|
||||||
<priority value="WARN"/>
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<category name="javax.xml">
|
|
||||||
<priority value="WARN"/>
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<logger name="org.hibernate">
|
|
||||||
<level value="info"/>
|
|
||||||
</logger>
|
|
||||||
|
|
||||||
<root>
|
|
||||||
<level value="DEBUG" />
|
|
||||||
<appender-ref ref="consoleAppender" />
|
|
||||||
</root>
|
|
||||||
</log4j:configuration>
|
|
||||||
@ -60,14 +60,14 @@ public class APIErrorResponse {
|
|||||||
this.rootCause = rootCauseMessage;
|
this.rootCause = rootCauseMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public APIErrorResponse(Exception exception, Locale locale) {
|
public APIErrorResponse(Exception exception) {
|
||||||
this.status = Response.Status.INTERNAL_SERVER_ERROR;
|
this.status = Response.Status.INTERNAL_SERVER_ERROR;
|
||||||
this.errorCode = "0";
|
this.errorCode = "0";
|
||||||
this.message = exception.getLocalizedMessage();
|
this.message = exception.getLocalizedMessage();
|
||||||
this.rootCause = null;
|
this.rootCause = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public APIErrorResponse(Exception exception, Locale locale, Throwable th) {
|
public APIErrorResponse(Exception exception, Throwable th) {
|
||||||
this.status = Response.Status.INTERNAL_SERVER_ERROR;
|
this.status = Response.Status.INTERNAL_SERVER_ERROR;
|
||||||
this.errorCode = "0";
|
this.errorCode = "0";
|
||||||
this.message = exception.getLocalizedMessage();
|
this.message = exception.getLocalizedMessage();
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class APIException extends RuntimeException {
|
|||||||
public static final String HTTP_HEADER_X_ROOT_CAUSE = "X-Root-Cause";
|
public static final String HTTP_HEADER_X_ROOT_CAUSE = "X-Root-Cause";
|
||||||
private static final long serialVersionUID = -4356132354448841938L;
|
private static final long serialVersionUID = -4356132354448841938L;
|
||||||
|
|
||||||
private final Response httpResponse;
|
private final transient Response httpResponse;
|
||||||
|
|
||||||
public APIException(APIError apiError, Locale locale) {
|
public APIException(APIError apiError, Locale locale) {
|
||||||
httpResponse = createHttpResponse(new APIErrorResponse(apiError, locale));
|
httpResponse = createHttpResponse(new APIErrorResponse(apiError, locale));
|
||||||
@ -49,8 +49,8 @@ public class APIException extends RuntimeException {
|
|||||||
httpResponse = createHttpResponse(new APIErrorResponse(apiError, new Locale(locale), rootCause));
|
httpResponse = createHttpResponse(new APIErrorResponse(apiError, new Locale(locale), rootCause));
|
||||||
}
|
}
|
||||||
|
|
||||||
public APIException(Exception exception, Locale locale) {
|
public APIException(Exception exception) {
|
||||||
httpResponse = createHttpResponse(new APIErrorResponse(exception, locale));
|
httpResponse = createHttpResponse(new APIErrorResponse(exception));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Response getHttpResponse() {
|
public Response getHttpResponse() {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
* Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -25,46 +25,41 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Joern Muehlencord (joern@muehlencord.de)
|
* @author Joern Muehlencord (joern@muehlencord.de)
|
||||||
*/
|
*/
|
||||||
public class APIExceptionInterceptor {
|
public class APIExceptionInterceptor {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(APIExceptionInterceptor.class);
|
private static final Logger logger = LoggerFactory.getLogger(APIExceptionInterceptor.class);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
Locale locale;
|
Locale locale;
|
||||||
|
|
||||||
@AroundInvoke
|
@AroundInvoke
|
||||||
public Object handleException(InvocationContext context) {
|
public Object handleException(InvocationContext context) {
|
||||||
Object proceedResponse;
|
Object proceedResponse;
|
||||||
try {
|
try {
|
||||||
// continue to execute context
|
// continue to execute context
|
||||||
// if an exception is thrown during processing, this is passed in to the catch block below
|
// if an exception is thrown during processing, this is passed in to the catch block below
|
||||||
proceedResponse = context.proceed();
|
proceedResponse = context.proceed();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if (LOGGER.isDebugEnabled()) {
|
logger.debug(ex.getMessage(), ex);
|
||||||
LOGGER.debug(ex.getMessage());
|
Response errorResponse;
|
||||||
LOGGER.debug("Detailed stacktrace", new Object[]{ex});
|
if (ex instanceof APIException) {
|
||||||
}
|
errorResponse = ((APIException) ex).getHttpResponse();
|
||||||
|
} else if (ex.getCause() instanceof APIException) {
|
||||||
Response errorResponse;
|
errorResponse = ((APIException) ex.getCause()).getHttpResponse();
|
||||||
if (ex instanceof APIException) {
|
} else if (ex instanceof ConstraintViolationException) {
|
||||||
errorResponse = ((APIException) ex).getHttpResponse();
|
// this exception is handled via the ConstraintViolationMapper
|
||||||
} else if (ex.getCause() instanceof APIException) {
|
throw (ConstraintViolationException) ex;
|
||||||
errorResponse = ((APIException) ex.getCause()).getHttpResponse();
|
} else if (ex.getCause() instanceof ConstraintViolationException) {
|
||||||
} else if (ex instanceof ConstraintViolationException) {
|
// this exception is handled via the ConstraintViolationMapper
|
||||||
// this exception is handled via the ConstraintViolationMapper
|
throw (ConstraintViolationException) ex.getCause();
|
||||||
throw (ConstraintViolationException) ex;
|
} else {
|
||||||
} else if (ex.getCause() instanceof ConstraintViolationException) {
|
errorResponse = new APIException(ex).getHttpResponse();
|
||||||
// this exception is handled via the ConstraintViolationMapper
|
}
|
||||||
throw (ConstraintViolationException) ex.getCause();
|
return errorResponse;
|
||||||
} else {
|
|
||||||
errorResponse = new APIException(ex, locale).getHttpResponse();
|
|
||||||
}
|
|
||||||
return errorResponse;
|
|
||||||
}
|
|
||||||
return proceedResponse;
|
|
||||||
}
|
}
|
||||||
|
return proceedResponse;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
132
network/pom.xml
132
network/pom.xml
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
||||||
|
|
||||||
@ -14,72 +13,73 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<artifactId>shared-network</artifactId>
|
||||||
|
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
<build>
|
||||||
<artifactId>shared-network</artifactId>
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
</build>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>slf4j-jdk14</artifactId>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>shared-util</artifactId>
|
||||||
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
|
<type>jar</type>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<artifactId>javax.mail</artifactId>
|
||||||
|
<groupId>com.sun.mail</groupId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>ews-java-api</artifactId>
|
||||||
|
<groupId>com.microsoft.ews-java-api</groupId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<artifactId>commons-net</artifactId>
|
||||||
|
<groupId>commons-net</groupId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<artifactId>jaxws-api</artifactId>
|
||||||
|
<groupId>javax.xml.ws</groupId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<version>2.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<name>shared-network</name>
|
||||||
|
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>shared</artifactId>
|
||||||
|
<groupId>de.muehlencord</groupId>
|
||||||
<version>1.2-SNAPSHOT</version>
|
<version>1.2-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
</parent>
|
||||||
<name>shared-network</name>
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<parent>
|
</properties>
|
||||||
<artifactId>shared</artifactId>
|
|
||||||
<groupId>de.muehlencord</groupId>
|
|
||||||
<version>1.2-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<url>http://maven.apache.org</url>
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<finalName>${project.artifactId}</finalName>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<dependencies>
|
<url>http://maven.apache.org</url>
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<version>1.2-SNAPSHOT</version>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
|
||||||
<artifactId>shared-util</artifactId>
|
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun.mail</groupId>
|
|
||||||
<artifactId>javax.mail</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.microsoft.ews-java-api</groupId>
|
|
||||||
<artifactId>ews-java-api</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-net</groupId>
|
|
||||||
<artifactId>commons-net</artifactId>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.xml.ws</groupId>
|
|
||||||
<artifactId>jaxws-api</artifactId>
|
|
||||||
<version>2.3.1</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
* Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -19,74 +19,77 @@ import static java.lang.Long.valueOf;
|
|||||||
import static java.lang.Math.floor;
|
import static java.lang.Math.floor;
|
||||||
import static java.lang.Math.log;
|
import static java.lang.Math.log;
|
||||||
import static java.lang.Math.pow;
|
import static java.lang.Math.pow;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Joern Muehlencord (joern@muehlencord.de)
|
* @author Joern Muehlencord (joern@muehlencord.de)
|
||||||
*/
|
*/
|
||||||
public class CidrTool {
|
public class CidrTool {
|
||||||
|
|
||||||
public static List<String> rangeToCidrList(String startIp, String endIp) {
|
|
||||||
long start = ipToLong(startIp);
|
|
||||||
long end = ipToLong(endIp);
|
|
||||||
|
|
||||||
ArrayList<String> pairs = new ArrayList<>();
|
private static final int[] CIDR2MASK = new int[]{0x00000000, 0x80000000,
|
||||||
while (end >= start) {
|
0xC0000000, 0xE0000000, 0xF0000000, 0xF8000000, 0xFC000000,
|
||||||
byte maxsize = 32;
|
0xFE000000, 0xFF000000, 0xFF800000, 0xFFC00000, 0xFFE00000,
|
||||||
while (maxsize > 0) {
|
0xFFF00000, 0xFFF80000, 0xFFFC0000, 0xFFFE0000, 0xFFFF0000,
|
||||||
long mask = CIDR2MASK[ maxsize - 1];
|
0xFFFF8000, 0xFFFFC000, 0xFFFFE000, 0xFFFFF000, 0xFFFFF800,
|
||||||
long maskedBase = start & mask;
|
0xFFFFFC00, 0xFFFFFE00, 0xFFFFFF00, 0xFFFFFF80, 0xFFFFFFC0,
|
||||||
|
0xFFFFFFE0, 0xFFFFFFF0, 0xFFFFFFF8, 0xFFFFFFFC, 0xFFFFFFFE,
|
||||||
|
0xFFFFFFFF};
|
||||||
|
|
||||||
if (maskedBase != start) {
|
private CidrTool() {
|
||||||
break;
|
// hide constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
maxsize--;
|
public static List<String> rangeToCidrList(String startIp, String endIp) {
|
||||||
}
|
long start = ipToLong(startIp);
|
||||||
double x = log(end - start + 1) / log(2);
|
long end = ipToLong(endIp);
|
||||||
byte maxdiff = (byte) (32 - floor(x));
|
|
||||||
if (maxsize < maxdiff) {
|
|
||||||
maxsize = maxdiff;
|
|
||||||
}
|
|
||||||
String ip = longToIP(start);
|
|
||||||
pairs.add(ip + "/" + maxsize);
|
|
||||||
start += pow(2, (32 - maxsize));
|
|
||||||
}
|
|
||||||
return pairs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static final int[] CIDR2MASK = new int[]{0x00000000, 0x80000000,
|
|
||||||
0xC0000000, 0xE0000000, 0xF0000000, 0xF8000000, 0xFC000000,
|
|
||||||
0xFE000000, 0xFF000000, 0xFF800000, 0xFFC00000, 0xFFE00000,
|
|
||||||
0xFFF00000, 0xFFF80000, 0xFFFC0000, 0xFFFE0000, 0xFFFF0000,
|
|
||||||
0xFFFF8000, 0xFFFFC000, 0xFFFFE000, 0xFFFFF000, 0xFFFFF800,
|
|
||||||
0xFFFFFC00, 0xFFFFFE00, 0xFFFFFF00, 0xFFFFFF80, 0xFFFFFFC0,
|
|
||||||
0xFFFFFFE0, 0xFFFFFFF0, 0xFFFFFFF8, 0xFFFFFFFC, 0xFFFFFFFE,
|
|
||||||
0xFFFFFFFF};
|
|
||||||
|
|
||||||
private static long ipToLong(String strIP) {
|
ArrayList<String> pairs = new ArrayList<>();
|
||||||
long[] ip = new long[4];
|
while (end >= start) {
|
||||||
String[] ipSec = strIP.split("\\.");
|
byte maxsize = 32;
|
||||||
for (int k = 0; k < 4; k++) {
|
while (maxsize > 0) {
|
||||||
ip[k] = valueOf(ipSec[k]);
|
long mask = CIDR2MASK[maxsize - 1];
|
||||||
|
long maskedBase = start & mask;
|
||||||
|
|
||||||
|
if (maskedBase != start) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ip[0] << 24) + (ip[1] << 16) + (ip[2] << 8) + ip[3];
|
maxsize--;
|
||||||
|
}
|
||||||
|
double x = log(end - start + 1D) / log(2);
|
||||||
|
byte maxdiff = (byte) (32 - floor(x));
|
||||||
|
if (maxsize < maxdiff) {
|
||||||
|
maxsize = maxdiff;
|
||||||
|
}
|
||||||
|
String ip = longToIP(start);
|
||||||
|
pairs.add(ip + "/" + maxsize);
|
||||||
|
start += pow(2, (32 - maxsize));
|
||||||
|
}
|
||||||
|
return pairs;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static long ipToLong(String strIP) {
|
||||||
|
long[] ip = new long[4];
|
||||||
|
String[] ipSec = strIP.split("\\.");
|
||||||
|
for (int k = 0; k < 4; k++) {
|
||||||
|
ip[k] = valueOf(ipSec[k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String longToIP(long longIP) {
|
return (ip[0] << 24) + (ip[1] << 16) + (ip[2] << 8) + ip[3];
|
||||||
StringBuilder sb = new StringBuilder("");
|
}
|
||||||
sb.append(String.valueOf(longIP >>> 24));
|
|
||||||
sb.append(".");
|
|
||||||
sb.append(String.valueOf((longIP & 0x00FFFFFF) >>> 16));
|
|
||||||
sb.append(".");
|
|
||||||
sb.append(String.valueOf((longIP & 0x0000FFFF) >>> 8));
|
|
||||||
sb.append(".");
|
|
||||||
sb.append(String.valueOf(longIP & 0x000000FF));
|
|
||||||
|
|
||||||
return sb.toString();
|
private static String longToIP(long longIP) {
|
||||||
}
|
StringBuilder sb = new StringBuilder("");
|
||||||
|
sb.append(String.valueOf(longIP >>> 24));
|
||||||
|
sb.append(".");
|
||||||
|
sb.append(String.valueOf((longIP & 0x00FFFFFF) >>> 16));
|
||||||
|
sb.append(".");
|
||||||
|
sb.append(String.valueOf((longIP & 0x0000FFFF) >>> 8));
|
||||||
|
sb.append(".");
|
||||||
|
sb.append(String.valueOf(longIP & 0x000000FF));
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@ package de.muehlencord.shared.network.whois;
|
|||||||
|
|
||||||
import static de.muehlencord.shared.network.CidrTool.rangeToCidrList;
|
import static de.muehlencord.shared.network.CidrTool.rangeToCidrList;
|
||||||
import static de.muehlencord.shared.util.StringUtil.getValueBetweenKeywords;
|
import static de.muehlencord.shared.util.StringUtil.getValueBetweenKeywords;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -31,7 +32,12 @@ public class ArinWhoisParser extends AbstractWhoisParser implements WhoisParser
|
|||||||
/**
|
/**
|
||||||
* logger object
|
* logger object
|
||||||
*/
|
*/
|
||||||
private final static Logger LOGGER = LoggerFactory.getLogger(DefaultWhoisParser.class);
|
private static final Logger logger = LoggerFactory.getLogger(ArinWhoisParser.class);
|
||||||
|
|
||||||
|
private static final String START_STRING = "# start";
|
||||||
|
private static final String END_STRING = "# end";
|
||||||
|
private static final String NET_RANGE = "NetRange:";
|
||||||
|
private static final String ORG_NAME = "OrgName:";
|
||||||
/**
|
/**
|
||||||
* information to be returned
|
* information to be returned
|
||||||
*/
|
*/
|
||||||
@ -41,19 +47,19 @@ public class ArinWhoisParser extends AbstractWhoisParser implements WhoisParser
|
|||||||
public WhoisInformation parseWhoIsString(String whoisString) throws WhoisException {
|
public WhoisInformation parseWhoIsString(String whoisString) throws WhoisException {
|
||||||
whoisInformation = new WhoisInformation();
|
whoisInformation = new WhoisInformation();
|
||||||
whoisInformation.setResponseString(whoisString);
|
whoisInformation.setResponseString(whoisString);
|
||||||
if (whoisString.contains("# start")) { // multiple values
|
if (whoisString.contains(START_STRING)) {
|
||||||
|
|
||||||
String multipleWhoisString = whoisString;
|
String multipleWhoisString = whoisString;
|
||||||
|
|
||||||
while (multipleWhoisString.contains("# start")) {
|
while (multipleWhoisString.contains(START_STRING)) {
|
||||||
String whoisPartString;
|
String whoisPartString;
|
||||||
try {
|
try {
|
||||||
whoisPartString = getValueBetweenKeywords(multipleWhoisString, "# start", "# end");
|
whoisPartString = getValueBetweenKeywords(multipleWhoisString, START_STRING, END_STRING);
|
||||||
} catch (ParseException ex) {
|
} catch (ParseException ex) {
|
||||||
throw new WhoisException("Error while reading whois part elements. Reason: " + ex.getMessage(), ex);
|
throw new WhoisException("Error while reading whois part elements. Reason: " + ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
analyse(whoisPartString);
|
analyse(whoisPartString);
|
||||||
multipleWhoisString = multipleWhoisString.substring(multipleWhoisString.indexOf("# end") + 4);
|
multipleWhoisString = multipleWhoisString.substring(multipleWhoisString.indexOf(END_STRING) + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -78,11 +84,11 @@ public class ArinWhoisParser extends AbstractWhoisParser implements WhoisParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void analyseBlock(String block) throws WhoisException {
|
private void analyseBlock(String block) throws WhoisException {
|
||||||
LOGGER.debug("Start analysing block");
|
logger.debug("Start analysing block");
|
||||||
LOGGER.debug("\n---\n" + block + "\n---\n");
|
logger.debug("\n---\n{}\n---\n", block);
|
||||||
|
|
||||||
if ((block == null) || (block.equals("")) || (!block.contains(" "))) {
|
if ((block == null) || (!block.contains(" "))) {
|
||||||
LOGGER.debug("Skippig empty block");
|
logger.debug("Skipping empty block");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,23 +104,24 @@ public class ArinWhoisParser extends AbstractWhoisParser implements WhoisParser
|
|||||||
|
|
||||||
switch (startString) {
|
switch (startString) {
|
||||||
|
|
||||||
case "NetRange:":
|
case NET_RANGE:
|
||||||
if (valueMap.containsKey("NetRange:")) {
|
if (valueMap.containsKey(NET_RANGE)) {
|
||||||
String netRange = valueMap.get("NetRange:");
|
String netRange = valueMap.get(NET_RANGE);
|
||||||
// convert inetnum to CDIR
|
// convert inetnum to CDIR
|
||||||
String[] ipAddresses = netRange.split(" "); // TODO - what happens if not 3 parts are found
|
// TODO - what happens if not 3 parts are found
|
||||||
|
String[] ipAddresses = netRange.split(" ");
|
||||||
// FIXME add CDIR notation support
|
// FIXME add CDIR notation support
|
||||||
String startIpAddress = ipAddresses[0];
|
String startIpAddress = ipAddresses[0];
|
||||||
String endIPAddress = ipAddresses[2];
|
String endIPAddress = ipAddresses[2];
|
||||||
whoisInformation.addNetwork(rangeToCidrList(startIpAddress, endIPAddress));
|
whoisInformation.addNetwork(rangeToCidrList(startIpAddress, endIPAddress));
|
||||||
LOGGER.info("Network:" + whoisInformation.getNetwork().toString());
|
logger.info("Network: {}", whoisInformation.getNetwork());
|
||||||
} else {
|
} else {
|
||||||
throw new WhoisException("Cannot identify netrange value");
|
throw new WhoisException("Cannot identify netrange value");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "OrgName:":
|
case ORG_NAME:
|
||||||
String orgName = getValue("OrgName:", valueMap);
|
String orgName = getValue(ORG_NAME, valueMap);
|
||||||
String orgId = getValue("OrgId:", valueMap);
|
String orgId = getValue("OrgId:", valueMap);
|
||||||
String country = getValue("Country:", valueMap);
|
String country = getValue("Country:", valueMap);
|
||||||
|
|
||||||
@ -125,23 +132,23 @@ public class ArinWhoisParser extends AbstractWhoisParser implements WhoisParser
|
|||||||
orgId = orgName;
|
orgId = orgName;
|
||||||
}
|
}
|
||||||
whoisInformation.setNetworkInformation(new NetworkInformation(orgName, orgId, country));
|
whoisInformation.setNetworkInformation(new NetworkInformation(orgName, orgId, country));
|
||||||
LOGGER.info("Networkinformation:" + whoisInformation.getNetworkInformation().toString());
|
logger.info("Networkinformation: {}", whoisInformation.getNetworkInformation());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "OrgAbuseHandle:":
|
case "OrgAbuseHandle:":
|
||||||
// TODO add abuse handler
|
// TODO add abuse handler
|
||||||
LOGGER.info("Skipping OrgAbuseHandle block");
|
logger.info("Skipping OrgAbuseHandle block");
|
||||||
break;
|
break;
|
||||||
case "OrgTechHandle:":
|
case "OrgTechHandle:":
|
||||||
// admin person of network server belongs to
|
// admin person of network server belongs to
|
||||||
LOGGER.info("Skipping OrgTechHandle block");
|
logger.info("Skipping OrgTechHandle block");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "#":
|
case "#":
|
||||||
LOGGER.info("Skipping comment block");
|
logger.info("Skipping comment block");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOGGER.info("Unknown block found");
|
logger.info("Unknown block found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
package de.muehlencord.shared.network.whois;
|
package de.muehlencord.shared.network.whois;
|
||||||
|
|
||||||
import static de.muehlencord.shared.network.CidrTool.rangeToCidrList;
|
import static de.muehlencord.shared.network.CidrTool.rangeToCidrList;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -29,7 +30,7 @@ public class DefaultWhoisParser extends AbstractWhoisParser implements WhoisPars
|
|||||||
/**
|
/**
|
||||||
* logger object
|
* logger object
|
||||||
*/
|
*/
|
||||||
private final static Logger LOGGER = LoggerFactory.getLogger(DefaultWhoisParser.class);
|
private static final Logger logger = LoggerFactory.getLogger(DefaultWhoisParser.class);
|
||||||
/**
|
/**
|
||||||
* information to be returned
|
* information to be returned
|
||||||
*/
|
*/
|
||||||
@ -56,11 +57,11 @@ public class DefaultWhoisParser extends AbstractWhoisParser implements WhoisPars
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void analyseBlock(String block) throws WhoisException {
|
private void analyseBlock(String block) throws WhoisException {
|
||||||
LOGGER.debug("Start analysing block");
|
logger.debug("Start analysing block");
|
||||||
LOGGER.debug("\n---\n" + block + "\n---\n");
|
logger.debug("\n---\n{}\n---\n", block);
|
||||||
|
|
||||||
if ((block == null) || (block.equals("")) || (!block.contains(" "))) {
|
if ((block == null) || (!block.contains(" "))) {
|
||||||
LOGGER.debug("Skippig empty block");
|
logger.debug("Skipping empty block");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,17 +77,17 @@ public class DefaultWhoisParser extends AbstractWhoisParser implements WhoisPars
|
|||||||
case "inetnum:":
|
case "inetnum:":
|
||||||
String inetnum = getValue("inetnum:", valueMap);
|
String inetnum = getValue("inetnum:", valueMap);
|
||||||
String country = getValue("country:", valueMap);
|
String country = getValue("country:", valueMap);
|
||||||
String netname = getValue("descr:", valueMap);
|
String netname = getValue("netname:", valueMap);
|
||||||
String descr = getValue("netname:", valueMap);
|
String descr = getValue("descr:", valueMap);
|
||||||
String parent = getValue("parent:", valueMap);
|
|
||||||
|
|
||||||
if ((inetnum == null) || (country == null)) {
|
if ((inetnum == null) || (country == null)) {
|
||||||
throw new WhoisException("Cannot identify inetnum and/or country value");
|
throw new WhoisException("Cannot identify inetnum and/or country value");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inetnum.contains(" ")) {
|
if (inetnum.contains(" ")) {
|
||||||
// convert inetnum to CDIR
|
// convert inetnum to CDIR
|
||||||
String[] ipAddresses = inetnum.split(" "); // TODO - what happens if not 3 parts are found
|
// TODO - what happens if not 3 parts are found
|
||||||
|
String[] ipAddresses = inetnum.split(" ");
|
||||||
// FIXME add CDIR notation support
|
// FIXME add CDIR notation support
|
||||||
String startIpAddress = ipAddresses[0];
|
String startIpAddress = ipAddresses[0];
|
||||||
String endIPAddress = ipAddresses[2];
|
String endIPAddress = ipAddresses[2];
|
||||||
@ -95,15 +96,7 @@ public class DefaultWhoisParser extends AbstractWhoisParser implements WhoisPars
|
|||||||
whoisInformation.addNetwork(inetnum);
|
whoisInformation.addNetwork(inetnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
logger.info("Network: {}", whoisInformation.getNetwork());
|
||||||
if (parent != null) {
|
|
||||||
whoisInformation.addRootNetwork(parent);
|
|
||||||
LOGGER.info("Root network by parent" + whoisInformation.getRootNetwork().toString());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
LOGGER.info("Network:" + whoisInformation.getNetwork().toString());
|
|
||||||
whoisInformation.setNetworkInformation(new NetworkInformation(netname, descr, country));
|
whoisInformation.setNetworkInformation(new NetworkInformation(netname, descr, country));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -111,26 +104,26 @@ public class DefaultWhoisParser extends AbstractWhoisParser implements WhoisPars
|
|||||||
// get information on level-2 network
|
// get information on level-2 network
|
||||||
String route = getValue("route:", valueMap);
|
String route = getValue("route:", valueMap);
|
||||||
whoisInformation.addRootNetwork(route);
|
whoisInformation.addRootNetwork(route);
|
||||||
LOGGER.info("Root network " + whoisInformation.getRootNetwork().toString());
|
logger.info("Root network: {}", whoisInformation.getRootNetwork());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "role:":
|
case "role:":
|
||||||
// admin company of network server belongs to
|
// admin company of network server belongs to
|
||||||
LOGGER.info("Skipping role block");
|
logger.info("Skipping role block");
|
||||||
break;
|
break;
|
||||||
case "person:":
|
case "person:":
|
||||||
// admin person of network server belongs to
|
// admin person of network server belongs to
|
||||||
LOGGER.info("Skipping person block");
|
logger.info("Skipping person block");
|
||||||
break;
|
break;
|
||||||
case "% Information":
|
case "% Information":
|
||||||
case "% Note:":
|
case "% Note:":
|
||||||
case "% This":
|
case "% This":
|
||||||
case "%":
|
case "%":
|
||||||
LOGGER.info("Skipping comment block");
|
logger.info("Skipping comment block");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOGGER.info("Unknown block found");
|
logger.info("Unknown block found");
|
||||||
LOGGER.error(block);
|
logger.error(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,28 @@
|
|||||||
|
package de.muehlencord.shared.network.whois;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
|
||||||
|
import de.muehlencord.shared.network.BaseTest;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test the default implementation
|
||||||
|
*
|
||||||
|
* @author Joern Muehlencord, 2021-09-22
|
||||||
|
* @since 1.2.0
|
||||||
|
*/
|
||||||
|
class DefaultWhoisParserTest extends BaseTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void parseWhoIsString() throws Exception {
|
||||||
|
String whoisInformation = this.readContentFromFile("90.63.251.1.txt");
|
||||||
|
DefaultWhoisParser parser = new DefaultWhoisParser();
|
||||||
|
WhoisInformation information = parser.parseWhoIsString(whoisInformation);
|
||||||
|
assertNotNull (information);
|
||||||
|
information.validate();
|
||||||
|
System.out.println ("parseWhoIsString");
|
||||||
|
System.out.println (information.getNetworkInformation().toString());
|
||||||
|
System.out.println (information.getNetwork().toString());
|
||||||
|
System.out.println (information.getRootNetwork().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
% This is the RIPE Database query service.
|
||||||
|
% The objects are in RPSL format.
|
||||||
|
%
|
||||||
|
% The RIPE Database is subject to Terms and Conditions.
|
||||||
|
% See http://www.ripe.net/db/support/db-terms-conditions.pdf
|
||||||
|
|
||||||
|
% Note: this output has been filtered.
|
||||||
|
% To receive output for a database update, use the "-B" flag.
|
||||||
|
|
||||||
|
% Information related to '90.63.251.0 - 90.63.251.255'
|
||||||
|
|
||||||
|
% Abuse contact for '90.63.251.0 - 90.63.251.255' is 'gestionip.ft@orange.com'
|
||||||
|
|
||||||
|
inetnum: 90.63.251.0 - 90.63.251.255
|
||||||
|
netname: IP2000-ADSL-BAS
|
||||||
|
descr: LNAUB658 Aubervilliers Bloc 1
|
||||||
|
country: FR
|
||||||
|
admin-c: WITR1-RIPE
|
||||||
|
tech-c: WITR1-RIPE
|
||||||
|
status: ASSIGNED PA
|
||||||
|
remarks: for hacking, spamming or security problems send mail to
|
||||||
|
remarks: abuse@orange.fr
|
||||||
|
mnt-by: FT-BRX
|
||||||
|
created: 2015-10-09T11:39:49Z
|
||||||
|
last-modified: 2019-10-07T13:05:05Z
|
||||||
|
source: RIPE
|
||||||
|
|
||||||
|
role: Wanadoo France Technical Role
|
||||||
|
address: FRANCE TELECOM/SCR
|
||||||
|
address: 48 rue Camille Desmoulins
|
||||||
|
address: 92791 ISSY LES MOULINEAUX CEDEX 9
|
||||||
|
address: FR
|
||||||
|
phone: +33 1 58 88 50 00
|
||||||
|
abuse-mailbox: abuse@orange.fr
|
||||||
|
admin-c: BRX1-RIPE
|
||||||
|
tech-c: BRX1-RIPE
|
||||||
|
nic-hdl: WITR1-RIPE
|
||||||
|
mnt-by: FT-BRX
|
||||||
|
created: 2001-12-04T17:57:08Z
|
||||||
|
last-modified: 2013-07-16T14:09:50Z
|
||||||
|
source: RIPE # Filtered
|
||||||
|
|
||||||
|
% Information related to '90.63.192.0/18AS3215'
|
||||||
|
|
||||||
|
route: 90.63.192.0/18
|
||||||
|
descr: France Telecom IP2000-ADSL-BAS
|
||||||
|
origin: AS3215
|
||||||
|
mnt-by: FT-BRX
|
||||||
|
created: 2012-12-11T10:12:42Z
|
||||||
|
last-modified: 2012-12-11T10:12:42Z
|
||||||
|
source: RIPE
|
||||||
|
|
||||||
|
% This query was served by the RIPE Database Query Service version 1.101 (ANGUS)
|
||||||
@ -1,48 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
|
||||||
|
|
||||||
Licensed 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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
|
|
||||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
|
|
||||||
debug="true">
|
|
||||||
|
|
||||||
<appender name="consoleAppender" class="org.apache.log4j.ConsoleAppender">
|
|
||||||
<layout class="org.apache.log4j.PatternLayout">
|
|
||||||
<param name="ConversionPattern" value="%d{ISO8601} %-5p [%c] %m%n" />
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<category name="de.muehlencord">
|
|
||||||
<priority value="DEBUG"/>
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<category name="com.sun">
|
|
||||||
<priority value="WARN"/>
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<category name="javax.xml">
|
|
||||||
<priority value="WARN"/>
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<logger name="org.hibernate">
|
|
||||||
<level value="INFO"/>
|
|
||||||
</logger>
|
|
||||||
|
|
||||||
<root>
|
|
||||||
<level value="DEBUG" />
|
|
||||||
<appender-ref ref="consoleAppender" />
|
|
||||||
</root>
|
|
||||||
</log4j:configuration>
|
|
||||||
@ -15,41 +15,42 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<artifactId>shared-poi-util</artifactId>
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
|
||||||
<artifactId>shared-poi-util</artifactId>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>shared-util</artifactId>
|
||||||
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>slf4j-jdk14</artifactId>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<name>shared-poi-util</name>
|
||||||
|
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>shared</artifactId>
|
||||||
|
<groupId>de.muehlencord</groupId>
|
||||||
<version>1.2-SNAPSHOT</version>
|
<version>1.2-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
</parent>
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>de.muehlencord</groupId>
|
<version>1.2-SNAPSHOT</version>
|
||||||
<artifactId>shared</artifactId>
|
</project>
|
||||||
<version>1.2-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<name>shared-poi-util</name>
|
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi-ooxml</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
|
||||||
<artifactId>shared-util</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
|
|||||||
772
pom.xml
772
pom.xml
@ -15,393 +15,397 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<groupId>de.muehlencord</groupId>
|
<artifactId>shared</artifactId>
|
||||||
<artifactId>shared</artifactId>
|
<build>
|
||||||
<version>1.2-SNAPSHOT</version>
|
<pluginManagement>
|
||||||
<packaging>pom</packaging>
|
<plugins>
|
||||||
<name>shared</name>
|
<!-- build archive -->
|
||||||
|
<plugin>
|
||||||
<modules>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<module>configuration</module>
|
<configuration>
|
||||||
<module>network</module>
|
<showDeprecation>true</showDeprecation>
|
||||||
<module>util</module>
|
<source>${maven.compiler.source}</source>
|
||||||
<module>jeeutil</module>
|
<target>${maven.compiler.target}</target>
|
||||||
<module>shiro-faces</module>
|
</configuration>
|
||||||
<module>poi-util</module>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<module>db</module>
|
<version>3.8.1</version>
|
||||||
</modules>
|
</plugin>
|
||||||
|
|
||||||
<scm>
|
|
||||||
<connection>scm:git:https://jomu.timelord.de/git/jomu/shared/</connection>
|
|
||||||
<developerConnection>scm:git:https://jomu.timelord.de/git/jomu/shared/</developerConnection>
|
|
||||||
<url>https://jomu.timelord.de/git/jomu/shared/</url>
|
|
||||||
<tag>HEAD</tag>
|
|
||||||
</scm>
|
|
||||||
|
|
||||||
<issueManagement>
|
|
||||||
<system>Gitea</system>
|
|
||||||
<url>https://jomu.timelord.de/git/jomu/shared/issues</url>
|
|
||||||
</issueManagement>
|
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>Apache License, Version 2.0</name>
|
|
||||||
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
|
|
||||||
<distribution>repo</distribution>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
<developers>
|
|
||||||
<developer>
|
|
||||||
<name>Joern Muehlencord</name>
|
|
||||||
<email>joern@muehlencord.de</email>
|
|
||||||
</developer>
|
|
||||||
</developers>
|
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<snapshotRepository>
|
|
||||||
<id>ossrh</id>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
|
||||||
</snapshotRepository>
|
|
||||||
<repository>
|
|
||||||
<id>ossrh</id>
|
|
||||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
|
||||||
</repository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<!-- project setup -->
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
|
||||||
<artifactId>shared-db</artifactId>
|
|
||||||
<version>1.2-SNAPSHOT</version>
|
|
||||||
<type>ejb</type>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
|
||||||
<artifactId>shared-shiro-faces</artifactId>
|
|
||||||
<version>1.2-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
|
||||||
<artifactId>shared-util</artifactId>
|
|
||||||
<version>1.2-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.muehlencord.shared</groupId>
|
|
||||||
<artifactId>shared-jeeutil</artifactId>
|
|
||||||
<version>1.2-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-codec</groupId>
|
|
||||||
<artifactId>commons-codec</artifactId>
|
|
||||||
<version>1.15</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-net</groupId>
|
|
||||||
<artifactId>commons-net</artifactId>
|
|
||||||
<version>3.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
<version>3.11</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-io</groupId>
|
|
||||||
<artifactId>commons-io</artifactId>
|
|
||||||
<version>2.8.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
<version>1.7.30</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
|
||||||
<version>1.7.30</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>jcl-over-slf4j</artifactId>
|
|
||||||
<version>1.7.30</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun.mail</groupId>
|
|
||||||
<artifactId>javax.mail</artifactId>
|
|
||||||
<version>1.6.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.microsoft.ews-java-api</groupId>
|
|
||||||
<artifactId>ews-java-api</artifactId>
|
|
||||||
<version>2.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.code.gson</groupId>
|
|
||||||
<artifactId>gson</artifactId>
|
|
||||||
<version>2.8.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-annotations</artifactId>
|
|
||||||
<version>2.11.3</version>
|
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
<version>2.11.3</version>
|
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
|
||||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
|
||||||
<version>2.11.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.shiro</groupId>
|
|
||||||
<artifactId>shiro-core</artifactId>
|
|
||||||
<version>1.7.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.shiro</groupId>
|
|
||||||
<artifactId>shiro-web</artifactId>
|
|
||||||
<version>1.7.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax</groupId>
|
|
||||||
<artifactId>javaee-api</artifactId>
|
|
||||||
<version>8.0.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax</groupId>
|
|
||||||
<artifactId>javaee-web-api</artifactId>
|
|
||||||
<version>8.0.1</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.lambdaworks</groupId>
|
|
||||||
<artifactId>scrypt</artifactId>
|
|
||||||
<version>1.4.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bouncycastle</groupId>
|
|
||||||
<artifactId>bcprov-jdk15on</artifactId>
|
|
||||||
<version>1.68</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.hibernate</groupId>
|
|
||||||
<artifactId>hibernate-core</artifactId>
|
|
||||||
<version>5.4.23.Final</version>
|
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.primefaces</groupId>
|
|
||||||
<artifactId>primefaces</artifactId>
|
|
||||||
<version>8.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.adminfaces</groupId>
|
|
||||||
<artifactId>admin-template</artifactId>
|
|
||||||
<version>1.2.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.omnifaces</groupId>
|
|
||||||
<artifactId>omnifaces</artifactId>
|
|
||||||
<version>3.4.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.poi</groupId>
|
|
||||||
<artifactId>poi-ooxml</artifactId>
|
|
||||||
<version>5.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.fusionauth</groupId>
|
|
||||||
<artifactId>fusionauth-jwt</artifactId>
|
|
||||||
<version>4.1.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Dev Tools -->
|
<!-- build maven ejb artifacts -->
|
||||||
<dependency>
|
<plugin>
|
||||||
<groupId>org.projectlombok</groupId>
|
<artifactId>maven-ejb-plugin</artifactId>
|
||||||
<artifactId>lombok</artifactId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<scope>provided</scope>
|
<version>3.0.1</version>
|
||||||
<version>1.18.16</version>
|
</plugin>
|
||||||
</dependency>
|
|
||||||
|
<!-- create new releases -->
|
||||||
<!-- Testing -->
|
<plugin>
|
||||||
<dependency>
|
<artifactId>maven-release-plugin</artifactId>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<version>2.5.3</version>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
</plugin>
|
||||||
<version>5.7.0</version>
|
|
||||||
<scope>test</scope>
|
<!-- control junit tests from maven build -->
|
||||||
</dependency>
|
<plugin>
|
||||||
</dependencies>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
</dependencyManagement>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<version>2.22.2</version>
|
||||||
|
</plugin>
|
||||||
<profiles>
|
</plugins>
|
||||||
<profile>
|
</pluginManagement>
|
||||||
<id>release</id>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- deploy artifacts to maven repository -->
|
<plugin>
|
||||||
<plugin>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
</plugin>
|
||||||
<version>1.6.8</version>
|
<plugin>
|
||||||
<extensions>true</extensions>
|
<artifactId>maven-release-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<serverId>ossrh</serverId>
|
<tagNameFormat>v@{project.version}</tagNameFormat>
|
||||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
</configuration>
|
||||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
<version>2.5.3</version>
|
||||||
</configuration>
|
</plugin>
|
||||||
</plugin>
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<!-- ensure sources are build so they are also uploaded -->
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<plugin>
|
</plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
</plugins>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
</build>
|
||||||
<version>3.1.0</version>
|
<dependencyManagement>
|
||||||
<executions>
|
<dependencies>
|
||||||
<execution>
|
<dependency>
|
||||||
<id>attach-sources</id>
|
<artifactId>shared-db</artifactId>
|
||||||
<goals>
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
<goal>jar-no-fork</goal>
|
<type>ejb</type>
|
||||||
</goals>
|
<version>${project.version}</version>
|
||||||
</execution>
|
</dependency>
|
||||||
</executions>
|
<dependency>
|
||||||
</plugin>
|
<artifactId>shared-shiro-faces</artifactId>
|
||||||
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
<!-- ensure java doc is built -->
|
<version>${project.version}</version>
|
||||||
<plugin>
|
</dependency>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<dependency>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>shared-util</artifactId>
|
||||||
<version>3.1.1</version>
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
<executions>
|
<version>${project.version}</version>
|
||||||
<execution>
|
</dependency>
|
||||||
<id>attach-javadocs</id>
|
<dependency>
|
||||||
<goals>
|
<artifactId>shared-jeeutil</artifactId>
|
||||||
<goal>jar</goal>
|
<groupId>de.muehlencord.shared</groupId>
|
||||||
</goals>
|
<version>${project.version}</version>
|
||||||
</execution>
|
</dependency>
|
||||||
</executions>
|
<dependency>
|
||||||
</plugin>
|
<artifactId>commons-codec</artifactId>
|
||||||
|
<groupId>commons-codec</groupId>
|
||||||
<!-- create license file -->
|
<version>1.15</version>
|
||||||
<plugin>
|
</dependency>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<dependency>
|
||||||
<artifactId>license-maven-plugin</artifactId>
|
<artifactId>commons-net</artifactId>
|
||||||
<version>1.14</version>
|
<groupId>commons-net</groupId>
|
||||||
<executions>
|
<version>3.8.0</version>
|
||||||
<execution>
|
</dependency>
|
||||||
<id>download-licenses</id>
|
<dependency>
|
||||||
<phase>generate-resources</phase>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<goals>
|
<groupId>org.apache.commons</groupId>
|
||||||
<goal>download-licenses</goal>
|
<version>3.12.0</version>
|
||||||
<goal>add-third-party</goal>
|
</dependency>
|
||||||
</goals>
|
<dependency>
|
||||||
<configuration>
|
<artifactId>commons-io</artifactId>
|
||||||
<licensesOutputDirectory>${licenses.dir}</licensesOutputDirectory>
|
<groupId>commons-io</groupId>
|
||||||
<outputDirectory>${licenses.dir}</outputDirectory>
|
<version>2.11.0</version>
|
||||||
<licenseMerges>
|
</dependency>
|
||||||
<licenseMerge>The Apache Software License, Version 2.0|Apache 2|Apache License, Version 2.0|Apache Public License 2.0</licenseMerge>
|
<dependency>
|
||||||
</licenseMerges>
|
<artifactId>slf4j-api</artifactId>
|
||||||
</configuration>
|
<groupId>org.slf4j</groupId>
|
||||||
</execution>
|
<version>${slf4j.version}</version>
|
||||||
</executions>
|
</dependency>
|
||||||
</plugin>
|
<dependency>
|
||||||
|
<artifactId>slf4j-jdk14</artifactId>
|
||||||
<!-- sign jar archives -->
|
<groupId>org.slf4j</groupId>
|
||||||
<plugin>
|
<version>${slf4j.version}</version>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
</dependency>
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
<dependency>
|
||||||
<version>1.6</version>
|
<artifactId>jcl-over-slf4j</artifactId>
|
||||||
<executions>
|
<groupId>org.slf4j</groupId>
|
||||||
<execution>
|
<version>${slf4j.version}</version>
|
||||||
<id>sign-artifacts</id>
|
</dependency>
|
||||||
<phase>verify</phase>
|
|
||||||
<goals>
|
<dependency>
|
||||||
<goal>sign</goal>
|
<artifactId>javax.mail</artifactId>
|
||||||
</goals>
|
<groupId>com.sun.mail</groupId>
|
||||||
</execution>
|
<version>1.6.2</version>
|
||||||
</executions>
|
</dependency>
|
||||||
<configuration>
|
<dependency>
|
||||||
<keyname>993245E2EC7608BB</keyname>
|
<artifactId>ews-java-api</artifactId>
|
||||||
</configuration>
|
<groupId>com.microsoft.ews-java-api</groupId>
|
||||||
</plugin>
|
<version>2.0</version>
|
||||||
</plugins>
|
</dependency>
|
||||||
</build>
|
<dependency>
|
||||||
</profile>
|
<artifactId>gson</artifactId>
|
||||||
</profiles>
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<version>2.8.9</version>
|
||||||
<build>
|
</dependency>
|
||||||
<pluginManagement>
|
<dependency>
|
||||||
<plugins>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
<!-- build archive -->
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<plugin>
|
<type>jar</type>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<version>${jackson.version}</version>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
</dependency>
|
||||||
<version>3.8.1</version>
|
<dependency>
|
||||||
<configuration>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<source>${maven.compiler.source}</source>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<target>${maven.compiler.target}</target>
|
<type>jar</type>
|
||||||
<showDeprecation>true</showDeprecation>
|
<version>${jackson.version}</version>
|
||||||
</configuration>
|
</dependency>
|
||||||
</plugin>
|
<dependency>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
<!-- build maven ejb artifacts -->
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
<plugin>
|
<version>${jackson.version}</version>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
</dependency>
|
||||||
<artifactId>maven-ejb-plugin</artifactId>
|
<dependency>
|
||||||
<version>3.0.1</version>
|
<artifactId>shiro-core</artifactId>
|
||||||
</plugin>
|
<groupId>org.apache.shiro</groupId>
|
||||||
|
<version>1.7.1</version>
|
||||||
<!-- create new releases -->
|
</dependency>
|
||||||
<plugin>
|
<dependency>
|
||||||
<artifactId>maven-release-plugin</artifactId>
|
<artifactId>shiro-web</artifactId>
|
||||||
<version>2.5.3</version>
|
<groupId>org.apache.shiro</groupId>
|
||||||
</plugin>
|
<version>1.7.1</version>
|
||||||
|
</dependency>
|
||||||
<!-- control junit tests from maven build -->
|
<dependency>
|
||||||
<plugin>
|
<artifactId>javaee-api</artifactId>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>javax</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<version>8.0.1</version>
|
||||||
<version>2.22.2</version>
|
</dependency>
|
||||||
</plugin>
|
<dependency>
|
||||||
</plugins>
|
<artifactId>javaee-web-api</artifactId>
|
||||||
</pluginManagement>
|
<groupId>javax</groupId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<version>8.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>scrypt</artifactId>
|
||||||
|
<groupId>com.lambdaworks</groupId>
|
||||||
|
<version>1.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>bcprov-jdk15on</artifactId>
|
||||||
|
<groupId>org.bouncycastle</groupId>
|
||||||
|
<version>1.68</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<artifactId>hibernate-core</artifactId>
|
||||||
|
<groupId>org.hibernate</groupId>
|
||||||
|
<type>jar</type>
|
||||||
|
<version>5.4.23.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>primefaces</artifactId>
|
||||||
|
<groupId>org.primefaces</groupId>
|
||||||
|
<version>10.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>admin-template</artifactId>
|
||||||
|
<groupId>com.github.adminfaces</groupId>
|
||||||
|
<version>1.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>omnifaces</artifactId>
|
||||||
|
<groupId>org.omnifaces</groupId>
|
||||||
|
<version>3.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<version>5.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>fusionauth-jwt</artifactId>
|
||||||
|
<groupId>io.fusionauth</groupId>
|
||||||
|
<version>4.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Dev Tools -->
|
||||||
|
<dependency>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<version>1.18.22</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Testing -->
|
||||||
|
<dependency>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<version>5.8.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<email>joern@muehlencord.de</email>
|
||||||
|
<name>Joern Muehlencord</name>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>ossrh</id>
|
||||||
|
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||||
|
</repository>
|
||||||
|
<snapshotRepository>
|
||||||
|
<id>ossrh</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
</snapshotRepository>
|
||||||
|
</distributionManagement>
|
||||||
|
<groupId>de.muehlencord</groupId>
|
||||||
|
|
||||||
|
<issueManagement>
|
||||||
|
<system>Gitea</system>
|
||||||
|
<url>https://jomu.timelord.de/git/jomu/shared/issues</url>
|
||||||
|
</issueManagement>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<distribution>repo</distribution>
|
||||||
|
<name>Apache License, Version 2.0</name>
|
||||||
|
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>configuration</module>
|
||||||
|
<module>network</module>
|
||||||
|
<module>util</module>
|
||||||
|
<module>jeeutil</module>
|
||||||
|
<module>shiro-faces</module>
|
||||||
|
<module>poi-util</module>
|
||||||
|
<module>db</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<name>shared</name>
|
||||||
|
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<!-- deploy artifacts to maven repository -->
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||||
</plugin>
|
<configuration>
|
||||||
<plugin>
|
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||||
<artifactId>maven-release-plugin</artifactId>
|
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||||
<version>2.5.3</version>
|
<serverId>ossrh</serverId>
|
||||||
|
</configuration>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<groupId>org.sonatype.plugins</groupId>
|
||||||
|
<version>1.6.8</version>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- ensure sources are build so they are also uploaded -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>jar-no-fork</goal>
|
||||||
|
</goals>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- ensure java doc is built -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- create license file -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>license-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
<configuration>
|
<configuration>
|
||||||
<tagNameFormat>v@{project.version}</tagNameFormat>
|
<licenseMerges>
|
||||||
|
<licenseMerge>The Apache Software License, Version 2.0|Apache 2|Apache License, Version 2.0|Apache Public License 2.0</licenseMerge>
|
||||||
|
</licenseMerges>
|
||||||
|
<licensesOutputDirectory>${licenses.dir}</licensesOutputDirectory>
|
||||||
|
<outputDirectory>${licenses.dir}</outputDirectory>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
<goals>
|
||||||
<plugin>
|
<goal>download-licenses</goal>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<goal>add-third-party</goal>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
</goals>
|
||||||
</plugin>
|
<id>download-licenses</id>
|
||||||
|
<phase>generate-resources</phase>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<version>1.14</version>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- sign jar archives -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<keyname>993245E2EC7608BB</keyname>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>sign</goal>
|
||||||
|
</goals>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<version>1.6</version>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
<id>release</id>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<!-- project setup -->
|
||||||
|
<jackson.version>2.13.0</jackson.version>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<slf4j.version>1.7.32</slf4j.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:https://jomu.timelord.de/git/jomu/shared/</connection>
|
||||||
|
<developerConnection>scm:git:https://jomu.timelord.de/git/jomu/shared/</developerConnection>
|
||||||
|
<tag>HEAD</tag>
|
||||||
|
<url>https://jomu.timelord.de/git/jomu/shared/</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<version>1.2-SNAPSHOT</version>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public abstract class AbstractAccessControlTag extends AbstractTag {
|
|||||||
|
|
||||||
protected TagAttribute attribute;
|
protected TagAttribute attribute;
|
||||||
|
|
||||||
public AbstractAccessControlTag(TagConfig config) {
|
protected AbstractAccessControlTag(TagConfig config) {
|
||||||
super(config);
|
super(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
* Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -19,42 +19,41 @@ import java.io.IOException;
|
|||||||
import javax.faces.component.UIComponent;
|
import javax.faces.component.UIComponent;
|
||||||
import javax.faces.view.facelets.FaceletContext;
|
import javax.faces.view.facelets.FaceletContext;
|
||||||
import javax.faces.view.facelets.TagConfig;
|
import javax.faces.view.facelets.TagConfig;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Joern Muehlencord (joern@muehlencord.de)
|
* @author Joern Muehlencord (joern@muehlencord.de)
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractAuthenticationTag extends AbstractTag {
|
public abstract class AbstractAuthenticationTag extends AbstractTag {
|
||||||
|
|
||||||
protected AbstractAuthenticationTag(TagConfig config) {
|
private static final Logger logger = LoggerFactory.getLogger(AbstractAuthenticationTag.class);
|
||||||
super(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract boolean isAuthenticated();
|
|
||||||
|
|
||||||
protected boolean applyTagHandler() {
|
|
||||||
if (isAuthenticated()) {
|
|
||||||
if (LOGGER.isTraceEnabled()) {
|
|
||||||
LOGGER.trace("Authentication verified, tag will be evaluated");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
if (LOGGER.isTraceEnabled()) {
|
|
||||||
LOGGER.trace ("Authentifaction verification failed, tag will not be evaluated");
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
protected AbstractAuthenticationTag(TagConfig config) {
|
||||||
public void apply(FaceletContext fc, UIComponent uic) throws IOException {
|
super(config);
|
||||||
if (applyTagHandler()) {
|
}
|
||||||
this.nextHandler.apply(fc, uic);
|
|
||||||
}
|
protected abstract boolean isAuthenticated();
|
||||||
|
|
||||||
|
protected boolean applyTagHandler() {
|
||||||
|
if (isAuthenticated()) {
|
||||||
|
if (logger.isTraceEnabled()) {
|
||||||
|
logger.trace("Authentication verified, tag will be evaluated");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (logger.isTraceEnabled()) {
|
||||||
|
logger.trace("Authentifaction verification failed, tag will not be evaluated");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(FaceletContext fc, UIComponent uic) throws IOException {
|
||||||
|
if (applyTagHandler()) {
|
||||||
|
this.nextHandler.apply(fc, uic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,8 +19,6 @@ import javax.faces.view.facelets.TagConfig;
|
|||||||
import javax.faces.view.facelets.TagHandler;
|
import javax.faces.view.facelets.TagHandler;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -28,9 +26,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractTag extends TagHandler {
|
public abstract class AbstractTag extends TagHandler {
|
||||||
|
|
||||||
protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractTag.class);
|
protected AbstractTag(TagConfig config) {
|
||||||
|
|
||||||
public AbstractTag(TagConfig config) {
|
|
||||||
super(config);
|
super(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,29 +24,28 @@ import java.util.stream.Collector;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Joern Muehlencord (joern@muehlencord.de)
|
* @author Joern Muehlencord (joern@muehlencord.de)
|
||||||
*/
|
*/
|
||||||
public class StreamUtils {
|
public interface StreamUtils {
|
||||||
|
|
||||||
public static <T> Collector<T, ?, T> singletonCollector() {
|
default <T> Collector<T, ?, T> singletonCollector() {
|
||||||
return getCollectorFunction(getListTSingleFunction());
|
return getCollectorFunction(getListTSingleFunction());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> Collector<T, ?, T> getCollectorFunction(Function<List<T>, T> listTFunction) {
|
default <T> Collector<T, ?, T> getCollectorFunction(Function<List<T>, T> listTFunction) {
|
||||||
return Collectors.collectingAndThen(Collectors.toList(), listTFunction);
|
return Collectors.collectingAndThen(Collectors.toList(), listTFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> Function<List<T>, T> getListTSingleFunction() {
|
default <T> Function<List<T>, T> getListTSingleFunction() {
|
||||||
return list -> {
|
return list -> {
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
throw new IllegalStateException("List must not be null");
|
throw new IllegalStateException("List must not be null");
|
||||||
}
|
}
|
||||||
if (list.size() != 1) {
|
if (list.size() != 1) {
|
||||||
throw new IllegalStateException("List contains not exactly one element (size=" + list.size() + ")");
|
throw new IllegalStateException("List contains not exactly one element (size=" + list.size() + ")");
|
||||||
}
|
}
|
||||||
return list.get(0);
|
return list.get(0);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ package de.muehlencord.shared.util;
|
|||||||
*/
|
*/
|
||||||
public class StringEncodingException extends Exception {
|
public class StringEncodingException extends Exception {
|
||||||
|
|
||||||
protected final static String DEFAULT_MSG = "An encoding exception occurred";
|
protected static final String DEFAULT_MSG = "An encoding exception occurred";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of
|
* Creates a new instance of
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
* Copyright 2019 Joern Muehlencord (joern@muehlencord.de).
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -15,38 +15,38 @@
|
|||||||
*/
|
*/
|
||||||
package de.muehlencord.shared.util;
|
package de.muehlencord.shared.util;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Joern Muehlencord (joern@muehlencord.de)
|
* @author Joern Muehlencord (joern@muehlencord.de)
|
||||||
*/
|
*/
|
||||||
public class StringEncodingExceptionTest {
|
class StringEncodingExceptionTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testDefaultConstructor() {
|
||||||
|
StringEncodingException ex = new StringEncodingException();
|
||||||
|
assertEquals(StringEncodingException.DEFAULT_MSG, ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testMessageConstructor() {
|
||||||
|
String msg = "Test message";
|
||||||
|
StringEncodingException ex = new StringEncodingException(msg);
|
||||||
|
assertEquals(ex.getMessage(), msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testRootcauseConstructor() {
|
||||||
|
String msg = "Test message";
|
||||||
|
StringEncodingException rootCause = new StringEncodingException();
|
||||||
|
StringEncodingException ex = new StringEncodingException(msg, rootCause);
|
||||||
|
assertEquals(ex.getMessage(), msg);
|
||||||
|
assertEquals(ex.getCause(), rootCause);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testDefaultConstructor() {
|
|
||||||
StringEncodingException ex = new StringEncodingException();
|
|
||||||
assertTrue (ex.getMessage().equals (StringEncodingException.DEFAULT_MSG));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testMessageConstructor() {
|
|
||||||
String msg = "Test message";
|
|
||||||
StringEncodingException ex = new StringEncodingException(msg);
|
|
||||||
assertTrue (ex.getMessage().equals (msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testRootcauseConstructor() {
|
|
||||||
String msg = "Test message";
|
|
||||||
StringEncodingException rootCause = new StringEncodingException();
|
|
||||||
StringEncodingException ex = new StringEncodingException(msg, rootCause);
|
|
||||||
assertTrue (ex.getMessage().equals (msg));
|
|
||||||
assertTrue (ex.getCause().equals (rootCause));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user