@Override public String toString() { final String s = new String(Character.toChars(codePoint)); return "unacceptable code point '" + s + "' (0x" + Integer.toHexString(codePoint).toUpperCase() + ") " + getMessage() + "\nin \"" + name + "\", position " + position; } }
pointer = 0; if (nonPrintable != ' ') { throw new ReaderException(name, cpIndex - 1, nonPrintable, "special characters are not allowed");
private static void raiseParserException(ThreadContext context, IRubyObject yaml, ReaderException re, IRubyObject rbPath) { Ruby runtime; RubyClass se; IRubyObject exception; runtime = context.runtime; se = (RubyClass)runtime.getModule("Psych").getConstant("SyntaxError"); exception = se.newInstance(context, new IRubyObject[] { rbPath, runtime.newFixnum(0), runtime.newFixnum(0), runtime.newFixnum(re.getPosition()), (null == re.getName() ? runtime.getNil() : runtime.newString(re.getName())), (null == re.toString() ? runtime.getNil() : runtime.newString(re.toString())) }, Block.NULL_BLOCK); RubyKernel.raise(context, runtime.getKernel(), new IRubyObject[] { exception }, Block.NULL_BLOCK); }
byte[] response = new byte[300]; int responseLength; try { responseLength = mReader.transmit(slotNum, command, command.length, response, response.length); } catch (ReaderException e) { e.printStackTrace(); return "executeCommand: error: " + e.getMessage(); }
private static void raiseParserException(ThreadContext context, IRubyObject yaml, ReaderException re, IRubyObject rbPath) { Ruby runtime; RubyClass se; IRubyObject exception; runtime = context.runtime; se = (RubyClass)runtime.getModule("Psych").getConstant("SyntaxError"); exception = se.newInstance(context, new IRubyObject[] { rbPath, runtime.newFixnum(0), runtime.newFixnum(0), runtime.newFixnum(re.getPosition()), (null == re.getName() ? runtime.getNil() : runtime.newString(re.getName())), (null == re.toString() ? runtime.getNil() : runtime.newString(re.toString())) }, Block.NULL_BLOCK); RubyKernel.raise(context, runtime.getKernel(), new IRubyObject[] { exception }, Block.NULL_BLOCK); }
@Override public String toString() { return "unacceptable character '" + character + "' (0x" + Integer.toHexString((int) character).toUpperCase() + ") " + getMessage() + "\nin \"" + name + "\", position " + position; } }
void checkPrintable(CharSequence data) { Matcher em = NON_PRINTABLE.matcher(data); if (em.find()) { int position = this.index + this.buffer.length() - this.pointer + em.start(); throw new ReaderException(name, position, em.group().charAt(0), "special characters are not allowed"); } }
@Override public String toString() { final String s = new String(Character.toChars(codePoint)); return "unacceptable code point '" + s + "' (0x" + Integer.toHexString(codePoint).toUpperCase() + ") " + getMessage() + "\nin \"" + name + "\", position " + position; } }
void checkPrintable(String data) { final int length = data.length(); for (int offset = 0; offset < length; ) { final int codePoint = data.codePointAt(offset); if (!isPrintable(codePoint)) { throw new ReaderException(name, offset, codePoint, "special characters are not allowed"); } offset += Character.charCount(codePoint); } }
@Override public String toString() { final String s = new String(Character.toChars(codePoint)); return "unacceptable code point '" + s + "' (0x" + Integer.toHexString(codePoint).toUpperCase() + ") " + getMessage() + "\nin \"" + name + "\", position " + position; } }
/** * Checks <code>chars</chars> for the non-printable characters. * * @param chars * the array where to search. * @param begin * the beginning index, inclusive. * @param end * the ending index, exclusive. * @throws ReaderException * if <code>chars</code> contains non-printable character(s). */ void checkPrintable(final char[] chars, final int begin, final int end) { for (int i = begin; i < end; i++) { final char c = chars[i]; if (isPrintable(c)) { continue; } int position = this.index + this.buffer.length() - this.pointer + i; throw new ReaderException(name, position, c, "special characters are not allowed"); } }
pointer = 0; if (nonPrintable != ' ') { throw new ReaderException(name, cpIndex - 1, nonPrintable, "special characters are not allowed");