updates for tomee 8

This commit is contained in:
Peter Hormanns 2021-09-13 18:55:46 +02:00
parent df9986361f
commit ee21c742a4
11 changed files with 40 additions and 38 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>de.hsadmin</groupId>
<artifactId>hsadmin-parent</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
</parent>
<artifactId>cust-webapp</artifactId>
@ -74,14 +74,14 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<version>3.3.1</version>
<configuration>
<archiveClasses>true</archiveClasses>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>3.0.2</version>
<version>3.2.0</version>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
@ -107,7 +107,7 @@
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>2.4.2</version>
<version>${openjpa.version}</version>
<configuration>
<includes>**/bo/*.class</includes>
<addDefaultConstructor>true</addDefaultConstructor>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>de.hsadmin</groupId>
<artifactId>hsadmin-parent</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
</parent>
<artifactId>framework</artifactId>
<packaging>jar</packaging>

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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) {

View File

@ -26,8 +26,10 @@ public class DefaultEnumPersistentObjectMapper implements PersistentObjectMapper
throws TechnicalException, UserException {
final Class<?> propertyClass = ReflectionUtil.getFieldType(persistentObject, propertyName);
@SuppressWarnings("rawtypes")
final Class<? extends Enum> 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);
}
}

View File

@ -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<VO extends ValueObject> 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<VO extends ValueObject> implements Pa
}
}
}
} catch (InstantiationException | IllegalAccessException e) {
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
throw new TechnicalException(e);
}
return value;

View File

@ -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<VO extends ValueObject> 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);
}
}

View File

@ -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<PropertyVO> implements Prope
continue;
}
final Class<?> serviceRemoteClass = Class.forName(remoteServicesProperties.getProperty(moduleName));
final AbstractRemote<ValueObject> serviceRemote = (AbstractRemote<ValueObject>) serviceRemoteClass.newInstance();
final AbstractRemote<ValueObject> serviceRemote = (AbstractRemote<ValueObject>) serviceRemoteClass.getDeclaredConstructor().newInstance();
final ValueObject valueObject = serviceRemote.createValueObject();
final Class<? extends ValueObject> voClass = valueObject.getClass();
final List<Property<?>> propertiesList = valueObject.properties();
@ -113,7 +114,7 @@ public class PropertyService extends AbstractModule<PropertyVO> 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;

26
pom.xml
View File

@ -6,32 +6,32 @@
<groupId>de.hsadmin</groupId>
<artifactId>hsadmin-parent</artifactId>
<packaging>pom</packaging>
<version>1.0.1</version>
<version>1.0.2</version>
<name>HSAdmin Parent Project</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hsadmin.version>1.0.1</hsadmin.version>
<tomee.version>8.0.4</tomee.version>
<hsadmin.version>1.0.2</hsadmin.version>
<tomee.version>8.0.8</tomee.version>
<servlet.version>4.0.1</servlet.version>
<liquibase.version>4.1.1</liquibase.version>
<openjpa.version>3.1.2</openjpa.version>
<liquibase.version>4.4.3</liquibase.version>
<openjpa.version>3.2.0</openjpa.version>
<log4j.version>1.2.17</log4j.version>
<xmlrpc.version>3.1.3</xmlrpc.version>
<bval.version>2.0.4</bval.version>
<bval.version>2.0.5</bval.version>
<postgresql.lib>org.postgresql:postgresql:42.2.18</postgresql.lib>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<modules>
<module>db-migration</module>
<module>framework</module>
<module>ldap-services</module>
<!--
<module>cust-services</module>
<!--
<module>ldap-services</module>
<module>database-services</module>
-->
-->
<module>web</module>
<module>cli</module>
</modules>
@ -40,12 +40,12 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>de.hsadmin</groupId>
<artifactId>hsadmin-parent</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
</parent>
<artifactId>admin-web</artifactId>
@ -24,7 +24,7 @@
<dependency>
<groupId>de.hsadmin</groupId>
<artifactId>framework</artifactId>
<version>1.0.1</version>
<version>${hsadmin.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.xmlrpc</groupId>
@ -90,11 +90,6 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgument></compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>