From d8cc4f8dfeec0f34b9da4d63b0aeb2a5e498deca Mon Sep 17 00:00:00 2001 From: Fabian Steeg Date: Thu, 31 Mar 2022 18:13:49 +0200 Subject: [PATCH] Extract try-catch to avoid Eclipse compiler bug (#210) See https://bugs.eclipse.org/466406 --- .../metafacture/metafix/RecordTransformer.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/metafix/src/main/java/org/metafacture/metafix/RecordTransformer.java b/metafix/src/main/java/org/metafacture/metafix/RecordTransformer.java index c9e613ba..602cda7f 100644 --- a/metafix/src/main/java/org/metafacture/metafix/RecordTransformer.java +++ b/metafix/src/main/java/org/metafacture/metafix/RecordTransformer.java @@ -173,26 +173,29 @@ private void processExpression(final Expression expression, final Consumer messageSupplier, final Runnable runnable) { - final FixExecutionException exception; + final FixExecutionException exception = tryRun(messageSupplier, runnable); + if (exception != null) { + metafix.getStrictness().handle(exception, record); + } + } + private FixExecutionException tryRun(final Supplier messageSupplier, final Runnable runnable) { // checkstyle-disable-line ReturnCount try { runnable.run(); - return; } catch (final FixProcessException e) { throw e; // TODO: Add nesting information? } catch (final FixExecutionException e) { - exception = e; // TODO: Add nesting information? + return e; // TODO: Add nesting information? } catch (final IllegalStateException | NumberFormatException e) { - exception = new FixExecutionException(messageSupplier.get(), e); + return new FixExecutionException(messageSupplier.get(), e); } catch (final RuntimeException e) { // checkstyle-disable-line IllegalCatch throw new FixProcessException(messageSupplier.get(), e); } - - metafix.getStrictness().handle(exception, record); + return null; } private String executionExceptionMessage(final Expression expression) {