protected void sendError(final HttpServletResponse resp, int responseCode) { try { resp.sendError(responseCode); } catch (IOException e) { throw new ConnectionScopedRuntimeException("Failed to send error response code " + responseCode, e); } }
LOGGER.info("Exception in servlet '{}' : {}", requestURI, e.getMessage());
private void assertState(final ConnectionState state) { if (_connectionState != state) { throw new ConnectionScopedRuntimeException(String.format( "Unexpected state, client has sent frame in an illegal order. Required state: %s, actual state: %s", state, _connectionState)); } }
@Override public void onFailure(final Throwable t) { String errorMessage = String.format("Failed to create LinkEndpoint in response to Attach: %s", _attach); LOGGER.error(errorMessage, t); throw new ConnectionScopedRuntimeException(errorMessage, t); } }
private CompositeData createRow(String loggerName, String level) { Object[] itemData = {loggerName, level.toUpperCase()}; try { CompositeData loggerData = new CompositeDataSupport(LOGGER_LEVEL_COMPOSITE_TYPE, COMPOSITE_ITEM_NAMES.toArray(new String[COMPOSITE_ITEM_NAMES.size()]), itemData); return loggerData; } catch (OpenDataException ode) { // Should not happen throw new ConnectionScopedRuntimeException(ode); } }
private ReplicatedEnvironment getEnvironment() { if (getFacadeState() == State.RESTARTING) { throw new ConnectionScopedRuntimeException("Environment is restarting"); } final ReplicatedEnvironment environment = _environment.get(); if (environment == null) { throw new IllegalStateException("Environment is null."); } return environment; }
void assertState(final ConnectionState requiredState) { if(_state != requiredState) { String replyText = "Command Invalid, expected " + requiredState + " but was " + _state; sendConnectionClose(ErrorCodes.COMMAND_INVALID, replyText, 0); throw new ConnectionScopedRuntimeException(replyText); } }
@Override public void add(long deliveryTag, MessageInstance message, final MessageInstanceConsumer consumer, final boolean usesCredit) { if(_map.put(deliveryTag, new MessageConsumerAssociationImpl(message, consumer, usesCredit)) == null) { _size++; } else { throw new ConnectionScopedRuntimeException("Unexpected duplicate delivery tag created"); } }
private void ensureHeaderIsEncoded() { if (_headerBytes == null) { try(ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); ObjectOutputStream os = new ObjectOutputStream(bytesOut)) { os.writeInt(_contentSize); os.writeObject(_header); os.close(); _headerBytes = bytesOut.toByteArray(); } catch (IOException e) { throw new ConnectionScopedRuntimeException("Unexpected IO Exception on in memory operation", e); } } } }
@Override public InternalMessageMetaData createMetaData(final QpidByteBuffer buf) { try (ObjectInputStream is = new ObjectInputStream(buf.asInputStream())) { int contentSize = is.readInt(); InternalMessageHeader header = (InternalMessageHeader) is.readObject(); return new InternalMessageMetaData(true, header, contentSize); } catch (IOException e) { throw new ConnectionScopedRuntimeException("Unexpected IO Exception on operation in memory", e); } catch (ClassNotFoundException e) { throw new ConnectionScopedRuntimeException("Unexpected exception when reading meta data, check classpath",e); } }
throw new ConnectionScopedRuntimeException(exceptionMessage, cause);
throw new ConnectionScopedRuntimeException(e.getCause());
throw new ConnectionScopedRuntimeException("Unexpected exception while " + action, e);
void updateDisposition(final Role role, final Binary deliveryTag, final DeliveryState state, final boolean settled) { final DeliveryRegistry deliveryRegistry = role == Role.RECEIVER ? _incomingDeliveryRegistry : _outgoingDeliveryRegistry; UnsignedInteger deliveryId = deliveryRegistry.getDeliveryIdByTag(deliveryTag); if (deliveryId == null) { throw new ConnectionScopedRuntimeException(String.format( "Delivery with tag '%s' is not found in unsettled deliveries", deliveryTag)); } updateDisposition(role, deliveryId, deliveryId, state, settled); }
@Override protected void onReceive(final QpidByteBuffer msg) { try { _decoder.decodeBuffer(msg); receivedCompleteAllChannels(); } catch (AMQFrameDecodingException | IOException e) { LOGGER.error("Unexpected exception", e); throw new ConnectionScopedRuntimeException(e); } }
private void assertState(final ServerConnection conn, final ConnectionState requiredState) { if(_state != requiredState) { String replyText = "Command Invalid, expected " + requiredState + " but was " + _state; conn.sendConnectionClose(ConnectionCloseCode.FRAMING_ERROR, replyText); conn.closeAndIgnoreFutureInput(); throw new ConnectionScopedRuntimeException(replyText); } }
@Override protected void onReceive(final QpidByteBuffer buf) { try { _inputHandler.received(buf); _connection.receivedComplete(); } catch (IllegalArgumentException | IllegalStateException e) { throw new ConnectionScopedRuntimeException(e); } }
@Override public Connection getConnection() { try { return getStore().getConnection(); } catch (SQLException e) { throw new ConnectionScopedRuntimeException(String.format( "Error opening connection to database for VirtualHostNode '%s'", getName())); } }
@Override public Connection getConnection() { try { return getStore().getConnection(); } catch (SQLException e) { throw new ConnectionScopedRuntimeException(String.format( "Error opening connection to database for VirtualHost '%s'", getName())); } }
@Override public Connection getConnection() { try { return ((DerbyMessageStore) getMessageStore()).getConnection(); } catch (SQLException e) { throw new ConnectionScopedRuntimeException(String.format( "Error opening connection to database for VirtualHost '%s'", getName())); } }