private boolean indexAvailable(ElasticsearchException ex) { return !CollectionUtils.contains(ex.getMetadata("es.index_uuid").iterator(), "_na_"); } }
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)); } } }
@Override public DataAccessException translateExceptionIfPossible(RuntimeException ex) { if (ex instanceof ElasticsearchException) { ElasticsearchException elasticsearchException = (ElasticsearchException) ex; if (!indexAvailable(elasticsearchException)) { return new NoSuchIndexException(elasticsearchException.getMetadata("es.index").toString(), ex); } } if (ex.getCause() instanceof ConnectException) { return new DataAccessResourceFailureException(ex.getMessage(), ex); } return null; }
result.addMetadata(metadata, exception.getMetadata(metadata));
public List<String> getResourceId() { return getMetadata(RESOURCE_METADATA_ID_KEY); }
public String getResourceType() { List<String> header = getMetadata(RESOURCE_METADATA_TYPE_KEY); if (header != null && header.isEmpty() == false) { assert header.size() == 1; return header.get(0); } return null; }
public Index getIndex() { List<String> index = getMetadata(INDEX_METADATA_KEY); if (index != null && index.isEmpty() == false) { List<String> index_uuid = getMetadata(INDEX_METADATA_KEY_UUID); return new Index(index.get(0), index_uuid.get(0)); } return null; }
public ShardId getShardId() { List<String> shard = getMetadata(SHARD_METADATA_KEY); if (shard != null && shard.isEmpty() == false) { return new ShardId(getIndex(), Integer.parseInt(shard.get(0))); } return null; }
public List<String> getResourceId() { return getMetadata(RESOURCE_METADATA_ID_KEY); }
public List<String> getResourceId() { return getMetadata(RESOURCE_METADATA_ID_KEY); }
public List<String> getResourceId() { return getMetadata(RESOURCE_METADATA_ID_KEY); }
public String getResourceType() { List<String> header = getMetadata(RESOURCE_METADATA_TYPE_KEY); if (header != null && header.isEmpty() == false) { assert header.size() == 1; return header.get(0); } return null; }
public String getResourceType() { List<String> header = getMetadata(RESOURCE_METADATA_TYPE_KEY); if (header != null && header.isEmpty() == false) { assert header.size() == 1; return header.get(0); } return null; }
public String getResourceType() { List<String> header = getMetadata(RESOURCE_METADATA_TYPE_KEY); if (header != null && header.isEmpty() == false) { assert header.size() == 1; return header.get(0); } return null; }
public Index getIndex() { List<String> index = getMetadata(INDEX_METADATA_KEY); if (index != null && index.isEmpty() == false) { List<String> index_uuid = getMetadata(INDEX_METADATA_KEY_UUID); return new Index(index.get(0), index_uuid.get(0)); } return null; }
public Index getIndex() { List<String> index = getMetadata(INDEX_METADATA_KEY); if (index != null && index.isEmpty() == false) { List<String> index_uuid = getMetadata(INDEX_METADATA_KEY_UUID); return new Index(index.get(0), index_uuid.get(0)); } return null; }
public Index getIndex() { List<String> index = getMetadata(INDEX_METADATA_KEY); if (index != null && index.isEmpty() == false) { List<String> index_uuid = getMetadata(INDEX_METADATA_KEY_UUID); return new Index(index.get(0), index_uuid.get(0)); } return null; }
public ShardId getShardId() { List<String> shard = getMetadata(SHARD_METADATA_KEY); if (shard != null && shard.isEmpty() == false) { return new ShardId(getIndex(), Integer.parseInt(shard.get(0))); } return null; }
public ShardId getShardId() { List<String> shard = getMetadata(SHARD_METADATA_KEY); if (shard != null && shard.isEmpty() == false) { return new ShardId(getIndex(), Integer.parseInt(shard.get(0))); } return null; }
public ShardId getShardId() { List<String> shard = getMetadata(SHARD_METADATA_KEY); if (shard != null && shard.isEmpty() == false) { return new ShardId(getIndex(), Integer.parseInt(shard.get(0))); } return null; }