Skip to content

Commit 7fcec13

Browse files
committed
fix(data): make MetadataHelper throw runtime exception
Due to the changed behaviour of the handlers throwing HandlerExceptions only, we need to throw the runtime exception InternalOAIException. This also makes more sense, as the exceptions does not happen because of a malicious user request (which is what we have been using the explicit exceptions for).
1 parent a9050f7 commit 7fcec13

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

xoai-data-provider/src/main/java/io/gdcc/xoai/dataprovider/handlers/helpers/MetadataHelper.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package io.gdcc.xoai.dataprovider.handlers.helpers;
22

3-
import io.gdcc.xoai.exceptions.OAIException;
3+
import io.gdcc.xoai.dataprovider.exceptions.InternalOAIException;
44
import io.gdcc.xoai.dataprovider.model.Context;
55
import io.gdcc.xoai.dataprovider.model.MetadataFormat;
66
import io.gdcc.xoai.model.oaipmh.results.record.Metadata;
77
import io.gdcc.xoai.xml.EchoElement;
88
import io.gdcc.xoai.xml.XSLPipeline;
99
import io.gdcc.xoai.xml.XmlWriter;
10-
import io.gdcc.xoai.xmlio.exceptions.XmlWriteException;
1110

1211
import javax.xml.stream.XMLStreamException;
1312
import javax.xml.transform.TransformerException;
@@ -16,7 +15,7 @@
1615
import java.io.IOException;
1716

1817
public class MetadataHelper {
19-
public static Metadata process(Metadata metadata, MetadataFormat format, Context context) throws OAIException {
18+
public static Metadata process(Metadata metadata, MetadataFormat format, Context context) {
2019
try (
2120
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
2221
XmlWriter writer = new XmlWriter(outStream);
@@ -33,7 +32,7 @@ public static Metadata process(Metadata metadata, MetadataFormat format, Context
3332

3433
return new Metadata(element);
3534
} catch (XMLStreamException | TransformerException | IOException e) {
36-
throw new OAIException(e);
35+
throw new InternalOAIException(e);
3736
}
3837
}
3938
}

0 commit comments

Comments
 (0)