From 9aebca77a031f8e76e119bc32adf27153f413a87 Mon Sep 17 00:00:00 2001 From: Sandro La Bruzzo Date: Mon, 29 Jan 2024 14:41:02 +0100 Subject: [PATCH] Added exception throwing in Hadoop transformation when TR is not syntactically valid --- .../xslt/XSLTTransformationFunction.java | 19 +- .../transformation/TransformationJobTest.java | 14 ++ .../eu/dnetlib/dhp/transform/invalid.xslt | 185 ++++++++++++++++++ 3 files changed, 212 insertions(+), 6 deletions(-) create mode 100644 dhp-workflows/dhp-aggregation/src/test/resources/eu/dnetlib/dhp/transform/invalid.xslt diff --git a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/transformation/xslt/XSLTTransformationFunction.java b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/transformation/xslt/XSLTTransformationFunction.java index 54192a7be..247915d17 100644 --- a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/transformation/xslt/XSLTTransformationFunction.java +++ b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/transformation/xslt/XSLTTransformationFunction.java @@ -48,7 +48,7 @@ public class XSLTTransformationFunction implements MapFunctiontr.call(mr)); + + } + private XSLTTransformationFunction loadTransformationRule(final String path) throws Exception { final String trValue = IOUtils.toString(this.getClass().getResourceAsStream(path)); final LongAccumulator la = new LongAccumulator(); diff --git a/dhp-workflows/dhp-aggregation/src/test/resources/eu/dnetlib/dhp/transform/invalid.xslt b/dhp-workflows/dhp-aggregation/src/test/resources/eu/dnetlib/dhp/transform/invalid.xslt new file mode 100644 index 000000000..3c84e08e7 --- /dev/null +++ b/dhp-workflows/dhp-aggregation/src/test/resources/eu/dnetlib/dhp/transform/invalid.xslt @@ -0,0 +1,185 @@ + + + + + + + + +asdf;klamsdof'sdn & + + c:format'" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file