Example usage for org.apache.lucene.index CorruptIndexException CorruptIndexException

List of usage examples for org.apache.lucene.index CorruptIndexException CorruptIndexException

Introduction

In this page you can find the example usage for org.apache.lucene.index CorruptIndexException CorruptIndexException.

Prototype

public CorruptIndexException(String message, String resourceDescription, Throwable cause) 

Source Link

Document

Create exception with message and root cause.

Usage

From source file:org.codelibs.elasticsearch.common.io.stream.StreamInput.java

License:Apache License

public <T extends Exception> T readException() throws IOException {
    if (readBoolean()) {
        int key = readVInt();
        switch (key) {
        case 0:/*from  ww  w  .j  av  a2  s  .c o  m*/
            final int ord = readVInt();
            return (T) ElasticsearchException.readException(this, ord);
        case 1:
            String msg1 = readOptionalString();
            String resource1 = readOptionalString();
            return (T) readStackTrace(new CorruptIndexException(msg1, resource1, readException()), this);
        case 2:
            String resource2 = readOptionalString();
            int version2 = readInt();
            int minVersion2 = readInt();
            int maxVersion2 = readInt();
            return (T) readStackTrace(
                    new IndexFormatTooNewException(resource2, version2, minVersion2, maxVersion2), this);
        case 3:
            String resource3 = readOptionalString();
            if (readBoolean()) {
                int version3 = readInt();
                int minVersion3 = readInt();
                int maxVersion3 = readInt();
                return (T) readStackTrace(
                        new IndexFormatTooOldException(resource3, version3, minVersion3, maxVersion3), this);
            } else {
                String version3 = readOptionalString();
                return (T) readStackTrace(new IndexFormatTooOldException(resource3, version3), this);
            }
        case 4:
            return (T) readStackTrace(new NullPointerException(readOptionalString()), this);
        case 5:
            return (T) readStackTrace(new NumberFormatException(readOptionalString()), this);
        case 6:
            return (T) readStackTrace(new IllegalArgumentException(readOptionalString(), readException()),
                    this);
        case 7:
            return (T) readStackTrace(new AlreadyClosedException(readOptionalString(), readException()), this);
        case 8:
            return (T) readStackTrace(new EOFException(readOptionalString()), this);
        case 9:
            return (T) readStackTrace(new SecurityException(readOptionalString(), readException()), this);
        case 10:
            return (T) readStackTrace(new StringIndexOutOfBoundsException(readOptionalString()), this);
        case 11:
            return (T) readStackTrace(new ArrayIndexOutOfBoundsException(readOptionalString()), this);
        case 12:
            return (T) readStackTrace(new FileNotFoundException(readOptionalString()), this);
        case 13:
            final int subclass = readVInt();
            final String file = readOptionalString();
            final String other = readOptionalString();
            final String reason = readOptionalString();
            readOptionalString(); // skip the msg - it's composed from file, other and reason
            final Exception exception;
            switch (subclass) {
            case 0:
                exception = new NoSuchFileException(file, other, reason);
                break;
            case 1:
                exception = new NotDirectoryException(file);
                break;
            case 2:
                exception = new DirectoryNotEmptyException(file);
                break;
            case 3:
                exception = new AtomicMoveNotSupportedException(file, other, reason);
                break;
            case 4:
                exception = new FileAlreadyExistsException(file, other, reason);
                break;
            case 5:
                exception = new AccessDeniedException(file, other, reason);
                break;
            case 6:
                exception = new FileSystemLoopException(file);
                break;
            case 7:
                exception = new FileSystemException(file, other, reason);
                break;
            default:
                throw new IllegalStateException("unknown FileSystemException with index " + subclass);
            }
            return (T) readStackTrace(exception, this);
        case 14:
            return (T) readStackTrace(new IllegalStateException(readOptionalString(), readException()), this);
        case 15:
            return (T) readStackTrace(new LockObtainFailedException(readOptionalString(), readException()),
                    this);
        case 16:
            return (T) readStackTrace(new InterruptedException(readOptionalString()), this);
        case 17:
            return (T) readStackTrace(new IOException(readOptionalString(), readException()), this);
        default:
            assert false : "no such exception for id: " + key;
        }
    }
    return null;
}