diff options
Diffstat (limited to 'plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/util/ReceptionUtil.java')
-rw-r--r-- | plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/util/ReceptionUtil.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/util/ReceptionUtil.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/util/ReceptionUtil.java index 9c0bab43..c26286da 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/util/ReceptionUtil.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/util/ReceptionUtil.java @@ -1,7 +1,6 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2022 Nordix Foundation. - * Modifications Copyright (C) 2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +21,7 @@ package org.onap.policy.distribution.reception.util; import java.io.IOException; +import java.io.InvalidClassException; import java.nio.file.Path; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -38,8 +38,12 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; */ public class ReceptionUtil { - private static StandardCoder coder = new StandardCoder(); - private static StandardYamlCoder yamlCoder = new StandardYamlCoder(); + private ReceptionUtil() throws InvalidClassException { + throw new InvalidClassException("Can't instantiate a helper class!"); + } + + private static final StandardCoder coder = new StandardCoder(); + private static final StandardYamlCoder yamlCoder = new StandardYamlCoder(); private static final long MAX_FILE_SIZE = 512L * 1024; /** @@ -66,7 +70,7 @@ public class ReceptionUtil { // // Throw an exception if path is outside the csar // - if (! path.startsWith(csarPath)) { + if (!path.startsWith(csarPath)) { throw new PolicyDecodingException("Potential path injection for zip entry " + entryName); } } |