Skip to content

Commit

Permalink
remove slf4j dependency from main classes
Browse files Browse the repository at this point in the history
  • Loading branch information
cwensel committed Nov 8, 2023
1 parent e009467 commit a31a0c3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 21 deletions.
2 changes: 1 addition & 1 deletion mini-parsers-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
dependencies {

implementation group: 'org.parboiled', name: 'parboiled-java', version: parboiledVersion
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion

testCompile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
testRuntime group: 'org.slf4j', name: 'slf4j-log4j12', version: slf4jVersion
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
public class ParserSyntaxException extends RuntimeException
{
public static final String SEARCH_PARSE_ERROR = "parser syntax error";
private Result result;
private List<String> errorMessages;
private final Result<?> result;
private final List<String> errorMessages;
private static final DefaultInvalidInputErrorFormatter formatter = new DefaultInvalidInputErrorFormatter();

public ParserSyntaxException( Result result )
public ParserSyntaxException( Result<?> result )
{
super( makeMessage( result ) );
this.result = result;
Expand All @@ -35,7 +35,7 @@ public ParserSyntaxException( Result result )
public ParserSyntaxException( List<String> errorMessages )
{
super( makeMessage( errorMessages ) );

this.result = null;
this.errorMessages = errorMessages;
}

Expand Down Expand Up @@ -81,7 +81,7 @@ private static String makeMessage( Result result )
return String.format( "%s: %s", SEARCH_PARSE_ERROR, errors );
}

private static String getSyntaxError( Result result )
private static String getSyntaxError( Result<?> result )
{
return ErrorUtils.printParseErrors( result.getParsingResult() );
}
Expand Down
1 change: 0 additions & 1 deletion mini-parsers-temporal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies {
api project( ':mini-parsers-core' )

implementation group: 'org.parboiled', name: 'parboiled-java', version: parboiledVersion
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion

testCompile project( path: ':mini-parsers-core', configuration: 'testArtifacts' )

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@
import org.parboiled.parserunners.ParseRunner;
import org.parboiled.parserunners.ReportingParseRunner;
import org.parboiled.support.ParsingResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
*
*/
public abstract class BaseTemporalExpressionParser<R, E extends Expression, G extends BaseParser<E>>
{
private static final Logger LOG = LoggerFactory.getLogger( BaseTemporalExpressionParser.class );

private final Context context;
private Rule grammar;

Expand Down Expand Up @@ -86,11 +82,7 @@ public TemporalResult<E, R> parseOrFail( String string ) throws ParserSyntaxExce
TemporalResult<E, R> parseResult = parse( string );

if( parseResult.hasErrors() )
{
LOG.warn( parseResult.prettyPrintErrors() );

throw new ParserSyntaxException( parseResult );
}

return parseResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import org.parboiled.parserunners.BasicParseRunner;
import org.parboiled.parserunners.ParseRunner;
import org.parboiled.support.ParsingResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static java.time.format.DateTimeFormatter.ISO_LOCAL_DATE;
import static java.time.format.DateTimeFormatter.ISO_LOCAL_TIME;
Expand Down Expand Up @@ -82,8 +80,6 @@
*/
public class DateTimeFormats
{
private static final Logger LOG = LoggerFactory.getLogger( DateTimeFormats.class );

public enum Char
{
text,
Expand Down Expand Up @@ -357,8 +353,7 @@ private static DateTimeFormatter insensitive( String format )
}
catch( RuntimeException exception )
{
LOG.error( "failed on pattern: {}", pattern, exception );
throw exception;
throw new RuntimeException( "failed on pattern: " + pattern, exception );
}
}

Expand Down

0 comments on commit a31a0c3

Please sign in to comment.