Save point: [skip ci]

* Tika test
This commit is contained in:
alandavis
2022-07-26 14:27:39 +01:00
parent 2243fad439
commit a04a26d6f6
3 changed files with 4 additions and 8 deletions

View File

@@ -87,13 +87,13 @@ abstract class TransformProcess extends TransformStreamHandler
} }
catch (TransformException e) catch (TransformException e)
{ {
transformerDebug.logFailure(reference, e.getMessage()); transformerDebug.logFailure(reference, " Error: "+e.getMessage());
LogEntry.setStatusCodeAndMessage(e.getStatus(), e.getMessage()); LogEntry.setStatusCodeAndMessage(e.getStatus(), e.getMessage());
handleTransformException(e, e.getStatus()); handleTransformException(e, e.getStatus());
} }
catch (Exception e) catch (Exception e)
{ {
transformerDebug.logFailure(reference, e.getMessage()); transformerDebug.logFailure(reference, " Error: "+e.getMessage());
LogEntry.setStatusCodeAndMessage(INTERNAL_SERVER_ERROR, e.getMessage()); LogEntry.setStatusCodeAndMessage(INTERNAL_SERVER_ERROR, e.getMessage());
handleException(e); handleException(e);
} }
@@ -134,6 +134,6 @@ abstract class TransformProcess extends TransformStreamHandler
protected void handleException(Exception e) protected void handleException(Exception e)
{ {
throw new RuntimeException(e); throw new TransformException(INTERNAL_SERVER_ERROR, e.getMessage(), e);
} }
} }

View File

@@ -236,7 +236,7 @@ public class Tika
} }
catch (UnsupportedEncodingException e) catch (UnsupportedEncodingException e)
{ {
throw new IllegalStateException("Unsupported encoding "+e.getMessage(), e); throw new IllegalArgumentException("Unsupported encoding "+e.getMessage(), e);
} }
catch (SAXException | TikaException | IOException e) catch (SAXException | TikaException | IOException e)
{ {

View File

@@ -245,10 +245,6 @@ public class TikaTest extends AbstractBaseTest
{ {
mockTransformCommand(PDF, TXT, MIMETYPE_PDF, true); mockTransformCommand(PDF, TXT, MIMETYPE_PDF, true);
targetEncoding = "rubbish"; targetEncoding = "rubbish";
// mockMvc.perform(
// mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", targetExtension))
// .andExpect(MockMvcResultMatchers.status().is(INTERNAL_SERVER_ERROR.value()));
mockMvc.perform( mockMvc.perform(
mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", targetExtension)) mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", targetExtension))
.andExpect(status().is(INTERNAL_SERVER_ERROR.value())); .andExpect(status().is(INTERNAL_SERVER_ERROR.value()));