This is an automated email from the ASF dual-hosted git repository. elserj pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/phoenix.git
commit ea7a21814dbfee181a1b3486b10d01d0b22d653f Author: Istvan Toth <st...@stoty.hu> AuthorDate: Mon Sep 2 13:53:17 2019 +0200 PHOENIX-5461 phoenix-pherf IT failures with JDK11 Closes #578 Signed-off-by: Josh Elser <els...@apache.org> --- phoenix-pherf/pom.xml | 22 +++++++++++++++++----- .../apache/phoenix/pherf/configuration/Column.java | 5 ----- .../pherf/configuration/XMLConfigParser.java | 16 +++++++++++++++- .../apache/phoenix/pherf/util/ResourceList.java | 3 ++- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/phoenix-pherf/pom.xml b/phoenix-pherf/pom.xml index 6ac62b3..31bd638 100644 --- a/phoenix-pherf/pom.xml +++ b/phoenix-pherf/pom.xml @@ -109,11 +109,23 @@ <artifactId>hadoop-minicluster</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + <!-- Java 11 --> + <dependency> + <groupId>jakarta.activation</groupId> + <artifactId>jakarta.activation-api</artifactId> + <version>1.2.1</version> + </dependency> + <dependency> + <groupId>org.glassfish.jaxb</groupId> + <artifactId>jaxb-runtime</artifactId> + <version>2.3.2</version> + <scope>test</scope> + </dependency> </dependencies> <build> diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/Column.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/Column.java index c121451..60646ea 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/Column.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/Column.java @@ -211,11 +211,6 @@ public class Column { @XmlElement(name = "datavalue") public void setDataValues(List<DataValue> dataValues) { this.dataValues = dataValues; - - // DataValue type is inherited from the column - for (DataValue value : dataValues) { - value.setType(getType()); - } } public String getPrefix() { diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java index 87b4403..104fab5 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/configuration/XMLConfigParser.java @@ -36,6 +36,7 @@ import javax.xml.transform.stream.StreamSource; import org.apache.phoenix.pherf.PherfConstants; import org.apache.phoenix.pherf.exception.FileLoaderException; +import org.apache.phoenix.pherf.rules.DataValue; import org.apache.phoenix.pherf.util.ResourceList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -176,7 +177,20 @@ public class XMLConfigParser { } for (Path path : this.paths) { System.out.println("Adding model for path:" + path.toString()); - this.dataModels.add(XMLConfigParser.readDataModel(path)); + DataModel dataModel = XMLConfigParser.readDataModel(path); + updateDataValueType(dataModel); + this.dataModels.add(dataModel); + } + } + + private void updateDataValueType(DataModel dataModel) { + for (Column column : dataModel.getDataMappingColumns()) { + if (column.getDataValues() != null) { + // DataValue type is inherited from the column + for (DataValue value : column.getDataValues()) { + value.setType(column.getType()); + } + } } } diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/ResourceList.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/ResourceList.java index df5dbf7..cec12d1 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/ResourceList.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/ResourceList.java @@ -28,6 +28,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.net.URI; import java.net.URL; +import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; @@ -130,7 +131,7 @@ public class ResourceList { ZipFile zf; try { zf = new ZipFile(file); - } catch (FileNotFoundException e) { + } catch (FileNotFoundException|NoSuchFileException e) { // Gracefully handle a jar listed on the classpath that doesn't actually exist. return Collections.emptyList(); } catch (final ZipException e) {