From 6348f81bedf9b9a94691209b73db31245c3f9a67 Mon Sep 17 00:00:00 2001 From: Joern Muehlencord Date: Sat, 14 Sep 2019 17:54:26 +0200 Subject: [PATCH] updated API description --- .../configuration/BooleanParameter.java | 2 +- .../shared/configuration/Configuration.java | 35 ++- .../shared/configuration/DateParameter.java | 7 +- .../configuration/DefaultConfiguration.java | 3 +- .../configuration/IntegerParameter.java | 2 +- .../shared/configuration/StringParameter.java | 14 +- .../shared/configuration/URIParameter.java | 2 +- .../configuration/ValidationException.java | 2 +- .../shared/configuration/Validator.java | 2 +- .../converter/BooleanStringConverter.java | 2 +- .../validator/IntgerRangeValidator.java | 2 +- .../validator/StringValueListValidator.java | 2 +- .../shared/db/AbstractController.java | 48 +++- .../shared/db/CommonAbstractController.java | 154 ++++++++++- .../shared/jeeutil/DefaultUIMessage.java | 2 +- .../shared/jeeutil/GenericEnumType.java | 2 +- network/pom.xml | 5 - .../shared/network/ftp/FTPConnection.java | 253 ------------------ .../network/ftp/FTPConnectionException.java | 47 ---- .../shared/network/http/HttpLayer.java | 2 +- .../network/http/MessageNotSendException.java | 2 +- .../shared/network/ldap/LDAPConnection.java | 22 +- .../shared/network/ldap/LDAPContact.java | 6 +- .../shared/network/ldap/LDAPSearch.java | 92 ++++--- .../network/mail/DefaultMailReader.java | 8 +- .../shared/network/mail/MailMessage.java | 2 +- .../network/mail/MailMessageException.java | 2 +- .../shared/network/mail/MailMessageUtils.java | 2 +- .../shared/network/mail/MailReader.java | 4 +- .../network/mail/MailReaderConfiguration.java | 8 +- .../MailReaderConfigurationException.java | 2 +- .../mail/MailReaderConfigurationFactory.java | 2 +- .../network/mail/imap/ImapMailReader.java | 2 +- .../shared/network/whois/ArinWhoisParser.java | 2 +- .../shared/network/whois/Whois.java | 2 +- .../network/whois/WhoisInformation.java | 2 +- .../muehlencord/shared/network/BaseTest.java | 2 +- .../shared/network/ftp/FTPConnectionTest.java | 166 ------------ .../shared/network/http/HttpLayerTest.java | 3 +- .../network/mail/MailMessageUtilsTest.java | 2 +- pom.xml | 193 +++++++++---- shiro-faces/pom.xml | 10 - .../de/muehlencord/shared/util/DateUtil.java | 2 +- .../de/muehlencord/shared/util/OSUtil.java | 2 +- .../shared/util/SecurityException.java | 2 +- .../shared/util/StringEncodingException.java | 2 +- .../muehlencord/shared/util/StringUtil.java | 13 +- .../de/muehlencord/shared/util/file/BOM.java | 2 +- .../util/file/BOMStripperInputStream.java | 2 +- .../util/file/FileHandlingException.java | 2 +- .../shared/util/file/FileUtil.java | 2 +- .../muehlencord/shared/util/DefaultTest.java | 2 +- .../shared/util/StringUtilTest.java | 2 +- 53 files changed, 487 insertions(+), 670 deletions(-) delete mode 100644 network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnection.java delete mode 100644 network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnectionException.java delete mode 100644 network/src/test/java/de/muehlencord/shared/network/ftp/FTPConnectionTest.java diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/BooleanParameter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/BooleanParameter.java index b161b6a..52b5603 100644 --- a/configuration/src/main/java/de/muehlencord/shared/configuration/BooleanParameter.java +++ b/configuration/src/main/java/de/muehlencord/shared/configuration/BooleanParameter.java @@ -20,7 +20,7 @@ import de.muehlencord.shared.configuration.converter.BooleanStringConverter; /** * A Boolean parameter * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class BooleanParameter extends Parameter { diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/Configuration.java b/configuration/src/main/java/de/muehlencord/shared/configuration/Configuration.java index d6af2c7..da91f05 100644 --- a/configuration/src/main/java/de/muehlencord/shared/configuration/Configuration.java +++ b/configuration/src/main/java/de/muehlencord/shared/configuration/Configuration.java @@ -18,14 +18,16 @@ package de.muehlencord.shared.configuration; import java.util.Map; /** + * Specifies a configurable objects. * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public interface Configuration { /** * adds a new parameter to the configuration * + * @param the type of the parameter to add * @param p the parameter to add * @throws ConfigurationException if the parameter cannot be added */ @@ -34,25 +36,27 @@ public interface Configuration { /** * sets the value of the given parameter * - * @param - * @param p - * @param value + * @param the type of the parameter to add + * @param p the parameter to add + * @param value the value the parameter should have * @throws ConfigurationException if the parameter is not defined */ public void setParameterValue(Parameter p, T value) throws ConfigurationException; - + /** * sets the value of parameter with given name * + * @param the type of the parameter to add * @param parameterName parameter to set * @param value value to set * @throws ConfigurationException if the parameter is not defined */ - public void setParameterValue(String parameterName, T value) throws ConfigurationException; - + public void setParameterValue(String parameterName, T value) throws ConfigurationException; + /** * sets the value of the given parameter * + * @param the type of the parameter to add * @param p parameter to set * @param value value to set * @throws ConfigurationException if the parameter is not defined @@ -71,22 +75,26 @@ public interface Configuration { /** * returns the value of the given parameter * + * @param the type of the parameter to add * @param p the parameter to return the value for * @return the value of the given parameter; null if not set * - * @throws ConfigurationException if the parameter is not defined or if the value is not set + * @throws ConfigurationException if the parameter is not defined or if the + * value is not set */ public T getParameterValue(Parameter p) throws ConfigurationException; - + /** * returns the value of the given parameter * + * @param the type of the parameter to add * @param parameterName the name of the parameter to return the value for * @return the value of the given parameter; null if not set * - * @throws ConfigurationException if the parameter is not defined or if the value is not set + * @throws ConfigurationException if the parameter is not defined or if the + * value is not set */ - public T getParameterValue(String parameterName) throws ConfigurationException; + public T getParameterValue(String parameterName) throws ConfigurationException; /** * validates the configuration @@ -94,11 +102,12 @@ public interface Configuration { * @throws ConfigurationException if the configuration is invalid */ public void validateConfiguration() throws ConfigurationException; - + /** * returns the map of parameters and values * + * @param the type of the parameter to add * @return the map of parameters and values */ - public Map, T> getParameterMap(); + public Map, T> getParameterMap(); } diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/DateParameter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/DateParameter.java index 1060463..08e2628 100644 --- a/configuration/src/main/java/de/muehlencord/shared/configuration/DateParameter.java +++ b/configuration/src/main/java/de/muehlencord/shared/configuration/DateParameter.java @@ -20,7 +20,8 @@ import java.util.Date; /** * A Date parameter - * @author joern@muehlencord.de + * + * @author Joern Muehlencord (joern@muehlencord.de) */ public class DateParameter extends Parameter { @@ -47,7 +48,7 @@ public class DateParameter extends Parameter { * creates a new parameter object using default string converter * * @param name the name of the parameter - * @param mandatory detremines if this is a mandatory parameter or not + * @param mandatory determines if this is a mandatory parameter or not */ public DateParameter(String name, boolean mandatory) { super(name, new DateStringConverter(), mandatory); @@ -58,7 +59,7 @@ public class DateParameter extends Parameter { * * @param name the name of the parameter * @param converter the converter object to convert the value of the parameter to string and vice versa - * @param mandatory detremines if this is a mandatory parameter or not + * @param mandatory determines if this is a mandatory parameter or not */ public DateParameter(String name, StringConverter converter, boolean mandatory) { super(name, converter, mandatory); diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/DefaultConfiguration.java b/configuration/src/main/java/de/muehlencord/shared/configuration/DefaultConfiguration.java index db47cc1..9841fce 100644 --- a/configuration/src/main/java/de/muehlencord/shared/configuration/DefaultConfiguration.java +++ b/configuration/src/main/java/de/muehlencord/shared/configuration/DefaultConfiguration.java @@ -22,7 +22,7 @@ import java.util.Map; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class DefaultConfiguration implements Configuration { @@ -104,6 +104,7 @@ public class DefaultConfiguration implements Configuration { /** * overrides parameter map with given map * + * @param the type of the parameter to add * @param map map to use * @throws ConfigurationException if the parameter is not defined */ diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/IntegerParameter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/IntegerParameter.java index 8f0d49a..de30816 100644 --- a/configuration/src/main/java/de/muehlencord/shared/configuration/IntegerParameter.java +++ b/configuration/src/main/java/de/muehlencord/shared/configuration/IntegerParameter.java @@ -20,7 +20,7 @@ import de.muehlencord.shared.configuration.converter.IntegerStringConverter; /** * A Integer parameter * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class IntegerParameter extends Parameter { diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/StringParameter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/StringParameter.java index 51ed781..54f1157 100644 --- a/configuration/src/main/java/de/muehlencord/shared/configuration/StringParameter.java +++ b/configuration/src/main/java/de/muehlencord/shared/configuration/StringParameter.java @@ -19,7 +19,8 @@ import de.muehlencord.shared.configuration.converter.StringStringConverter; /** * A String parameter - * @author joern@muehlencord.de + * + * @author Joern Muehlencord (joern@muehlencord.de) */ public class StringParameter extends Parameter { @@ -31,22 +32,24 @@ public class StringParameter extends Parameter { public StringParameter(String name) { super(name, new StringStringConverter(), true); } - + /** * creates a new mandatory parameter object using default string converter * * @param name the name of the parameter + * @param defaultValue the default value of the parameter to set. */ public StringParameter(String name, String defaultValue) { super(name, new StringStringConverter(), true); this.defaultValue = defaultValue; - } + } /** * creates a new mandatory parameter object * * @param name the name of the parameter - * @param converter the converter object to convert the value of the parameter to string and vice versa + * @param converter the converter object to convert the value of the + * parameter to string and vice versa */ public StringParameter(String name, StringConverter converter) { super(name, converter, true); @@ -66,7 +69,8 @@ public class StringParameter extends Parameter { * creates a new parameter object * * @param name the name of the parameter - * @param converter the converter object to convert the value of the parameter to string and vice versa + * @param converter the converter object to convert the value of the + * parameter to string and vice versa * @param mandatory detremines if this is a mandatory parameter or not */ public StringParameter(String name, StringConverter converter, boolean mandatory) { diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/URIParameter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/URIParameter.java index cb0dff3..a61e50d 100644 --- a/configuration/src/main/java/de/muehlencord/shared/configuration/URIParameter.java +++ b/configuration/src/main/java/de/muehlencord/shared/configuration/URIParameter.java @@ -20,7 +20,7 @@ import java.net.URI; /** * A URI parameter - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class URIParameter extends Parameter { diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/ValidationException.java b/configuration/src/main/java/de/muehlencord/shared/configuration/ValidationException.java index abee0fc..eb1d21b 100644 --- a/configuration/src/main/java/de/muehlencord/shared/configuration/ValidationException.java +++ b/configuration/src/main/java/de/muehlencord/shared/configuration/ValidationException.java @@ -17,7 +17,7 @@ package de.muehlencord.shared.configuration; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class ValidationException extends Exception { diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/Validator.java b/configuration/src/main/java/de/muehlencord/shared/configuration/Validator.java index 42e6a10..7d37e17 100644 --- a/configuration/src/main/java/de/muehlencord/shared/configuration/Validator.java +++ b/configuration/src/main/java/de/muehlencord/shared/configuration/Validator.java @@ -18,7 +18,7 @@ package de.muehlencord.shared.configuration; /** * * @param the type of the validator - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public interface Validator { diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/converter/BooleanStringConverter.java b/configuration/src/main/java/de/muehlencord/shared/configuration/converter/BooleanStringConverter.java index cdaea5e..d5bd917 100644 --- a/configuration/src/main/java/de/muehlencord/shared/configuration/converter/BooleanStringConverter.java +++ b/configuration/src/main/java/de/muehlencord/shared/configuration/converter/BooleanStringConverter.java @@ -21,7 +21,7 @@ import static java.lang.Boolean.parseBoolean; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class BooleanStringConverter implements StringConverter { diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/validator/IntgerRangeValidator.java b/configuration/src/main/java/de/muehlencord/shared/configuration/validator/IntgerRangeValidator.java index 17c7781..413c111 100644 --- a/configuration/src/main/java/de/muehlencord/shared/configuration/validator/IntgerRangeValidator.java +++ b/configuration/src/main/java/de/muehlencord/shared/configuration/validator/IntgerRangeValidator.java @@ -20,7 +20,7 @@ import de.muehlencord.shared.configuration.Validator; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class IntgerRangeValidator implements Validator { diff --git a/configuration/src/main/java/de/muehlencord/shared/configuration/validator/StringValueListValidator.java b/configuration/src/main/java/de/muehlencord/shared/configuration/validator/StringValueListValidator.java index c36e81a..a001188 100644 --- a/configuration/src/main/java/de/muehlencord/shared/configuration/validator/StringValueListValidator.java +++ b/configuration/src/main/java/de/muehlencord/shared/configuration/validator/StringValueListValidator.java @@ -23,7 +23,7 @@ import java.util.List; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class StringValueListValidator implements Validator { diff --git a/db/src/main/java/de/muehlencord/shared/db/AbstractController.java b/db/src/main/java/de/muehlencord/shared/db/AbstractController.java index 36c2e34..175074c 100644 --- a/db/src/main/java/de/muehlencord/shared/db/AbstractController.java +++ b/db/src/main/java/de/muehlencord/shared/db/AbstractController.java @@ -34,7 +34,8 @@ import javax.persistence.criteria.Root; /** * * @author Joern Muehlencord (joern@muehlencord.de) - * @param + * @param the entity this controller will serve. All objects returned are of + * this type. */ public abstract class AbstractController extends CommonAbstractController { @@ -44,16 +45,26 @@ public abstract class AbstractController extends CommonA this.entityClass = clazz; } - /** - * * general find methods *** + * general find method + * + * @param id the primary key of the entity to search for. + * @return the found entity instance or null if the entity does not exist */ - @Lock(LockType.READ) public T find(Object id) { return em.find(entityClass, id); - } - + } + + /** + * general find method with the option to initialize lists/sets of 1:n + * relations during the query. + * + * @param id the primary key of the entity to search for. + * @param subGraphItems the name of the subgraph items to initialize. + * Typically this is the name of the 1:n set or list. + * @return the found entity instance or null if the entity does not exist + */ @Lock(LockType.READ) public T find(Object id, String... subGraphItems) { EntityGraph graph = this.em.createEntityGraph(entityClass); @@ -68,16 +79,32 @@ public abstract class AbstractController extends CommonA return entity; } + /** + * returns a list of all entities. + * + * @return a list of all entities. + */ @Lock(LockType.READ) public List findAll() { return findAll(new ArrayList<>()); } + /** + * returns a list of all entities. + * + * @param orderFields the list of field names to order the result by. + * @return a list of all entities. + */ @Lock(LockType.READ) public List findAll(String... orderFields) { return findAll(Arrays.asList(orderFields)); } + /** + * + * @param orderFields the list of field names to order the result by. + * @return a list of all entities. + */ @Lock(LockType.READ) public List findAll(List orderFields) { final CriteriaBuilder cb = em.getCriteriaBuilder(); @@ -92,6 +119,14 @@ public abstract class AbstractController extends CommonA return query.getResultList(); } + /** + * searches for entities by specifying a filter map. The map contains a + * field name and field value. + * + * @param filters the filters to apply + * @param orderFields the fields to order the result by. + * @return a list of found entities. + */ @Lock(LockType.READ) public List find(Map filters, List orderFields) { final CriteriaBuilder cb = em.getCriteriaBuilder(); @@ -108,6 +143,5 @@ public abstract class AbstractController extends CommonA return query.getResultList(); } - } diff --git a/db/src/main/java/de/muehlencord/shared/db/CommonAbstractController.java b/db/src/main/java/de/muehlencord/shared/db/CommonAbstractController.java index 2250a54..1e0d85f 100644 --- a/db/src/main/java/de/muehlencord/shared/db/CommonAbstractController.java +++ b/db/src/main/java/de/muehlencord/shared/db/CommonAbstractController.java @@ -44,20 +44,43 @@ import org.apache.commons.lang3.StringUtils; */ public abstract class CommonAbstractController { + /** + * the entity manager to use + */ @Inject @ApplicationPU protected EntityManager em; + /** + * + * @param the type of the entity to search for + * @param entityClass the entity class to return + * @return a list of all entities found + */ @Lock(LockType.READ) public List findAll(Class entityClass) { return findAll(entityClass, new ArrayList<>()); } + /** + * + * @param the type of the entity to search for + * @param entityClass the entity class to return + * @param orderFields the fields to order the result by. + * @return a list of all entities found + */ @Lock(LockType.READ) public List findAll(Class entityClass, String... orderFields) { return findAll(entityClass, Arrays.asList(orderFields)); } + /** + * + * @param the type of the entity to search for + * @param entityClass the entity class to return + * @param orderFields the fields to order the result by. + * @return a list of all entities found + */ @Lock(LockType.READ) public List findAll(Class entityClass, List orderFields) { final CriteriaBuilder cb = em.getCriteriaBuilder(); @@ -73,6 +96,17 @@ public abstract class CommonAbstractController { } /* **** standard crud options *** */ + /** + * updates the audit field of the entity class. + * + * @param audit the audit to apply + * @param onCreate specifies, whether the the update should be applied for a + * new entity or not. If yes, then also the createdBy /createdOn fields are + * updated. Otherwise these fields are skipped. + * @param changedBy the username to apply + * @return an updated audit object to use for the updated entity. + * @throws ControllerException + */ public Audit applyAuditChanges(Audit audit, boolean onCreate, String changedBy) throws ControllerException { if (audit == null) { audit = new Audit(); @@ -87,6 +121,16 @@ public abstract class CommonAbstractController { return audit; } + /** + * creates an new entity or if the entity already exists updates it + * + * @param the type of the entity to search for + * @param entity the entity to create or update + * @param createdBy the username to apply write into the audit history + * @return the entity after it has been written to the database. + * @throws ControllerException if the the creation or update of the entity + * fails. + */ @TransactionAttribute(TransactionAttributeType.REQUIRED) @Transactional @Lock(LockType.WRITE) @@ -99,6 +143,15 @@ public abstract class CommonAbstractController { } } + /** + * creates an new entity. + * + * @param the type of the entity to handle + * @param entity the entity to create or update + * @param createdBy the username to apply write into the audit history + * @return the entity after it has been written to the database. + * @throws ControllerException if the the creation fails + */ @TransactionAttribute(TransactionAttributeType.REQUIRED) @Transactional @Lock(LockType.WRITE) @@ -121,6 +174,15 @@ public abstract class CommonAbstractController { return entity; } + /** + * updates an existing entity. + * + * @param the type of the entity to handle + * @param entity the entity to update + * @param updatedBy the username to apply write into the audit history + * @return the entity after it has been written to the database. + * @throws ControllerException if the the updates fails + */ private T executeUpdate(T entity, String updatedBy) throws ControllerException { T currentEntity = attach(entity); if (Auditable.class.isAssignableFrom(currentEntity.getClass())) { @@ -145,6 +207,15 @@ public abstract class CommonAbstractController { return currentEntity; } + /** + * updates an existing entity. + * + * @param the type of the entity to handle + * @param entity the entity to update + * @param updatedBy the username to apply write into the audit history + * @return the entity after it has been written to the database. + * @throws ControllerException if the the updates fails + */ @TransactionAttribute(TransactionAttributeType.REQUIRED) @Transactional @Lock(LockType.WRITE) @@ -161,6 +232,16 @@ public abstract class CommonAbstractController { } } + /** + * Deletes an entity from the database. If the entity implements the + * {@link EndDateable} interface, the entity is not deleted but marked as + * deleted (end date set). + * + * @param the type of the entity to handle + * @param entity the entity to delete + * @param deletedBy the username to apply write into the audit history + * @throws ControllerException if the deletion fails. + */ @TransactionAttribute(TransactionAttributeType.REQUIRED) @Transactional @Lock(LockType.WRITE) @@ -174,20 +255,53 @@ public abstract class CommonAbstractController { } } + /** + * attaches the given entity + * + * @param the type of the entity to handle + * @param entity the entity to attach + * @return the entity after it has been attached + */ public T attach(T entity) { return em.merge(entity); } - - public void refresh (T entity) { + + /** + * Refreshes an entity. + * + * @param the type of the entity to handle + * @param entity the entity after it has been refreshed. + */ + public void refresh(T entity) { em.refresh(entity); } /* *** filter methods *** */ + /** + * Creates a filter condition. + * + * @param the type of the entity to handle + * @param cb the CriteriaBuilder to use + * @param root the root to use + * @param filters the filters to use + * @return the created filter condition + */ protected Predicate getFilterCondition(CriteriaBuilder cb, Root root, Map filters) { return getFilterCondition(cb, root, filters, null); } + /** + * Creates a filter condition. + * + * @param the type of the entity to handle + * @param cb the CriteriaBuilder to use + * @param root the root to use + * @param filters the filters to use + * @param excludeFilters the exclude filters to apply. Entities which match + * these filters, are not taken into the result list. + * @return the created filter condition + */ protected Predicate getFilterCondition(CriteriaBuilder cb, Root root, Map filters, Map excludeFilters) { // Predicate filterCondition = null; // filterCondition = getFilterCondition(filterCondition, cb, root, filters, true); @@ -208,14 +322,17 @@ public abstract class CommonAbstractController { } /** - * extends the given filterCondition by the addtional filters + * extends the given filterCondition by the additional filters * + * @param the type of the entity to handle * @param filterCondition the current filter condition * @param cb the criteria builder to use * @param root the root of the object to search for * @param filters the filters to apply - * @param include if set to true, the filter is used as include filter (equals, in). If set to false, the filter is inverted and used as exclude filter (not equals, not in etc) - * @return + * @param include if set to true, the filter is used as include filter + * (equals, in). If set to false, the filter is inverted and used as exclude + * filter (not equals, not in etc) + * @return the created filter condition */ protected Predicate getFilterCondition(Predicate filterCondition, CriteriaBuilder cb, Root root, Map filters, boolean include) { String wildCard = "%"; @@ -301,6 +418,14 @@ public abstract class CommonAbstractController { return filterCondition; } + /** + * Adds a filter condition to an existing condition + * + * @param cb the builder to use + * @param filterCondition the existing filter condition + * @param addCondition the condition to add to the existing condition. + * @return an updated filter condition. + */ protected Predicate addFilterCondition(CriteriaBuilder cb, Predicate filterCondition, Predicate addCondition) { if (addCondition == null) { return filterCondition; @@ -327,20 +452,23 @@ public abstract class CommonAbstractController { } /** - * returns null, if the list is empty or null itself. Returns the one element if there is exactly one element in the list. Otherwise an exception is thrown + * returns null, if the list is empty or null itself.Returns the one element + * if there is exactly one element in the list. Otherwise an exception is + * thrown * - * @param resultList - * @return - * @throws ControllerException + * @param the type of the entity to handle + * @param entityList the list to validate + * @return the one and only element of the provided list + * @throws ControllerException if the list contains more than one element. */ - public T ensureSingleElement(List resultList) throws ControllerException { - if ((resultList == null) || (resultList.isEmpty())) { + public T ensureSingleElement(List entityList) throws ControllerException { + if ((entityList == null) || (entityList.isEmpty())) { return null; } - if (resultList.size() > 1) { + if (entityList.size() > 1) { throw new ControllerException(ControllerException.CAUSE_TOO_MANY_ROWS, "More than one element found in list - expected exactly one"); } - return resultList.get(0); + return entityList.get(0); } } diff --git a/jeeutil/src/main/java/de/muehlencord/shared/jeeutil/DefaultUIMessage.java b/jeeutil/src/main/java/de/muehlencord/shared/jeeutil/DefaultUIMessage.java index 112d6e0..c3d9d64 100644 --- a/jeeutil/src/main/java/de/muehlencord/shared/jeeutil/DefaultUIMessage.java +++ b/jeeutil/src/main/java/de/muehlencord/shared/jeeutil/DefaultUIMessage.java @@ -20,7 +20,7 @@ import javax.faces.application.FacesMessage.Severity; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class DefaultUIMessage implements UIMessage { diff --git a/jeeutil/src/main/java/de/muehlencord/shared/jeeutil/GenericEnumType.java b/jeeutil/src/main/java/de/muehlencord/shared/jeeutil/GenericEnumType.java index 23df7d4..bebcbfa 100644 --- a/jeeutil/src/main/java/de/muehlencord/shared/jeeutil/GenericEnumType.java +++ b/jeeutil/src/main/java/de/muehlencord/shared/jeeutil/GenericEnumType.java @@ -29,7 +29,7 @@ import org.hibernate.usertype.UserType; /** * http://octagen.at/2014/10/postgresql-custom-data-types-enum-in-hibernate/ * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public abstract class GenericEnumType> implements UserType, Serializable { diff --git a/network/pom.xml b/network/pom.xml index fe5a61e..cfed573 100644 --- a/network/pom.xml +++ b/network/pom.xml @@ -44,11 +44,6 @@ limitations under the License. junit-jupiter-engine test - - com.enterprisedt - edtFTPj - compile - org.slf4j slf4j-api diff --git a/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnection.java b/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnection.java deleted file mode 100644 index acf9415..0000000 --- a/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnection.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * 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. - */ -package de.muehlencord.shared.network.ftp; - -import com.enterprisedt.net.ftp.FTPClient; -import com.enterprisedt.net.ftp.FTPConnectMode; -import com.enterprisedt.net.ftp.FTPException; -import com.enterprisedt.net.ftp.FTPFile; -import de.muehlencord.shared.util.StringUtil; -import java.io.File; -import java.io.IOException; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -/** - * - * @author joern@muehlencord.de - */ -public class FTPConnection { - - /** the default timeout in ms */ - public static final int DEFAULTTIMEOUT = 30000; - /** the logger object */ - private final static Logger LOGGER = LoggerFactory.getLogger(FTPConnection.class); - /** the username to connect with */ - private String userName; - /** the password to connect with */ - private String password; - /** the ftp client to use */ - private FTPClient client; - /** the remote host to connect to */ - private String remoteHost; - /** the locale of the client to use */ - private Locale clientLocale; - - /** - * creates a new ftp connection - * - * @param remoteHost the host to connect to - * @param userName the user to connect with - * @param password the password to connect with - */ - public FTPConnection(String remoteHost, String userName, String password) { - this(remoteHost, userName, password, Locale.getDefault()); - } - - /** - * creates a new ftp connection - * - * @param remoteHost the host to connect to - * @param userName the user to connect with - * @param password the password to connect with - * @param clientLocale the locale to use for the client - */ - public FTPConnection(String remoteHost, String userName, String password, Locale clientLocale) { - this.remoteHost = remoteHost; - this.userName = userName; - this.password = password; - this.clientLocale = clientLocale; - } - - /** - * connects the ftp client to the remote host - * - * @throws FTPConnectionException if the command cannot be executed - */ - public void connect() throws FTPConnectionException { - try { - client = new FTPClient(); - client.setConnectMode(FTPConnectMode.PASV); - client.setParserLocale(clientLocale); - client.setRemoteHost(remoteHost); - client.setTimeout(DEFAULTTIMEOUT); - client.connect(); - client.login(userName, password); - } catch (Exception ex) { - throw new FTPConnectionException("Error while connecting to ftp client. Reason: " + ex.getMessage(), ex); - } - } - - /** disconnects the ftp client from the remote host */ - public void disconnect() { - try { - client.quit(); - } catch (IOException | FTPException ex) { - LOGGER.error(ex.getMessage()); - LOGGER.debug(StringUtil.getStackTraceString(ex)); - } - } - - /** - * returns a list of files (as string) found in the given directory - * - * @param dir the directory to return the list for - * @return a list of files (as string) found in the given directory - * - * @throws FTPConnectionException if the command cannot be executed - */ - public List list(String dir) throws FTPConnectionException { - List returnValue = new LinkedList<>(); - try { - FTPFile[] files = client.dirDetails(dir); - for (FTPFile file : files) { - returnValue.add(file.getName()); - } - } catch (Exception ex) { - LOGGER.error(ex.getMessage()); - LOGGER.debug(StringUtil.getStackTraceString(ex)); - throw new FTPConnectionException("Error while getting diretoy listing. Reason: " + ex.getMessage(), ex); - } - - return returnValue; - } - - /** - * returns a list of directories contained in given directory - * - * @param dir the directory to return the subfolders for - * @return a list of subfolders of the given directory - * - * @throws FTPConnectionException if the command cannot be executed - */ - public List listDirsOnly(String dir) throws FTPConnectionException { - List returnValue = new LinkedList<>(); - try { - FTPFile[] files = client.dirDetails(dir); - for (FTPFile file : files) { - if (file.isDir()) { - returnValue.add(file.getName()); - } - } - } catch (Exception ex) { - LOGGER.error(ex.getMessage()); - LOGGER.debug(StringUtil.getStackTraceString(ex)); - throw new FTPConnectionException("Error while getting diretoy listing. Reason: " + ex.getMessage(), ex); - - } - - return returnValue; - } - - /** - * returns a list of files contained in the given folder - * - * @param dir the directory to list - * @return a list of files contained in the given folder - * - * @throws FTPConnectionException if the command cannot be executed - */ - public List listFilesOnly(String dir) throws FTPConnectionException { - List returnValue = new LinkedList<>(); - try { - FTPFile[] files = client.dirDetails(dir); - for (FTPFile file : files) { - if (!file.isDir()) { - returnValue.add(file.getName()); - } - } - } catch (Exception ex) { - LOGGER.error(ex.getMessage()); - LOGGER.debug(StringUtil.getStackTraceString(ex)); - throw new FTPConnectionException("Error while getting diretoy listing. Reason: " + ex.getMessage(), ex); - - } - - return returnValue; - } - - /** - * returns a list of links contained in the given folder - * - * @param dir the directory to list - * @return a list of links contained in the given folder - * - * @throws FTPConnectionException if the command cannot be executed - */ - public List listLinksOnly(String dir) throws FTPConnectionException { - List returnValue = new LinkedList<>(); - try { - FTPFile[] files = client.dirDetails(dir); - for (FTPFile file : files) { - if (file.isLink()) { - returnValue.add(file.getName()); - } - } - } catch (Exception ex) { - LOGGER.error(ex.getMessage()); - LOGGER.debug(StringUtil.getStackTraceString(ex)); - throw new FTPConnectionException("Error while getting diretoy listing. Reason: " + ex.getMessage(), ex); - - } - - return returnValue; - } - - /** - * uploads the given file and stores it under the given remote filename - including path - * - * @param localFilename the path and filename of the source file - * @param remoteFileName the path and filename of the destination file - * @throws FTPConnectionException if the command cannot be executed - */ - public void uploadFile(String localFilename, String remoteFileName) throws FTPConnectionException { - - try { - client.setDetectTransferMode(true); - if ((remoteFileName != null) && !remoteFileName.equals("")) { - client.put(localFilename, remoteFileName, false); - } else { - File f = new File(localFilename); - String remoteName = f.getName(); - client.put(localFilename, remoteName, false); - } - } catch (Exception ex) { - LOGGER.error(ex.getMessage()); - LOGGER.debug(StringUtil.getStackTraceString(ex)); - throw new FTPConnectionException("Error while uploading file. Reason: " + ex.getMessage(), ex); - - } - } - - /** - * renames a file on the remote host - * - * @param remoteOldName the current file name - * @param remoteNewName the new file name - * @throws FTPConnectionException if the command cannot be executed - */ - public void rename(String remoteOldName, String remoteNewName) throws FTPConnectionException { - try { - client.rename(remoteOldName, remoteNewName); - } catch (Exception ex) { - LOGGER.error(ex.getMessage()); - LOGGER.debug(StringUtil.getStackTraceString(ex)); - throw new FTPConnectionException("Error while renaming file. Reason: " + ex.getMessage(), ex); - } - } -} diff --git a/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnectionException.java b/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnectionException.java deleted file mode 100644 index a43c708..0000000 --- a/network/src/main/java/de/muehlencord/shared/network/ftp/FTPConnectionException.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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. - */ -package de.muehlencord.shared.network.ftp; - -/** - * - * @author Joern Muehlencord (joern@muehlencord.de) - */ -public class FTPConnectionException extends Exception { - - private static final long serialVersionUID = 1001347648193052240L; - - - /** - * Constructs an instance of - * FTPConnectionException with the specified detail message. - * - * @param msg the detail message. - */ - public FTPConnectionException(String msg) { - super(msg); - } - - /** - * Constructs an instance of - * FTPConnectionException with the specified detail message. - * - * @param msg the detail message. - * @param th the causing exception - */ - public FTPConnectionException(String msg, Throwable th) { - super(msg, th); - } -} diff --git a/network/src/main/java/de/muehlencord/shared/network/http/HttpLayer.java b/network/src/main/java/de/muehlencord/shared/network/http/HttpLayer.java index bb8c060..d1c8e11 100644 --- a/network/src/main/java/de/muehlencord/shared/network/http/HttpLayer.java +++ b/network/src/main/java/de/muehlencord/shared/network/http/HttpLayer.java @@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory; /** * Communication endpoint for posting a messages * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class HttpLayer { diff --git a/network/src/main/java/de/muehlencord/shared/network/http/MessageNotSendException.java b/network/src/main/java/de/muehlencord/shared/network/http/MessageNotSendException.java index 3402144..e3620a8 100644 --- a/network/src/main/java/de/muehlencord/shared/network/http/MessageNotSendException.java +++ b/network/src/main/java/de/muehlencord/shared/network/http/MessageNotSendException.java @@ -17,7 +17,7 @@ package de.muehlencord.shared.network.http; /** * This message is thrown if a message cannot be sent - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class MessageNotSendException extends Exception { diff --git a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPConnection.java b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPConnection.java index 4686a8c..199b5f9 100644 --- a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPConnection.java +++ b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPConnection.java @@ -25,9 +25,10 @@ import javax.naming.ldap.InitialLdapContext; import javax.naming.ldap.LdapContext; /** - * Inits and holds a connection to an ldap address directory - * @see javax.naming.ldap.LdapContext; - * @author dennis.nobel + * Initializes and holds a connection to an LDAP address directory + * {@link javax.naming.ldap.LdapContext} + * + * @author Joern Muehlencord (joern@muehlencord.de) */ public class LDAPConnection { @@ -91,7 +92,7 @@ public class LDAPConnection { } /** - * intializes connection to AD + * initialize connection to AD * @throws NamingException is thrown if connection to LDAP failed */ protected void init() throws NamingException { @@ -106,16 +107,23 @@ public class LDAPConnection { env.put(Context.SECURITY_PROTOCOL, securityProtocol); ldapContext = new InitialLdapContext(env, null); } - + /** - * @see javax.naming.ldap.LdapContext; + * {@link javax.naming.ldap.LdapContext} + * + * @param name the name to search for + * @param filter the filter to apply + * @param cons the search controls to use + * @return the result returned by the LDAP server + * @throws NamingException it the search fails */ public NamingEnumeration search(String name, String filter, SearchControls cons) throws NamingException { return ldapContext.search(name, filter, cons); } /** - * @see javax.naming.ldap.LdapContext; + * @throws javax.naming.NamingException if the close operation fails + * {@link javax.naming.ldap.LdapContext} */ public void close() throws NamingException { if (ldapContext != null) { diff --git a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPContact.java b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPContact.java index 6cac681..83826ab 100644 --- a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPContact.java +++ b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPContact.java @@ -16,9 +16,9 @@ package de.muehlencord.shared.network.ldap; /** - * Represents a contact in ldap address directory + * Represents a contact in LDAP address directory * - * @author Joern Muehlencord + * @author Joern Muehlencord (joern@muehlencord.de) */ public class LDAPContact { @@ -45,6 +45,8 @@ public class LDAPContact { private String countryCode = null; private boolean isEnabled = false; private String distinguishedName = null; + + /* *** getter / setter *** */ public String getType() { return type; diff --git a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPSearch.java b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPSearch.java index d08f4bf..7f5a968 100644 --- a/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPSearch.java +++ b/network/src/main/java/de/muehlencord/shared/network/ldap/LDAPSearch.java @@ -29,38 +29,45 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Connection to ldap server to searh by different values + * Connection to LDAP server to search by different values * - * @author Joern Muehlencord + * @author Joern Muehlencord (joern@muehlencord.de) */ public class LDAPSearch { private static final Logger LOGGER = LoggerFactory.getLogger(LDAPSearch.class); /** - * the ldap connection to use + * the LDAP connection to use */ private LDAPConnection ldapConnection; /** * the search base for all queries */ - private String searchBase; + private final String searchBase; /** - * Creates a new instance of a ldap search. + * Creates a new instance of a LDAP search. * - *

- * Important:
If you want to use ldaps - usually port 636 make sure you provide a trustkeystore in case your ldap server does not use a certificate which can be trusted by the build in root - * certificates. (e.g. self signed certificates)

+ *
+ * Important:
If you want to use LDAPs - usually port 636 make sure you + * provide a trustkeystore in case your LDAP server does not use a + * certificate which can be trusted by the build in root certificates. (e.g. + * self signed certificates) + *
* - *

- * To provide access to a trust center you can specify the following parameter to your application by providing the following parameter + *

+ * To provide access to a trust center you can specify the following + * parameter to your application by providing the following parameter *
      * -Djavax.net.ssl.trustStore=/path/to/truststore.keystore
-     * 

+ * + *
* - * @param url the url of the ldap server to connect to like ldap://ldapserver.your.domain:389 - * @param searchBase the search base to use - e.g. DC=domain,DC=tld + * @param url the url of the LDAP server to connect to like + * ldap://ldapserver.your.domain:389 + * @param searchBase the search base to use - e.g. + * DC=domain,DC=tld * @param username the username to connect with * @param password the password to connect with */ @@ -73,22 +80,29 @@ public class LDAPSearch { } /** - * Creates a new instance of a ldap search. + * Creates a new instance of a LDAP search. * - *

- * Important:
If you want to use ldaps - usually port 636 make sure you provide a trustkeystore in case your ldap server does not use a certificate which can be trusted by the build in root - * certificates. (e.g. self signed certificates)

+ *
+ * Important:
If you want to use LDAPs - usually port 636 make sure you + * provide a trustkeystore in case your LDAP server does not use a + * certificate which can be trusted by the build in root certificates. (e.g. + * self signed certificates) + *
* - *

- * To provide access to a trust center you can specify the following parameter to your application by providing the following parameter + *

+ * To provide access to a trust center you can specify the following + * parameter to your application by providing the following parameter *
      * -Djavax.net.ssl.trustStore=/path/to/truststore.keystore
-     * 

+ * + *
* * @param authentication the authentification type to use -e.g. "SIMPLE" - * @param url the url of the ldap server to connect to like ldap://ldapserver.your.domain:389 + * @param url the url of the ldap server to connect to like + * ldap://ldapserver.your.domain:389 * @param securityProtocol the security protocol to use - e.g. SIMPLE - * @param searchBase the search base to use - e.g. DC=domain,DC=tld + * @param searchBase the search base to use - e.g. + * DC=domain,DC=tld * @param username the username to connect with * @param password the password to connect with */ @@ -98,7 +112,10 @@ public class LDAPSearch { } /** - * execute several init steps, connect to ldap + * execute several init steps, connect to LDAP + * + * @throws de.muehlencord.shared.network.ldap.LDAPException if the + * connection cannot be established */ public void init() throws LDAPException { try { @@ -109,7 +126,10 @@ public class LDAPSearch { } /** - * close the ldap connection + * close the LDAP connection + * + * @throws de.muehlencord.shared.network.ldap.LDAPException if an error + * during closing appears. */ public void close() throws LDAPException { if (ldapConnection != null) { @@ -123,9 +143,9 @@ public class LDAPSearch { } /** - * Returns the search base of the ldap connection + * Returns the search base of the LDAP connection * - * @return the search base of the ldap connection + * @return the search base of the LDAP connection */ public String getSearchBase() { return searchBase; @@ -135,7 +155,7 @@ public class LDAPSearch { * Searches a contact according to emailaddress in the address directory * * @param email emailaddress to search for - * @return ldap contact or null if nothing could be found + * @return LDAP contact or null if nothing could be found * @throws LDAPException when search fails */ public LDAPContact searchContactWithEmail(String email) throws LDAPException { @@ -182,9 +202,10 @@ public class LDAPSearch { } /** - * Returns true, if the given email address can be found in the configured ldap + * Returns true, if the given email address can be found in the configured + * LDAP. * - * @param email the emailaddress to search for + * @param email the email address to search for * @return true, if the email address could be found; else false * @throws LDAPException if the search fails */ @@ -193,11 +214,16 @@ public class LDAPSearch { } /** - * Returns true, if the given email address is member of the given group, specified by the DN + * Returns true, if the given email address is member of the given group, + * specified by the DN * - * @param email the email to validat - * @param groupDn the group search base - all members must be found as "member" in this group - * @return + * @param email the email to validate + * @param groupDn the group search base - all members must be found as + * "member" in this group + * @return true, if the given contact, specified by the email address is + * member of the specified group. Otherwise false is returned. + * + * @throws de.muehlencord.shared.network.ldap.LDAPException */ public boolean isMemberOfGroup(String email, String groupDn) throws LDAPException { boolean returnValue = false; diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/DefaultMailReader.java b/network/src/main/java/de/muehlencord/shared/network/mail/DefaultMailReader.java index 422233a..93f1912 100644 --- a/network/src/main/java/de/muehlencord/shared/network/mail/DefaultMailReader.java +++ b/network/src/main/java/de/muehlencord/shared/network/mail/DefaultMailReader.java @@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory; /** * MailReader to connect and work with IMAP mailboxes. Also works with exchange servers. * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public abstract class DefaultMailReader implements MailReader { @@ -57,7 +57,7 @@ public abstract class DefaultMailReader implements MailReader { } /** - * onnects to the mailbox + * connects to the mailbox * * @throws MailReaderConnectionException if the connection cannot be established */ @@ -486,8 +486,8 @@ public abstract class DefaultMailReader implements MailReader { } /** - * asures the message can be read even if the underlaying IMAP server does not handle the message correctly. see - * http://www.oracle.com/technetwork/java/faq-135477.html for details + * ensure the message can be read even if the underlaying IMAP server does not handle the message correctly. see + * @see https://www.oracle.com/technetwork/java/faq-135477.html * * @param msg the message to read * @return the message in a readable format diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailMessage.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailMessage.java index a6635d2..8396d5f 100644 --- a/network/src/main/java/de/muehlencord/shared/network/mail/MailMessage.java +++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailMessage.java @@ -25,7 +25,7 @@ import javax.mail.internet.InternetAddress; /** * A mail message * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class MailMessage { diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageException.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageException.java index ef7d373..20aa2dc 100644 --- a/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageException.java +++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageException.java @@ -17,7 +17,7 @@ package de.muehlencord.shared.network.mail; /** * Exception used during mail handling - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class MailMessageException extends Exception { diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageUtils.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageUtils.java index d3f6774..cd98c60 100644 --- a/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageUtils.java +++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailMessageUtils.java @@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory; /** * Util class to convert between javax.mail.Message and MailMessage objects * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public abstract class MailMessageUtils { diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailReader.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailReader.java index 98cf722..432c046 100644 --- a/network/src/main/java/de/muehlencord/shared/network/mail/MailReader.java +++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailReader.java @@ -19,7 +19,7 @@ import java.util.List; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public interface MailReader { @@ -85,6 +85,8 @@ public interface MailReader { * retrieves the list of messages stored in the given folder * * @param folder the folder to search return the emails for + * @param start the number of the first message + * @param end the number of the last message * @return list of messages stored in the given folder * * @throws MailReaderException if the message list cannot be retrieved diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfiguration.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfiguration.java index c23c040..6ddb391 100644 --- a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfiguration.java +++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfiguration.java @@ -22,11 +22,11 @@ package de.muehlencord.shared.network.mail; public class MailReaderConfiguration { /** - * server for smtp sessions + * server for SMTP sessions */ private String smtpHost = null; /** - * server for incoming emails - e.g. the imap or pop3 server + * server for incoming emails - e.g. the IMAP or pop3 server */ private String readerHost = null; /** @@ -47,11 +47,12 @@ public class MailReaderConfiguration { private MailProtocol protocol = null; // TODO add checkConfig to asure the config is valid for the reader it is attached to + /** * creates a new config * * @param mailHost the smtp host to connect to - * @param host the mailreader host (imap, exchange, pop, ...) to connect to + * @param host the mailreader host (IMAP, exchange, pop, ...) to connect to * @param user the username to connect with * @param pw the password to connect with */ @@ -69,6 +70,7 @@ public class MailReaderConfiguration { * @param host the mailreader host (imap, exchange, pop, ...) to connect to * @param user the username to connect with * @param pw the password to connect with + * @param email the email address to use for sending emails */ public MailReaderConfiguration(String mailHost, String host, String user, String pw, String email) { this.smtpHost = mailHost; diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationException.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationException.java index 4440afd..360f2f6 100644 --- a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationException.java +++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationException.java @@ -17,7 +17,7 @@ package de.muehlencord.shared.network.mail; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class MailReaderConfigurationException extends Exception { diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationFactory.java b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationFactory.java index 07692d1..45715d7 100644 --- a/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationFactory.java +++ b/network/src/main/java/de/muehlencord/shared/network/mail/MailReaderConfigurationFactory.java @@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public abstract class MailReaderConfigurationFactory { diff --git a/network/src/main/java/de/muehlencord/shared/network/mail/imap/ImapMailReader.java b/network/src/main/java/de/muehlencord/shared/network/mail/imap/ImapMailReader.java index b495c68..fc18ee1 100644 --- a/network/src/main/java/de/muehlencord/shared/network/mail/imap/ImapMailReader.java +++ b/network/src/main/java/de/muehlencord/shared/network/mail/imap/ImapMailReader.java @@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory; /** * Implementation of MailReader to connect to an IMAP server * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class ImapMailReader extends DefaultMailReader { diff --git a/network/src/main/java/de/muehlencord/shared/network/whois/ArinWhoisParser.java b/network/src/main/java/de/muehlencord/shared/network/whois/ArinWhoisParser.java index 93e31ab..6c1bb8a 100644 --- a/network/src/main/java/de/muehlencord/shared/network/whois/ArinWhoisParser.java +++ b/network/src/main/java/de/muehlencord/shared/network/whois/ArinWhoisParser.java @@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class ArinWhoisParser extends AbstractWhoisParser implements WhoisParser { diff --git a/network/src/main/java/de/muehlencord/shared/network/whois/Whois.java b/network/src/main/java/de/muehlencord/shared/network/whois/Whois.java index ace59ea..1d3c145 100644 --- a/network/src/main/java/de/muehlencord/shared/network/whois/Whois.java +++ b/network/src/main/java/de/muehlencord/shared/network/whois/Whois.java @@ -23,7 +23,7 @@ import org.apache.commons.net.whois.WhoisClient; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class Whois { diff --git a/network/src/main/java/de/muehlencord/shared/network/whois/WhoisInformation.java b/network/src/main/java/de/muehlencord/shared/network/whois/WhoisInformation.java index df249e2..af660c5 100644 --- a/network/src/main/java/de/muehlencord/shared/network/whois/WhoisInformation.java +++ b/network/src/main/java/de/muehlencord/shared/network/whois/WhoisInformation.java @@ -21,7 +21,7 @@ import java.util.List; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class WhoisInformation { diff --git a/network/src/test/java/de/muehlencord/shared/network/BaseTest.java b/network/src/test/java/de/muehlencord/shared/network/BaseTest.java index d59b9e1..a5c4ba8 100644 --- a/network/src/test/java/de/muehlencord/shared/network/BaseTest.java +++ b/network/src/test/java/de/muehlencord/shared/network/BaseTest.java @@ -21,7 +21,7 @@ import java.io.InputStream; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public abstract class BaseTest { diff --git a/network/src/test/java/de/muehlencord/shared/network/ftp/FTPConnectionTest.java b/network/src/test/java/de/muehlencord/shared/network/ftp/FTPConnectionTest.java deleted file mode 100644 index 18914c6..0000000 --- a/network/src/test/java/de/muehlencord/shared/network/ftp/FTPConnectionTest.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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. - */ -package de.muehlencord.shared.network.ftp; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.net.URL; -import java.util.List; -import java.util.Locale; -import java.util.Properties; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Joern Muehlencord (joern@muehlencord.de) - */ -public class FTPConnectionTest { - - private final static Logger LOGGER = LoggerFactory.getLogger(FTPConnectionTest.class.getName()); - - /** the properties loaded from the config file */ - Properties props = null; - /** true, if init is complete to execute test */ - boolean initDone = false; - - @BeforeEach - public void setup() { - System.out.println("\n[FTPConnectionTest]"); - URL testConfigURL = FTPConnectionTest.class.getResource("/test.properties"); - FileInputStream fin = null; - try { - File file = new File(testConfigURL.toURI()); - props = new Properties(); - if ((file == null) || (!file.exists())) { - initDone = false; - - } else { - fin = new FileInputStream(file); - props.load(fin); - } - if ((props.containsKey("ftp.host")) && (props.containsKey("ftp.user")) && (props.containsKey("ftp.password")) && (props.containsKey("ftp.locale"))) { - initDone = true; - } else { - initDone = false; - } - } catch (Exception ex) { - initDone = false; - } finally { - try { - if (fin != null) { - fin.close(); - } - } catch (IOException ex) { - LOGGER.error (ex.toString(), ex); - } - } - } - - /** tests connect / disconnect */ - @Test - public void testConnectAndDisconnect() throws FTPConnectionException { - System.out.println("testConnectAndDisconnect"); - if (initDone) { - String remoteHost = props.getProperty("ftp.host"); - String user = props.getProperty("ftp.user"); - String password = props.getProperty("ftp.password"); - Locale locale = new Locale(props.getProperty("ftp.locale")); - - FTPConnection con = new FTPConnection(remoteHost, user, password, locale); - con.connect(); - con.disconnect(); - System.out.println("executed successfully"); - } else { - System.out.println("Skipped because config is not complete"); - } - } - - @Test - @Disabled - public void testList() throws FTPConnectionException { - System.out.println("list"); - String dir = ""; - FTPConnection instance = null; - List expResult = null; - List result = instance.list(dir); - assertEquals(expResult, result); - fail("The test case is a prototype."); - } - - @Test - @Disabled - public void testListDirsOnly() throws FTPConnectionException { - System.out.println("listDirsOnly"); - String dir = ""; - FTPConnection instance = null; - List expResult = null; - List result = instance.listDirsOnly(dir); - assertEquals(expResult, result); - fail("The test case is a prototype."); - } - - @Test - @Disabled - public void testListFilesOnly() throws FTPConnectionException { - System.out.println("listFilesOnly"); - String dir = ""; - FTPConnection instance = null; - List expResult = null; - List result = instance.listFilesOnly(dir); - assertEquals(expResult, result); - fail("The test case is a prototype."); - } - - @Test - @Disabled - public void testListLinksOnly() throws FTPConnectionException { - System.out.println("listLinksOnly"); - String dir = ""; - FTPConnection instance = null; - List expResult = null; - List result = instance.listLinksOnly(dir); - assertEquals(expResult, result); - fail("The test case is a prototype."); - } - - @Test - @Disabled - public void testUploadFile() throws FTPConnectionException { - System.out.println("uploadFile"); - String localFilename = ""; - String remoteFileName = ""; - FTPConnection instance = null; - instance.uploadFile(localFilename, remoteFileName); - } - - @Test - @Disabled - public void testRename() throws FTPConnectionException { - System.out.println("rename"); - String remoteOldName = ""; - String remoteNewName = ""; - FTPConnection instance = null; - instance.rename(remoteOldName, remoteNewName); - fail("The test case is a prototype."); - } -} diff --git a/network/src/test/java/de/muehlencord/shared/network/http/HttpLayerTest.java b/network/src/test/java/de/muehlencord/shared/network/http/HttpLayerTest.java index a1b4c36..edf3bec 100644 --- a/network/src/test/java/de/muehlencord/shared/network/http/HttpLayerTest.java +++ b/network/src/test/java/de/muehlencord/shared/network/http/HttpLayerTest.java @@ -38,8 +38,7 @@ public class HttpLayerTest extends BaseTest { String[] value = {"Hello World!", "Hello World again"}; map.put("message", value); - HttpLayer httpLayer = new HttpLayer( - "http://localhost:8080/HttpPostListener/HttpPostListener"); + HttpLayer httpLayer = new HttpLayer("http://localhost:8080/HttpPostListener/HttpPostListener"); httpLayer.post(map); } diff --git a/network/src/test/java/de/muehlencord/shared/network/mail/MailMessageUtilsTest.java b/network/src/test/java/de/muehlencord/shared/network/mail/MailMessageUtilsTest.java index 1388b01..50565a7 100644 --- a/network/src/test/java/de/muehlencord/shared/network/mail/MailMessageUtilsTest.java +++ b/network/src/test/java/de/muehlencord/shared/network/mail/MailMessageUtilsTest.java @@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class MailMessageUtilsTest extends BaseTest { diff --git a/pom.xml b/pom.xml index ab910de..fedc3d1 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,7 @@ limitations under the License. 1.2-SNAPSHOT pom shared + configuration network @@ -34,10 +35,43 @@ limitations under the License. + scm:git:https://jomu.timelord.de/git/jomu/shared/ scm:git:https://jomu.timelord.de/git/jomu/shared/ + https://jomu.timelord.de/git/jomu/shared/ HEAD + + Gitea + https://jomu.timelord.de/git/jomu/shared/issues + + + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0 + repo + + + + + + Joern Muehlencord + joern@muehlencord.de + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + UTF-8 @@ -67,12 +101,7 @@ limitations under the License. de.muehlencord.shared shared-jeeutil 1.2-SNAPSHOT -
- - de.muehlencord.sf - filter - 1.1-SNAPSHOT - + commons-codec commons-codec @@ -157,13 +186,6 @@ limitations under the License. 7.0 provided - - - com.enterprisedt - edtFTPj - 1.5.3 - - com.lambdaworks scrypt @@ -207,18 +229,6 @@ limitations under the License. omnifaces 3.3 - - com.sun.faces - jsf-api - 2.2.20 - provided - - - javax.el - javax.el-api - 3.0.0 - provided - org.apache.poi poi-ooxml @@ -228,7 +238,7 @@ limitations under the License. com.inversoft prime-jwt 2.0.0 - + @@ -237,25 +247,106 @@ limitations under the License. 5.5.1 test - - org.mockito - mockito-core - 2.28.2 - test - - - org.mockito - mockito-junit-jupiter - 2.28.2 - test - - - + + + + + release + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + true + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.1.0 + + + attach-sources + + jar-no-fork + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.1.1 + + + attach-javadocs + + jar + + + + + + + + org.codehaus.mojo + license-maven-plugin + 1.14 + + + download-licenses + generate-resources + + download-licenses + add-third-party + + + ${licenses.dir} + ${licenses.dir} + + The Apache Software License, Version 2.0|Apache 2|Apache License, Version 2.0|Apache Public License 2.0 + + + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + + + + + - + + org.apache.maven.plugins maven-compiler-plugin @@ -266,27 +357,21 @@ limitations under the License. true - - org.codehaus.mojo - jaxb2-maven-plugin - 2.5.0 - + + org.apache.maven.plugins maven-ejb-plugin 3.0.1 - - - - com.helger.maven - jaxws-maven-plugin - 2.6.2 - + + + maven-release-plugin 2.5.3 + org.apache.maven.plugins maven-surefire-plugin @@ -294,6 +379,8 @@ limitations under the License. + + org.apache.maven.plugins diff --git a/shiro-faces/pom.xml b/shiro-faces/pom.xml index 4b16756..b03c159 100644 --- a/shiro-faces/pom.xml +++ b/shiro-faces/pom.xml @@ -35,16 +35,6 @@ limitations under the License. shiro-web provided - - com.sun.faces - jsf-api - provided - - - javax.el - javax.el-api - provided - javax javaee-api diff --git a/util/src/main/java/de/muehlencord/shared/util/DateUtil.java b/util/src/main/java/de/muehlencord/shared/util/DateUtil.java index 9a3782c..0f01bef 100644 --- a/util/src/main/java/de/muehlencord/shared/util/DateUtil.java +++ b/util/src/main/java/de/muehlencord/shared/util/DateUtil.java @@ -25,7 +25,7 @@ import java.util.Date; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class DateUtil { diff --git a/util/src/main/java/de/muehlencord/shared/util/OSUtil.java b/util/src/main/java/de/muehlencord/shared/util/OSUtil.java index 30add78..e9799b0 100644 --- a/util/src/main/java/de/muehlencord/shared/util/OSUtil.java +++ b/util/src/main/java/de/muehlencord/shared/util/OSUtil.java @@ -20,7 +20,7 @@ import java.util.Locale; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public abstract class OSUtil { diff --git a/util/src/main/java/de/muehlencord/shared/util/SecurityException.java b/util/src/main/java/de/muehlencord/shared/util/SecurityException.java index e290c53..e4e7b97 100644 --- a/util/src/main/java/de/muehlencord/shared/util/SecurityException.java +++ b/util/src/main/java/de/muehlencord/shared/util/SecurityException.java @@ -17,7 +17,7 @@ package de.muehlencord.shared.util; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class SecurityException extends Exception { diff --git a/util/src/main/java/de/muehlencord/shared/util/StringEncodingException.java b/util/src/main/java/de/muehlencord/shared/util/StringEncodingException.java index 946dbe1..8012850 100644 --- a/util/src/main/java/de/muehlencord/shared/util/StringEncodingException.java +++ b/util/src/main/java/de/muehlencord/shared/util/StringEncodingException.java @@ -17,7 +17,7 @@ package de.muehlencord.shared.util; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class StringEncodingException extends Exception { diff --git a/util/src/main/java/de/muehlencord/shared/util/StringUtil.java b/util/src/main/java/de/muehlencord/shared/util/StringUtil.java index 22a3ad3..da38628 100644 --- a/util/src/main/java/de/muehlencord/shared/util/StringUtil.java +++ b/util/src/main/java/de/muehlencord/shared/util/StringUtil.java @@ -19,13 +19,12 @@ import java.io.UnsupportedEncodingException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.text.ParseException; -import java.util.HashMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public abstract class StringUtil { @@ -72,15 +71,11 @@ public abstract class StringUtil { } /** - * fills s with blanks if s < length - * - * - * - * + * fills s with blanks if s < length * * @param length the needed length for this field * @param s the field to extend with blanks - * @return s extended by trainling blanks. s.length == length + * @return s extended by trailing blanks. s.length == length */ public static String getBlankedString(int length, String s) { if (s == null) { @@ -100,7 +95,7 @@ public abstract class StringUtil { * * @param content the string to get the value from * @param keyWord1 the starting keyword - * @param keyWord2 the end keywod + * @param keyWord2 the end keyword * @return the string between keyword1 and keyword2 * @throws ParseException if the value cannot be determined - e.g. if one of the keywords is not found */ diff --git a/util/src/main/java/de/muehlencord/shared/util/file/BOM.java b/util/src/main/java/de/muehlencord/shared/util/file/BOM.java index 01414bb..157ed26 100644 --- a/util/src/main/java/de/muehlencord/shared/util/file/BOM.java +++ b/util/src/main/java/de/muehlencord/shared/util/file/BOM.java @@ -23,7 +23,7 @@ import java.util.Map; /** * Defines possbile file Byte Order Marks used in files. * - * @see http://en.wikipedia.org/wiki/Byte-order_mark + * @see https://en.wikipedia.org/wiki/Byte-order_mark * @author Joern Muehlencord (joern@muehlencord.de) */ public class BOM { diff --git a/util/src/main/java/de/muehlencord/shared/util/file/BOMStripperInputStream.java b/util/src/main/java/de/muehlencord/shared/util/file/BOMStripperInputStream.java index ed9bf02..a5c8186 100644 --- a/util/src/main/java/de/muehlencord/shared/util/file/BOMStripperInputStream.java +++ b/util/src/main/java/de/muehlencord/shared/util/file/BOMStripperInputStream.java @@ -29,7 +29,7 @@ public class BOMStripperInputStream extends PushbackInputStream { /** * List of all possible BOMS * - * @see http://en.wikipedia.org/wiki/Byte-order_mark for details + * @see https://en.wikipedia.org/wiki/Byte-order_mark */ protected static final int[][] BOMS = { BOM.BOM_UTF32_BE, diff --git a/util/src/main/java/de/muehlencord/shared/util/file/FileHandlingException.java b/util/src/main/java/de/muehlencord/shared/util/file/FileHandlingException.java index 064e3a1..6222c1d 100644 --- a/util/src/main/java/de/muehlencord/shared/util/file/FileHandlingException.java +++ b/util/src/main/java/de/muehlencord/shared/util/file/FileHandlingException.java @@ -19,7 +19,7 @@ import java.io.Serializable; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class FileHandlingException extends Exception implements Serializable { diff --git a/util/src/main/java/de/muehlencord/shared/util/file/FileUtil.java b/util/src/main/java/de/muehlencord/shared/util/file/FileUtil.java index e9aa416..8660f68 100644 --- a/util/src/main/java/de/muehlencord/shared/util/file/FileUtil.java +++ b/util/src/main/java/de/muehlencord/shared/util/file/FileUtil.java @@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public abstract class FileUtil { diff --git a/util/src/test/java/de/muehlencord/shared/util/DefaultTest.java b/util/src/test/java/de/muehlencord/shared/util/DefaultTest.java index 9388d5e..b2deeec 100644 --- a/util/src/test/java/de/muehlencord/shared/util/DefaultTest.java +++ b/util/src/test/java/de/muehlencord/shared/util/DefaultTest.java @@ -21,7 +21,7 @@ import java.io.InputStream; /** * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public abstract class DefaultTest { diff --git a/util/src/test/java/de/muehlencord/shared/util/StringUtilTest.java b/util/src/test/java/de/muehlencord/shared/util/StringUtilTest.java index a154ef2..b043095 100644 --- a/util/src/test/java/de/muehlencord/shared/util/StringUtilTest.java +++ b/util/src/test/java/de/muehlencord/shared/util/StringUtilTest.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test; /** * Basic StringUtilTests * - * @author joern@muehlencord.de + * @author Joern Muehlencord (joern@muehlencord.de) */ public class StringUtilTest extends DefaultTest {