private PagingState(byte[] complete) { // Check the sizes in the beginning of the buffer, otherwise we cannot build the paging state // object ByteBuffer pagingStateBB = ByteBuffer.wrap(complete); int pagingSize = pagingStateBB.getShort(); int hashSize = pagingStateBB.getShort(); if (pagingSize + hashSize != pagingStateBB.remaining() && pagingSize + hashSize + 2 != pagingStateBB.remaining()) { throw new PagingStateException( "Cannot deserialize paging state, invalid format. " + "The serialized form was corrupted, or not initially generated from a PagingState object."); } this.pagingState = new byte[pagingSize]; pagingStateBB.get(this.pagingState); this.hash = new byte[hashSize]; pagingStateBB.get(this.hash); this.protocolVersion = (pagingStateBB.remaining() > 0) ? ProtocolVersion.fromInt(pagingStateBB.getShort()) : ProtocolVersion.V2; }
@Test(groups = "unit") public void should_create_proper_paging_state_exception() { PagingStateException e = new PagingStateException("Bad, really bad"); assertThat(e.getMessage()).isEqualTo("Bad, really bad"); // no copy method for this exception }
select.setPagingState(PagingState.fromString(page)); } catch (PagingStateException e) { throw new BackendException(e.getMessage());
} catch (PagingStateException e) { setWithFalseContent = true; logger.debug(e.getMessage()); } finally { assertThat(setWithFalseContent).isTrue(); } catch (PagingStateException e) { setWithWrongStatement = true; logger.debug(e.getMessage()); } finally { assertThat(setWithWrongStatement).isTrue();
/** * Create a PagingState object from a string previously generated with {@link #toString()}. * * @param string the string value. * @return the PagingState object created. * @throws PagingStateException if the string does not have the correct format. */ public static PagingState fromString(String string) { try { byte[] complete = Bytes.fromRawHexString(string, 0); return new PagingState(complete); } catch (Exception e) { throw new PagingStateException( "Cannot deserialize paging state, invalid format. " + "The serialized form was corrupted, or not initially generated from a PagingState object.", e); } }
@Test(groups = "unit") public void should_create_proper_paging_state_exception() { PagingStateException e = new PagingStateException("Bad, really bad"); assertThat(e.getMessage()).isEqualTo("Bad, really bad"); // no copy method for this exception }
select.setPagingState(PagingState.fromString(page)); } catch (PagingStateException e) { throw new BackendException(e.getMessage());
this.pagingState = pagingState.getRawState(); } else { throw new PagingStateException( "Paging state mismatch, " + "this means that either the paging state contents were altered, "
} catch (PagingStateException e) { setWithFalseContent = true; logger.debug(e.getMessage()); } finally { assertThat(setWithFalseContent).isTrue(); } catch (PagingStateException e) { setWithWrongStatement = true; logger.debug(e.getMessage()); } finally { assertThat(setWithWrongStatement).isTrue();
private PagingState(byte[] complete) { // Check the sizes in the beginning of the buffer, otherwise we cannot build the paging state object ByteBuffer pagingStateBB = ByteBuffer.wrap(complete); int pagingSize = pagingStateBB.getShort(); int hashSize = pagingStateBB.getShort(); if (pagingSize + hashSize != pagingStateBB.remaining() && pagingSize + hashSize + 2 != pagingStateBB.remaining()) { throw new PagingStateException("Cannot deserialize paging state, invalid format. " + "The serialized form was corrupted, or not initially generated from a PagingState object."); } this.pagingState = new byte[pagingSize]; pagingStateBB.get(this.pagingState); this.hash = new byte[hashSize]; pagingStateBB.get(this.hash); this.protocolVersion = (pagingStateBB.remaining() > 0) ? ProtocolVersion.fromInt(pagingStateBB.getShort()) : ProtocolVersion.V2; }
private PagingState(byte[] complete) { // Check the sizes in the beginning of the buffer, otherwise we cannot build the paging state object ByteBuffer pagingStateBB = ByteBuffer.wrap(complete); int pagingSize = pagingStateBB.getShort(); int hashSize = pagingStateBB.getShort(); if (pagingSize + hashSize != pagingStateBB.remaining() && pagingSize + hashSize + 2 != pagingStateBB.remaining()) { throw new PagingStateException("Cannot deserialize paging state, invalid format. " + "The serialized form was corrupted, or not initially generated from a PagingState object."); } this.pagingState = new byte[pagingSize]; pagingStateBB.get(this.pagingState); this.hash = new byte[hashSize]; pagingStateBB.get(this.hash); this.protocolVersion = (pagingStateBB.remaining() > 0) ? ProtocolVersion.fromInt(pagingStateBB.getShort()) : ProtocolVersion.V2; }
private PagingState(byte[] complete) { // Check the sizes in the beginning of the buffer, otherwise we cannot build the paging state object ByteBuffer pagingStateBB = ByteBuffer.wrap(complete); int pagingSize = pagingStateBB.getShort(); int hashSize = pagingStateBB.getShort(); if (pagingSize + hashSize != pagingStateBB.remaining() && pagingSize + hashSize + 2 != pagingStateBB.remaining()) { throw new PagingStateException("Cannot deserialize paging state, invalid format. " + "The serialized form was corrupted, or not initially generated from a PagingState object."); } this.pagingState = new byte[pagingSize]; pagingStateBB.get(this.pagingState); this.hash = new byte[hashSize]; pagingStateBB.get(this.hash); this.protocolVersion = (pagingStateBB.remaining() > 0) ? ProtocolVersion.fromInt(pagingStateBB.getShort()) : ProtocolVersion.V2; }
/** * Create a PagingState object from a string previously generated with {@link #toString()}. * * @param string the string value. * @return the PagingState object created. * @throws PagingStateException if the string does not have the correct format. */ public static PagingState fromString(String string) { try { byte[] complete = Bytes.fromRawHexString(string, 0); return new PagingState(complete); } catch (Exception e) { throw new PagingStateException("Cannot deserialize paging state, invalid format. " + "The serialized form was corrupted, or not initially generated from a PagingState object.", e); } }
/** * Create a PagingState object from a string previously generated with {@link #toString()}. * * @param string the string value. * @return the PagingState object created. * @throws PagingStateException if the string does not have the correct format. */ public static PagingState fromString(String string) { try { byte[] complete = Bytes.fromRawHexString(string, 0); return new PagingState(complete); } catch (Exception e) { throw new PagingStateException("Cannot deserialize paging state, invalid format. " + "The serialized form was corrupted, or not initially generated from a PagingState object.", e); } }
/** * Create a PagingState object from a string previously generated with {@link #toString()}. * * @param string the string value. * @return the PagingState object created. * @throws PagingStateException if the string does not have the correct format. */ public static PagingState fromString(String string) { try { byte[] complete = Bytes.fromRawHexString(string, 0); return new PagingState(complete); } catch (Exception e) { throw new PagingStateException("Cannot deserialize paging state, invalid format. " + "The serialized form was corrupted, or not initially generated from a PagingState object.", e); } }
this.pagingState = pagingState.getRawState(); } else { throw new PagingStateException("Paging state mismatch, " + "this means that either the paging state contents were altered, " + "or you're trying to apply it to a different statement");
this.pagingState = pagingState.getRawState(); } else { throw new PagingStateException("Paging state mismatch, " + "this means that either the paging state contents were altered, " + "or you're trying to apply it to a different statement");
this.pagingState = pagingState.getRawState(); } else { throw new PagingStateException("Paging state mismatch, " + "this means that either the paging state contents were altered, " + "or you're trying to apply it to a different statement");