logger.warn("warn message"); logger.error("error message"); logger.fatal("fatal message");
private boolean newQuestion(CSVEntry question, CSVEntry option, Question tempQ) throws SurveyException { // checks for well-formedness and returns true if we should set tempQ to a new question if (question.lineNo != option.lineNo) { SurveyException e = new SyntaxException("CSV entries not properly aligned."); LOGGER.fatal(e); throw e; } if ( tempQ == null && "".equals(question.contents) ){ SurveyException e = new SyntaxException("No question indicated."); LOGGER.fatal(e); throw e; } return !(tempQ != null && (question.contents == null || question.contents.equals(""))); }
if (lineNo != questionLexeme.lineNo) { SurveyException se = new SyntaxException("Misaligned linenumbers"); LOGGER.fatal(se); throw se; LOGGER.fatal(e); throw e; if (block == null) { SurveyException e = new SyntaxException(String.format("No block found corresponding to %s in %s", blockStr, csvLexer.filename)); LOGGER.fatal(e); throw e;
/** * Validates and parses the survey. * * @return A {@link edu.umass.cs.surveyman.survey.Survey} object. * @throws SurveyException */ public Survey parse() throws SurveyException { validateInput(); Survey s = new Survey(); try { populateSurvey(s); } catch (IOException io) { LOGGER.fatal(io); throw new RuntimeException(io); } return s; }
private boolean validateInput() { try { final JsonSchemaFactory factory = JsonSchemaFactory.byDefault(); String schemaString = Slurpie.slurp(INPUT_SCHEMA); final JsonNode jsonSchema = JsonLoader.fromString(schemaString); final JsonNode instance = JsonLoader.fromString(this.json); final JsonSchema schema = factory.getJsonSchema(jsonSchema); ProcessingReport report = schema.validate(instance); LOGGER.info(report.toString()); return true; } catch (IOException io) { LOGGER.fatal(io.getStackTrace()); return false; } catch (ProcessingException pe) { LOGGER.fatal(pe.getStackTrace()); return false; } }