Throws a new IO exception with the given message and a context snippet
with this reader's content.
170622
private MalformedJsonException syntaxError(String message)
  {
    String mess = message + " at line " + getLineNumber() + " column " + getColumnNumber();
    logger.log(Level.SEVERE, mess);
    throw new MalformedJsonException(mess);
  }
90947
protected String createExceptionMessage(final String message, final Object... messageParameters) {

        if (ArrayUtils.isEmpty(messageParameters)) {
            return message;
        } else {
            return String.format(message, messageParameters);
        }
    }
1012641
public static void consumeMessage(BigEndianBinaryReader in) throws IOException {
        FieldInfo fieldInfo;
        while ((fieldInfo = readFieldInfo(in)) != null) {
            readFieldValue(in, fieldInfo, null, false);
        }
    }
202489
public static InsnList throwRuntimeException(String message) {
        Validate.notNull(message);

        InsnList ret = new InsnList();

        ret.add(new TypeInsnNode(Opcodes.NEW, "java/lang/RuntimeException"));
        ret.add(new InsnNode(Opcodes.DUP));
        ret.add(new LdcInsnNode(message));
        ret.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V", false));
        ret.add(new InsnNode(Opcodes.ATHROW));

        return ret;
    }
872019
public void read(BufferedReader reader) throws Exception {
		String line;

		clear();

		while ((line = reader.readLine()) != null) {
			line = line.trim();
			// comment?
			if (line.startsWith("#"))
				continue;
			add(line);
		}

		reader.close();
	}
313111
public void         add(Type type, String message, Throwable exception)
    {
        String          queueMessage = message;
        if ( (type == Type.ERROR) && (exception != null) )
        {
            queueMessage += " (" + getExceptionMessage(exception) + ")";
        }

        if ( type.addToUI() )
        {
            while ( queue.size() > windowSizeLines )  // NOTE: due to concurrency, this may make the queue shorter than MAX - that's OK (and in some cases longer)
            {
                queue.remove();
            }
            queue.add(new Message(queueMessage, type));
        }
        type.log(message, exception);
    }
335484
protected void process(BufferedReader bufferedReader) throws IOException {
        Matcher eventMatcher;
        Matcher exceptionMatcher;
        String line;
        while ((line = bufferedReader.readLine()) != null) {
            //skip empty line entries
            eventMatcher = regexpPattern.matcher(line);
            if (line.trim().equals("")) {continue;}
            exceptionMatcher = exceptionPattern.matcher(line);
            if (eventMatcher.matches()) {
                //build an event from the previous match (held in current map)
                LoggingEvent event = buildEvent();
                if (event != null) {
                    if (passesExpression(event)) {
                        doPost(event);
                    }
                }
                currentMap.putAll(processEvent(eventMatcher.toMatchResult()));
            } else if (exceptionMatcher.matches()) {
                //an exception line
                additionalLines.add(line);
            } else {
                //neither...either post an event with the line or append as additional lines
                //if this was a logging event with multiple lines, each line will show up as its own event instead of being
                //appended as multiple lines on the same event..
                //choice is to have each non-matching line show up as its own line, or append them all to a previous event
                if (appendNonMatches) {
                    //hold on to the previous time, so we can do our best to preserve time-based ordering if the event is a non-match
                    String lastTime = (String)currentMap.get(TIMESTAMP);
                    //build an event from the previous match (held in current map)
                    if (currentMap.size() > 0) {
                        LoggingEvent event = buildEvent();
                        if (event != null) {
                            if (passesExpression(event)) {
                              doPost(event);
                            }
                        }
                    }
                    if (lastTime != null) {
                        currentMap.put(TIMESTAMP, lastTime);
                    }
                    currentMap.put(MESSAGE, line);
                } else {
                    additionalLines.add(line);
                }
            }
        }

        //process last event if one exists
        LoggingEvent event = buildEvent();
        if (event != null) {
            if (passesExpression(event)) {
                doPost(event);
            }
        }
    }
1131306
public static EncodingException createEncodingException(
			final ErrorKeys errorId, final String message)
	{

		return new EncodingException(errorId.toString() + ":\r\n" + message);
	}
62015
public static DecodingException createDecodingException(
			final ErrorKeys errorId, final String message)
	{

		return new DecodingException(errorId.toString() + ":\r\n" + message);
	}
118540
@Override
    protected void throwStreamException(String msg, Location loc)
        throws XMLStreamException
    {
        if (loc == null) {
            throw new WstxParsingException(msg);
        }
        throw new WstxParsingException(msg, loc);
    }
1163337
protected IOException toIoException(Exception e) {
        if (e instanceof IOException) {
            return (IOException) e;
        } else {
            return new IOException("Unexpected failure", e);
        }
    }
1181252
public final PersistException toPersistException(final String message) {
        Throwable cause;
        if (this instanceof PersistException) {
            cause = this;
        } else {
            cause = getCause();
        }

        if (cause == null) {
            cause = this;
        } else if (cause instanceof PersistException && message == null) {
            return (PersistException) cause;
        }

        String causeMessage = cause.getMessage();
        if (causeMessage == null) {
            causeMessage = message;
        } else if (message != null) {
            causeMessage = message + " : " + causeMessage;
        }

        return makePersistException(causeMessage, cause);
    }
1059456
static IllegalArgumentException error(String message, String str, int pos) {
    return new IllegalArgumentException(message + "\n" + context(str, pos));
  }
473116
private void handleIOException(IOException e) {
    String content = e.getLocalizedMessage();
    if (e instanceof RemoteException) {
      int eol = content.indexOf('\n');
      if (eol>=0) {
        content = content.substring(0, eol);
      }      
    }
    System.err.println(getCommandName() + ": " + content);
  }
1307392
private void sendMessage(Message message) throws IOException {
        logger.debug("Sending> {}", message);
        int totalSize = 0;
        for (Field field : message.fields) {
            totalSize += field.getBytes().remaining();
        }
        ByteBuffer combined = ByteBuffer.allocate(totalSize);
        for (Field field : message.fields) {
            logger.debug("..sending> {}", field);
            combined.put(field.getBytes());
        }
        combined.flip();
        Util.writeFully(combined, channel);
    }
743267
public Button dialog(String message) throws IOException, UserCancelExcption {
		Map<String, Object> m = JSONProtocol.cmd("dialog");
		m.put("text", message);
		pipe.send(m);
		Map<String, Object> r = pipe.recv();
		if (!JSONProtocol.check(m, r) || !r.containsKey("button")) {
			throw new IOException("Unknown button pressed");
		}
		return Button.valueOf(((String)r.get("button")).toUpperCase());
	}
710108
protected static Throwable newEncoderException(final String message,
                                                   final Throwable cause) {

        try {
            return ENCODER_EXCEPTION
                .getConstructor(String.class, Throwable.class)
                .newInstance(message, cause);
        } catch (final NoSuchMethodException nsme) {
            throw new RuntimeException(nsme);
        } catch (final InstantiationException ie) {
            throw new RuntimeException(ie);
        } catch (final IllegalAccessException iae) {
            throw new RuntimeException(iae);
        } catch (final InvocationTargetException ite) {
            throw new RuntimeException(ite);
        }
    }