public void copyHeaders(ElasticsearchException ex) { Set<String> headerKeySet = ex.getHeaderKeys(); if (customHeaders == null) { customHeaders = new HashMap<>(headerKeySet.size()); } for (String key : headerKeySet) { List<String> values = customHeaders.get(key); if (values == null) { values = new ArrayList<>(); customHeaders.put(key, values); } values.addAll(ex.getHeader(key)); } }
private void putFailureMetadata(IngestDocument ingestDocument, ElasticsearchException cause) { List<String> processorTypeHeader = cause.getHeader("processor_type"); List<String> processorTagHeader = cause.getHeader("processor_tag"); String failedProcessorType = (processorTypeHeader != null) ? processorTypeHeader.get(0) : null; String failedProcessorTag = (processorTagHeader != null) ? processorTagHeader.get(0) : null; Map<String, Object> ingestMetadata = ingestDocument.getIngestMetadata(); ingestMetadata.put(ON_FAILURE_MESSAGE_FIELD, cause.getRootCause().getMessage()); ingestMetadata.put(ON_FAILURE_PROCESSOR_TYPE_FIELD, failedProcessorType); ingestMetadata.put(ON_FAILURE_PROCESSOR_TAG_FIELD, failedProcessorTag); }
public NotSerializableExceptionWrapper(Throwable other) { super(ElasticsearchException.getExceptionName(other) + ": " + other.getMessage(), other.getCause()); this.name = ElasticsearchException.getExceptionName(other); this.status = ExceptionsHelper.status(other); setStackTrace(other.getStackTrace()); for (Throwable otherSuppressed : other.getSuppressed()) { addSuppressed(otherSuppressed); } if (other instanceof ElasticsearchException) { ElasticsearchException ex = (ElasticsearchException) other; for (String key : ex.getHeaderKeys()) { this.addHeader(key, ex.getHeader(key)); } for (String key : ex.getMetadataKeys()) { this.addMetadata(key, ex.getMetadata(key)); } } }
private ElasticsearchException newCompoundProcessorException(Exception e, String processorType, String processorTag) { if (e instanceof ElasticsearchException && ((ElasticsearchException) e).getHeader("processor_type") != null) { return (ElasticsearchException) e; } ElasticsearchException exception = new ElasticsearchException(new IllegalArgumentException(e)); if (processorType != null) { exception.addHeader("processor_type", processorType); } if (processorTag != null) { exception.addHeader("processor_tag", processorTag); } return exception; } }
result.addHeader(header, exception.getHeader(header));
public List<String> getResourceId() { return getHeader(RESOURCE_HEADER_ID_KEY); }
public void copyHeaders(ElasticsearchException ex) { Set<String> headerKeySet = ex.getHeaderKeys(); if (customHeaders == null) { customHeaders = new HashMap<>(headerKeySet.size()); } for (String key : headerKeySet) { List<String> values = customHeaders.get(key); if (values == null) { values = new ArrayList<>(); customHeaders.put(key, values); } values.addAll(ex.getHeader(key)); } }
public String getIndex() { List<String> index = getHeader(INDEX_HEADER_KEY); if (index != null && index.isEmpty() == false) { return index.get(0); } return null; }
public void copyHeaders(ElasticsearchException ex) { Set<String> headerKeySet = ex.getHeaderKeys(); if (customHeaders == null) { customHeaders = new HashMap<>(headerKeySet.size()); } for (String key : headerKeySet) { List<String> values = customHeaders.get(key); if (values == null) { values = new ArrayList<>(); customHeaders.put(key, values); } values.addAll(ex.getHeader(key)); } }
public String getResourceType() { List<String> header = getHeader(RESOURCE_HEADER_TYPE_KEY); if (header != null && header.isEmpty() == false) { assert header.size() == 1; return header.get(0); } return null; }
public void copyHeaders(ElasticsearchException ex) { Set<String> headerKeySet = ex.getHeaderKeys(); if (customHeaders == null) { customHeaders = new HashMap<>(headerKeySet.size()); } for (String key : headerKeySet) { List<String> values = customHeaders.get(key); if (values == null) { values = new ArrayList<>(); customHeaders.put(key, values); } values.addAll(ex.getHeader(key)); } }
private void putFailureMetadata(IngestDocument ingestDocument, ElasticsearchException cause) { List<String> processorTypeHeader = cause.getHeader("processor_type"); List<String> processorTagHeader = cause.getHeader("processor_tag"); String failedProcessorType = (processorTypeHeader != null) ? processorTypeHeader.get(0) : null; String failedProcessorTag = (processorTagHeader != null) ? processorTagHeader.get(0) : null; Map<String, Object> ingestMetadata = ingestDocument.getIngestMetadata(); ingestMetadata.put(ON_FAILURE_MESSAGE_FIELD, cause.getRootCause().getMessage()); ingestMetadata.put(ON_FAILURE_PROCESSOR_TYPE_FIELD, failedProcessorType); ingestMetadata.put(ON_FAILURE_PROCESSOR_TAG_FIELD, failedProcessorTag); }
public void copyHeaders(ElasticsearchException ex) { Set<String> headerKeySet = ex.getHeaderKeys(); if (customHeaders == null) { customHeaders = new HashMap<>(headerKeySet.size()); } for (String key : headerKeySet) { List<String> values = customHeaders.get(key); if (values == null) { values = new ArrayList<>(); customHeaders.put(key, values); } values.addAll(ex.getHeader(key)); } }
private void putFailureMetadata(IngestDocument ingestDocument, ElasticsearchException cause) { List<String> processorTypeHeader = cause.getHeader("processor_type"); List<String> processorTagHeader = cause.getHeader("processor_tag"); String failedProcessorType = (processorTypeHeader != null) ? processorTypeHeader.get(0) : null; String failedProcessorTag = (processorTagHeader != null) ? processorTagHeader.get(0) : null; Map<String, Object> ingestMetadata = ingestDocument.getIngestMetadata(); ingestMetadata.put(ON_FAILURE_MESSAGE_FIELD, cause.getRootCause().getMessage()); ingestMetadata.put(ON_FAILURE_PROCESSOR_TYPE_FIELD, failedProcessorType); ingestMetadata.put(ON_FAILURE_PROCESSOR_TAG_FIELD, failedProcessorTag); }
public NotSerializableExceptionWrapper(Throwable other) { super(ElasticsearchException.getExceptionName(other) + ": " + other.getMessage(), other.getCause()); this.name = ElasticsearchException.getExceptionName(other); this.status = ExceptionsHelper.status(other); setStackTrace(other.getStackTrace()); for (Throwable otherSuppressed : other.getSuppressed()) { addSuppressed(otherSuppressed); } if (other instanceof ElasticsearchException) { ElasticsearchException ex = (ElasticsearchException) other; for (String key : ex.getHeaderKeys()) { this.addHeader(key, ex.getHeader(key)); } } }
public ShardId getShardId() { List<String> shard = getHeader(SHARD_HEADER_KEY); if (shard != null && shard.isEmpty() == false) { return new ShardId(getIndex(), Integer.parseInt(shard.get(0))); } return null; }
public NotSerializableExceptionWrapper(Throwable other) { super(ElasticsearchException.getExceptionName(other) + ": " + other.getMessage(), other.getCause()); this.name = ElasticsearchException.getExceptionName(other); this.status = ExceptionsHelper.status(other); setStackTrace(other.getStackTrace()); for (Throwable otherSuppressed : other.getSuppressed()) { addSuppressed(otherSuppressed); } if (other instanceof ElasticsearchException) { ElasticsearchException ex = (ElasticsearchException) other; for (String key : ex.getHeaderKeys()) { this.addHeader(key, ex.getHeader(key)); } for (String key : ex.getMetadataKeys()) { this.addMetadata(key, ex.getMetadata(key)); } } }
private ElasticsearchException newCompoundProcessorException(Exception e, String processorType, String processorTag) { if (e instanceof ElasticsearchException && ((ElasticsearchException) e).getHeader("processor_type") != null) { return (ElasticsearchException) e; } ElasticsearchException exception = new ElasticsearchException(new IllegalArgumentException(e)); if (processorType != null) { exception.addHeader("processor_type", processorType); } if (processorTag != null) { exception.addHeader("processor_tag", processorTag); } return exception; } }
public NotSerializableExceptionWrapper(Throwable other) { super(ElasticsearchException.getExceptionName(other) + ": " + other.getMessage(), other.getCause()); this.name = ElasticsearchException.getExceptionName(other); this.status = ExceptionsHelper.status(other); setStackTrace(other.getStackTrace()); for (Throwable otherSuppressed : other.getSuppressed()) { addSuppressed(otherSuppressed); } if (other instanceof ElasticsearchException) { ElasticsearchException ex = (ElasticsearchException) other; for (String key : ex.getHeaderKeys()) { this.addHeader(key, ex.getHeader(key)); } for (String key : ex.getMetadataKeys()) { this.addMetadata(key, ex.getMetadata(key)); } } }
private ElasticsearchException newCompoundProcessorException(Exception e, String processorType, String processorTag) { if (e instanceof ElasticsearchException && ((ElasticsearchException)e).getHeader("processor_type") != null) { return (ElasticsearchException) e; } ElasticsearchException exception = new ElasticsearchException(new IllegalArgumentException(e)); if (processorType != null) { exception.addHeader("processor_type", processorType); } if (processorTag != null) { exception.addHeader("processor_tag", processorTag); } return exception; } }