mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
WEB-20557 JSON Schema: provide warning about required type Object for the schema to be read
This commit is contained in:
@@ -374,6 +374,7 @@ public class JsonSchemaMappingsConfigurable extends MasterDetailsComponent imple
|
||||
myText = FileUtil.loadFile(ioFile);
|
||||
}
|
||||
catch (IOException e1) {
|
||||
JsonSchemaReader.LOG.info(e1);
|
||||
myError = "Problem during reading JSON schema from '" + myFile.getName() + "': " + e1.getMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonToken;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.intellij.notification.NotificationGroup;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.ThrowablePairConsumer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -18,6 +19,7 @@ import java.util.*;
|
||||
* @author Irina.Chernushina on 8/27/2015.
|
||||
*/
|
||||
public class JsonSchemaReader {
|
||||
public static final Logger LOG = Logger.getInstance("#com.jetbrains.jsonSchema.impl.JsonSchemaReader");
|
||||
public static final NotificationGroup ERRORS_NOTIFICATION = NotificationGroup.logOnlyGroup("JSON Schema");
|
||||
|
||||
public JsonSchemaObject read(@NotNull final Reader reader) throws IOException {
|
||||
@@ -43,9 +45,11 @@ public class JsonSchemaReader {
|
||||
new JsonSchemaReader().read(new java.io.StringReader(string));
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
LOG.info(e);
|
||||
errorConsumer.consume(e.getMessage());
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
LOG.info(e);
|
||||
errorConsumer.consume(e.getMessage());
|
||||
return false;
|
||||
}
|
||||
@@ -293,7 +297,12 @@ public class JsonSchemaReader {
|
||||
}
|
||||
|
||||
private JsonSchemaType parseType(JsonReader in) throws IOException {
|
||||
return JsonSchemaType.valueOf("_" + in.nextString());
|
||||
final String typeString = in.nextString();
|
||||
try {
|
||||
return JsonSchemaType.valueOf("_" + typeString);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new IOException("Wrong type value: " + typeString + "\"");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user