warnings removed

This commit is contained in:
lucio 2024-03-15 15:14:26 +01:00
parent e11b2147da
commit eefa46cbf6
5 changed files with 15 additions and 16 deletions

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>

View File

@ -45,11 +45,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.2</version>
</dependency>
</dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.tika/tika-parsers -->
</dependencyManagement>

View File

@ -92,6 +92,7 @@ public class Item2NodeConverter {
}
@SuppressWarnings("unchecked")
private void iterateItemNodeAttributeFields(Object object, Node parentNode, String nodeName) throws Exception{
AttributeRootNode attributeRootNode = object.getClass().getAnnotation(AttributeRootNode.class);
@ -268,6 +269,7 @@ public class Item2NodeConverter {
node.setProperty(NodeProperty.DESCRIPTION.toString(), description);
}
@SuppressWarnings("unchecked")
public void updateOwnerOnSubTree(Node node, String owner) throws RepositoryException, BackendGenericError {
Class<? extends Item> classToHandle = (Class<? extends Item>)ClassHandler.instance().get(node.getPrimaryNodeType().getName());
if (classToHandle==null) return;

View File

@ -104,7 +104,7 @@ public class Node2ItemConverter {
private <T extends Item> T retrieveItem(Node node, List<String> excludes, Class<T> classToHandle) throws RepositoryException, BackendGenericError{
T item;
try {
item = classToHandle.newInstance();
item = classToHandle.getDeclaredConstructor().newInstance();
}catch (Exception e) {
throw new BackendGenericError(e);
}
@ -194,7 +194,7 @@ public class Node2ItemConverter {
}
private <T> T iterateNodeAttributeFields(Class<T> clazz, Node node) throws Exception{
T obj = clazz.newInstance();
T obj = clazz.getDeclaredConstructor().newInstance();
for (Field field : retrieveAllFields(clazz)){
if (field.isAnnotationPresent(Attribute.class)){
setAttributeFieldCheckingDefault(field, obj, node);
@ -252,6 +252,7 @@ public class Node2ItemConverter {
}
@SuppressWarnings("unchecked")
private <T> void setListNode(Field field, T instance, Node node) throws Exception{
field.setAccessible(true);
String exclude = field.getAnnotation(ListNodes.class).excludeTypeStartWith();

View File

@ -16,9 +16,10 @@ import org.slf4j.LoggerFactory;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.Protocol;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.S3ClientOptions;
import com.amazonaws.services.s3.model.ObjectMetadata;
@ -31,9 +32,6 @@ public class S3Backend extends StorageBackend{
String bucketName;
AmazonS3 client;
//private static final long PART_SIZE = 100000000;
@Override
protected void setPayloadConfiguration(PayloadBackend payloadConfiguration) {
super.setPayloadConfiguration(payloadConfiguration);
@ -56,9 +54,12 @@ public class S3Backend extends StorageBackend{
ClientConfiguration clientConfig = new ClientConfiguration();
clientConfig.setProtocol(Protocol.HTTPS);
client = new AmazonS3Client(credentials, clientConfig);
client = AmazonS3ClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(credentials)).withClientConfiguration(clientConfig).build();
client.setEndpoint(url);
client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true));
client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build());
if (createBucket && !client.doesBucketExistV2(bucketName)) {
client.createBucket(bucketName);