For code quality reasons, I would like to replace a try catch block inside my bode with a if condition in order to avoid using a FrontendException.
Here is my code :
Schema mySchema = new Schema();
mySchema.add(new Schema.FieldSchema("myInteger", DataType.INTEGER));
mySchema.add(new Schema.FieldSchema("myBoolean", DataType.BOOLEAN));
Schema tupleSchema = new Schema();
try {
tupleSchema.add(new Schema.FieldSchema("ARRAY_ELEM", mySchema, DataType.BAG));
} catch (FrontendException e) {
tupleSchema = new Schema(new Schema.FieldSchema(getSchemaName("myClass", input), DataType.DOUBLE));
}
return tupleSchema;
Is this possible to replace this code using an if else condition ? This way I won't have to use this type of Exception and that would be better for SonarQube.
Any ideas ?
Thanks.
Aucun commentaire:
Enregistrer un commentaire