File tree 1 file changed +3
-3
lines changed
lib/src/main/java/com/diffplug/spotless/gherkin
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -54,15 +54,13 @@ FormatterFunc toFormatter() {
54
54
55
55
Method format ;
56
56
Constructor <?> constructor ;
57
- Object formatter ;
58
57
try {
59
58
ClassLoader classLoader = jarState .getClassLoader ();
60
59
Class <?> prettyFormatter = classLoader .loadClass ("me.jvt.cucumber.gherkinformatter.PrettyFormatter" );
61
60
Class <?>[] constructorArguments = new Class []{int .class };
62
61
constructor = prettyFormatter .getConstructor (constructorArguments );
63
62
format = prettyFormatter .getMethod ("format" , String .class );
64
- formatter = constructor .newInstance (indentSpaces );
65
- } catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e ) {
63
+ } catch (ClassNotFoundException | NoSuchMethodException e ) {
66
64
throw new IllegalStateException (String .format ("There was a problem preparing %s dependencies" , MAVEN_COORDINATE ), e );
67
65
}
68
66
@@ -71,6 +69,8 @@ FormatterFunc toFormatter() {
71
69
return s ;
72
70
}
73
71
try {
72
+ Object formatter ;
73
+ formatter = constructor .newInstance (indentSpaces );
74
74
return (String ) format .invoke (formatter , s );
75
75
} catch (InvocationTargetException ex ) {
76
76
throw new AssertionError ("Unable to format Gherkin" , ex .getCause ());
You can’t perform that action at this time.
0 commit comments