Skip to content

Commit e6d9207

Browse files
authored
Lazily instantiate defaults for JsonSchemaFactoryBuilder. (#293)
Fixes #290.
1 parent da8d43c commit e6d9207

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main/java/com/github/fge/jsonschema/main/JsonSchemaFactoryBuilder.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,7 @@ public final class JsonSchemaFactoryBuilder
7474
* @param factory the factory
7575
* @see JsonSchemaFactory#thaw()
7676
*/
77-
JsonSchemaFactoryBuilder(final JsonSchemaFactory factory)
78-
{
79-
reportProvider = factory.reportProvider;
80-
loadingCfg = factory.loadingCfg;
81-
validationCfg = factory.validationCfg;
82-
}
77+
JsonSchemaFactoryBuilder(final JsonSchemaFactory factory) {}
8378

8479
/**
8580
* Set a new report provider for this factory
@@ -135,6 +130,12 @@ public JsonSchemaFactoryBuilder setValidationConfiguration(
135130
@Override
136131
public JsonSchemaFactory freeze()
137132
{
133+
if (reportProvider == null)
134+
reportProvider = new ListReportProvider(LogLevel.INFO, LogLevel.FATAL);
135+
if (loadingCfg == null)
136+
loadingCfg = LoadingConfiguration.byDefault();
137+
if (validationCfg == null)
138+
validationCfg = ValidationConfiguration.byDefault();
138139
return new JsonSchemaFactory(this);
139140
}
140141
}

0 commit comments

Comments
 (0)