private void rethrowEofException(IOException ioEx) throws IOException { boolean isEof = false; try { isEof = this.in.available() == 0; } catch (Throwable t) { LOG.trace("Error getting available for error message - ignoring", t); } if (!isEof) throw ioEx; if (LOG.isTraceEnabled()) { LOG.trace("Partial cell read caused by EOF", ioEx); } EOFException eofEx = new EOFException("Partial cell read"); eofEx.initCause(ioEx); throw eofEx; }
@Override public synchronized int read(ByteBuffer dst) throws IOException { try { int len = dst.remaining(); if (len == 0) { return 0; } len = (int) Math.min(len, fileLength - pos); if (len <= 0) { return -1; } mapped.position(pos); mapped.get(dst.array(), dst.arrayOffset() + dst.position(), len); dst.position(dst.position() + len); pos += len; return len; } catch (IllegalArgumentException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; } catch (BufferUnderflowException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; } }
@Override public synchronized int read(ByteBuffer dst) throws IOException { try { int len = dst.remaining(); if (len == 0) { return 0; } len = (int) Math.min(len, fileLength - pos); if (len <= 0) { return -1; } mapped.position(pos); mapped.get(dst.array(), dst.arrayOffset() + dst.position(), len); dst.position(dst.position() + len); pos += len; return len; } catch (IllegalArgumentException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; } catch (BufferUnderflowException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; } }
EOFException eof = new EOFException("Locator at " + ipAddr + " did not respond. This is normal if the locator was shutdown. If it wasn't check its log for exceptions."); eof.initCause(ex); throw eof;
throw (EOFException) new EOFException("Invalid PB, EOF? Ignoring; originalPosition=" + originalPosition + ", currentPosition=" + this.inputStream.getPos() + ", messageSize=" + size + ", currentAvailable=" + available).initCause(ipbe); IOException realEofEx = extractHiddenEof(ex); throw (EOFException) new EOFException("EOF " + message). initCause(realEofEx != null ? realEofEx : ex);
private void rethrowEofException(IOException ioEx) throws IOException { boolean isEof = false; try { isEof = this.in.available() == 0; } catch (Throwable t) { LOG.trace("Error getting available for error message - ignoring", t); } if (!isEof) throw ioEx; if (LOG.isTraceEnabled()) { LOG.trace("Partial cell read caused by EOF", ioEx); } EOFException eofEx = new EOFException("Partial cell read"); eofEx.initCause(ioEx); throw eofEx; }
@Override public void readFully(byte[] b) throws IOException { try { buf.get(b); } catch (BufferUnderflowException e) { throw (EOFException)new EOFException().initCause(e); } }
@Override public long readLong() throws IOException { try { return buf.getLong(); } catch (BufferUnderflowException e) { throw (EOFException)new EOFException().initCause(e); } }
@Override public byte readByte() throws IOException { try { return buf.get(); } catch (BufferUnderflowException e) { throw (EOFException)new EOFException().initCause(e); } }
@Override public double readDouble() throws IOException { try { return buf.getDouble(); } catch (BufferUnderflowException e) { throw (EOFException)new EOFException().initCause(e); } }
@Override public int readUnsignedShort() throws IOException { try { return buf.getShort() & 0xFFFF; } catch (BufferUnderflowException e) { throw (EOFException)new EOFException().initCause(e); } }
@Override public float readFloat() throws IOException { try { return buf.getFloat(); } catch (BufferUnderflowException e) { throw (EOFException)new EOFException().initCause(e); } }
@Override public void readFully(byte[] b, int off, int len) throws IOException { try { buf.get(b, off, len); } catch (BufferUnderflowException e) { throw (EOFException)new EOFException().initCause(e); } }
@Override public int readUnsignedByte() throws IOException { try { return buf.get() & 0xFF; } catch (BufferUnderflowException e) { throw (EOFException)new EOFException().initCause(e); } }
@Override public int readInt() throws IOException { try { return buf.getInt(); } catch (BufferUnderflowException e) { throw (EOFException)new EOFException().initCause(e); } }
@Override public short readShort() throws IOException { try { return buf.getShort(); } catch (BufferUnderflowException e) { throw (EOFException)new EOFException().initCause(e); } }
eof.initCause(ise); session.propogateError("Session closed while signing leaseset", eof); } else {
@Override public byte readByte() throws IOException { buffer(position, 1); position += 1; try { return buffer.get(); } catch (BufferUnderflowException e) { EOFException eof = new EOFException(EOF_ERROR_MSG); eof.initCause(e); throw eof; } }
@Override public char readChar() throws IOException { buffer(position, 2); position += 2; try { return buffer.getChar(); } catch (BufferUnderflowException e) { EOFException eof = new EOFException(EOF_ERROR_MSG); eof.initCause(e); throw eof; } }
@Override public int readInt() throws IOException { buffer(position, 4); position += 4; try { return buffer.getInt(); } catch (BufferUnderflowException e) { EOFException eof = new EOFException(EOF_ERROR_MSG); eof.initCause(e); throw eof; } }