From ee21c742a4989ed3d359d0c56865b7d4d7cad786 Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Mon, 13 Sep 2021 18:55:46 +0200 Subject: [PATCH] updates for tomee 8 --- cust-services/pom.xml | 8 +++--- framework/pom.xml | 2 +- .../hsadmin/common/util/ReflectionUtil.java | 4 +-- .../login/cas/TicketValidatorFactory.java | 6 +++-- .../de/hsadmin/module/impl/AbstractVO.java | 4 +-- .../DefaultEnumPersistentObjectMapper.java | 4 ++- .../DefaultListParameterMapMapper.java | 5 ++-- .../DefaultListPersistentObjectMapper.java | 5 ++-- .../service/property/PropertyService.java | 5 ++-- pom.xml | 26 +++++++++---------- web/pom.xml | 9 ++----- 11 files changed, 40 insertions(+), 38 deletions(-) diff --git a/cust-services/pom.xml b/cust-services/pom.xml index 5f6582e..1856c06 100644 --- a/cust-services/pom.xml +++ b/cust-services/pom.xml @@ -5,7 +5,7 @@ de.hsadmin hsadmin-parent - 1.0.1 + 1.0.2 cust-webapp @@ -74,14 +74,14 @@ org.apache.maven.plugins maven-war-plugin - 3.0.0 + 3.3.1 true org.apache.maven.plugins - 3.0.2 + 3.2.0 maven-jar-plugin @@ -107,7 +107,7 @@ org.apache.openjpa openjpa-maven-plugin - 2.4.2 + ${openjpa.version} **/bo/*.class true diff --git a/framework/pom.xml b/framework/pom.xml index ddc1a78..f590e86 100644 --- a/framework/pom.xml +++ b/framework/pom.xml @@ -6,7 +6,7 @@ de.hsadmin hsadmin-parent - 1.0.1 + 1.0.2 framework jar diff --git a/framework/src/main/java/de/hsadmin/common/util/ReflectionUtil.java b/framework/src/main/java/de/hsadmin/common/util/ReflectionUtil.java index 073d530..114a295 100644 --- a/framework/src/main/java/de/hsadmin/common/util/ReflectionUtil.java +++ b/framework/src/main/java/de/hsadmin/common/util/ReflectionUtil.java @@ -59,10 +59,10 @@ public class ReflectionUtil { public static Object newInstance(final Object anObject, String propertyName) throws TechnicalException { try { final PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName, anObject.getClass()); - final Object newInstance = propertyDescriptor.getReadMethod().getReturnType().newInstance(); + final Object newInstance = propertyDescriptor.getReadMethod().getReturnType().getDeclaredConstructor().newInstance(); invokeSetter(anObject, propertyName, newInstance); return newInstance; - } catch (InstantiationException | IllegalAccessException | IntrospectionException | TechnicalException e) { + } catch (InstantiationException | IllegalAccessException | IntrospectionException | TechnicalException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new TechnicalException(e); } } diff --git a/framework/src/main/java/de/hsadmin/login/cas/TicketValidatorFactory.java b/framework/src/main/java/de/hsadmin/login/cas/TicketValidatorFactory.java index 7ccebda..6ab4a98 100644 --- a/framework/src/main/java/de/hsadmin/login/cas/TicketValidatorFactory.java +++ b/framework/src/main/java/de/hsadmin/login/cas/TicketValidatorFactory.java @@ -1,5 +1,7 @@ package de.hsadmin.login.cas; +import java.lang.reflect.InvocationTargetException; + import de.hsadmin.common.config.Config; import de.hsadmin.common.error.TechnicalException; import de.hsadmin.login.TicketValidator; @@ -12,8 +14,8 @@ public class TicketValidatorFactory { try { final String property = Config.getInstance().getProperty(Config.TICKETVALIDATOR_CLASS, "de.hsadmin.login.cas.CASTicketValidator"); final Class validatorClass = Class.forName(property); - ticketValidator = (TicketValidator) validatorClass.newInstance(); - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { + ticketValidator = (TicketValidator) validatorClass.getDeclaredConstructor().newInstance(); + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new TechnicalException(e); } } diff --git a/framework/src/main/java/de/hsadmin/module/impl/AbstractVO.java b/framework/src/main/java/de/hsadmin/module/impl/AbstractVO.java index a2f5527..245468f 100644 --- a/framework/src/main/java/de/hsadmin/module/impl/AbstractVO.java +++ b/framework/src/main/java/de/hsadmin/module/impl/AbstractVO.java @@ -131,8 +131,8 @@ public abstract class AbstractVO implements ValueObject { final Mapping mapping = f.getAnnotation(Mapping.class); if (mapping != null && newInstance instanceof AbstractProperty) { AbstractProperty prop = (AbstractProperty) newInstance; - PersistentObjectMapper persistentObjectMapper = mapping.boMapping().newInstance(); - ParameterMapMapper parameterMapMapper = mapping.rpcMapping().newInstance(); + PersistentObjectMapper persistentObjectMapper = mapping.boMapping().getDeclaredConstructor().newInstance(); + ParameterMapMapper parameterMapMapper = mapping.rpcMapping().getDeclaredConstructor().newInstance(); prop.setParameterMapMapper(parameterMapMapper); prop.setPersistentObjectMapper(persistentObjectMapper); if (persistentObjectMapper instanceof ReferredPropertyPath) { diff --git a/framework/src/main/java/de/hsadmin/module/property/mapping/DefaultEnumPersistentObjectMapper.java b/framework/src/main/java/de/hsadmin/module/property/mapping/DefaultEnumPersistentObjectMapper.java index b97dd0b..58f7fcb 100644 --- a/framework/src/main/java/de/hsadmin/module/property/mapping/DefaultEnumPersistentObjectMapper.java +++ b/framework/src/main/java/de/hsadmin/module/property/mapping/DefaultEnumPersistentObjectMapper.java @@ -26,8 +26,10 @@ public class DefaultEnumPersistentObjectMapper implements PersistentObjectMapper throws TechnicalException, UserException { final Class propertyClass = ReflectionUtil.getFieldType(persistentObject, propertyName); + @SuppressWarnings("rawtypes") + final Class aSubclass = propertyClass.asSubclass(Enum.class); @SuppressWarnings("unchecked") - final Enum enumValue = Enum.valueOf(propertyClass.asSubclass(Enum.class), value); + final Enum enumValue = Enum.valueOf(aSubclass, value); ReflectionUtil.invokeSetter(persistentObject, propertyName, enumValue); } } \ No newline at end of file diff --git a/framework/src/main/java/de/hsadmin/module/property/mapping/DefaultListParameterMapMapper.java b/framework/src/main/java/de/hsadmin/module/property/mapping/DefaultListParameterMapMapper.java index 6c5b2c5..6114553 100644 --- a/framework/src/main/java/de/hsadmin/module/property/mapping/DefaultListParameterMapMapper.java +++ b/framework/src/main/java/de/hsadmin/module/property/mapping/DefaultListParameterMapMapper.java @@ -1,5 +1,6 @@ package de.hsadmin.module.property.mapping; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -46,7 +47,7 @@ public class DefaultListParameterMapMapper implements Pa if (list instanceof Object[]) { for (Object obj : (Object[])list) { if (obj instanceof Map) { - final VO vo = (VO) elementsType.newInstance(); + final VO vo = (VO) elementsType.getDeclaredConstructor().newInstance(); final Map map = (Map) obj; for (Object key : map.keySet()) { if (key instanceof String) { @@ -58,7 +59,7 @@ public class DefaultListParameterMapMapper implements Pa } } } - } catch (InstantiationException | IllegalAccessException e) { + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new TechnicalException(e); } return value; diff --git a/framework/src/main/java/de/hsadmin/module/property/mapping/DefaultListPersistentObjectMapper.java b/framework/src/main/java/de/hsadmin/module/property/mapping/DefaultListPersistentObjectMapper.java index e660c96..47a76ef 100644 --- a/framework/src/main/java/de/hsadmin/module/property/mapping/DefaultListPersistentObjectMapper.java +++ b/framework/src/main/java/de/hsadmin/module/property/mapping/DefaultListPersistentObjectMapper.java @@ -1,5 +1,6 @@ package de.hsadmin.module.property.mapping; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -31,10 +32,10 @@ public class DefaultListPersistentObjectMapper implement final Collection coll = (Collection) object; for (Object o : coll) { try { - final VO newInstance = elementsType.newInstance(); + final VO newInstance = elementsType.getDeclaredConstructor().newInstance(); newInstance.copyPropertiesFromPersistentObject(o); valueList.add(newInstance); - } catch (InstantiationException | IllegalAccessException e) { + } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new TechnicalException(e); } } diff --git a/framework/src/main/java/de/hsadmin/service/property/PropertyService.java b/framework/src/main/java/de/hsadmin/service/property/PropertyService.java index 3876c79..3fce20e 100644 --- a/framework/src/main/java/de/hsadmin/service/property/PropertyService.java +++ b/framework/src/main/java/de/hsadmin/service/property/PropertyService.java @@ -1,6 +1,7 @@ package de.hsadmin.service.property; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; import java.util.Enumeration; import java.util.List; import java.util.Properties; @@ -66,7 +67,7 @@ public class PropertyService extends AbstractModule implements Prope continue; } final Class serviceRemoteClass = Class.forName(remoteServicesProperties.getProperty(moduleName)); - final AbstractRemote serviceRemote = (AbstractRemote) serviceRemoteClass.newInstance(); + final AbstractRemote serviceRemote = (AbstractRemote) serviceRemoteClass.getDeclaredConstructor().newInstance(); final ValueObject valueObject = serviceRemote.createValueObject(); final Class voClass = valueObject.getClass(); final List> propertiesList = valueObject.properties(); @@ -113,7 +114,7 @@ public class PropertyService extends AbstractModule implements Prope emptyList.add(vo); } } - } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException e) { + } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new TechnicalException(e); } return emptyList; diff --git a/pom.xml b/pom.xml index d9af2c7..1ffbd40 100644 --- a/pom.xml +++ b/pom.xml @@ -6,32 +6,32 @@ de.hsadmin hsadmin-parent pom - 1.0.1 + 1.0.2 HSAdmin Parent Project UTF-8 - 1.0.1 - 8.0.4 + 1.0.2 + 8.0.8 4.0.1 - 4.1.1 - 3.1.2 + 4.4.3 + 3.2.0 1.2.17 3.1.3 - 2.0.4 + 2.0.5 org.postgresql:postgresql:42.2.18 - 1.8 - 1.8 + 11 + 11 db-migration framework - ldap-services - + --> web cli @@ -40,12 +40,12 @@ org.apache.commons commons-lang3 - 3.11 + 3.12.0 junit junit - 4.13.1 + 4.13.2 test diff --git a/web/pom.xml b/web/pom.xml index 6e30d21..0c32fe0 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -5,7 +5,7 @@ de.hsadmin hsadmin-parent - 1.0.1 + 1.0.2 admin-web @@ -24,7 +24,7 @@ de.hsadmin framework - 1.0.1 + ${hsadmin.version} org.apache.xmlrpc @@ -90,11 +90,6 @@ maven-compiler-plugin 3.8.1 - - 1.8 - 1.8 - - org.apache.tomcat.maven