private static String getMessage(ParserSession session, String msg, Object... args) { if (args.length != 0) msg = format(msg, args); if (session != null) { Position p = session.getPosition(); msg += "\n\tAt: " + p; ObjectMap lastLocation = session.getLastLocation(); if (lastLocation != null) { msg += "\n\tWhile parsing into: "; for (Map.Entry<String,Object> e : lastLocation.entrySet()) msg += "\n\t\t" + e.getKey() + ": " + e.getValue(); } String lines = session.getInputAsString(); if (lines == null) msg += "\n\tUse BEAN_debug setting to display content."; else { int numLines = session.getDebugOutputLines(); int start = p.line - numLines, end = p.line + numLines; msg += "\n---start--\n" + StringUtils.getNumberedLines(lines, start, end) + "---end---"; } } return msg; }
private static String getMessage(ParserSession session, String msg, Object... args) { if (args.length != 0) msg = format(msg, args); if (session != null) { Position p = session.getPosition(); msg += "\n\tAt: " + p; ObjectMap lastLocation = session.getLastLocation(); if (lastLocation != null) { msg += "\n\tWhile parsing into: "; for (Map.Entry<String,Object> e : lastLocation.entrySet()) msg += "\n\t\t" + e.getKey() + ": " + e.getValue(); } String lines = session.getInputAsString(); if (lines == null) msg += "\n\tUse BEAN_debug setting to display content."; else { int numLines = session.getDebugOutputLines(); int start = p.line - numLines, end = p.line + numLines; msg += "\n---start--\n" + StringUtils.getNumberedLines(lines, start, end) + "---end---"; } } return msg; }
private static String getMessage(ParserSession session, String msg, Object... args) { if (args.length != 0) msg = format(msg, args); if (session != null) { Position p = session.getPosition(); msg += "\n\tAt: " + p; ObjectMap lastLocation = session.getLastLocation(); if (lastLocation != null) { msg += "\n\tWhile parsing into: "; for (Map.Entry<String,Object> e : lastLocation.entrySet()) msg += "\n\t\t" + e.getKey() + ": " + e.getValue(); } String lines = session.getInputAsString(); if (lines == null) msg += "\n\tUse BEAN_debug setting to display content."; else { int numLines = session.getDebugOutputLines(); int start = p.line - numLines, end = p.line + numLines; msg += "\n---start--\n" + StringUtils.getNumberedLines(lines, start, end) + "---end---"; } } return msg; }