Exception Fact Sheet for "h2"

The goal of an Exception Fact Sheet is to reveal the design of exception handling in an application.

--Maxence, Martin

For feedback, please contact Martin

Table of contents

Basic Statistics

Number of Classes 711
Number of Domain Exception Types (Thrown or Caught) 13
Number of Domain Checked Exception Types 10
Number of Domain Runtime Exception Types 1
Number of Domain Unknown Exception Types 2
nTh = Number of Throw 1845
nTh = Number of Throw in Catch 736
Number of Catch-Rethrow (may not be correct) 51
nC = Number of Catch 1069
nCTh = Number of Catch with Throw 728
Number of Empty Catch (really Empty) 1
Number of Empty Catch (with comments) 92
Number of Empty Catch 93
nM = Number of Methods 8548
nbFunctionWithCatch = Number of Methods with Catch 929 / 8548
nbFunctionWithThrow = Number of Methods with Throw 1511 / 8548
nbFunctionWithThrowS = Number of Methods with ThrowS 1479 / 8548
nbFunctionTransmitting = Number of Methods with "Throws" but NO catch, NO throw (only transmitting) 782 / 8548
P1 = nCTh / nC 68.1% (0.681)
P2 = nMC / nM 10.9% (0.109)
P3 = nbFunctionWithThrow / nbFunction 17.7% (0.177)
P4 = nbFunctionTransmitting / nbFunction 9.1% (0.091)
P5 = nbThrowInCatch / nbThrow 39.9% (0.399)
R2 = nCatch / nThrow 0.579
A1 = Number of Caught Exception Types From External Libraries 30
A2 = Number of Reused Exception Types From External Libraries (thrown from application code) 15

W1 is a rough estimation of the richness of the exception model. It does not take into account the inheritance relationships between domain exceptions.

Proportion P1 measures the overall exception flow. According to our experience, it varies from 5% to 70%. Early-catch design generally yields a low P1, libraries that must warn clients about errors (e.g. databases) generally have a high P1.

Proportion P2 measures the dispersion of catch blocks in the application. According to our experience, it varies from 2% to 15%. A small P2 indicates a rather centralized management of errors.

R1 shows how many exceptions types from libraries (incl. JDK) are thrown from application code. For instance, IllegalArgumentException comes from the JDK but is used in many applications.

A1 measures the awareness of the application to library exceptions. A high value of A1 means either that the application is polluted with checked exceptions or that it is able to apply specific recovery depending on the library exception.

Exception Hierachy

Exception Map

Each exception that is used at least once in the project is a dot. A orange dot represents a domain exception that is defined in the application. A blue dot exception is defined in the JDK or in a library. The x-axis represents the number of times an exception is caught, the y-axis the number of times an exception is thrown.

Exceptions With State

State means fields. Number of exceptions with state: 2
DbException
              package org.h2.message;public class DbException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private static final Properties MESSAGES = new Properties();

    private Object source;

    static {
        try {
            byte[] messages = Utils.getResource("/org/h2/res/_messages_en.prop");
            if (messages != null) {
                MESSAGES.load(new ByteArrayInputStream(messages));
            }
            String language = Locale.getDefault().getLanguage();
            if (!"en".equals(language)) {
                byte[] translations = Utils.getResource("/org/h2/res/_messages_" + language + ".prop");
                // message: translated message + english
                // (otherwise certain applications don't work)
                if (translations != null) {
                    Properties p = SortedProperties.fromLines(new String(translations, "UTF-8"));
                    for (Entry<Object, Object> e : p.entrySet()) {
                        String key = (String) e.getKey();
                        String translation = (String) e.getValue();
                        if (translation != null && !translation.startsWith("#")) {
                            String original = MESSAGES.getProperty(key);
                            String message = translation + "\n" + original;
                            MESSAGES.put(key, message);
                        }
                    }
                }
            }
        }
            
JdbcSQLException
              package org.h2.jdbc;public class JdbcSQLException extends SQLException {

    /**
     * If the SQL statement contains this text, then it is never added to the
     * SQL exception. Hiding the SQL statement may be important if it contains a
     * passwords, such as a CREATE LINKED TABLE statement.
     */
    public static final String HIDE_SQL = "--hide--";

    private static final long serialVersionUID = 1L;
    private final String originalMessage;
    private final Throwable cause;
    private final String stackTrace;
    private String message;
    private String sql;

    /**
     * Creates a SQLException.
     *
     * @param message the reason
     * @param sql the SQL statement
     * @param state the SQL state
     * @param errorCode the error code
     * @param cause the exception that was the reason for this exception
     * @param stackTrace the stack trace
     */
    public JdbcSQLException(String message, String sql, String state, int errorCode, Throwable cause, String stackTrace) {
        super(message, state, errorCode);
        this.originalMessage = message;
        setSQL(sql);
        this.cause = cause;
        this.stackTrace = stackTrace;
        buildMessage();
        initCause(cause);
    }

    /**
     * Get the detail error message.
     *
     * @return the message
     */
    public String getMessage() {
        return message;
    }

    /**
     * INTERNAL
     */
    public String getOriginalMessage() {
        return originalMessage;
    }

    /**
     * Prints the stack trace to the standard error stream.
     */
    public void printStackTrace() {
        // The default implementation already does that,
        // but we do it again to avoid problems.
        // If it is not implemented, somebody might implement it
        // later on which would be a problem if done in the wrong way.
        printStackTrace(System.err);
    }

    /**
     * Prints the stack trace to the specified print writer.
     *
     * @param s the print writer
     */
    public void printStackTrace(PrintWriter s) {
        if (s != null) {
            super.printStackTrace(s);
            // getNextException().printStackTrace(s) would be very very slow
            // if many exceptions are joined
            SQLException next = getNextException();
            for (int i = 0; i < 100 && next != null; i++) {
                s.println(next.toString());
                next = next.getNextException();
            }
            if (next != null) {
                s.println("(truncated)");
            }
        }
    }

    /**
     * Prints the stack trace to the specified print stream.
     *
     * @param s the print stream
     */
    public void printStackTrace(PrintStream s) {
        if (s != null) {
            super.printStackTrace(s);
            // getNextException().printStackTrace(s) would be very very slow
            // if many exceptions are joined
            SQLException next = getNextException();
            for (int i = 0; i < 100 && next != null; i++) {
                s.println(next.toString());
                next = next.getNextException();
            }
            if (next != null) {
                s.println("(truncated)");
            }
        }
    }

    /**
     * INTERNAL
     */
    public Throwable getOriginalCause() {
        return cause;
    }

    /**
     * Returns the SQL statement.
     * SQL statements that contain '--hide--' are not listed.
     *
     * @return the SQL statement
     */
    public String getSQL() {
        return sql;
    }

    /**
     * INTERNAL
     */
    public void setSQL(String sql) {
        if (sql != null && sql.indexOf(HIDE_SQL) >= 0) {
            sql = "-";
        }
        this.sql = sql;
        buildMessage();
    }

    private void buildMessage() {
        StringBuilder buff = new StringBuilder(originalMessage == null ? "- " : originalMessage);
        if (sql != null) {
            buff.append("; SQL statement:\n").append(sql);
        }
        buff.append(" [").append(getErrorCode()).append('-').append(Constants.BUILD_ID).append(']');
        message = buff.toString();
    }

    /**
     * Returns the class name, the message, and in the server mode, the stack
     * trace of the server
     *
     * @return the string representation
     */
    public String toString() {
        if (stackTrace == null) {
            return super.toString();
        }
        return stackTrace;
    }

}
            

Thrown Exceptions Summary

A (Domain) exception is defined in the application. A (Lib) exception is defined in the JDK or in a library. An exception can be thrown, thrown from within a catch, or declared in the signature of a method (usually for checked exceptions). Hovering over a number triggers showing code snippets from the application code.

Type Exception Thrown Thrown
from Catch
Declared
- Unknown 1580
              
//in src/main/org/h2/jdbcx/JdbcXid.java
throw DbException.get(ErrorCode.WRONG_XID_FORMAT_1, tid);

              
//in src/main/org/h2/jdbcx/JdbcXid.java
throw DbException.get(ErrorCode.WRONG_XID_FORMAT_1, tid);

              
//in src/main/org/h2/jdbcx/JdbcXAConnection.java
throw xa;

              
//in src/main/org/h2/jdbcx/JdbcXAConnection.java
throw convertException(e);

              
//in src/main/org/h2/jdbcx/JdbcXAConnection.java
throw convertException(e);

              
//in src/main/org/h2/jdbcx/JdbcXAConnection.java
throw convertException(e);

              
//in src/main/org/h2/jdbcx/JdbcXAConnection.java
throw convertException(e);

              
//in src/main/org/h2/jdbcx/JdbcXAConnection.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
//in src/main/org/h2/jdbcx/JdbcConnectionPool.java
throw DbException.getUnsupportedException("unwrap");

              
//in src/main/org/h2/jdbcx/JdbcConnectionPool.java
throw DbException.getUnsupportedException("isWrapperFor");

              
//in src/main/org/h2/jdbcx/JdbcDataSource.java
throw unsupported("unwrap");

              
//in src/main/org/h2/jdbcx/JdbcDataSource.java
throw unsupported("isWrapperFor");

              
//in src/main/org/h2/constraint/ConstraintCheck.java
throw DbException.get(ErrorCode.CHECK_CONSTRAINT_VIOLATED_1, getShortDescription());

              
//in src/main/org/h2/constraint/ConstraintCheck.java
throw DbException.get(ErrorCode.CHECK_CONSTRAINT_VIOLATED_1, getName());

              
//in src/main/org/h2/constraint/Constraint.java
throw DbException.throwInternalError("type: " + constraintType);

              
//in src/main/org/h2/constraint/ConstraintReferential.java
throw DbException.get(ErrorCode.REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1,
                    getShortDescription(refIndex, check));

              
//in src/main/org/h2/constraint/ConstraintReferential.java
throw DbException.get(ErrorCode.REFERENTIAL_INTEGRITY_VIOLATED_CHILD_EXISTS_1,
                    getShortDescription(index, check));

              
//in src/main/org/h2/constraint/ConstraintReferential.java
throw DbException.get(ErrorCode.CONSTRAINT_ALREADY_EXISTS_1, "ON DELETE");

              
//in src/main/org/h2/constraint/ConstraintReferential.java
throw DbException.get(ErrorCode.CONSTRAINT_ALREADY_EXISTS_1, "ON UPDATE");

              
//in src/main/org/h2/constraint/ConstraintReferential.java
throw DbException.get(ErrorCode.NO_DEFAULT_SET_1, column.getName());

              
//in src/main/org/h2/constraint/ConstraintReferential.java
throw DbException.get(ErrorCode.REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1,
                    getShortDescription(null, null));

              
//in src/main/org/h2/message/DbException.java
throw e;

              
//in src/main/org/h2/message/DbException.java
throw (Error) e;

              
//in src/main/org/h2/message/TraceObject.java
throw DbException.getUnsupportedException(message);

              
//in src/main/org/h2/message/TraceObject.java
throw logAndConvert(e);

              
//in src/main/org/h2/tools/Restore.java
throw DbException.convertIOException(e, zipFileName);

              
//in src/main/org/h2/tools/ChangeFileEncryption.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/tools/ChangeFileEncryption.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/tools/CompressTool.java
throw DbException.get(ErrorCode.COMPRESSION_ERROR, e);

              
//in src/main/org/h2/tools/CompressTool.java
throw DbException.get(ErrorCode.COMPRESSION_ERROR, e);

              
//in src/main/org/h2/tools/CompressTool.java
throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1, algorithm);

              
//in src/main/org/h2/tools/CompressTool.java
throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1, "" + algorithm);

              
//in src/main/org/h2/tools/CompressTool.java
throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1, compressionAlgorithm);

              
//in src/main/org/h2/tools/CompressTool.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/tools/CompressTool.java
throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1, compressionAlgorithm);

              
//in src/main/org/h2/tools/CompressTool.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/tools/ConvertTraceFile.java
throw DbException.convertIOException(e, traceFile);

              
//in src/main/org/h2/tools/Backup.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/tools/Backup.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/tools/Backup.java
throw DbException.convertIOException(e, zipFileName);

              
//in src/main/org/h2/tools/Csv.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/tools/Csv.java
throw convertException("IOException writing " + outputFileName, e);

              
//in src/main/org/h2/tools/Csv.java
throw convertException("IOException reading " + inputFileName, e);

              
//in src/main/org/h2/tools/Csv.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/tools/Csv.java
throw e;

              
//in src/main/org/h2/tools/Csv.java
throw convertException("IOException reading from " + fileName, e);

              
//in src/main/org/h2/tools/Csv.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, key);

              
//in src/main/org/h2/tools/CreateCluster.java
throw e;

              
//in src/main/org/h2/tools/Recover.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/tools/Recover.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/tools/Recover.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/tools/Recover.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/tools/Server.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/tools/Server.java
throw result;

              
//in src/main/org/h2/tools/Server.java
throw e;

              
//in src/main/org/h2/tools/Server.java
throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2, name, "timeout; " +
                    "please check your network configuration, specially the file /etc/hosts");

              
//in src/main/org/h2/tools/Server.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/tools/RunScript.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/tools/RunScript.java
throw DbException.convertIOException(e, fileName);

              
//in src/main/org/h2/tools/Console.java
throw startException;

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnLabel).getSQLException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw DbException.getInvalidValueException("columnIndex", columnIndex).getSQLException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE).getSQLException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
//in src/main/org/h2/value/ValueNull.java
throw DbException.throwInternalError("compare null");

              
//in src/main/org/h2/value/ValueTime.java
throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2,
                    e, "TIME", s);

              
//in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, fileName);

              
//in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, fileName);

              
//in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/value/ValueDate.java
throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2,
                    e, "DATE", s);

              
//in src/main/org/h2/value/DataType.java
throw DbException.throwInternalError("type="+type);

              
//in src/main/org/h2/value/DataType.java
throw DbException.convert(e);

              
//in src/main/org/h2/value/DataType.java
throw DbException.throwInternalError("type="+type);

              
//in src/main/org/h2/value/DataType.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "?");

              
//in src/main/org/h2/value/DataType.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "" + sqlType);

              
//in src/main/org/h2/value/DataType.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, "char (not supported)");

              
//in src/main/org/h2/value/DataType.java
throw DbException.convert(e);

              
//in src/main/org/h2/value/DataType.java
throw DbException.convert(e);

              
//in src/main/org/h2/value/DataType.java
throw DbException.throwInternalError("primitive=" + clazz.toString());

              
//in src/main/org/h2/value/DataType.java
throw DbException.getUnsupportedException(paramClass.getName());

              
//in src/main/org/h2/value/ValueInt.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Long.toString(x));

              
//in src/main/org/h2/value/ValueInt.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/ValueInt.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/CompareModeDefault.java
throw DbException.throwInternalError(name);

              
//in src/main/org/h2/value/ValueByte.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Integer.toString(x));

              
//in src/main/org/h2/value/ValueByte.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/ValueByte.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/ValueLong.java
throw getOverflow();

              
//in src/main/org/h2/value/ValueLong.java
throw getOverflow();

              
//in src/main/org/h2/value/ValueLong.java
throw getOverflow();

              
//in src/main/org/h2/value/ValueLong.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/ValueLong.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/ValueFloat.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/ValueFloat.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/CompareModeIcu4J.java
throw DbException.getInvalidValueException("collator", name);

              
//in src/main/org/h2/value/CompareModeIcu4J.java
throw DbException.convert(e);

              
//in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, toString());

              
//in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, toString());

              
//in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, toString());

              
//in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/value/ValueTimestamp.java
throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2,
                    e, "TIMESTAMP", s);

              
//in src/main/org/h2/value/ValueTimestamp.java
throw DbException.getInvalidValueException("scale", targetScale);

              
//in src/main/org/h2/value/ValueArray.java
throw throwUnsupportedExceptionForType("PreparedStatement.set");

              
//in src/main/org/h2/value/Value.java
throw DbException.throwInternalError("type:"+type);

              
//in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "?, ?");

              
//in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "NULL, ?");

              
//in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "?, NULL");

              
//in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("+");

              
//in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("SIGNUM");

              
//in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("NEG");

              
//in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("-");

              
//in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("/");

              
//in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("*");

              
//in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("%");

              
//in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, getString());

              
//in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, "" + d);

              
//in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, "" + f);

              
//in src/main/org/h2/value/Value.java
throw DbException.throwInternalError("type=" + targetType);

              
//in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, getString());

              
//in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Long.toString(x));

              
//in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Long.toString(x));

              
//in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Long.toString(x));

              
//in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Double.toString(x));

              
//in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, x.toString());

              
//in src/main/org/h2/value/Value.java
throw DbException.getUnsupportedException(DataType.getDataType(getType()).name + " " + op);

              
//in src/main/org/h2/value/ValueDouble.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/ValueDouble.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/ValueShort.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Integer.toString(x));

              
//in src/main/org/h2/value/ValueShort.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/ValueShort.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "length=" + length);

              
//in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "length:" + length + " written:" + written);

              
//in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "length=" + length);

              
//in src/main/org/h2/value/Transfer.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "type=" + type);

              
//in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic);

              
//in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic);

              
//in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic);

              
//in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic);

              
//in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "type=" + type);

              
//in src/main/org/h2/value/ValueResultSet.java
throw DbException.convert(e);

              
//in src/main/org/h2/value/ValueResultSet.java
throw DbException.convert(e);

              
//in src/main/org/h2/value/ValueResultSet.java
throw throwUnsupportedExceptionForType("PreparedStatement.set");

              
//in src/main/org/h2/value/ValueUuid.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s);

              
//in src/main/org/h2/value/ValueDecimal.java
throw DbException.get(ErrorCode.INVALID_CLASS_2,
                    BigDecimal.class.getName(), value.getClass().getName());

              
//in src/main/org/h2/value/ValueDecimal.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/ValueDecimal.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/value/ValueDecimal.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Long.toString(precision));

              
//in src/main/org/h2/upgrade/DbUpgrade.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/result/ResultRemote.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/result/ResultRemote.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/result/ResultRemote.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/result/ResultDiskBuffer.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/result/ResultDiskBuffer.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/result/ResultDiskBuffer.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/result/LocalResult.java
throw DbException.convert(e);

              
//in src/main/org/h2/result/UpdatableRow.java
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnName);

              
//in src/main/org/h2/result/UpdatableRow.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
//in src/main/org/h2/result/UpdatableRow.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
//in src/main/org/h2/result/UpdatableRow.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
//in src/main/org/h2/result/UpdatableRow.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
//in src/main/org/h2/result/UpdatableRow.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
//in src/main/org/h2/schema/Sequence.java
throw DbException.getInvalidValueException("INCREMENT", 0);

              
//in src/main/org/h2/schema/Sequence.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/schema/Constant.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/schema/Schema.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/schema/Schema.java
throw DbException.throwInternalError("type=" + type);

              
//in src/main/org/h2/schema/Schema.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, name);

              
//in src/main/org/h2/schema/Schema.java
throw DbException.get(ErrorCode.INDEX_NOT_FOUND_1, name);

              
//in src/main/org/h2/schema/Schema.java
throw DbException.get(ErrorCode.CONSTRAINT_NOT_FOUND_1, name);

              
//in src/main/org/h2/schema/Schema.java
throw DbException.get(ErrorCode.CONSTANT_NOT_FOUND_1, constantName);

              
//in src/main/org/h2/schema/Schema.java
throw DbException.get(ErrorCode.SEQUENCE_NOT_FOUND_1, sequenceName);

              
//in src/main/org/h2/schema/Schema.java
throw DbException.convert(e);

              
//in src/main/org/h2/schema/TriggerObject.java
throw DbException.get(ErrorCode.ERROR_CREATING_TRIGGER_OBJECT_3, e, getName(),
                            triggerClassName, e.toString());

              
//in src/main/org/h2/schema/TriggerObject.java
throw e;

              
//in src/main/org/h2/schema/TriggerObject.java
throw DbException.get(ErrorCode.ERROR_EXECUTING_TRIGGER_3, e, getName(),
                            triggerClassName, e.toString());

              
//in src/main/org/h2/schema/TriggerObject.java
throw DbException.convert(e);

              
//in src/main/org/h2/schema/TriggerObject.java
throw DbException.convert(e);

              
//in src/main/org/h2/expression/ConditionInSelect.java
throw DbException.get(ErrorCode.SUBQUERY_IS_NOT_SINGLE_COLUMN);

              
//in src/main/org/h2/expression/Variable.java
throw DbException.throwInternalError("type="+visitor.getType());

              
//in src/main/org/h2/expression/Parameter.java
throw DbException.get(ErrorCode.PARAMETER_NOT_SET_1, "#" + (index + 1));

              
//in src/main/org/h2/expression/Parameter.java
throw DbException.throwInternalError("type="+visitor.getType());

              
//in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.INVALID_PARAMETER_COUNT_2, info.name,
                        "" + args.length);

              
//in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
//in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, regexp);

              
//in src/main/org/h2/expression/Function.java
throw DbException.convert(e);

              
//in src/main/org/h2/expression/Function.java
throw DbException.convert(e);

              
//in src/main/org/h2/expression/Function.java
throw DbException.convertIOException(e, fileName);

              
//in src/main/org/h2/expression/Function.java
throw DbException.throwInternalError("type=" + info.type);

              
//in src/main/org/h2/expression/Function.java
throw DbException.getSyntaxError(sql, 1);

              
//in src/main/org/h2/expression/Function.java
throw DbException.getInvalidValueException("algorithm", algorithm);

              
//in src/main/org/h2/expression/Function.java
throw DbException.getInvalidValueException("date part", part);

              
//in src/main/org/h2/expression/Function.java
throw DbException.throwInternalError("field:" + field);

              
//in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s);

              
//in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s);

              
//in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.INVALID_PARAMETER_COUNT_2, info.name, min + ".." + max);

              
//in src/main/org/h2/expression/Function.java
throw DbException
                        .get(ErrorCode.INVALID_PARAMETER_COUNT_2, info.name, "" + len);

              
//in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.CAN_ONLY_ASSIGN_TO_VARIABLE_1, p0.getSQL());

              
//in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.PARAMETER_NOT_SET_1, "fileName");

              
//in src/main/org/h2/expression/Function.java
throw DbException.convert(e);

              
//in src/main/org/h2/expression/Function.java
throw DbException.throwInternalError("type=" + visitor.getType());

              
//in src/main/org/h2/expression/CompareLike.java
throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, es);

              
//in src/main/org/h2/expression/CompareLike.java
throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, p);

              
//in src/main/org/h2/expression/Rownum.java
throw DbException.throwInternalError("type="+visitor.getType());

              
//in src/main/org/h2/expression/ParameterRemote.java
throw DbException.get(ErrorCode.PARAMETER_NOT_SET_1, "#" + (index + 1));

              
//in src/main/org/h2/expression/ConditionAndOr.java
throw DbException.throwInternalError("andOrType=" + andOrType);

              
//in src/main/org/h2/expression/ConditionAndOr.java
throw DbException.throwInternalError("type=" + andOrType);

              
//in src/main/org/h2/expression/JavaAggregate.java
throw DbException.convert(e);

              
//in src/main/org/h2/expression/JavaAggregate.java
throw DbException.get(ErrorCode.INVALID_USE_OF_AGGREGATE_FUNCTION_1, getSQL());

              
//in src/main/org/h2/expression/JavaAggregate.java
throw DbException.convert(e);

              
//in src/main/org/h2/expression/JavaAggregate.java
throw DbException.convert(e);

              
//in src/main/org/h2/expression/SequenceValue.java
throw DbException.throwInternalError("type="+visitor.getType());

              
//in src/main/org/h2/expression/Operation.java
throw DbException.throwInternalError("opType=" + opType);

              
//in src/main/org/h2/expression/Operation.java
throw DbException.throwInternalError("type=" + opType);

              
//in src/main/org/h2/expression/Operation.java
throw DbException.getUnsupportedException(
                        DataType.getDataType(l).name + " " +
                        getOperationToken() + " " +
                        DataType.getDataType(r).name);

              
//in src/main/org/h2/expression/Comparison.java
throw DbException.throwInternalError("compareType=" + compareType);

              
//in src/main/org/h2/expression/Comparison.java
throw DbException.throwInternalError("type=" + compareType);

              
//in src/main/org/h2/expression/Comparison.java
throw DbException.throwInternalError("type=" + compareType);

              
//in src/main/org/h2/expression/Comparison.java
throw DbException.throwInternalError("type=" + compareType);

              
//in src/main/org/h2/expression/Comparison.java
throw DbException.throwInternalError("type=" + compareType);

              
//in src/main/org/h2/expression/Comparison.java
throw DbException.throwInternalError("type=" + compareType);

              
//in src/main/org/h2/expression/ExpressionColumn.java
throw DbException.get(ErrorCode.AMBIGUOUS_COLUMN_NAME_1, columnName);

              
//in src/main/org/h2/expression/ExpressionColumn.java
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, name);

              
//in src/main/org/h2/expression/ExpressionColumn.java
throw DbException.get(ErrorCode.MUST_GROUP_BY_COLUMN_1, getSQL());

              
//in src/main/org/h2/expression/ExpressionColumn.java
throw DbException.get(ErrorCode.MUST_GROUP_BY_COLUMN_1, getSQL());

              
//in src/main/org/h2/expression/ExpressionColumn.java
throw DbException.get(ErrorCode.MUST_GROUP_BY_COLUMN_1, getSQL());

              
//in src/main/org/h2/expression/ExpressionColumn.java
throw DbException.throwInternalError("type=" + visitor.getType());

              
//in src/main/org/h2/expression/TableFunction.java
throw DbException.get(ErrorCode.INVALID_PARAMETER_COUNT_2, getName(), ">0");

              
//in src/main/org/h2/expression/ValueExpression.java
throw DbException.throwInternalError("type=" + visitor.getType());

              
//in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/expression/Wildcard.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_1, table);

              
//in src/main/org/h2/expression/Wildcard.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_1, table);

              
//in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/expression/Subquery.java
throw DbException.get(ErrorCode.SCALAR_SUBQUERY_CONTAINS_MORE_THAN_ONE_ROW);

              
//in src/main/org/h2/expression/Aggregate.java
throw DbException.get(ErrorCode.INVALID_USE_OF_AGGREGATE_FUNCTION_1, getSQL());

              
//in src/main/org/h2/expression/Aggregate.java
throw DbException.get(ErrorCode.SUM_OR_AVG_ON_WRONG_DATATYPE_1, getSQL());

              
//in src/main/org/h2/expression/Aggregate.java
throw DbException.get(ErrorCode.SUM_OR_AVG_ON_WRONG_DATATYPE_1, getSQL());

              
//in src/main/org/h2/expression/Aggregate.java
throw DbException.throwInternalError("type=" + type);

              
//in src/main/org/h2/expression/Expression.java
throw DbException.convert(e);

              
//in src/main/org/h2/store/PageStreamTrunk.java
throw e;

              
//in src/main/org/h2/store/FileLister.java
throw DbException.get(
                            ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, message).getSQLException();

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.get(ErrorCode.IO_EXCEPTION_1, "Missing lob entry: "+ lob + "/" + seq).getSQLException();

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.get(ErrorCode.IO_EXCEPTION_1, "Missing lob: "+ lobId).getSQLException();

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
//in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
//in src/main/org/h2/store/PageLog.java
throw DbException.throwInternalError("endless loop at " + t);

              
//in src/main/org/h2/store/PageLog.java
throw e;

              
//in src/main/org/h2/store/PageLog.java
throw DbException.getInvalidValueException("transaction name (too long)", transaction);

              
//in src/main/org/h2/store/PageLog.java
throw DbException.throwInternalError(
                        "log.removeUntil not found: " + firstDataPageToKeep + " last " + last);

              
//in src/main/org/h2/store/FileStoreInputStream.java
throw DbException.convertIOException(e, store.name);

              
//in src/main/org/h2/store/Data.java
throw DbException.convert(e);

              
//in src/main/org/h2/store/Data.java
throw DbException
                        .throwInternalError("value size error: got " + (pos - start) + " expected " + getValueLen(v, handler));

              
//in src/main/org/h2/store/Data.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "type: " + type);

              
//in src/main/org/h2/store/Data.java
throw DbException.convert(e);

              
//in src/main/org/h2/store/Data.java
throw DbException.throwInternalError("type=" + v.getType());

              
//in src/main/org/h2/store/InDoubtTransaction.java
throw DbException.throwInternalError("state="+state);

              
//in src/main/org/h2/store/fs/FilePathWrapper.java
throw DbException.convert(e);

              
//in src/main/org/h2/store/fs/FilePathMem.java
throw DbException.get(ErrorCode.FILE_CREATION_FAILED_1, name + " (a file with this name already exists)");

              
//in src/main/org/h2/store/fs/FilePathMem.java
throw DbException.convertIOException(e, name);

              
//in src/main/org/h2/store/fs/FilePathSplit.java
throw DbException.convertIOException(e, name);

              
//in src/main/org/h2/store/fs/FilePathSplit.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/store/fs/FilePathNioMapped.java
throw e2;

              
//in src/main/org/h2/store/fs/FilePathNioMapped.java
throw e2;

              
//in src/main/org/h2/store/fs/FilePathNioMapped.java
throw e;

              
//in src/main/org/h2/store/fs/FilePathZip.java
throw DbException.getUnsupportedException("write");

              
//in src/main/org/h2/store/fs/FilePathZip.java
throw DbException.getUnsupportedException("write");

              
//in src/main/org/h2/store/fs/FilePathZip.java
throw DbException.convertIOException(e, "listFiles " + path);

              
//in src/main/org/h2/store/fs/FilePathZip.java
throw DbException.getUnsupportedException("write");

              
//in src/main/org/h2/store/fs/FilePathZip.java
throw DbException.getUnsupportedException("write");

              
//in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2,
                    name + " (not found)",
                    newName.name);

              
//in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2,
                    new String[] { name, newName + " (exists)" });

              
//in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2, new String[]{name, newName.name});

              
//in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.get(ErrorCode.FILE_DELETE_FAILED_1, name);

              
//in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.convertIOException(e, name);

              
//in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.convertIOException(e, name);

              
//in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.get(ErrorCode.FILE_CREATION_FAILED_1, name + " (a file with this name already exists)");

              
//in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.get(ErrorCode.FILE_CREATION_FAILED_1, name);

              
//in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.convertIOException(e, name);

              
//in src/main/org/h2/store/fs/FilePathDisk.java
throw e;

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, fileName + " length: " + length);

              
//in src/main/org/h2/store/PageStore.java
throw e;

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, fileName);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, e, fileName);

              
//in src/main/org/h2/store/PageStore.java
throw e;

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, fileName + " pageCount: " + pageCount);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "wrong checksum");

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "index not found " + indexId);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "not a data index " + indexId + " " + idx);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "index not found " + indexId);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "not a data index " + indexId + " " + idx);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "index not found " + indexId);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "not a btree index " + indexId + " " + idx);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "index not found " + indexId);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "not a btree index " + indexId + " " + idx);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "page=" + pageId + " type=" + type);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_VERSION_ERROR_1, fileName);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, fileName);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, fileName + " pageSize: " + size);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, fileName);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, pos + " of " + pageCount);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/store/PageStore.java
throw DbException.throwInternalError("Table not found: " + tableId + " " + row + " " + add);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.throwInternalError(row.toString());

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "Table not found:" + parent + " for " + row + " meta:" + metaObjects);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1,
                    "key: " + key + " index: " + index +
                    " table: " + index.getTable() + " row: " + row);

              
//in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.DATABASE_IS_CLOSED);

              
//in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, "name: " + name + " mode: " + mode);

              
//in src/main/org/h2/store/FileStore.java
throw DbException.get(ErrorCode.FILE_VERSION_ERROR_1, name);

              
//in src/main/org/h2/store/FileStore.java
throw DbException.get(ErrorCode.FILE_ENCRYPTION_ERROR_1, name);

              
//in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
//in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
//in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
//in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
//in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
//in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
//in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
//in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Could not save properties " + fileName, e);

              
//in src/main/org/h2/store/FileLock.java
throw e.addSQL(server + "/" + id);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Could not load properties " + fileName, lastException);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Lock file recently modified", null);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Unsupported lock method " + m2, null);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionAlreadyInUse("Locked by another process");

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Another process was faster", null);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Concurrent update", null);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Unsupported lock method " + m2, null);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionAlreadyInUse("Locked by another computer: " + ip);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Unknown host " + ip, e);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionAlreadyInUse("Locked by another process");

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Bind Exception", null);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("IOException", null);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Concurrent update", null);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Another process was faster", null);

              
//in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Sleep interrupted", e);

              
//in src/main/org/h2/store/FileLock.java
throw DbException.get(ErrorCode.UNSUPPORTED_LOCK_METHOD_1, method);

              
//in src/main/org/h2/index/PageBtreeIndex.java
throw DbException.throwInternalError("" + indexName);

              
//in src/main/org/h2/index/PageBtreeIndex.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, "Index on BLOB or CLOB column: " + c.column.getCreateSQL());

              
//in src/main/org/h2/index/PageBtreeIndex.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "" + p);

              
//in src/main/org/h2/index/PageBtreeIndex.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
//in src/main/org/h2/index/PageDataOverflow.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "page:" + getPos() + " type:" + type);

              
//in src/main/org/h2/index/PageDataOverflow.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/ScanIndex.java
throw DbException.get(ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1, rows.size() + ": " + key);

              
//in src/main/org/h2/index/ScanIndex.java
throw DbException.getUnsupportedException("SCAN");

              
//in src/main/org/h2/index/ScanIndex.java
throw DbException.getUnsupportedException("SCAN");

              
//in src/main/org/h2/index/FunctionCursor.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/PageBtree.java
throw index.getDuplicateKeyException();

              
//in src/main/org/h2/index/HashIndex.java
throw getDuplicateKeyException();

              
//in src/main/org/h2/index/HashIndex.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/HashIndex.java
throw DbException.getUnsupportedException("HASH");

              
//in src/main/org/h2/index/LinkedCursor.java
throw DbException.convert(e);

              
//in src/main/org/h2/index/LinkedCursor.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
//in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
//in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
//in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
//in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
//in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
//in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
//in src/main/org/h2/index/FunctionCursorResultSet.java
throw DbException.convert(e);

              
//in src/main/org/h2/index/FunctionCursorResultSet.java
throw DbException.convert(e);

              
//in src/main/org/h2/index/FunctionCursorResultSet.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/RangeIndex.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
//in src/main/org/h2/index/RangeIndex.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
//in src/main/org/h2/index/RangeIndex.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
//in src/main/org/h2/index/RangeIndex.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
//in src/main/org/h2/index/RangeIndex.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
//in src/main/org/h2/index/PageDataCursor.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/PageBtreeLeaf.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1,
                    "page:" + getPos() + " expected index:" + index.getId() +
                    "got:" + indexId);

              
//in src/main/org/h2/index/PageBtreeLeaf.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/PageBtreeLeaf.java
throw DbException.get(ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1, index.getSQL() + ": " + row);

              
//in src/main/org/h2/index/ViewCursor.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/ViewIndex.java
throw DbException.getUnsupportedException("VIEW");

              
//in src/main/org/h2/index/ViewIndex.java
throw DbException.getUnsupportedException("VIEW");

              
//in src/main/org/h2/index/ViewIndex.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_2, "recursive queries without UNION ALL");

              
//in src/main/org/h2/index/ViewIndex.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_2, "recursive queries without UNION ALL");

              
//in src/main/org/h2/index/ViewIndex.java
throw DbException.getUnsupportedException("VIEW");

              
//in src/main/org/h2/index/ViewIndex.java
throw DbException.getUnsupportedException("VIEW");

              
//in src/main/org/h2/index/ViewIndex.java
throw DbException.getUnsupportedException("VIEW");

              
//in src/main/org/h2/index/ViewIndex.java
throw DbException.getUnsupportedException("VIEW");

              
//in src/main/org/h2/index/SingleRowCursor.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/IndexCursor.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/MetaIndex.java
throw DbException.getUnsupportedException("META");

              
//in src/main/org/h2/index/MetaIndex.java
throw DbException.getUnsupportedException("META");

              
//in src/main/org/h2/index/MetaIndex.java
throw DbException.getUnsupportedException("META");

              
//in src/main/org/h2/index/MetaIndex.java
throw DbException.getUnsupportedException("META");

              
//in src/main/org/h2/index/MetaIndex.java
throw DbException.getUnsupportedException("META");

              
//in src/main/org/h2/index/MetaIndex.java
throw DbException.getUnsupportedException("META");

              
//in src/main/org/h2/index/TreeIndex.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/TreeIndex.java
throw getDuplicateKeyException();

              
//in src/main/org/h2/index/TreeIndex.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/TreeIndex.java
throw DbException.throwInternalError("not found!");

              
//in src/main/org/h2/index/TreeIndex.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/BaseIndex.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/BaseIndex.java
throw DbException.getUnsupportedException(toString());

              
//in src/main/org/h2/index/PageDataIndex.java
throw DbException.throwInternalError(table.getName());

              
//in src/main/org/h2/index/PageDataIndex.java
throw e;

              
//in src/main/org/h2/index/PageDataIndex.java
throw getNewDuplicateKeyException();

              
//in src/main/org/h2/index/PageDataIndex.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, p == null ? "null" : p.toString());

              
//in src/main/org/h2/index/PageDataIndex.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "" + pd);

              
//in src/main/org/h2/index/PageDataIndex.java
throw DbException.throwInternalError(p + " parent " + p.getParentPageId() + " expected " + parent);

              
//in src/main/org/h2/index/PageDataIndex.java
throw DbException.throwInternalError(row.toString());

              
//in src/main/org/h2/index/PageDataIndex.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/PageDataIndex.java
throw DbException.getUnsupportedException("PAGE");

              
//in src/main/org/h2/index/NonUniqueHashIndex.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/NonUniqueHashIndex.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/PageDelegateIndex.java
throw DbException.throwInternalError("" + name);

              
//in src/main/org/h2/index/PageDelegateIndex.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/LinkedIndex.java
throw TableLink.wrapException(sql, e);

              
//in src/main/org/h2/index/LinkedIndex.java
throw TableLink.wrapException(sql, e);

              
//in src/main/org/h2/index/LinkedIndex.java
throw DbException.getUnsupportedException("LINKED");

              
//in src/main/org/h2/index/LinkedIndex.java
throw DbException.getUnsupportedException("LINKED");

              
//in src/main/org/h2/index/LinkedIndex.java
throw TableLink.wrapException(sql, e);

              
//in src/main/org/h2/index/LinkedIndex.java
throw TableLink.wrapException(sql, e);

              
//in src/main/org/h2/index/PageDataLeaf.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1,
                    "page:" + getPos() + " expected table:" + index.getId() +
                    " got:" + tableId + " type:" + type);

              
//in src/main/org/h2/index/PageDataLeaf.java
throw index.getDuplicateKeyException();

              
//in src/main/org/h2/index/PageDataLeaf.java
throw DbException.get(ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1,
                    index.getSQL() + ": " + key + " " + (keys == null ? -1 : keys[i]));

              
//in src/main/org/h2/index/MetaCursor.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/MultiVersionIndex.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/ScanCursor.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/PageDataNode.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1,
                    "page:" + getPos() + " expected index:" + index.getId() +
                    "got:" + indexId);

              
//in src/main/org/h2/index/PageDataNode.java
throw DbException.throwInternalError("Page it its own child: " + getPos());

              
//in src/main/org/h2/index/PageDataNode.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/PageBtreeNode.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1,
                    "page:" + getPos() + " expected index:" + index.getId() +
                    "got:" + indexId);

              
//in src/main/org/h2/index/PageBtreeNode.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/PageBtreeNode.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/PageBtreeNode.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/RangeCursor.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/index/IndexCondition.java
throw DbException.throwInternalError("type=" + compareType);

              
//in src/main/org/h2/compress/CompressDeflate.java
throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_OPTIONS_1, options);

              
//in src/main/org/h2/compress/CompressDeflate.java
throw DbException.get(ErrorCode.COMPRESSION_ERROR, e);

              
//in src/main/org/h2/Driver.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw e.addSQL(originalSQL);

              
//in src/main/org/h2/command/Parser.java
throw e.addSQL(sql);

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.SCHEMA_NOT_FOUND_1, schemaName);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.DATABASE_NOT_FOUND_1, catalogName);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.SCHEMA_NOT_FOUND_1, schema);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, tableAlias);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.DUPLICATE_COLUMN_NAME_1, column.getSQL());

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "database name");

              
//in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "table.column");

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.FUNCTION_ALIAS_NOT_FOUND_1, procedureName);

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.FUNCTION_NOT_FOUND_1, functionName);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.DATABASE_NOT_FOUND_1, databaseName);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.DATABASE_NOT_FOUND_1, databaseName);

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.CANNOT_MIX_INDEXED_AND_UNINDEXED_PARAMS);

              
//in src/main/org/h2/command/Parser.java
throw DbException.getInvalidValueException("parameter index", index);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.CANNOT_MIX_INDEXED_AND_UNINDEXED_PARAMS);

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.getInvalidValueException("positive integer", v);

              
//in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "integer");

              
//in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "long");

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "string");

              
//in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "identifier");

              
//in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "identifier");

              
//in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "identifier");

              
//in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "identifier");

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.LITERALS_ARE_NOT_ALLOWED);

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, sub);

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, currentToken);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.INVALID_VALUE_2, Integer.toString(scale), "scale (precision = " + precision + ")");

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.ROLES_AND_RIGHT_CANNOT_BE_MIXED);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.CONSTANT_ALREADY_EXISTS_1, constantName);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, name);

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, aliasName);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, tempViewName);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, tempViewName);

              
//in src/main/org/h2/command/Parser.java
throw e;

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.SCHEMA_NAME_MUST_MATCH);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName);

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw DbException.getInvalidValueException("collation", name);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, tableName);

              
//in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.SEQUENCE_NOT_FOUND_1, sequenceName);

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
//in src/main/org/h2/command/ddl/AlterUser.java
throw DbException.get(ErrorCode.USER_ALREADY_EXISTS_1, newName);

              
//in src/main/org/h2/command/ddl/GrantRevoke.java
throw DbException.get(ErrorCode.USER_OR_ROLE_NOT_FOUND_1, granteeName);

              
//in src/main/org/h2/command/ddl/GrantRevoke.java
throw DbException.get(ErrorCode.ROLE_NOT_FOUND_1, name);

              
//in src/main/org/h2/command/ddl/GrantRevoke.java
throw DbException.get(ErrorCode.ROLE_ALREADY_GRANTED_1, grantedRole.getSQL());

              
//in src/main/org/h2/command/ddl/CreateView.java
throw DbException.get(ErrorCode.VIEW_ALREADY_EXISTS_1, viewName);

              
//in src/main/org/h2/command/ddl/CreateView.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, "parameters in views");

              
//in src/main/org/h2/command/ddl/CreateSchema.java
throw DbException.get(ErrorCode.SCHEMA_ALREADY_EXISTS_1, schemaName);

              
//in src/main/org/h2/command/ddl/DropRole.java
throw DbException.get(ErrorCode.ROLE_CAN_NOT_BE_DROPPED_1, roleName);

              
//in src/main/org/h2/command/ddl/DropRole.java
throw DbException.get(ErrorCode.ROLE_NOT_FOUND_1, roleName);

              
//in src/main/org/h2/command/ddl/AlterTableRename.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, newTableName);

              
//in src/main/org/h2/command/ddl/AlterTableRename.java
throw DbException.getUnsupportedException("temp table");

              
//in src/main/org/h2/command/ddl/DropUser.java
throw DbException.get(ErrorCode.USER_NOT_FOUND_1, userName);

              
//in src/main/org/h2/command/ddl/DropUser.java
throw DbException.get(ErrorCode.CANNOT_DROP_CURRENT_USER);

              
//in src/main/org/h2/command/ddl/DropAggregate.java
throw DbException.get(ErrorCode.AGGREGATE_NOT_FOUND_1, name);

              
//in src/main/org/h2/command/ddl/DropIndex.java
throw DbException.get(ErrorCode.INDEX_NOT_FOUND_1, indexName);

              
//in src/main/org/h2/command/ddl/DropIndex.java
throw DbException.get(ErrorCode.INDEX_BELONGS_TO_CONSTRAINT_1, indexName);

              
//in src/main/org/h2/command/ddl/AlterSchemaRename.java
throw DbException.get(ErrorCode.SCHEMA_CAN_NOT_BE_DROPPED_1, oldSchema.getName());

              
//in src/main/org/h2/command/ddl/AlterSchemaRename.java
throw DbException.get(ErrorCode.SCHEMA_ALREADY_EXISTS_1, newSchemaName);

              
//in src/main/org/h2/command/ddl/CreateSequence.java
throw DbException.get(ErrorCode.SEQUENCE_ALREADY_EXISTS_1, sequenceName);

              
//in src/main/org/h2/command/ddl/CreateConstant.java
throw DbException.get(ErrorCode.CONSTANT_ALREADY_EXISTS_1, constantName);

              
//in src/main/org/h2/command/ddl/CreateTrigger.java
throw DbException.get(ErrorCode.TRIGGER_ALREADY_EXISTS_1, triggerName);

              
//in src/main/org/h2/command/ddl/CreateAggregate.java
throw DbException.get(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, name);

              
//in src/main/org/h2/command/ddl/CreateIndex.java
throw DbException.get(ErrorCode.INDEX_ALREADY_EXISTS_1, indexName);

              
//in src/main/org/h2/command/ddl/CreateIndex.java
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);

              
//in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.get(ErrorCode.CONSTRAINT_ALREADY_EXISTS_1, constraintName);

              
//in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);

              
//in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);

              
//in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);

              
//in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, "Reference " + refTable.getSQL());

              
//in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
//in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.throwInternalError("type=" + type);

              
//in src/main/org/h2/command/ddl/DropTrigger.java
throw DbException.get(ErrorCode.TRIGGER_NOT_FOUND_1, triggerName);

              
//in src/main/org/h2/command/ddl/AlterIndexRename.java
throw DbException.get(ErrorCode.INDEX_ALREADY_EXISTS_1, newIndexName);

              
//in src/main/org/h2/command/ddl/CreateTable.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, data.tableName);

              
//in src/main/org/h2/command/ddl/CreateTable.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
//in src/main/org/h2/command/ddl/CreateTable.java
throw e;

              
//in src/main/org/h2/command/ddl/CreateTable.java
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);

              
//in src/main/org/h2/command/ddl/CreateTable.java
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);

              
//in src/main/org/h2/command/ddl/CreateLinkedTable.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1,
                    tableName);

              
//in src/main/org/h2/command/ddl/DropConstant.java
throw DbException.get(ErrorCode.CONSTANT_NOT_FOUND_1, constantName);

              
//in src/main/org/h2/command/ddl/DropSchema.java
throw DbException.get(ErrorCode.SCHEMA_NOT_FOUND_1, schemaName);

              
//in src/main/org/h2/command/ddl/DropSchema.java
throw DbException.get(ErrorCode.SCHEMA_CAN_NOT_BE_DROPPED_1, schemaName);

              
//in src/main/org/h2/command/ddl/CreateFunctionAlias.java
throw DbException.get(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, aliasName);

              
//in src/main/org/h2/command/ddl/DropUserDataType.java
throw DbException.get(ErrorCode.USER_DATA_TYPE_NOT_FOUND_1, typeName);

              
//in src/main/org/h2/command/ddl/CreateUserDataType.java
throw DbException.get(ErrorCode.USER_DATA_TYPE_ALREADY_EXISTS_1, typeName);

              
//in src/main/org/h2/command/ddl/CreateUserDataType.java
throw DbException.get(ErrorCode.USER_DATA_TYPE_ALREADY_EXISTS_1, typeName);

              
//in src/main/org/h2/command/ddl/CreateUserDataType.java
throw DbException.get(ErrorCode.USER_DATA_TYPE_ALREADY_EXISTS_1, typeName + " (" + table.getSQL() + ")");

              
//in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
throw DbException.get(ErrorCode.CANNOT_DROP_LAST_COLUMN, oldColumn.getSQL());

              
//in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
throw DbException.get(ErrorCode.COLUMN_IS_REFERENCED_1, defaultExpression.getSQL());

              
//in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
throw DbException.getUnsupportedException("TEMP TABLE");

              
//in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage());

              
//in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
throw DbException.get(ErrorCode.COLUMN_IS_PART_OF_INDEX_1, index.getSQL());

              
//in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
throw DbException.get(ErrorCode.COLUMN_CONTAINS_NULL_VALUES_1, oldColumn.getSQL());

              
//in src/main/org/h2/command/ddl/AlterTableDropConstraint.java
throw DbException.get(ErrorCode.CONSTRAINT_NOT_FOUND_1, constraintName);

              
//in src/main/org/h2/command/ddl/CreateRole.java
throw DbException.get(ErrorCode.USER_ALREADY_EXISTS_1, roleName);

              
//in src/main/org/h2/command/ddl/CreateRole.java
throw DbException.get(ErrorCode.ROLE_ALREADY_EXISTS_1, roleName);

              
//in src/main/org/h2/command/ddl/DropView.java
throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName);

              
//in src/main/org/h2/command/ddl/DropView.java
throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName);

              
//in src/main/org/h2/command/ddl/DropView.java
throw DbException.get(ErrorCode.CANNOT_DROP_2, viewName, child.getName());

              
//in src/main/org/h2/command/ddl/DropFunctionAlias.java
throw DbException.get(ErrorCode.FUNCTION_ALIAS_NOT_FOUND_1, aliasName);

              
//in src/main/org/h2/command/ddl/AlterView.java
throw e;

              
//in src/main/org/h2/command/ddl/DropSequence.java
throw DbException.get(ErrorCode.SEQUENCE_NOT_FOUND_1, sequenceName);

              
//in src/main/org/h2/command/ddl/DropSequence.java
throw DbException.get(ErrorCode.SEQUENCE_BELONGS_TO_A_TABLE_1, sequenceName);

              
//in src/main/org/h2/command/ddl/SetComment.java
throw DbException.get(errorCode, objectName);

              
//in src/main/org/h2/command/ddl/DropTable.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, tableName);

              
//in src/main/org/h2/command/ddl/DropTable.java
throw DbException.get(ErrorCode.CANNOT_DROP_TABLE_1, tableName);

              
//in src/main/org/h2/command/ddl/DropTable.java
throw DbException.get(ErrorCode.CANNOT_DROP_2, tableName, buff.toString());

              
//in src/main/org/h2/command/ddl/TruncateTable.java
throw DbException.get(ErrorCode.CANNOT_TRUNCATE_1, table.getSQL());

              
//in src/main/org/h2/command/ddl/CreateUser.java
throw DbException.get(ErrorCode.ROLE_ALREADY_EXISTS_1, userName);

              
//in src/main/org/h2/command/ddl/CreateUser.java
throw DbException.get(ErrorCode.USER_ALREADY_EXISTS_1, userName);

              
//in src/main/org/h2/command/ddl/CreateUser.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/command/dml/Query.java
throw DbException.get(ErrorCode.ORDER_BY_NOT_IN_RESULT, e.getSQL());

              
//in src/main/org/h2/command/dml/Query.java
throw DbException.get(ErrorCode.ORDER_BY_NOT_IN_RESULT, "" + (idx + 1));

              
//in src/main/org/h2/command/dml/RunScriptCommand.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/command/dml/RunScriptCommand.java
throw e.addSQL(sql);

              
//in src/main/org/h2/command/dml/Select.java
throw DbException.getInvalidValueException("ORDER BY", idx + 1);

              
//in src/main/org/h2/command/dml/Select.java
throw DbException.getUnsupportedException("FOR UPDATE && GROUP");

              
//in src/main/org/h2/command/dml/Select.java
throw DbException.getUnsupportedException("FOR UPDATE && DISTINCT");

              
//in src/main/org/h2/command/dml/Select.java
throw DbException.getUnsupportedException("FOR UPDATE && AGGREGATE");

              
//in src/main/org/h2/command/dml/Select.java
throw DbException.getUnsupportedException("FOR UPDATE && JOIN");

              
//in src/main/org/h2/command/dml/Select.java
throw DbException.getUnsupportedException("FOR UPDATE && JOIN");

              
//in src/main/org/h2/command/dml/Select.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, tableAlias);

              
//in src/main/org/h2/command/dml/Select.java
throw DbException.get(ErrorCode.UNSUPPORTED_OUTER_JOIN_CONDITION_1, on.getSQL());

              
//in src/main/org/h2/command/dml/SelectUnion.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
//in src/main/org/h2/command/dml/ScriptBase.java
throw DbException.convertIOException(e, file);

              
//in src/main/org/h2/command/dml/ScriptBase.java
throw DbException.get(ErrorCode.FILE_NOT_FOUND_1, SCRIPT_SQL + " in " + file);

              
//in src/main/org/h2/command/dml/ScriptBase.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.get(ErrorCode.SCHEMA_NOT_FOUND_1, schemaName);

              
//in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.convertIOException(e, getFileName());

              
//in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/command/dml/Merge.java
throw setRow(ex, count, getSQL(expr));

              
//in src/main/org/h2/command/dml/Merge.java
throw setRow(ex, count, getSQL(r));

              
//in src/main/org/h2/command/dml/Merge.java
throw DbException.get(ErrorCode.COLUMN_CONTAINS_NULL_VALUES_1, col.getSQL());

              
//in src/main/org/h2/command/dml/Merge.java
throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, table.getName());

              
//in src/main/org/h2/command/dml/Merge.java
throw e;

              
//in src/main/org/h2/command/dml/Merge.java
throw DbException.get(ErrorCode.DUPLICATE_KEY_1, table.getSQL());

              
//in src/main/org/h2/command/dml/Merge.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
//in src/main/org/h2/command/dml/Merge.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
//in src/main/org/h2/command/dml/Merge.java
throw DbException.get(ErrorCode.CONSTRAINT_NOT_FOUND_1, "PRIMARY KEY");

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("ALLOW_LITERALS", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("CACHE_SIZE", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.get(ErrorCode.COLLATION_CHANGE_WITH_DATA_TABLE_1, table.getSQL());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("DB_CLOSE_DELAY", x);

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("DEFAULT_LOCK_TIMEOUT", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("EXCLUSIVE", value);

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("LOCK_TIMEOUT", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("MAX_LENGTH_INPLACE_LOB", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("MAX_LOG_SIZE", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("MAX_MEMORY_ROWS", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("MAX_MEMORY_UNDO", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("MAX_OPERATION_MEMORY", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.get(ErrorCode.UNKNOWN_MODE_1, stringValue);

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.get(ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, "MVCC");

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("QUERY_TIMEOUT", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("REFERENTIAL_INTEGRITY", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("TRACE_MAX_FILE_SIZE", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("THROTTLE", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("UNDO_LOG", getIntValue());

              
//in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("WRITE_DELAY", getIntValue());

              
//in src/main/org/h2/command/dml/AlterSequence.java
throw DbException.get(ErrorCode.SEQUENCE_NOT_FOUND_1, column.getSQL());

              
//in src/main/org/h2/command/dml/AlterSequence.java
throw DbException.getInvalidValueException("INCREMENT", 0);

              
//in src/main/org/h2/command/dml/Update.java
throw DbException.get(ErrorCode.DUPLICATE_COLUMN_NAME_1, column
                    .getName());

              
//in src/main/org/h2/command/dml/BackupCommand.java
throw DbException.get(ErrorCode.DATABASE_IS_NOT_PERSISTENT);

              
//in src/main/org/h2/command/dml/BackupCommand.java
throw DbException.convertIOException(e, fileName);

              
//in src/main/org/h2/command/dml/Insert.java
throw setRow(ex, x, getSQL(expr));

              
//in src/main/org/h2/command/dml/Insert.java
throw setRow(ex, rowNumber, getSQL(values));

              
//in src/main/org/h2/command/dml/Insert.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
//in src/main/org/h2/command/dml/Insert.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
//in src/main/org/h2/command/Command.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_QUERY);

              
//in src/main/org/h2/command/Command.java
throw DbException.get(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY);

              
//in src/main/org/h2/command/Command.java
throw DbException.get(ErrorCode.STATEMENT_WAS_CANCELED);

              
//in src/main/org/h2/command/Command.java
throw DbException.convert(e);

              
//in src/main/org/h2/command/Command.java
throw e;

              
//in src/main/org/h2/command/Command.java
throw DbException.convert(e);

              
//in src/main/org/h2/command/Command.java
throw e;

              
//in src/main/org/h2/command/Command.java
throw e;

              
//in src/main/org/h2/command/Command.java
throw e;

              
//in src/main/org/h2/command/Command.java
throw DbException.get(ErrorCode.LOCK_TIMEOUT_1, e.getCause(), "");

              
//in src/main/org/h2/command/Prepared.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "database closed");

              
//in src/main/org/h2/command/Prepared.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_QUERY);

              
//in src/main/org/h2/command/Prepared.java
throw DbException.get(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw e;

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getInvalidValueException("level", level);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.throwInternalError("lockMode:" + lockMode);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.get(ErrorCode.SAVEPOINT_IS_INVALID_1, "" + savepoint);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.get(ErrorCode.UNSUPPORTED_JAVA_VERSION);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.throwInternalError("c=" + c);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getInvalidValueException("SQL", null);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i, "=");

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, sql.length() - 1);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getInvalidValueException("resultSetType", resultSetType);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getInvalidValueException("resultSetConcurrency", resultSetConcurrency);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getInvalidValueException("resultSetHoldability", resultSetHoldability);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.get(ErrorCode.DATABASE_CALLED_AT_SHUTDOWN);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw unsupported("SQLXML");

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw unsupported("createArray");

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw unsupported("Struct");

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw unsupported("clientInfo");

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw unsupported("unwrap");

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw unsupported("isWrapperFor");

              
//in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getUnsupportedException("map.size > 0");

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw unsupported("ref");

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw unsupported("unicodeStream");

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw unsupported("setArray");

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw unsupported("url");

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw e;

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.getInvalidValueException("parameterIndex", parameterIndex + 1);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw unsupported("rowId");

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw unsupported("SQLXML");

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw DbException.getInvalidValueException("columnIndex", columnIndex);

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw unsupported("unwrap");

              
//in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw unsupported("isWrapperFor");

              
//in src/main/org/h2/jdbc/JdbcSavepoint.java
throw DbException.get(ErrorCode.SAVEPOINT_IS_INVALID_1, getName(name, savepointId));

              
//in src/main/org/h2/jdbc/JdbcSavepoint.java
throw DbException.get(ErrorCode.SAVEPOINT_IS_NAMED);

              
//in src/main/org/h2/jdbc/JdbcSavepoint.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcSavepoint.java
throw DbException.get(ErrorCode.SAVEPOINT_IS_UNNAMED);

              
//in src/main/org/h2/jdbc/JdbcSavepoint.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw unsupported("LOB update");

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw unsupported("LOB update");

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.getInvalidValueException("pos", pos);

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.getInvalidValueException("length", value.getPrecision());

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.getInvalidValueException("pos", pos);

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.getInvalidValueException("length", length);

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.getInvalidValueException("pos", pos);

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.getInvalidValueException("str", str);

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw unsupported("LOB update");

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw unsupported("LOB search");

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw unsupported("LOB search");

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw unsupported("LOB subset");

              
//in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("superTypes");

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("attributes");

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("getSchemas(., .)");

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("clientInfoProperties");

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("unwrap");

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("isWrapperFor");

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("getFunctionColumns");

              
//in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("getFunctions");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.getInvalidValueException("scale", scale);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.getInvalidValueException("scale", scale);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("unicodeStream");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("unicodeStream");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("map");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("map");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("ref");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("ref");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("url");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("url");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("ref");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("ref");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("setArray");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("setArray");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("cursorName");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.getInvalidValueException("rows", rows);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.getInvalidValueException("rows", rows);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("setFetchDirection");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.NOT_ON_UPDATABLE_ROW);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.NOT_ON_UPDATABLE_ROW);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.NOT_ON_UPDATABLE_ROW);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.RESULT_SET_NOT_UPDATABLE);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.getInvalidValueException("columnLabel", null);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnLabel);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnLabel);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.getInvalidValueException("columnIndex", columnIndex);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.RESULT_SET_NOT_SCROLLABLE);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("rowId");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("rowId");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("rowId");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("rowId");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("NClob");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("NClob");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("NClob");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("NClob");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("NClob");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("NClob");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("SQLXML");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("SQLXML");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("SQLXML");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("SQLXML");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("unwrap");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("isWrapperFor");

              
//in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.RESULT_SET_READONLY);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw DbException.getInvalidValueException("count (1.."
                    + array.length + ")", count);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw DbException.getInvalidValueException("index (1.."
                    + array.length + ")", index);

              
//in src/main/org/h2/jdbc/JdbcArray.java
throw DbException.getUnsupportedException("map.size > 0");

              
//in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw DbException.getInvalidValueException("param", param);

              
//in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw unsupported("unwrap");

              
//in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw unsupported("isWrapperFor");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("url");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("map");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("ref");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("url");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("ref");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("map");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("rowId");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("rowId");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("SQLXML");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("SQLXML");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("url");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("rowId");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("SQLXML");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw DbException.getUnsupportedException("Supported only for calling stored procedures");

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw DbException.getInvalidValueException("parameterIndex", parameterIndex);

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw DbException.getInvalidValueException("parameterIndex", parameterIndex);

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw DbException.getInvalidValueException("parameterName", parameterName);

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
//in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw unsupported("LOB update");

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw DbException.getInvalidValueException("pos", pos);

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw unsupported("LOB update");

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw DbException.getInvalidValueException("pos", pos);

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw DbException.getInvalidValueException("length", value.getPrecision());

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw unsupported("LOB search");

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw unsupported("LOB subset");

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw unsupported("LOB update");

              
//in src/main/org/h2/jdbc/JdbcBlob.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw DbException.getInvalidValueException("maxRows", maxRows);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw DbException.getInvalidValueException("rows", rows);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw DbException.getInvalidValueException("seconds", seconds);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw DbException.getInvalidValueException("current", current);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw unsupported("unwrap");

              
//in src/main/org/h2/jdbc/JdbcStatement.java
throw unsupported("isWrapperFor");

              
//in src/main/org/h2/engine/Comment.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/engine/UserAggregate.java
throw DbException.convert(e);

              
//in src/main/org/h2/engine/UserAggregate.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/engine/UserAggregate.java
throw DbException.getUnsupportedException("AGGREGATE");

              
//in src/main/org/h2/engine/User.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/engine/User.java
throw DbException.get(ErrorCode.NOT_ENOUGH_RIGHTS_FOR_1, table.getSQL());

              
//in src/main/org/h2/engine/User.java
throw DbException.get(ErrorCode.ADMIN_RIGHTS_REQUIRED);

              
//in src/main/org/h2/engine/User.java
throw DbException.get(ErrorCode.CANNOT_DROP_2, getName(), s.getName());

              
//in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.getInvalidValueException("url", u);

              
//in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.convert(e);

              
//in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.get(ErrorCode.IO_EXCEPTION_1, normalizedName + " outside " +
                        absDir);

              
//in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.get(ErrorCode.DUPLICATE_PROPERTY_1, key);

              
//in src/main/org/h2/engine/ConnectionInfo.java
throw getFormatException();

              
//in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.get(ErrorCode.UNSUPPORTED_SETTING_1, key);

              
//in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.get(ErrorCode.DUPLICATE_PROPERTY_1, key);

              
//in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.get(ErrorCode.WRONG_PASSWORD_FORMAT);

              
//in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.get(ErrorCode.INVALID_DATABASE_NAME_1, name);

              
//in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.convert(e);

              
//in src/main/org/h2/engine/Database.java
throw DbException.convert(e);

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.DATABASE_IS_CLOSED);

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.FILE_NOT_FOUND_1, name);

              
//in src/main/org/h2/engine/Database.java
throw e;

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.FILE_VERSION_ERROR_1,
                        "Old database: " + dataFileName + " - please convert the database to a SQL script and re-create it.");

              
//in src/main/org/h2/engine/Database.java
throw DbException.getUnsupportedException("autoServerMode && (readOnly || fileLockMethod == NO" +
                            " || fileLockMethod == SERIALIZED || inMemory)");

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, "Lock file exists: " + lockFileName);

              
//in src/main/org/h2/engine/Database.java
throw e;

              
//in src/main/org/h2/engine/Database.java
throw DbException.getUnsupportedException("autoServerMode && inMemory");

              
//in src/main/org/h2/engine/Database.java
throw DbException.convert(e);

              
//in src/main/org/h2/engine/Database.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/engine/Database.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/engine/Database.java
throw DbException.throwInternalError("type=" + type);

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.USER_NOT_FOUND_1, name);

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE);

              
//in src/main/org/h2/engine/Database.java
throw DbException.convertIOException(e, databaseName);

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.SCHEMA_NOT_FOUND_1, schemaName);

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.CANNOT_DROP_2, obj.getSQL(), t.getSQL());

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.DATABASE_IS_READ_ONLY);

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.NO_DISK_SPACE_AVAILABLE);

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.DATABASE_IS_READ_ONLY);

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.ERROR_SETTING_DATABASE_EVENT_LISTENER_2, e, className, e.toString());

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, "LOCK_MODE=0 & MULTI_THREADED");

              
//in src/main/org/h2/engine/Database.java
throw DbException.getInvalidValueException("lock mode", lockMode);

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, "MVCC & MULTI_THREADED");

              
//in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, "LOCK_MODE=0 & MULTI_THREADED");

              
//in src/main/org/h2/engine/Database.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/engine/Database.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/engine/Database.java
throw DbException.getInvalidValueException("LOG", log);

              
//in src/main/org/h2/engine/Database.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/engine/DatabaseCloser.java
throw e;

              
//in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.DATABASE_NOT_FOUND_1, name);

              
//in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.WRONG_USER_OR_PASSWORD);

              
//in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX");

              
//in src/main/org/h2/engine/Engine.java
throw DbException.convert(e);

              
//in src/main/org/h2/engine/Engine.java
throw e;

              
//in src/main/org/h2/engine/Engine.java
throw e;

              
//in src/main/org/h2/engine/Engine.java
throw e;

              
//in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.CLUSTER_ERROR_DATABASE_RUNS_ALONE);

              
//in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.CLUSTER_ERROR_DATABASE_RUNS_CLUSTERED_1, clusterDb);

              
//in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX");

              
//in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.WRONG_USER_OR_PASSWORD);

              
//in src/main/org/h2/engine/SettingsBase.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s);

              
//in src/main/org/h2/engine/SettingsBase.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s);

              
//in src/main/org/h2/engine/UndoLogRecord.java
throw e;

              
//in src/main/org/h2/engine/UndoLogRecord.java
throw e;

              
//in src/main/org/h2/engine/SessionRemote.java
throw e;

              
//in src/main/org/h2/engine/SessionRemote.java
throw DbException.getUnsupportedException("remote");

              
//in src/main/org/h2/engine/SessionRemote.java
throw e;

              
//in src/main/org/h2/engine/SessionRemote.java
throw ci.getFormatException();

              
//in src/main/org/h2/engine/SessionRemote.java
throw DbException.convertIOException(e, prefix);

              
//in src/main/org/h2/engine/SessionRemote.java
throw DbException.getUnsupportedException("autoServer && serverList != null");

              
//in src/main/org/h2/engine/SessionRemote.java
throw DbException.convert(e);

              
//in src/main/org/h2/engine/SessionRemote.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, e, e + ": " + s);

              
//in src/main/org/h2/engine/SessionRemote.java
throw e;

              
//in src/main/org/h2/engine/SessionRemote.java
throw e;

              
//in src/main/org/h2/engine/SessionRemote.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "session closed");

              
//in src/main/org/h2/engine/SessionRemote.java
throw closeError;

              
//in src/main/org/h2/engine/SessionRemote.java
throw e;

              
//in src/main/org/h2/engine/SessionRemote.java
throw DbException.convert(s);

              
//in src/main/org/h2/engine/SessionRemote.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "unexpected status " + status);

              
//in src/main/org/h2/engine/SessionRemote.java
throw DbException.get(ErrorCode.FILE_NOT_FOUND_1, name);

              
//in src/main/org/h2/engine/SessionRemote.java
throw e;

              
//in src/main/org/h2/engine/Role.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/engine/MetaRecord.java
throw e;

              
//in src/main/org/h2/engine/MetaRecord.java
throw DbException.throwInternalError("type="+objectType);

              
//in src/main/org/h2/engine/UserDataType.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, table.getSQL());

              
//in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.INDEX_ALREADY_EXISTS_1, index.getSQL());

              
//in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.CONSTRAINT_ALREADY_EXISTS_1, constraint.getSQL());

              
//in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "session closed");

              
//in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.COMMIT_ROLLBACK_NOT_ALLOWED);

              
//in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.SAVEPOINT_IS_INVALID_1, name);

              
//in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.SAVEPOINT_IS_INVALID_1, name);

              
//in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.TRANSACTION_NOT_FOUND_1, transactionName);

              
//in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.STATEMENT_WAS_CANCELED);

              
//in src/main/org/h2/engine/Setting.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/engine/Setting.java
throw DbException.getUnsupportedException("RENAME");

              
//in src/main/org/h2/engine/FunctionAlias.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_1, javaClassMethod);

              
//in src/main/org/h2/engine/FunctionAlias.java
throw e;

              
//in src/main/org/h2/engine/FunctionAlias.java
throw e;

              
//in src/main/org/h2/engine/FunctionAlias.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_1, e, source);

              
//in src/main/org/h2/engine/FunctionAlias.java
throw DbException.get(
                                ErrorCode.METHODS_MUST_HAVE_DIFFERENT_PARAMETER_COUNTS_2,
                                old.toString(), javaMethod.toString()
                        );

              
//in src/main/org/h2/engine/FunctionAlias.java
throw DbException.get(ErrorCode.PUBLIC_STATIC_JAVA_METHOD_NOT_FOUND_1, methodName + " (" + className + ")");

              
//in src/main/org/h2/engine/FunctionAlias.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/engine/FunctionAlias.java
throw DbException.getUnsupportedException("RENAME");

              
//in src/main/org/h2/engine/FunctionAlias.java
throw DbException.get(ErrorCode.METHOD_NOT_FOUND_1,
                methodName + " (" + className + ", parameter count: " + parameterCount + ")");

              
//in src/main/org/h2/engine/FunctionAlias.java
throw DbException.convertInvocation(e, buff.toString());

              
//in src/main/org/h2/engine/FunctionAlias.java
throw DbException.convert(e);

              
//in src/main/org/h2/util/SortedProperties.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/util/SmallMap.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
//in src/main/org/h2/util/ScriptReader.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/util/ScriptReader.java
throw DbException.convertIOException(e, null);

              
//in src/main/org/h2/util/SourceCompiler.java
throw DbException.convert(e);

              
//in src/main/org/h2/util/SourceCompiler.java
throw DbException.convert(e);

              
//in src/main/org/h2/util/SourceCompiler.java
throw DbException.convert(e);

              
//in src/main/org/h2/util/SourceCompiler.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_1, err);

              
//in src/main/org/h2/util/NetUtils.java
throw e;

              
//in src/main/org/h2/util/NetUtils.java
throw e;

              
//in src/main/org/h2/util/NetUtils.java
throw e;

              
//in src/main/org/h2/util/NetUtils.java
throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2,
                    be, "" + port, be.toString());

              
//in src/main/org/h2/util/NetUtils.java
throw DbException.convertIOException(e, "port: " + port + " ssl: " + ssl);

              
//in src/main/org/h2/util/NetUtils.java
throw DbException.convert(e);

              
//in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/util/IOUtils.java
throw DbException.convert(e);

              
//in src/main/org/h2/util/IOUtils.java
throw DbException.convert(e);

              
//in src/main/org/h2/util/IOUtils.java
throw DbException.convert(e);

              
//in src/main/org/h2/util/IOUtils.java
throw DbException.convert(e);

              
//in src/main/org/h2/util/Utils.java
throw DbException.get(ErrorCode.SERIALIZATION_FAILED_1, e, e.toString());

              
//in src/main/org/h2/util/Utils.java
throw DbException.get(ErrorCode.DESERIALIZATION_FAILED_1, e, e.toString());

              
//in src/main/org/h2/util/Utils.java
throw e2;

              
//in src/main/org/h2/util/Utils.java
throw DbException.get(ErrorCode.ACCESS_DENIED_TO_CLASS_1, className);

              
//in src/main/org/h2/util/Utils.java
throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className);

              
//in src/main/org/h2/util/Utils.java
throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className);

              
//in src/main/org/h2/util/Utils.java
throw DbException.get(ErrorCode.GENERAL_ERROR_1, e, className);

              
//in src/main/org/h2/util/MathUtils.java
throw DbException.getInvalidValueException("scale", scale);

              
//in src/main/org/h2/util/JdbcUtils.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/util/DateTimeUtils.java
throw DbException.getInvalidValueException("calendar", null);

              
//in src/main/org/h2/util/DateTimeUtils.java
throw DbException.getInvalidValueException("calendar", null);

              
//in src/main/org/h2/util/DateTimeUtils.java
throw DbException.getInvalidValueException("calendar", null);

              
//in src/main/org/h2/util/DateTimeUtils.java
throw DbException.getInvalidValueException("calendar", null);

              
//in src/main/org/h2/util/DateTimeUtils.java
throw e;

              
//in src/main/org/h2/util/DateTimeUtils.java
throw e;

              
//in src/main/org/h2/util/DateTimeUtils.java
throw DbException.get(ErrorCode.PARSE_ERROR_1, e, date);

              
//in src/main/org/h2/util/DateTimeUtils.java
throw DbException.get(ErrorCode.PARSE_ERROR_1, e, format + "/" + locale + "/" + timeZone);

              
//in src/main/org/h2/util/Tool.java
throw throwUnsupportedOption(option);

              
//in src/main/org/h2/util/Tool.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, option).getSQLException();

              
//in src/main/org/h2/util/Tool.java
throw DbException.getUnsupportedException("expected: " + option + " got: " + arg);

              
//in src/main/org/h2/util/CacheLRU.java
throw DbException.getInvalidValueException("CACHE_TYPE", cacheType);

              
//in src/main/org/h2/util/CacheLRU.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/util/StringUtils.java
throw getFormatException(s, i);

              
//in src/main/org/h2/util/StringUtils.java
throw getFormatException(s, i);

              
//in src/main/org/h2/util/StringUtils.java
throw getFormatException(s, i);

              
//in src/main/org/h2/util/StringUtils.java
throw getFormatException(s, i);

              
//in src/main/org/h2/util/StringUtils.java
throw DbException.convert(e);

              
//in src/main/org/h2/util/StringUtils.java
throw DbException.convert(e);

              
//in src/main/org/h2/util/StringUtils.java
throw DbException.convert(e);

              
//in src/main/org/h2/util/StringUtils.java
throw DbException.convert(e);

              
//in src/main/org/h2/util/StringUtils.java
throw DbException.get(ErrorCode.HEX_STRING_ODD_1, s);

              
//in src/main/org/h2/util/StringUtils.java
throw DbException.get(ErrorCode.HEX_STRING_WRONG_1, s);

              
//in src/main/org/h2/util/StringUtils.java
throw DbException.get(ErrorCode.HEX_STRING_WRONG_1, s);

              
//in src/main/org/h2/server/TcpServer.java
throw e;

              
//in src/main/org/h2/server/TcpServer.java
throw DbException.convert(e);

              
//in src/main/org/h2/server/TcpServer.java
throw e;

              
//in src/main/org/h2/server/TcpServer.java
throw e;

              
//in src/main/org/h2/server/TcpServer.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/server/TcpServer.java
throw DbException.get(ErrorCode.WRONG_USER_OR_PASSWORD);

              
//in src/main/org/h2/server/pg/PgServer.java
throw e;

              
//in src/main/org/h2/server/pg/PgServerThread.java
throw DbException.throwInternalError("Incompatible PG_VERSION");

              
//in src/main/org/h2/server/pg/PgServerThread.java
throw DbException.convertIOException(e, "Can not read pg_catalog resource");

              
//in src/main/org/h2/server/TcpServerThread.java
throw DbException.get(ErrorCode.REMOTE_CONNECTION_NOT_ALLOWED);

              
//in src/main/org/h2/server/TcpServerThread.java
throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2, "" + clientVersion, "" + Constants.TCP_PROTOCOL_VERSION_6);

              
//in src/main/org/h2/server/TcpServerThread.java
throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2, "" + clientVersion, "" + Constants.TCP_PROTOCOL_VERSION_11);

              
//in src/main/org/h2/server/TcpServerThread.java
throw closeError;

              
//in src/main/org/h2/server/TcpServerThread.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
//in src/main/org/h2/server/web/DbContextRule.java
throw DbException.throwInternalError("type=" + type);

              
//in src/main/org/h2/server/web/WebApp.java
throw DbException.throwInternalError(toolName);

              
//in src/main/org/h2/table/LinkSchema.java
throw DbException.convert(e);

              
//in src/main/org/h2/table/RangeTable.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
//in src/main/org/h2/table/RangeTable.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
//in src/main/org/h2/table/RangeTable.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
//in src/main/org/h2/table/RangeTable.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
//in src/main/org/h2/table/RangeTable.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
//in src/main/org/h2/table/RangeTable.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/table/RangeTable.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
//in src/main/org/h2/table/FunctionTable.java
throw DbException.get(ErrorCode.FUNCTION_MUST_RETURN_RESULT_SET_1, function.getName());

              
//in src/main/org/h2/table/FunctionTable.java
throw DbException.get(ErrorCode.FUNCTION_MUST_RETURN_RESULT_SET_1, function.getName());

              
//in src/main/org/h2/table/FunctionTable.java
throw DbException.convert(e);

              
//in src/main/org/h2/table/FunctionTable.java
throw DbException.getUnsupportedException("ALIAS");

              
//in src/main/org/h2/table/FunctionTable.java
throw DbException.getUnsupportedException("ALIAS");

              
//in src/main/org/h2/table/FunctionTable.java
throw DbException.getUnsupportedException("ALIAS");

              
//in src/main/org/h2/table/FunctionTable.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/table/FunctionTable.java
throw DbException.getUnsupportedException("ALIAS");

              
//in src/main/org/h2/table/FunctionTable.java
throw DbException.getUnsupportedException("ALIAS");

              
//in src/main/org/h2/table/FunctionTable.java
throw DbException.getUnsupportedException("ALIAS");

              
//in src/main/org/h2/table/RegularTable.java
throw e2;

              
//in src/main/org/h2/table/RegularTable.java
throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName());

              
//in src/main/org/h2/table/RegularTable.java
throw de;

              
//in src/main/org/h2/table/RegularTable.java
throw DbException.get(ErrorCode.COLUMN_MUST_NOT_BE_NULLABLE_1, column.getName());

              
//in src/main/org/h2/table/RegularTable.java
throw e2;

              
//in src/main/org/h2/table/RegularTable.java
throw e;

              
//in src/main/org/h2/table/RegularTable.java
throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, getName());

              
//in src/main/org/h2/table/RegularTable.java
throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, getName());

              
//in src/main/org/h2/table/RegularTable.java
throw e2;

              
//in src/main/org/h2/table/RegularTable.java
throw DbException.convert(e);

              
//in src/main/org/h2/table/RegularTable.java
throw DbException.get(ErrorCode.DEADLOCK_1, getDeadlockDetails(sessions));

              
//in src/main/org/h2/table/RegularTable.java
throw DbException.get(ErrorCode.LOCK_TIMEOUT_1, getName());

              
//in src/main/org/h2/table/TableLink.java
throw e;

              
//in src/main/org/h2/table/TableLink.java
throw DbException.convert(e);

              
//in src/main/org/h2/table/TableLink.java
throw e;

              
//in src/main/org/h2/table/TableLink.java
throw DbException.get(ErrorCode.SCHEMA_NAME_MUST_MATCH, originalTable);

              
//in src/main/org/h2/table/TableLink.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, e,
                    originalTable + "(" + e.toString() + ")");

              
//in src/main/org/h2/table/TableLink.java
throw DbException.getUnsupportedException("LINK");

              
//in src/main/org/h2/table/TableLink.java
throw DbException.get(ErrorCode.DATABASE_IS_READ_ONLY);

              
//in src/main/org/h2/table/TableLink.java
throw wrapException(sql, e);

              
//in src/main/org/h2/table/TableLink.java
throw connectException;

              
//in src/main/org/h2/table/TableLink.java
throw DbException.convert(e);

              
//in src/main/org/h2/table/TableLink.java
throw DbException.getUnsupportedException("LINK");

              
//in src/main/org/h2/table/TableLink.java
throw DbException.getUnsupportedException("LINK");

              
//in src/main/org/h2/table/Column.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, v.getSQL() + " (" + target + ")");

              
//in src/main/org/h2/table/Column.java
throw e;

              
//in src/main/org/h2/table/Column.java
throw DbException.get(ErrorCode.NULL_NOT_ALLOWED, name);

              
//in src/main/org/h2/table/Column.java
throw DbException.get(ErrorCode.CHECK_CONSTRAINT_VIOLATED_1, checkConstraint.getSQL());

              
//in src/main/org/h2/table/Column.java
throw DbException.get(ErrorCode.VALUE_TOO_LONG_2,
                        getCreateSQL(), s + " (" + value.getPrecision() + ")");

              
//in src/main/org/h2/table/TableLinkConnection.java
throw DbException.convert(e);

              
//in src/main/org/h2/table/MetaTable.java
throw DbException.throwInternalError("type="+type);

              
//in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
//in src/main/org/h2/table/MetaTable.java
throw DbException.convert(e);

              
//in src/main/org/h2/table/MetaTable.java
throw DbException.throwInternalError("action="+action);

              
//in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
//in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
//in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
//in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
//in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
//in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
//in src/main/org/h2/table/MetaTable.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/table/TableView.java
throw e;

              
//in src/main/org/h2/table/TableView.java
throw DbException.getSyntaxError(sql, 0);

              
//in src/main/org/h2/table/TableView.java
throw DbException.getUnsupportedException("VIEW");

              
//in src/main/org/h2/table/TableView.java
throw DbException.getUnsupportedException("VIEW");

              
//in src/main/org/h2/table/TableView.java
throw DbException.getUnsupportedException("VIEW");

              
//in src/main/org/h2/table/TableView.java
throw DbException.getUnsupportedException("VIEW");

              
//in src/main/org/h2/table/TableView.java
throw DbException.getUnsupportedException("VIEW");

              
//in src/main/org/h2/table/TableView.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/table/TableView.java
throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, createException, getSQL(), msg);

              
//in src/main/org/h2/table/TableView.java
throw v.createException;

              
//in src/main/org/h2/table/Table.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, col.getSQL());

              
//in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.DUPLICATE_COLUMN_NAME_1, columnName);

              
//in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.DUPLICATE_COLUMN_NAME_1, newName);

              
//in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.COLUMN_IS_REFERENCED_1, constraint.getSQL());

              
//in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.COLUMN_IS_REFERENCED_1, index.getSQL());

              
//in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnName);

              
//in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.INDEX_NOT_FOUND_1, Constants.PREFIX_PRIMARY_KEY);

              
//in src/main/org/h2/table/TableFilter.java
throw DbException.throwInternalError();

              
//in src/main/org/h2/security/CipherFactory.java
throw DbException.get(ErrorCode.UNSUPPORTED_CIPHER, algorithm);

              
//in src/main/org/h2/security/CipherFactory.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/security/CipherFactory.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/security/CipherFactory.java
throw DbException.convertToIOException(e);

              
//in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
//in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
//in src/main/org/h2/fulltext/FullTextLucene.java
throw throwException("Fulltext search for in-memory databases is not supported.");

              
//in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
//in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
//in src/main/org/h2/fulltext/FullTextLucene.java
throw throwException("No primary key for table " + tableName);

              
//in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
//in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
//in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
//in src/main/org/h2/fulltext/FullText.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/fulltext/FullText.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/fulltext/FullText.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/fulltext/FullText.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/fulltext/FullText.java
throw DbException.toSQLException(e);

              
//in src/main/org/h2/fulltext/FullText.java
throw throwException("Unsupported column data type: " + type);

              
//in src/main/org/h2/fulltext/FullText.java
throw throwException("Unsupported key data type: " + type);

              
//in src/main/org/h2/fulltext/FullText.java
throw throwException("Column not found: " + key);

              
//in src/main/org/h2/fulltext/FullText.java
throw DbException.convertIOException(e, "Tokenizer error");

              
//in src/main/org/h2/fulltext/FullText.java
throw throwException("No primary key for table " + tableName);

              
//in src/main/org/h2/fulltext/FullTextSettings.java
throw FullText.throwException("Fulltext search for private (unnamed) in-memory databases is not supported.");

              
//in src/tools/org/h2/android/H2Cursor.java
throw H2Database.unsupported();

              
//in src/tools/org/h2/dev/fs/FilePathCrypt.java
throw DbException.convertIOException(e, name);

              
//in src/tools/org/h2/dev/fs/FilePathCrypt.java
throw DbException.convertIOException(e, name);

              
//in src/tools/org/h2/dev/fs/FileShell.java
throw DbException.convertIOException(e, "cwd");

              
//in src/tools/org/h2/dev/fs/FileShell.java
throw DbException.convert(e);

              
//in src/tools/org/h2/dev/fs/FileShell.java
throw DbException.convertIOException(e, zipFileName);

              
//in src/tools/org/h2/dev/fs/FilePathZip2.java
throw DbException.getUnsupportedException("write");

              
//in src/tools/org/h2/dev/fs/FilePathZip2.java
throw DbException.getUnsupportedException("write");

              
//in src/tools/org/h2/dev/fs/FilePathZip2.java
throw DbException.convertIOException(e, "listFiles " + path);

              
//in src/tools/org/h2/dev/fs/FilePathZip2.java
throw DbException.getUnsupportedException("write");

              
//in src/tools/org/h2/dev/fs/FilePathZip2.java
throw DbException.getUnsupportedException("write");

              
//in src/tools/org/h2/dev/store/tree/TreeMapStore.java
throw convert(e);

              
//in src/tools/org/h2/dev/store/tree/TreeMapStore.java
throw convert(e);

              
//in src/tools/org/h2/dev/store/tree/TreeMapStore.java
throw convert(e);

              
//in src/tools/org/h2/dev/store/tree/TreeMapStore.java
throw convert(e);

              
//in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
throw convert(e);

              
//in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
throw convert(e);

              
//in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
throw convert(e);

              
//in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
throw convert(e);

              
//in src/tools/org/h2/dev/util/ReaderInputStream.java
throw DbException.convert(e);

              
//in src/tools/org/h2/dev/util/FileViewer.java
throw DbException.toSQLException(e);

              
//in src/tools/org/h2/build/BuildBase.java
throw e.getCause();

              
//in src/tools/org/h2/build/BuildBase.java
throw e;

              
//in src/tools/org/h2/build/BuildBase.java
throw e;

              
//in src/tools/org/h2/jaqu/Db.java
throw convert(e);

              
//in src/tools/org/h2/jaqu/Db.java
throw convert(e);

              
//in src/tools/org/h2/jaqu/Db.java
throw convert(e);

              
//in src/tools/org/h2/jaqu/util/GenerateModels.java
throw DbException.convertIOException(io, "could not generate model").getSQLException();

              
//in src/tools/org/h2/java/JavaParser.java
throw getSyntaxException("Constructor of wrong type: " + type);

              
//in src/tools/org/h2/java/JavaParser.java
throw getSyntaxException("this usage in static context");

              
//in src/tools/org/h2/java/JavaParser.java
throw getSyntaxException("this usage in static context");

              
//in src/tools/org/h2/java/JavaParser.java
throw getSyntaxException(string + " expected, got " + current.token);

              
//in src/tools/org/h2/java/JavaParser.java
throw getSyntaxException("identifier expected, got " + current.token);

              
//in src/tools/org/h2/java/JavaParser.java
throw getFormatException(s, s.length() - 1);

              
//in src/tools/org/h2/java/JavaParser.java
throw getFormatException(s, i);

              
//in src/tools/org/h2/java/JavaParser.java
throw getFormatException(s, i);

              
//in src/tools/org/h2/java/JavaParser.java
throw getFormatException(s, i);

            
- -
- Builder 1510
              
// in src/main/org/h2/jdbcx/JdbcXid.java
throw DbException.get(ErrorCode.WRONG_XID_FORMAT_1, tid);

              
// in src/main/org/h2/jdbcx/JdbcXid.java
throw DbException.get(ErrorCode.WRONG_XID_FORMAT_1, tid);

              
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
throw convertException(e);

              
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
throw convertException(e);

              
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
throw convertException(e);

              
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
throw convertException(e);

              
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
throw DbException.getUnsupportedException("unwrap");

              
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
throw DbException.getUnsupportedException("isWrapperFor");

              
// in src/main/org/h2/jdbcx/JdbcDataSource.java
throw unsupported("unwrap");

              
// in src/main/org/h2/jdbcx/JdbcDataSource.java
throw unsupported("isWrapperFor");

              
// in src/main/org/h2/constraint/ConstraintCheck.java
throw DbException.get(ErrorCode.CHECK_CONSTRAINT_VIOLATED_1, getShortDescription());

              
// in src/main/org/h2/constraint/ConstraintCheck.java
throw DbException.get(ErrorCode.CHECK_CONSTRAINT_VIOLATED_1, getName());

              
// in src/main/org/h2/constraint/Constraint.java
throw DbException.throwInternalError("type: " + constraintType);

              
// in src/main/org/h2/constraint/ConstraintReferential.java
throw DbException.get(ErrorCode.REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1,
                    getShortDescription(refIndex, check));

              
// in src/main/org/h2/constraint/ConstraintReferential.java
throw DbException.get(ErrorCode.REFERENTIAL_INTEGRITY_VIOLATED_CHILD_EXISTS_1,
                    getShortDescription(index, check));

              
// in src/main/org/h2/constraint/ConstraintReferential.java
throw DbException.get(ErrorCode.CONSTRAINT_ALREADY_EXISTS_1, "ON DELETE");

              
// in src/main/org/h2/constraint/ConstraintReferential.java
throw DbException.get(ErrorCode.CONSTRAINT_ALREADY_EXISTS_1, "ON UPDATE");

              
// in src/main/org/h2/constraint/ConstraintReferential.java
throw DbException.get(ErrorCode.NO_DEFAULT_SET_1, column.getName());

              
// in src/main/org/h2/constraint/ConstraintReferential.java
throw DbException.get(ErrorCode.REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1,
                    getShortDescription(null, null));

              
// in src/main/org/h2/message/TraceObject.java
throw DbException.getUnsupportedException(message);

              
// in src/main/org/h2/message/TraceObject.java
throw logAndConvert(e);

              
// in src/main/org/h2/tools/Restore.java
throw DbException.convertIOException(e, zipFileName);

              
// in src/main/org/h2/tools/ChangeFileEncryption.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/tools/ChangeFileEncryption.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/tools/CompressTool.java
throw DbException.get(ErrorCode.COMPRESSION_ERROR, e);

              
// in src/main/org/h2/tools/CompressTool.java
throw DbException.get(ErrorCode.COMPRESSION_ERROR, e);

              
// in src/main/org/h2/tools/CompressTool.java
throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1, algorithm);

              
// in src/main/org/h2/tools/CompressTool.java
throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1, "" + algorithm);

              
// in src/main/org/h2/tools/CompressTool.java
throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1, compressionAlgorithm);

              
// in src/main/org/h2/tools/CompressTool.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/tools/CompressTool.java
throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_ALGORITHM_1, compressionAlgorithm);

              
// in src/main/org/h2/tools/CompressTool.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/tools/ConvertTraceFile.java
throw DbException.convertIOException(e, traceFile);

              
// in src/main/org/h2/tools/Backup.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/tools/Backup.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/tools/Backup.java
throw DbException.convertIOException(e, zipFileName);

              
// in src/main/org/h2/tools/Csv.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/tools/Csv.java
throw convertException("IOException writing " + outputFileName, e);

              
// in src/main/org/h2/tools/Csv.java
throw convertException("IOException reading " + inputFileName, e);

              
// in src/main/org/h2/tools/Csv.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/tools/Csv.java
throw convertException("IOException reading from " + fileName, e);

              
// in src/main/org/h2/tools/Csv.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, key);

              
// in src/main/org/h2/tools/Recover.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/tools/Recover.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/tools/Recover.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/tools/Recover.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/tools/Server.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/tools/Server.java
throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2, name, "timeout; " +
                    "please check your network configuration, specially the file /etc/hosts");

              
// in src/main/org/h2/tools/Server.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/tools/RunScript.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/tools/RunScript.java
throw DbException.convertIOException(e, fileName);

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnLabel).getSQLException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw DbException.getInvalidValueException("columnIndex", columnIndex).getSQLException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE).getSQLException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/tools/SimpleResultSet.java
throw getUnsupportedException();

              
// in src/main/org/h2/value/ValueNull.java
throw DbException.throwInternalError("compare null");

              
// in src/main/org/h2/value/ValueTime.java
throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2,
                    e, "TIME", s);

              
// in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, fileName);

              
// in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, fileName);

              
// in src/main/org/h2/value/ValueLob.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/value/ValueDate.java
throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2,
                    e, "DATE", s);

              
// in src/main/org/h2/value/DataType.java
throw DbException.throwInternalError("type="+type);

              
// in src/main/org/h2/value/DataType.java
throw DbException.convert(e);

              
// in src/main/org/h2/value/DataType.java
throw DbException.throwInternalError("type="+type);

              
// in src/main/org/h2/value/DataType.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "?");

              
// in src/main/org/h2/value/DataType.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "" + sqlType);

              
// in src/main/org/h2/value/DataType.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, "char (not supported)");

              
// in src/main/org/h2/value/DataType.java
throw DbException.convert(e);

              
// in src/main/org/h2/value/DataType.java
throw DbException.convert(e);

              
// in src/main/org/h2/value/DataType.java
throw DbException.throwInternalError("primitive=" + clazz.toString());

              
// in src/main/org/h2/value/DataType.java
throw DbException.getUnsupportedException(paramClass.getName());

              
// in src/main/org/h2/value/ValueInt.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Long.toString(x));

              
// in src/main/org/h2/value/ValueInt.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/ValueInt.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/CompareModeDefault.java
throw DbException.throwInternalError(name);

              
// in src/main/org/h2/value/ValueByte.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Integer.toString(x));

              
// in src/main/org/h2/value/ValueByte.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/ValueByte.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/ValueLong.java
throw getOverflow();

              
// in src/main/org/h2/value/ValueLong.java
throw getOverflow();

              
// in src/main/org/h2/value/ValueLong.java
throw getOverflow();

              
// in src/main/org/h2/value/ValueLong.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/ValueLong.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/ValueFloat.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/ValueFloat.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/CompareModeIcu4J.java
throw DbException.getInvalidValueException("collator", name);

              
// in src/main/org/h2/value/CompareModeIcu4J.java
throw DbException.convert(e);

              
// in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, toString());

              
// in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, toString());

              
// in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, toString());

              
// in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/value/ValueLobDb.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/value/ValueTimestamp.java
throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2,
                    e, "TIMESTAMP", s);

              
// in src/main/org/h2/value/ValueTimestamp.java
throw DbException.getInvalidValueException("scale", targetScale);

              
// in src/main/org/h2/value/ValueArray.java
throw throwUnsupportedExceptionForType("PreparedStatement.set");

              
// in src/main/org/h2/value/Value.java
throw DbException.throwInternalError("type:"+type);

              
// in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "?, ?");

              
// in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "NULL, ?");

              
// in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, "?, NULL");

              
// in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("+");

              
// in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("SIGNUM");

              
// in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("NEG");

              
// in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("-");

              
// in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("/");

              
// in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("*");

              
// in src/main/org/h2/value/Value.java
throw throwUnsupportedExceptionForType("%");

              
// in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, getString());

              
// in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, "" + d);

              
// in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, "" + f);

              
// in src/main/org/h2/value/Value.java
throw DbException.throwInternalError("type=" + targetType);

              
// in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, getString());

              
// in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Long.toString(x));

              
// in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Long.toString(x));

              
// in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Long.toString(x));

              
// in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Double.toString(x));

              
// in src/main/org/h2/value/Value.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, x.toString());

              
// in src/main/org/h2/value/Value.java
throw DbException.getUnsupportedException(DataType.getDataType(getType()).name + " " + op);

              
// in src/main/org/h2/value/ValueDouble.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/ValueDouble.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/ValueShort.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Integer.toString(x));

              
// in src/main/org/h2/value/ValueShort.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/ValueShort.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "length=" + length);

              
// in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "length:" + length + " written:" + written);

              
// in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "length=" + length);

              
// in src/main/org/h2/value/Transfer.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "type=" + type);

              
// in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic);

              
// in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic);

              
// in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic);

              
// in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic);

              
// in src/main/org/h2/value/Transfer.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "type=" + type);

              
// in src/main/org/h2/value/ValueResultSet.java
throw DbException.convert(e);

              
// in src/main/org/h2/value/ValueResultSet.java
throw DbException.convert(e);

              
// in src/main/org/h2/value/ValueResultSet.java
throw throwUnsupportedExceptionForType("PreparedStatement.set");

              
// in src/main/org/h2/value/ValueUuid.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s);

              
// in src/main/org/h2/value/ValueDecimal.java
throw DbException.get(ErrorCode.INVALID_CLASS_2,
                    BigDecimal.class.getName(), value.getClass().getName());

              
// in src/main/org/h2/value/ValueDecimal.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/ValueDecimal.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/value/ValueDecimal.java
throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Long.toString(precision));

              
// in src/main/org/h2/upgrade/DbUpgrade.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/result/ResultRemote.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/result/ResultRemote.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/result/ResultRemote.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/result/ResultDiskBuffer.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/result/ResultDiskBuffer.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/result/ResultDiskBuffer.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/result/LocalResult.java
throw DbException.convert(e);

              
// in src/main/org/h2/result/UpdatableRow.java
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnName);

              
// in src/main/org/h2/result/UpdatableRow.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
// in src/main/org/h2/result/UpdatableRow.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
// in src/main/org/h2/result/UpdatableRow.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
// in src/main/org/h2/result/UpdatableRow.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
// in src/main/org/h2/result/UpdatableRow.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
// in src/main/org/h2/schema/Sequence.java
throw DbException.getInvalidValueException("INCREMENT", 0);

              
// in src/main/org/h2/schema/Sequence.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/schema/Constant.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/schema/Schema.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/schema/Schema.java
throw DbException.throwInternalError("type=" + type);

              
// in src/main/org/h2/schema/Schema.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, name);

              
// in src/main/org/h2/schema/Schema.java
throw DbException.get(ErrorCode.INDEX_NOT_FOUND_1, name);

              
// in src/main/org/h2/schema/Schema.java
throw DbException.get(ErrorCode.CONSTRAINT_NOT_FOUND_1, name);

              
// in src/main/org/h2/schema/Schema.java
throw DbException.get(ErrorCode.CONSTANT_NOT_FOUND_1, constantName);

              
// in src/main/org/h2/schema/Schema.java
throw DbException.get(ErrorCode.SEQUENCE_NOT_FOUND_1, sequenceName);

              
// in src/main/org/h2/schema/Schema.java
throw DbException.convert(e);

              
// in src/main/org/h2/schema/TriggerObject.java
throw DbException.get(ErrorCode.ERROR_CREATING_TRIGGER_OBJECT_3, e, getName(),
                            triggerClassName, e.toString());

              
// in src/main/org/h2/schema/TriggerObject.java
throw DbException.get(ErrorCode.ERROR_EXECUTING_TRIGGER_3, e, getName(),
                            triggerClassName, e.toString());

              
// in src/main/org/h2/schema/TriggerObject.java
throw DbException.convert(e);

              
// in src/main/org/h2/schema/TriggerObject.java
throw DbException.convert(e);

              
// in src/main/org/h2/expression/ConditionInSelect.java
throw DbException.get(ErrorCode.SUBQUERY_IS_NOT_SINGLE_COLUMN);

              
// in src/main/org/h2/expression/Variable.java
throw DbException.throwInternalError("type="+visitor.getType());

              
// in src/main/org/h2/expression/Parameter.java
throw DbException.get(ErrorCode.PARAMETER_NOT_SET_1, "#" + (index + 1));

              
// in src/main/org/h2/expression/Parameter.java
throw DbException.throwInternalError("type="+visitor.getType());

              
// in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.INVALID_PARAMETER_COUNT_2, info.name,
                        "" + args.length);

              
// in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL());

              
// in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, regexp);

              
// in src/main/org/h2/expression/Function.java
throw DbException.convert(e);

              
// in src/main/org/h2/expression/Function.java
throw DbException.convert(e);

              
// in src/main/org/h2/expression/Function.java
throw DbException.convertIOException(e, fileName);

              
// in src/main/org/h2/expression/Function.java
throw DbException.throwInternalError("type=" + info.type);

              
// in src/main/org/h2/expression/Function.java
throw DbException.getSyntaxError(sql, 1);

              
// in src/main/org/h2/expression/Function.java
throw DbException.getInvalidValueException("algorithm", algorithm);

              
// in src/main/org/h2/expression/Function.java
throw DbException.getInvalidValueException("date part", part);

              
// in src/main/org/h2/expression/Function.java
throw DbException.throwInternalError("field:" + field);

              
// in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s);

              
// in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s);

              
// in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.INVALID_PARAMETER_COUNT_2, info.name, min + ".." + max);

              
// in src/main/org/h2/expression/Function.java
throw DbException
                        .get(ErrorCode.INVALID_PARAMETER_COUNT_2, info.name, "" + len);

              
// in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.CAN_ONLY_ASSIGN_TO_VARIABLE_1, p0.getSQL());

              
// in src/main/org/h2/expression/Function.java
throw DbException.get(ErrorCode.PARAMETER_NOT_SET_1, "fileName");

              
// in src/main/org/h2/expression/Function.java
throw DbException.convert(e);

              
// in src/main/org/h2/expression/Function.java
throw DbException.throwInternalError("type=" + visitor.getType());

              
// in src/main/org/h2/expression/CompareLike.java
throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, es);

              
// in src/main/org/h2/expression/CompareLike.java
throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, p);

              
// in src/main/org/h2/expression/Rownum.java
throw DbException.throwInternalError("type="+visitor.getType());

              
// in src/main/org/h2/expression/ParameterRemote.java
throw DbException.get(ErrorCode.PARAMETER_NOT_SET_1, "#" + (index + 1));

              
// in src/main/org/h2/expression/ConditionAndOr.java
throw DbException.throwInternalError("andOrType=" + andOrType);

              
// in src/main/org/h2/expression/ConditionAndOr.java
throw DbException.throwInternalError("type=" + andOrType);

              
// in src/main/org/h2/expression/JavaAggregate.java
throw DbException.convert(e);

              
// in src/main/org/h2/expression/JavaAggregate.java
throw DbException.get(ErrorCode.INVALID_USE_OF_AGGREGATE_FUNCTION_1, getSQL());

              
// in src/main/org/h2/expression/JavaAggregate.java
throw DbException.convert(e);

              
// in src/main/org/h2/expression/JavaAggregate.java
throw DbException.convert(e);

              
// in src/main/org/h2/expression/SequenceValue.java
throw DbException.throwInternalError("type="+visitor.getType());

              
// in src/main/org/h2/expression/Operation.java
throw DbException.throwInternalError("opType=" + opType);

              
// in src/main/org/h2/expression/Operation.java
throw DbException.throwInternalError("type=" + opType);

              
// in src/main/org/h2/expression/Operation.java
throw DbException.getUnsupportedException(
                        DataType.getDataType(l).name + " " +
                        getOperationToken() + " " +
                        DataType.getDataType(r).name);

              
// in src/main/org/h2/expression/Comparison.java
throw DbException.throwInternalError("compareType=" + compareType);

              
// in src/main/org/h2/expression/Comparison.java
throw DbException.throwInternalError("type=" + compareType);

              
// in src/main/org/h2/expression/Comparison.java
throw DbException.throwInternalError("type=" + compareType);

              
// in src/main/org/h2/expression/Comparison.java
throw DbException.throwInternalError("type=" + compareType);

              
// in src/main/org/h2/expression/Comparison.java
throw DbException.throwInternalError("type=" + compareType);

              
// in src/main/org/h2/expression/Comparison.java
throw DbException.throwInternalError("type=" + compareType);

              
// in src/main/org/h2/expression/ExpressionColumn.java
throw DbException.get(ErrorCode.AMBIGUOUS_COLUMN_NAME_1, columnName);

              
// in src/main/org/h2/expression/ExpressionColumn.java
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, name);

              
// in src/main/org/h2/expression/ExpressionColumn.java
throw DbException.get(ErrorCode.MUST_GROUP_BY_COLUMN_1, getSQL());

              
// in src/main/org/h2/expression/ExpressionColumn.java
throw DbException.get(ErrorCode.MUST_GROUP_BY_COLUMN_1, getSQL());

              
// in src/main/org/h2/expression/ExpressionColumn.java
throw DbException.get(ErrorCode.MUST_GROUP_BY_COLUMN_1, getSQL());

              
// in src/main/org/h2/expression/ExpressionColumn.java
throw DbException.throwInternalError("type=" + visitor.getType());

              
// in src/main/org/h2/expression/TableFunction.java
throw DbException.get(ErrorCode.INVALID_PARAMETER_COUNT_2, getName(), ">0");

              
// in src/main/org/h2/expression/ValueExpression.java
throw DbException.throwInternalError("type=" + visitor.getType());

              
// in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/expression/Wildcard.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_1, table);

              
// in src/main/org/h2/expression/Wildcard.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_1, table);

              
// in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/expression/Wildcard.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/expression/Subquery.java
throw DbException.get(ErrorCode.SCALAR_SUBQUERY_CONTAINS_MORE_THAN_ONE_ROW);

              
// in src/main/org/h2/expression/Aggregate.java
throw DbException.get(ErrorCode.INVALID_USE_OF_AGGREGATE_FUNCTION_1, getSQL());

              
// in src/main/org/h2/expression/Aggregate.java
throw DbException.get(ErrorCode.SUM_OR_AVG_ON_WRONG_DATATYPE_1, getSQL());

              
// in src/main/org/h2/expression/Aggregate.java
throw DbException.get(ErrorCode.SUM_OR_AVG_ON_WRONG_DATATYPE_1, getSQL());

              
// in src/main/org/h2/expression/Aggregate.java
throw DbException.throwInternalError("type=" + type);

              
// in src/main/org/h2/expression/Expression.java
throw DbException.convert(e);

              
// in src/main/org/h2/store/FileLister.java
throw DbException.get(
                            ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, message).getSQLException();

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.get(ErrorCode.IO_EXCEPTION_1, "Missing lob entry: "+ lob + "/" + seq).getSQLException();

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.get(ErrorCode.IO_EXCEPTION_1, "Missing lob: "+ lobId).getSQLException();

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
// in src/main/org/h2/store/LobStorage.java
throw DbException.convert(e);

              
// in src/main/org/h2/store/PageLog.java
throw DbException.throwInternalError("endless loop at " + t);

              
// in src/main/org/h2/store/PageLog.java
throw DbException.getInvalidValueException("transaction name (too long)", transaction);

              
// in src/main/org/h2/store/PageLog.java
throw DbException.throwInternalError(
                        "log.removeUntil not found: " + firstDataPageToKeep + " last " + last);

              
// in src/main/org/h2/store/FileStoreInputStream.java
throw DbException.convertIOException(e, store.name);

              
// in src/main/org/h2/store/Data.java
throw DbException.convert(e);

              
// in src/main/org/h2/store/Data.java
throw DbException
                        .throwInternalError("value size error: got " + (pos - start) + " expected " + getValueLen(v, handler));

              
// in src/main/org/h2/store/Data.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "type: " + type);

              
// in src/main/org/h2/store/Data.java
throw DbException.convert(e);

              
// in src/main/org/h2/store/Data.java
throw DbException.throwInternalError("type=" + v.getType());

              
// in src/main/org/h2/store/InDoubtTransaction.java
throw DbException.throwInternalError("state="+state);

              
// in src/main/org/h2/store/fs/FilePathWrapper.java
throw DbException.convert(e);

              
// in src/main/org/h2/store/fs/FilePathMem.java
throw DbException.get(ErrorCode.FILE_CREATION_FAILED_1, name + " (a file with this name already exists)");

              
// in src/main/org/h2/store/fs/FilePathMem.java
throw DbException.convertIOException(e, name);

              
// in src/main/org/h2/store/fs/FilePathSplit.java
throw DbException.convertIOException(e, name);

              
// in src/main/org/h2/store/fs/FilePathSplit.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/store/fs/FilePathZip.java
throw DbException.getUnsupportedException("write");

              
// in src/main/org/h2/store/fs/FilePathZip.java
throw DbException.getUnsupportedException("write");

              
// in src/main/org/h2/store/fs/FilePathZip.java
throw DbException.convertIOException(e, "listFiles " + path);

              
// in src/main/org/h2/store/fs/FilePathZip.java
throw DbException.getUnsupportedException("write");

              
// in src/main/org/h2/store/fs/FilePathZip.java
throw DbException.getUnsupportedException("write");

              
// in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2,
                    name + " (not found)",
                    newName.name);

              
// in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2,
                    new String[] { name, newName + " (exists)" });

              
// in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2, new String[]{name, newName.name});

              
// in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.get(ErrorCode.FILE_DELETE_FAILED_1, name);

              
// in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.convertIOException(e, name);

              
// in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.convertIOException(e, name);

              
// in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.get(ErrorCode.FILE_CREATION_FAILED_1, name + " (a file with this name already exists)");

              
// in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.get(ErrorCode.FILE_CREATION_FAILED_1, name);

              
// in src/main/org/h2/store/fs/FilePathDisk.java
throw DbException.convertIOException(e, name);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, fileName + " length: " + length);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, fileName);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, e, fileName);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, fileName + " pageCount: " + pageCount);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "wrong checksum");

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "index not found " + indexId);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "not a data index " + indexId + " " + idx);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "index not found " + indexId);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "not a data index " + indexId + " " + idx);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "index not found " + indexId);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "not a btree index " + indexId + " " + idx);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "index not found " + indexId);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "not a btree index " + indexId + " " + idx);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "page=" + pageId + " type=" + type);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_VERSION_ERROR_1, fileName);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, fileName);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, fileName + " pageSize: " + size);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, fileName);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, pos + " of " + pageCount);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/store/PageStore.java
throw DbException.throwInternalError("Table not found: " + tableId + " " + row + " " + add);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.throwInternalError(row.toString());

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "Table not found:" + parent + " for " + row + " meta:" + metaObjects);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1,
                    "key: " + key + " index: " + index +
                    " table: " + index.getTable() + " row: " + row);

              
// in src/main/org/h2/store/PageStore.java
throw DbException.get(ErrorCode.DATABASE_IS_CLOSED);

              
// in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, "name: " + name + " mode: " + mode);

              
// in src/main/org/h2/store/FileStore.java
throw DbException.get(ErrorCode.FILE_VERSION_ERROR_1, name);

              
// in src/main/org/h2/store/FileStore.java
throw DbException.get(ErrorCode.FILE_ENCRYPTION_ERROR_1, name);

              
// in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
// in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
// in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
// in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
// in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
// in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
// in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
// in src/main/org/h2/store/FileStore.java
throw DbException.convertIOException(e, name);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Could not save properties " + fileName, e);

              
// in src/main/org/h2/store/FileLock.java
throw e.addSQL(server + "/" + id);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Could not load properties " + fileName, lastException);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Lock file recently modified", null);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Unsupported lock method " + m2, null);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionAlreadyInUse("Locked by another process");

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Another process was faster", null);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Concurrent update", null);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Unsupported lock method " + m2, null);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionAlreadyInUse("Locked by another computer: " + ip);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Unknown host " + ip, e);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionAlreadyInUse("Locked by another process");

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Bind Exception", null);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("IOException", null);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Concurrent update", null);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Another process was faster", null);

              
// in src/main/org/h2/store/FileLock.java
throw getExceptionFatal("Sleep interrupted", e);

              
// in src/main/org/h2/store/FileLock.java
throw DbException.get(ErrorCode.UNSUPPORTED_LOCK_METHOD_1, method);

              
// in src/main/org/h2/index/PageBtreeIndex.java
throw DbException.throwInternalError("" + indexName);

              
// in src/main/org/h2/index/PageBtreeIndex.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, "Index on BLOB or CLOB column: " + c.column.getCreateSQL());

              
// in src/main/org/h2/index/PageBtreeIndex.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "" + p);

              
// in src/main/org/h2/index/PageBtreeIndex.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
// in src/main/org/h2/index/PageDataOverflow.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "page:" + getPos() + " type:" + type);

              
// in src/main/org/h2/index/PageDataOverflow.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/ScanIndex.java
throw DbException.get(ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1, rows.size() + ": " + key);

              
// in src/main/org/h2/index/ScanIndex.java
throw DbException.getUnsupportedException("SCAN");

              
// in src/main/org/h2/index/ScanIndex.java
throw DbException.getUnsupportedException("SCAN");

              
// in src/main/org/h2/index/FunctionCursor.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/PageBtree.java
throw index.getDuplicateKeyException();

              
// in src/main/org/h2/index/HashIndex.java
throw getDuplicateKeyException();

              
// in src/main/org/h2/index/HashIndex.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/HashIndex.java
throw DbException.getUnsupportedException("HASH");

              
// in src/main/org/h2/index/LinkedCursor.java
throw DbException.convert(e);

              
// in src/main/org/h2/index/LinkedCursor.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
// in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
// in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
// in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
// in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
// in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
// in src/main/org/h2/index/FunctionIndex.java
throw DbException.getUnsupportedException("ALIAS");

              
// in src/main/org/h2/index/FunctionCursorResultSet.java
throw DbException.convert(e);

              
// in src/main/org/h2/index/FunctionCursorResultSet.java
throw DbException.convert(e);

              
// in src/main/org/h2/index/FunctionCursorResultSet.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/RangeIndex.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
// in src/main/org/h2/index/RangeIndex.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
// in src/main/org/h2/index/RangeIndex.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
// in src/main/org/h2/index/RangeIndex.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
// in src/main/org/h2/index/RangeIndex.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
// in src/main/org/h2/index/PageDataCursor.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/PageBtreeLeaf.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1,
                    "page:" + getPos() + " expected index:" + index.getId() +
                    "got:" + indexId);

              
// in src/main/org/h2/index/PageBtreeLeaf.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/PageBtreeLeaf.java
throw DbException.get(ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1, index.getSQL() + ": " + row);

              
// in src/main/org/h2/index/ViewCursor.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/ViewIndex.java
throw DbException.getUnsupportedException("VIEW");

              
// in src/main/org/h2/index/ViewIndex.java
throw DbException.getUnsupportedException("VIEW");

              
// in src/main/org/h2/index/ViewIndex.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_2, "recursive queries without UNION ALL");

              
// in src/main/org/h2/index/ViewIndex.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_2, "recursive queries without UNION ALL");

              
// in src/main/org/h2/index/ViewIndex.java
throw DbException.getUnsupportedException("VIEW");

              
// in src/main/org/h2/index/ViewIndex.java
throw DbException.getUnsupportedException("VIEW");

              
// in src/main/org/h2/index/ViewIndex.java
throw DbException.getUnsupportedException("VIEW");

              
// in src/main/org/h2/index/ViewIndex.java
throw DbException.getUnsupportedException("VIEW");

              
// in src/main/org/h2/index/SingleRowCursor.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/IndexCursor.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/MetaIndex.java
throw DbException.getUnsupportedException("META");

              
// in src/main/org/h2/index/MetaIndex.java
throw DbException.getUnsupportedException("META");

              
// in src/main/org/h2/index/MetaIndex.java
throw DbException.getUnsupportedException("META");

              
// in src/main/org/h2/index/MetaIndex.java
throw DbException.getUnsupportedException("META");

              
// in src/main/org/h2/index/MetaIndex.java
throw DbException.getUnsupportedException("META");

              
// in src/main/org/h2/index/MetaIndex.java
throw DbException.getUnsupportedException("META");

              
// in src/main/org/h2/index/TreeIndex.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/TreeIndex.java
throw getDuplicateKeyException();

              
// in src/main/org/h2/index/TreeIndex.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/TreeIndex.java
throw DbException.throwInternalError("not found!");

              
// in src/main/org/h2/index/TreeIndex.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/BaseIndex.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/BaseIndex.java
throw DbException.getUnsupportedException(toString());

              
// in src/main/org/h2/index/PageDataIndex.java
throw DbException.throwInternalError(table.getName());

              
// in src/main/org/h2/index/PageDataIndex.java
throw getNewDuplicateKeyException();

              
// in src/main/org/h2/index/PageDataIndex.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, p == null ? "null" : p.toString());

              
// in src/main/org/h2/index/PageDataIndex.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1, "" + pd);

              
// in src/main/org/h2/index/PageDataIndex.java
throw DbException.throwInternalError(p + " parent " + p.getParentPageId() + " expected " + parent);

              
// in src/main/org/h2/index/PageDataIndex.java
throw DbException.throwInternalError(row.toString());

              
// in src/main/org/h2/index/PageDataIndex.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/PageDataIndex.java
throw DbException.getUnsupportedException("PAGE");

              
// in src/main/org/h2/index/NonUniqueHashIndex.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/NonUniqueHashIndex.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/PageDelegateIndex.java
throw DbException.throwInternalError("" + name);

              
// in src/main/org/h2/index/PageDelegateIndex.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/LinkedIndex.java
throw TableLink.wrapException(sql, e);

              
// in src/main/org/h2/index/LinkedIndex.java
throw TableLink.wrapException(sql, e);

              
// in src/main/org/h2/index/LinkedIndex.java
throw DbException.getUnsupportedException("LINKED");

              
// in src/main/org/h2/index/LinkedIndex.java
throw DbException.getUnsupportedException("LINKED");

              
// in src/main/org/h2/index/LinkedIndex.java
throw TableLink.wrapException(sql, e);

              
// in src/main/org/h2/index/LinkedIndex.java
throw TableLink.wrapException(sql, e);

              
// in src/main/org/h2/index/PageDataLeaf.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1,
                    "page:" + getPos() + " expected table:" + index.getId() +
                    " got:" + tableId + " type:" + type);

              
// in src/main/org/h2/index/PageDataLeaf.java
throw index.getDuplicateKeyException();

              
// in src/main/org/h2/index/PageDataLeaf.java
throw DbException.get(ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1,
                    index.getSQL() + ": " + key + " " + (keys == null ? -1 : keys[i]));

              
// in src/main/org/h2/index/MetaCursor.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/MultiVersionIndex.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/ScanCursor.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/PageDataNode.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1,
                    "page:" + getPos() + " expected index:" + index.getId() +
                    "got:" + indexId);

              
// in src/main/org/h2/index/PageDataNode.java
throw DbException.throwInternalError("Page it its own child: " + getPos());

              
// in src/main/org/h2/index/PageDataNode.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/PageBtreeNode.java
throw DbException.get(ErrorCode.FILE_CORRUPTED_1,
                    "page:" + getPos() + " expected index:" + index.getId() +
                    "got:" + indexId);

              
// in src/main/org/h2/index/PageBtreeNode.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/PageBtreeNode.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/PageBtreeNode.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/RangeCursor.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/index/IndexCondition.java
throw DbException.throwInternalError("type=" + compareType);

              
// in src/main/org/h2/compress/CompressDeflate.java
throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_OPTIONS_1, options);

              
// in src/main/org/h2/compress/CompressDeflate.java
throw DbException.get(ErrorCode.COMPRESSION_ERROR, e);

              
// in src/main/org/h2/Driver.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw e.addSQL(originalSQL);

              
// in src/main/org/h2/command/Parser.java
throw e.addSQL(sql);

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.SCHEMA_NOT_FOUND_1, schemaName);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.DATABASE_NOT_FOUND_1, catalogName);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.SCHEMA_NOT_FOUND_1, schema);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, tableAlias);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.DUPLICATE_COLUMN_NAME_1, column.getSQL());

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "database name");

              
// in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "table.column");

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.FUNCTION_ALIAS_NOT_FOUND_1, procedureName);

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.FUNCTION_NOT_FOUND_1, functionName);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.DATABASE_NOT_FOUND_1, databaseName);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.DATABASE_NOT_FOUND_1, databaseName);

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.CANNOT_MIX_INDEXED_AND_UNINDEXED_PARAMS);

              
// in src/main/org/h2/command/Parser.java
throw DbException.getInvalidValueException("parameter index", index);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.CANNOT_MIX_INDEXED_AND_UNINDEXED_PARAMS);

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.getInvalidValueException("positive integer", v);

              
// in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "integer");

              
// in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "long");

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "string");

              
// in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "identifier");

              
// in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "identifier");

              
// in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "identifier");

              
// in src/main/org/h2/command/Parser.java
throw DbException.getSyntaxError(sqlCommand, parseIndex, "identifier");

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.LITERALS_ARE_NOT_ALLOWED);

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, sub);

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, currentToken);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.INVALID_VALUE_2, Integer.toString(scale), "scale (precision = " + precision + ")");

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.ROLES_AND_RIGHT_CANNOT_BE_MIXED);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.CONSTANT_ALREADY_EXISTS_1, constantName);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, name);

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, aliasName);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, tempViewName);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, tempViewName);

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.SCHEMA_NAME_MUST_MATCH);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName);

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw DbException.getInvalidValueException("collation", name);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, tableName);

              
// in src/main/org/h2/command/Parser.java
throw DbException.get(ErrorCode.SEQUENCE_NOT_FOUND_1, sequenceName);

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/Parser.java
throw getSyntaxError();

              
// in src/main/org/h2/command/ddl/AlterUser.java
throw DbException.get(ErrorCode.USER_ALREADY_EXISTS_1, newName);

              
// in src/main/org/h2/command/ddl/GrantRevoke.java
throw DbException.get(ErrorCode.USER_OR_ROLE_NOT_FOUND_1, granteeName);

              
// in src/main/org/h2/command/ddl/GrantRevoke.java
throw DbException.get(ErrorCode.ROLE_NOT_FOUND_1, name);

              
// in src/main/org/h2/command/ddl/GrantRevoke.java
throw DbException.get(ErrorCode.ROLE_ALREADY_GRANTED_1, grantedRole.getSQL());

              
// in src/main/org/h2/command/ddl/CreateView.java
throw DbException.get(ErrorCode.VIEW_ALREADY_EXISTS_1, viewName);

              
// in src/main/org/h2/command/ddl/CreateView.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, "parameters in views");

              
// in src/main/org/h2/command/ddl/CreateSchema.java
throw DbException.get(ErrorCode.SCHEMA_ALREADY_EXISTS_1, schemaName);

              
// in src/main/org/h2/command/ddl/DropRole.java
throw DbException.get(ErrorCode.ROLE_CAN_NOT_BE_DROPPED_1, roleName);

              
// in src/main/org/h2/command/ddl/DropRole.java
throw DbException.get(ErrorCode.ROLE_NOT_FOUND_1, roleName);

              
// in src/main/org/h2/command/ddl/AlterTableRename.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, newTableName);

              
// in src/main/org/h2/command/ddl/AlterTableRename.java
throw DbException.getUnsupportedException("temp table");

              
// in src/main/org/h2/command/ddl/DropUser.java
throw DbException.get(ErrorCode.USER_NOT_FOUND_1, userName);

              
// in src/main/org/h2/command/ddl/DropUser.java
throw DbException.get(ErrorCode.CANNOT_DROP_CURRENT_USER);

              
// in src/main/org/h2/command/ddl/DropAggregate.java
throw DbException.get(ErrorCode.AGGREGATE_NOT_FOUND_1, name);

              
// in src/main/org/h2/command/ddl/DropIndex.java
throw DbException.get(ErrorCode.INDEX_NOT_FOUND_1, indexName);

              
// in src/main/org/h2/command/ddl/DropIndex.java
throw DbException.get(ErrorCode.INDEX_BELONGS_TO_CONSTRAINT_1, indexName);

              
// in src/main/org/h2/command/ddl/AlterSchemaRename.java
throw DbException.get(ErrorCode.SCHEMA_CAN_NOT_BE_DROPPED_1, oldSchema.getName());

              
// in src/main/org/h2/command/ddl/AlterSchemaRename.java
throw DbException.get(ErrorCode.SCHEMA_ALREADY_EXISTS_1, newSchemaName);

              
// in src/main/org/h2/command/ddl/CreateSequence.java
throw DbException.get(ErrorCode.SEQUENCE_ALREADY_EXISTS_1, sequenceName);

              
// in src/main/org/h2/command/ddl/CreateConstant.java
throw DbException.get(ErrorCode.CONSTANT_ALREADY_EXISTS_1, constantName);

              
// in src/main/org/h2/command/ddl/CreateTrigger.java
throw DbException.get(ErrorCode.TRIGGER_ALREADY_EXISTS_1, triggerName);

              
// in src/main/org/h2/command/ddl/CreateAggregate.java
throw DbException.get(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, name);

              
// in src/main/org/h2/command/ddl/CreateIndex.java
throw DbException.get(ErrorCode.INDEX_ALREADY_EXISTS_1, indexName);

              
// in src/main/org/h2/command/ddl/CreateIndex.java
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);

              
// in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.get(ErrorCode.CONSTRAINT_ALREADY_EXISTS_1, constraintName);

              
// in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);

              
// in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);

              
// in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);

              
// in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, "Reference " + refTable.getSQL());

              
// in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
// in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
throw DbException.throwInternalError("type=" + type);

              
// in src/main/org/h2/command/ddl/DropTrigger.java
throw DbException.get(ErrorCode.TRIGGER_NOT_FOUND_1, triggerName);

              
// in src/main/org/h2/command/ddl/AlterIndexRename.java
throw DbException.get(ErrorCode.INDEX_ALREADY_EXISTS_1, newIndexName);

              
// in src/main/org/h2/command/ddl/CreateTable.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, data.tableName);

              
// in src/main/org/h2/command/ddl/CreateTable.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
// in src/main/org/h2/command/ddl/CreateTable.java
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);

              
// in src/main/org/h2/command/ddl/CreateTable.java
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);

              
// in src/main/org/h2/command/ddl/CreateLinkedTable.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1,
                    tableName);

              
// in src/main/org/h2/command/ddl/DropConstant.java
throw DbException.get(ErrorCode.CONSTANT_NOT_FOUND_1, constantName);

              
// in src/main/org/h2/command/ddl/DropSchema.java
throw DbException.get(ErrorCode.SCHEMA_NOT_FOUND_1, schemaName);

              
// in src/main/org/h2/command/ddl/DropSchema.java
throw DbException.get(ErrorCode.SCHEMA_CAN_NOT_BE_DROPPED_1, schemaName);

              
// in src/main/org/h2/command/ddl/CreateFunctionAlias.java
throw DbException.get(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, aliasName);

              
// in src/main/org/h2/command/ddl/DropUserDataType.java
throw DbException.get(ErrorCode.USER_DATA_TYPE_NOT_FOUND_1, typeName);

              
// in src/main/org/h2/command/ddl/CreateUserDataType.java
throw DbException.get(ErrorCode.USER_DATA_TYPE_ALREADY_EXISTS_1, typeName);

              
// in src/main/org/h2/command/ddl/CreateUserDataType.java
throw DbException.get(ErrorCode.USER_DATA_TYPE_ALREADY_EXISTS_1, typeName);

              
// in src/main/org/h2/command/ddl/CreateUserDataType.java
throw DbException.get(ErrorCode.USER_DATA_TYPE_ALREADY_EXISTS_1, typeName + " (" + table.getSQL() + ")");

              
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
throw DbException.get(ErrorCode.CANNOT_DROP_LAST_COLUMN, oldColumn.getSQL());

              
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
throw DbException.get(ErrorCode.COLUMN_IS_REFERENCED_1, defaultExpression.getSQL());

              
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
throw DbException.getUnsupportedException("TEMP TABLE");

              
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage());

              
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
throw DbException.get(ErrorCode.COLUMN_IS_PART_OF_INDEX_1, index.getSQL());

              
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
throw DbException.get(ErrorCode.COLUMN_CONTAINS_NULL_VALUES_1, oldColumn.getSQL());

              
// in src/main/org/h2/command/ddl/AlterTableDropConstraint.java
throw DbException.get(ErrorCode.CONSTRAINT_NOT_FOUND_1, constraintName);

              
// in src/main/org/h2/command/ddl/CreateRole.java
throw DbException.get(ErrorCode.USER_ALREADY_EXISTS_1, roleName);

              
// in src/main/org/h2/command/ddl/CreateRole.java
throw DbException.get(ErrorCode.ROLE_ALREADY_EXISTS_1, roleName);

              
// in src/main/org/h2/command/ddl/DropView.java
throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName);

              
// in src/main/org/h2/command/ddl/DropView.java
throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName);

              
// in src/main/org/h2/command/ddl/DropView.java
throw DbException.get(ErrorCode.CANNOT_DROP_2, viewName, child.getName());

              
// in src/main/org/h2/command/ddl/DropFunctionAlias.java
throw DbException.get(ErrorCode.FUNCTION_ALIAS_NOT_FOUND_1, aliasName);

              
// in src/main/org/h2/command/ddl/DropSequence.java
throw DbException.get(ErrorCode.SEQUENCE_NOT_FOUND_1, sequenceName);

              
// in src/main/org/h2/command/ddl/DropSequence.java
throw DbException.get(ErrorCode.SEQUENCE_BELONGS_TO_A_TABLE_1, sequenceName);

              
// in src/main/org/h2/command/ddl/SetComment.java
throw DbException.get(errorCode, objectName);

              
// in src/main/org/h2/command/ddl/DropTable.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, tableName);

              
// in src/main/org/h2/command/ddl/DropTable.java
throw DbException.get(ErrorCode.CANNOT_DROP_TABLE_1, tableName);

              
// in src/main/org/h2/command/ddl/DropTable.java
throw DbException.get(ErrorCode.CANNOT_DROP_2, tableName, buff.toString());

              
// in src/main/org/h2/command/ddl/TruncateTable.java
throw DbException.get(ErrorCode.CANNOT_TRUNCATE_1, table.getSQL());

              
// in src/main/org/h2/command/ddl/CreateUser.java
throw DbException.get(ErrorCode.ROLE_ALREADY_EXISTS_1, userName);

              
// in src/main/org/h2/command/ddl/CreateUser.java
throw DbException.get(ErrorCode.USER_ALREADY_EXISTS_1, userName);

              
// in src/main/org/h2/command/ddl/CreateUser.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/command/dml/Query.java
throw DbException.get(ErrorCode.ORDER_BY_NOT_IN_RESULT, e.getSQL());

              
// in src/main/org/h2/command/dml/Query.java
throw DbException.get(ErrorCode.ORDER_BY_NOT_IN_RESULT, "" + (idx + 1));

              
// in src/main/org/h2/command/dml/RunScriptCommand.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/command/dml/RunScriptCommand.java
throw e.addSQL(sql);

              
// in src/main/org/h2/command/dml/Select.java
throw DbException.getInvalidValueException("ORDER BY", idx + 1);

              
// in src/main/org/h2/command/dml/Select.java
throw DbException.getUnsupportedException("FOR UPDATE && GROUP");

              
// in src/main/org/h2/command/dml/Select.java
throw DbException.getUnsupportedException("FOR UPDATE && DISTINCT");

              
// in src/main/org/h2/command/dml/Select.java
throw DbException.getUnsupportedException("FOR UPDATE && AGGREGATE");

              
// in src/main/org/h2/command/dml/Select.java
throw DbException.getUnsupportedException("FOR UPDATE && JOIN");

              
// in src/main/org/h2/command/dml/Select.java
throw DbException.getUnsupportedException("FOR UPDATE && JOIN");

              
// in src/main/org/h2/command/dml/Select.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, tableAlias);

              
// in src/main/org/h2/command/dml/Select.java
throw DbException.get(ErrorCode.UNSUPPORTED_OUTER_JOIN_CONDITION_1, on.getSQL());

              
// in src/main/org/h2/command/dml/SelectUnion.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
// in src/main/org/h2/command/dml/ScriptBase.java
throw DbException.convertIOException(e, file);

              
// in src/main/org/h2/command/dml/ScriptBase.java
throw DbException.get(ErrorCode.FILE_NOT_FOUND_1, SCRIPT_SQL + " in " + file);

              
// in src/main/org/h2/command/dml/ScriptBase.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.get(ErrorCode.SCHEMA_NOT_FOUND_1, schemaName);

              
// in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.convertIOException(e, getFileName());

              
// in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/command/dml/ScriptCommand.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/command/dml/Merge.java
throw setRow(ex, count, getSQL(expr));

              
// in src/main/org/h2/command/dml/Merge.java
throw setRow(ex, count, getSQL(r));

              
// in src/main/org/h2/command/dml/Merge.java
throw DbException.get(ErrorCode.COLUMN_CONTAINS_NULL_VALUES_1, col.getSQL());

              
// in src/main/org/h2/command/dml/Merge.java
throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, table.getName());

              
// in src/main/org/h2/command/dml/Merge.java
throw DbException.get(ErrorCode.DUPLICATE_KEY_1, table.getSQL());

              
// in src/main/org/h2/command/dml/Merge.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
// in src/main/org/h2/command/dml/Merge.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
// in src/main/org/h2/command/dml/Merge.java
throw DbException.get(ErrorCode.CONSTRAINT_NOT_FOUND_1, "PRIMARY KEY");

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("ALLOW_LITERALS", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("CACHE_SIZE", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.get(ErrorCode.COLLATION_CHANGE_WITH_DATA_TABLE_1, table.getSQL());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("DB_CLOSE_DELAY", x);

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("DEFAULT_LOCK_TIMEOUT", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("EXCLUSIVE", value);

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("LOCK_TIMEOUT", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("MAX_LENGTH_INPLACE_LOB", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("MAX_LOG_SIZE", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("MAX_MEMORY_ROWS", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("MAX_MEMORY_UNDO", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("MAX_OPERATION_MEMORY", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.get(ErrorCode.UNKNOWN_MODE_1, stringValue);

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.get(ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, "MVCC");

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("QUERY_TIMEOUT", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("REFERENTIAL_INTEGRITY", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("TRACE_MAX_FILE_SIZE", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("THROTTLE", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("UNDO_LOG", getIntValue());

              
// in src/main/org/h2/command/dml/Set.java
throw DbException.getInvalidValueException("WRITE_DELAY", getIntValue());

              
// in src/main/org/h2/command/dml/AlterSequence.java
throw DbException.get(ErrorCode.SEQUENCE_NOT_FOUND_1, column.getSQL());

              
// in src/main/org/h2/command/dml/AlterSequence.java
throw DbException.getInvalidValueException("INCREMENT", 0);

              
// in src/main/org/h2/command/dml/Update.java
throw DbException.get(ErrorCode.DUPLICATE_COLUMN_NAME_1, column
                    .getName());

              
// in src/main/org/h2/command/dml/BackupCommand.java
throw DbException.get(ErrorCode.DATABASE_IS_NOT_PERSISTENT);

              
// in src/main/org/h2/command/dml/BackupCommand.java
throw DbException.convertIOException(e, fileName);

              
// in src/main/org/h2/command/dml/Insert.java
throw setRow(ex, x, getSQL(expr));

              
// in src/main/org/h2/command/dml/Insert.java
throw setRow(ex, rowNumber, getSQL(values));

              
// in src/main/org/h2/command/dml/Insert.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
// in src/main/org/h2/command/dml/Insert.java
throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);

              
// in src/main/org/h2/command/Command.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_QUERY);

              
// in src/main/org/h2/command/Command.java
throw DbException.get(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY);

              
// in src/main/org/h2/command/Command.java
throw DbException.get(ErrorCode.STATEMENT_WAS_CANCELED);

              
// in src/main/org/h2/command/Command.java
throw DbException.convert(e);

              
// in src/main/org/h2/command/Command.java
throw DbException.convert(e);

              
// in src/main/org/h2/command/Command.java
throw DbException.get(ErrorCode.LOCK_TIMEOUT_1, e.getCause(), "");

              
// in src/main/org/h2/command/Prepared.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "database closed");

              
// in src/main/org/h2/command/Prepared.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_QUERY);

              
// in src/main/org/h2/command/Prepared.java
throw DbException.get(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getInvalidValueException("level", level);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.throwInternalError("lockMode:" + lockMode);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.get(ErrorCode.SAVEPOINT_IS_INVALID_1, "" + savepoint);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.get(ErrorCode.UNSUPPORTED_JAVA_VERSION);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.throwInternalError("c=" + c);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getInvalidValueException("SQL", null);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i, "=");

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, sql.length() - 1);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getSyntaxError(sql, i);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getInvalidValueException("resultSetType", resultSetType);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getInvalidValueException("resultSetConcurrency", resultSetConcurrency);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getInvalidValueException("resultSetHoldability", resultSetHoldability);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.get(ErrorCode.DATABASE_CALLED_AT_SHUTDOWN);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw unsupported("SQLXML");

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw unsupported("createArray");

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw unsupported("Struct");

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw unsupported("clientInfo");

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw unsupported("unwrap");

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw unsupported("isWrapperFor");

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw DbException.getUnsupportedException("map.size > 0");

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw unsupported("ref");

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw unsupported("unicodeStream");

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw unsupported("setArray");

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw unsupported("url");

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw DbException.getInvalidValueException("parameterIndex", parameterIndex + 1);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw unsupported("rowId");

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw unsupported("SQLXML");

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw DbException.getInvalidValueException("columnIndex", columnIndex);

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw unsupported("unwrap");

              
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
throw unsupported("isWrapperFor");

              
// in src/main/org/h2/jdbc/JdbcSavepoint.java
throw DbException.get(ErrorCode.SAVEPOINT_IS_INVALID_1, getName(name, savepointId));

              
// in src/main/org/h2/jdbc/JdbcSavepoint.java
throw DbException.get(ErrorCode.SAVEPOINT_IS_NAMED);

              
// in src/main/org/h2/jdbc/JdbcSavepoint.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcSavepoint.java
throw DbException.get(ErrorCode.SAVEPOINT_IS_UNNAMED);

              
// in src/main/org/h2/jdbc/JdbcSavepoint.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw unsupported("LOB update");

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw unsupported("LOB update");

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.getInvalidValueException("pos", pos);

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.getInvalidValueException("length", value.getPrecision());

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.getInvalidValueException("pos", pos);

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.getInvalidValueException("length", length);

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.getInvalidValueException("pos", pos);

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.getInvalidValueException("str", str);

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw unsupported("LOB update");

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw unsupported("LOB search");

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw unsupported("LOB search");

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw unsupported("LOB subset");

              
// in src/main/org/h2/jdbc/JdbcClob.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("superTypes");

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("attributes");

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("getSchemas(., .)");

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("clientInfoProperties");

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("unwrap");

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("isWrapperFor");

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("getFunctionColumns");

              
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
throw unsupported("getFunctions");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.getInvalidValueException("scale", scale);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.getInvalidValueException("scale", scale);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("unicodeStream");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("unicodeStream");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("map");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("map");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("ref");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("ref");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("url");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("url");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("ref");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("ref");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("setArray");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("setArray");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("cursorName");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.getInvalidValueException("rows", rows);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.getInvalidValueException("rows", rows);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("setFetchDirection");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.NOT_ON_UPDATABLE_ROW);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.NOT_ON_UPDATABLE_ROW);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.NOT_ON_UPDATABLE_ROW);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.RESULT_SET_NOT_UPDATABLE);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.getInvalidValueException("columnLabel", null);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnLabel);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnLabel);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.getInvalidValueException("columnIndex", columnIndex);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.RESULT_SET_NOT_SCROLLABLE);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("rowId");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("rowId");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("rowId");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("rowId");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("NClob");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("NClob");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("NClob");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("NClob");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("NClob");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("NClob");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("SQLXML");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("SQLXML");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("SQLXML");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("SQLXML");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("unwrap");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw unsupported("isWrapperFor");

              
// in src/main/org/h2/jdbc/JdbcResultSet.java
throw DbException.get(ErrorCode.RESULT_SET_READONLY);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw DbException.getInvalidValueException("count (1.."
                    + array.length + ")", count);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw DbException.getInvalidValueException("index (1.."
                    + array.length + ")", index);

              
// in src/main/org/h2/jdbc/JdbcArray.java
throw DbException.getUnsupportedException("map.size > 0");

              
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw DbException.getInvalidValueException("param", param);

              
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw unsupported("unwrap");

              
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
throw unsupported("isWrapperFor");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("url");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("map");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("ref");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("url");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("ref");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("map");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("rowId");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("rowId");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("SQLXML");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("SQLXML");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("url");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("rowId");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw unsupported("SQLXML");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw DbException.getUnsupportedException("Supported only for calling stored procedures");

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw DbException.getInvalidValueException("parameterIndex", parameterIndex);

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw DbException.getInvalidValueException("parameterIndex", parameterIndex);

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw DbException.getInvalidValueException("parameterName", parameterName);

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);

              
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw unsupported("LOB update");

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw DbException.getInvalidValueException("pos", pos);

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw unsupported("LOB update");

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw DbException.getInvalidValueException("pos", pos);

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw DbException.getInvalidValueException("length", value.getPrecision());

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw unsupported("LOB search");

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw unsupported("LOB subset");

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw unsupported("LOB update");

              
// in src/main/org/h2/jdbc/JdbcBlob.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw DbException.getInvalidValueException("maxRows", maxRows);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw DbException.getInvalidValueException("rows", rows);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw DbException.getInvalidValueException("seconds", seconds);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw DbException.getInvalidValueException("current", current);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw logAndConvert(e);

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw unsupported("unwrap");

              
// in src/main/org/h2/jdbc/JdbcStatement.java
throw unsupported("isWrapperFor");

              
// in src/main/org/h2/engine/Comment.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/engine/UserAggregate.java
throw DbException.convert(e);

              
// in src/main/org/h2/engine/UserAggregate.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/engine/UserAggregate.java
throw DbException.getUnsupportedException("AGGREGATE");

              
// in src/main/org/h2/engine/User.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/engine/User.java
throw DbException.get(ErrorCode.NOT_ENOUGH_RIGHTS_FOR_1, table.getSQL());

              
// in src/main/org/h2/engine/User.java
throw DbException.get(ErrorCode.ADMIN_RIGHTS_REQUIRED);

              
// in src/main/org/h2/engine/User.java
throw DbException.get(ErrorCode.CANNOT_DROP_2, getName(), s.getName());

              
// in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.getInvalidValueException("url", u);

              
// in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.convert(e);

              
// in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.get(ErrorCode.IO_EXCEPTION_1, normalizedName + " outside " +
                        absDir);

              
// in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.get(ErrorCode.DUPLICATE_PROPERTY_1, key);

              
// in src/main/org/h2/engine/ConnectionInfo.java
throw getFormatException();

              
// in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.get(ErrorCode.UNSUPPORTED_SETTING_1, key);

              
// in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.get(ErrorCode.DUPLICATE_PROPERTY_1, key);

              
// in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.get(ErrorCode.WRONG_PASSWORD_FORMAT);

              
// in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.get(ErrorCode.INVALID_DATABASE_NAME_1, name);

              
// in src/main/org/h2/engine/ConnectionInfo.java
throw DbException.convert(e);

              
// in src/main/org/h2/engine/Database.java
throw DbException.convert(e);

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.DATABASE_IS_CLOSED);

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.FILE_NOT_FOUND_1, name);

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.FILE_VERSION_ERROR_1,
                        "Old database: " + dataFileName + " - please convert the database to a SQL script and re-create it.");

              
// in src/main/org/h2/engine/Database.java
throw DbException.getUnsupportedException("autoServerMode && (readOnly || fileLockMethod == NO" +
                            " || fileLockMethod == SERIALIZED || inMemory)");

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, "Lock file exists: " + lockFileName);

              
// in src/main/org/h2/engine/Database.java
throw DbException.getUnsupportedException("autoServerMode && inMemory");

              
// in src/main/org/h2/engine/Database.java
throw DbException.convert(e);

              
// in src/main/org/h2/engine/Database.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/engine/Database.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/engine/Database.java
throw DbException.throwInternalError("type=" + type);

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.USER_NOT_FOUND_1, name);

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE);

              
// in src/main/org/h2/engine/Database.java
throw DbException.convertIOException(e, databaseName);

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.SCHEMA_NOT_FOUND_1, schemaName);

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.CANNOT_DROP_2, obj.getSQL(), t.getSQL());

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.DATABASE_IS_READ_ONLY);

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.NO_DISK_SPACE_AVAILABLE);

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.DATABASE_IS_READ_ONLY);

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.ERROR_SETTING_DATABASE_EVENT_LISTENER_2, e, className, e.toString());

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, "LOCK_MODE=0 & MULTI_THREADED");

              
// in src/main/org/h2/engine/Database.java
throw DbException.getInvalidValueException("lock mode", lockMode);

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, "MVCC & MULTI_THREADED");

              
// in src/main/org/h2/engine/Database.java
throw DbException.get(ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, "LOCK_MODE=0 & MULTI_THREADED");

              
// in src/main/org/h2/engine/Database.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/engine/Database.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/engine/Database.java
throw DbException.getInvalidValueException("LOG", log);

              
// in src/main/org/h2/engine/Database.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.DATABASE_NOT_FOUND_1, name);

              
// in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.WRONG_USER_OR_PASSWORD);

              
// in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX");

              
// in src/main/org/h2/engine/Engine.java
throw DbException.convert(e);

              
// in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.CLUSTER_ERROR_DATABASE_RUNS_ALONE);

              
// in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.CLUSTER_ERROR_DATABASE_RUNS_CLUSTERED_1, clusterDb);

              
// in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX");

              
// in src/main/org/h2/engine/Engine.java
throw DbException.get(ErrorCode.WRONG_USER_OR_PASSWORD);

              
// in src/main/org/h2/engine/SettingsBase.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s);

              
// in src/main/org/h2/engine/SettingsBase.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s);

              
// in src/main/org/h2/engine/SessionRemote.java
throw DbException.getUnsupportedException("remote");

              
// in src/main/org/h2/engine/SessionRemote.java
throw ci.getFormatException();

              
// in src/main/org/h2/engine/SessionRemote.java
throw DbException.convertIOException(e, prefix);

              
// in src/main/org/h2/engine/SessionRemote.java
throw DbException.getUnsupportedException("autoServer && serverList != null");

              
// in src/main/org/h2/engine/SessionRemote.java
throw DbException.convert(e);

              
// in src/main/org/h2/engine/SessionRemote.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, e, e + ": " + s);

              
// in src/main/org/h2/engine/SessionRemote.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "session closed");

              
// in src/main/org/h2/engine/SessionRemote.java
throw DbException.convert(s);

              
// in src/main/org/h2/engine/SessionRemote.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "unexpected status " + status);

              
// in src/main/org/h2/engine/SessionRemote.java
throw DbException.get(ErrorCode.FILE_NOT_FOUND_1, name);

              
// in src/main/org/h2/engine/Role.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/engine/MetaRecord.java
throw DbException.throwInternalError("type="+objectType);

              
// in src/main/org/h2/engine/UserDataType.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, table.getSQL());

              
// in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.INDEX_ALREADY_EXISTS_1, index.getSQL());

              
// in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.CONSTRAINT_ALREADY_EXISTS_1, constraint.getSQL());

              
// in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "session closed");

              
// in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.COMMIT_ROLLBACK_NOT_ALLOWED);

              
// in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.SAVEPOINT_IS_INVALID_1, name);

              
// in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.SAVEPOINT_IS_INVALID_1, name);

              
// in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.TRANSACTION_NOT_FOUND_1, transactionName);

              
// in src/main/org/h2/engine/Session.java
throw DbException.get(ErrorCode.STATEMENT_WAS_CANCELED);

              
// in src/main/org/h2/engine/Setting.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/engine/Setting.java
throw DbException.getUnsupportedException("RENAME");

              
// in src/main/org/h2/engine/FunctionAlias.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_1, javaClassMethod);

              
// in src/main/org/h2/engine/FunctionAlias.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_1, e, source);

              
// in src/main/org/h2/engine/FunctionAlias.java
throw DbException.get(
                                ErrorCode.METHODS_MUST_HAVE_DIFFERENT_PARAMETER_COUNTS_2,
                                old.toString(), javaMethod.toString()
                        );

              
// in src/main/org/h2/engine/FunctionAlias.java
throw DbException.get(ErrorCode.PUBLIC_STATIC_JAVA_METHOD_NOT_FOUND_1, methodName + " (" + className + ")");

              
// in src/main/org/h2/engine/FunctionAlias.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/engine/FunctionAlias.java
throw DbException.getUnsupportedException("RENAME");

              
// in src/main/org/h2/engine/FunctionAlias.java
throw DbException.get(ErrorCode.METHOD_NOT_FOUND_1,
                methodName + " (" + className + ", parameter count: " + parameterCount + ")");

              
// in src/main/org/h2/engine/FunctionAlias.java
throw DbException.convertInvocation(e, buff.toString());

              
// in src/main/org/h2/engine/FunctionAlias.java
throw DbException.convert(e);

              
// in src/main/org/h2/util/SortedProperties.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/util/SmallMap.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
// in src/main/org/h2/util/ScriptReader.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/util/ScriptReader.java
throw DbException.convertIOException(e, null);

              
// in src/main/org/h2/util/SourceCompiler.java
throw DbException.convert(e);

              
// in src/main/org/h2/util/SourceCompiler.java
throw DbException.convert(e);

              
// in src/main/org/h2/util/SourceCompiler.java
throw DbException.convert(e);

              
// in src/main/org/h2/util/SourceCompiler.java
throw DbException.get(ErrorCode.SYNTAX_ERROR_1, err);

              
// in src/main/org/h2/util/NetUtils.java
throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2,
                    be, "" + port, be.toString());

              
// in src/main/org/h2/util/NetUtils.java
throw DbException.convertIOException(e, "port: " + port + " ssl: " + ssl);

              
// in src/main/org/h2/util/NetUtils.java
throw DbException.convert(e);

              
// in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/util/IOUtils.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/util/IOUtils.java
throw DbException.convert(e);

              
// in src/main/org/h2/util/IOUtils.java
throw DbException.convert(e);

              
// in src/main/org/h2/util/IOUtils.java
throw DbException.convert(e);

              
// in src/main/org/h2/util/IOUtils.java
throw DbException.convert(e);

              
// in src/main/org/h2/util/Utils.java
throw DbException.get(ErrorCode.SERIALIZATION_FAILED_1, e, e.toString());

              
// in src/main/org/h2/util/Utils.java
throw DbException.get(ErrorCode.DESERIALIZATION_FAILED_1, e, e.toString());

              
// in src/main/org/h2/util/Utils.java
throw DbException.get(ErrorCode.ACCESS_DENIED_TO_CLASS_1, className);

              
// in src/main/org/h2/util/Utils.java
throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className);

              
// in src/main/org/h2/util/Utils.java
throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className);

              
// in src/main/org/h2/util/Utils.java
throw DbException.get(ErrorCode.GENERAL_ERROR_1, e, className);

              
// in src/main/org/h2/util/MathUtils.java
throw DbException.getInvalidValueException("scale", scale);

              
// in src/main/org/h2/util/JdbcUtils.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/util/DateTimeUtils.java
throw DbException.getInvalidValueException("calendar", null);

              
// in src/main/org/h2/util/DateTimeUtils.java
throw DbException.getInvalidValueException("calendar", null);

              
// in src/main/org/h2/util/DateTimeUtils.java
throw DbException.getInvalidValueException("calendar", null);

              
// in src/main/org/h2/util/DateTimeUtils.java
throw DbException.getInvalidValueException("calendar", null);

              
// in src/main/org/h2/util/DateTimeUtils.java
throw DbException.get(ErrorCode.PARSE_ERROR_1, e, date);

              
// in src/main/org/h2/util/DateTimeUtils.java
throw DbException.get(ErrorCode.PARSE_ERROR_1, e, format + "/" + locale + "/" + timeZone);

              
// in src/main/org/h2/util/Tool.java
throw throwUnsupportedOption(option);

              
// in src/main/org/h2/util/Tool.java
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, option).getSQLException();

              
// in src/main/org/h2/util/Tool.java
throw DbException.getUnsupportedException("expected: " + option + " got: " + arg);

              
// in src/main/org/h2/util/CacheLRU.java
throw DbException.getInvalidValueException("CACHE_TYPE", cacheType);

              
// in src/main/org/h2/util/CacheLRU.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/util/StringUtils.java
throw getFormatException(s, i);

              
// in src/main/org/h2/util/StringUtils.java
throw getFormatException(s, i);

              
// in src/main/org/h2/util/StringUtils.java
throw getFormatException(s, i);

              
// in src/main/org/h2/util/StringUtils.java
throw getFormatException(s, i);

              
// in src/main/org/h2/util/StringUtils.java
throw DbException.convert(e);

              
// in src/main/org/h2/util/StringUtils.java
throw DbException.convert(e);

              
// in src/main/org/h2/util/StringUtils.java
throw DbException.convert(e);

              
// in src/main/org/h2/util/StringUtils.java
throw DbException.convert(e);

              
// in src/main/org/h2/util/StringUtils.java
throw DbException.get(ErrorCode.HEX_STRING_ODD_1, s);

              
// in src/main/org/h2/util/StringUtils.java
throw DbException.get(ErrorCode.HEX_STRING_WRONG_1, s);

              
// in src/main/org/h2/util/StringUtils.java
throw DbException.get(ErrorCode.HEX_STRING_WRONG_1, s);

              
// in src/main/org/h2/server/TcpServer.java
throw DbException.convert(e);

              
// in src/main/org/h2/server/TcpServer.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/server/TcpServer.java
throw DbException.get(ErrorCode.WRONG_USER_OR_PASSWORD);

              
// in src/main/org/h2/server/pg/PgServerThread.java
throw DbException.throwInternalError("Incompatible PG_VERSION");

              
// in src/main/org/h2/server/pg/PgServerThread.java
throw DbException.convertIOException(e, "Can not read pg_catalog resource");

              
// in src/main/org/h2/server/TcpServerThread.java
throw DbException.get(ErrorCode.REMOTE_CONNECTION_NOT_ALLOWED);

              
// in src/main/org/h2/server/TcpServerThread.java
throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2, "" + clientVersion, "" + Constants.TCP_PROTOCOL_VERSION_6);

              
// in src/main/org/h2/server/TcpServerThread.java
throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2, "" + clientVersion, "" + Constants.TCP_PROTOCOL_VERSION_11);

              
// in src/main/org/h2/server/TcpServerThread.java
throw DbException.get(ErrorCode.OBJECT_CLOSED);

              
// in src/main/org/h2/server/web/DbContextRule.java
throw DbException.throwInternalError("type=" + type);

              
// in src/main/org/h2/server/web/WebApp.java
throw DbException.throwInternalError(toolName);

              
// in src/main/org/h2/table/LinkSchema.java
throw DbException.convert(e);

              
// in src/main/org/h2/table/RangeTable.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
// in src/main/org/h2/table/RangeTable.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
// in src/main/org/h2/table/RangeTable.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
// in src/main/org/h2/table/RangeTable.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
// in src/main/org/h2/table/RangeTable.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
// in src/main/org/h2/table/RangeTable.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/table/RangeTable.java
throw DbException.getUnsupportedException("SYSTEM_RANGE");

              
// in src/main/org/h2/table/FunctionTable.java
throw DbException.get(ErrorCode.FUNCTION_MUST_RETURN_RESULT_SET_1, function.getName());

              
// in src/main/org/h2/table/FunctionTable.java
throw DbException.get(ErrorCode.FUNCTION_MUST_RETURN_RESULT_SET_1, function.getName());

              
// in src/main/org/h2/table/FunctionTable.java
throw DbException.convert(e);

              
// in src/main/org/h2/table/FunctionTable.java
throw DbException.getUnsupportedException("ALIAS");

              
// in src/main/org/h2/table/FunctionTable.java
throw DbException.getUnsupportedException("ALIAS");

              
// in src/main/org/h2/table/FunctionTable.java
throw DbException.getUnsupportedException("ALIAS");

              
// in src/main/org/h2/table/FunctionTable.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/table/FunctionTable.java
throw DbException.getUnsupportedException("ALIAS");

              
// in src/main/org/h2/table/FunctionTable.java
throw DbException.getUnsupportedException("ALIAS");

              
// in src/main/org/h2/table/FunctionTable.java
throw DbException.getUnsupportedException("ALIAS");

              
// in src/main/org/h2/table/RegularTable.java
throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName());

              
// in src/main/org/h2/table/RegularTable.java
throw DbException.get(ErrorCode.COLUMN_MUST_NOT_BE_NULLABLE_1, column.getName());

              
// in src/main/org/h2/table/RegularTable.java
throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, getName());

              
// in src/main/org/h2/table/RegularTable.java
throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, getName());

              
// in src/main/org/h2/table/RegularTable.java
throw DbException.convert(e);

              
// in src/main/org/h2/table/RegularTable.java
throw DbException.get(ErrorCode.DEADLOCK_1, getDeadlockDetails(sessions));

              
// in src/main/org/h2/table/RegularTable.java
throw DbException.get(ErrorCode.LOCK_TIMEOUT_1, getName());

              
// in src/main/org/h2/table/TableLink.java
throw DbException.convert(e);

              
// in src/main/org/h2/table/TableLink.java
throw DbException.get(ErrorCode.SCHEMA_NAME_MUST_MATCH, originalTable);

              
// in src/main/org/h2/table/TableLink.java
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, e,
                    originalTable + "(" + e.toString() + ")");

              
// in src/main/org/h2/table/TableLink.java
throw DbException.getUnsupportedException("LINK");

              
// in src/main/org/h2/table/TableLink.java
throw DbException.get(ErrorCode.DATABASE_IS_READ_ONLY);

              
// in src/main/org/h2/table/TableLink.java
throw wrapException(sql, e);

              
// in src/main/org/h2/table/TableLink.java
throw DbException.convert(e);

              
// in src/main/org/h2/table/TableLink.java
throw DbException.getUnsupportedException("LINK");

              
// in src/main/org/h2/table/TableLink.java
throw DbException.getUnsupportedException("LINK");

              
// in src/main/org/h2/table/Column.java
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, v.getSQL() + " (" + target + ")");

              
// in src/main/org/h2/table/Column.java
throw DbException.get(ErrorCode.NULL_NOT_ALLOWED, name);

              
// in src/main/org/h2/table/Column.java
throw DbException.get(ErrorCode.CHECK_CONSTRAINT_VIOLATED_1, checkConstraint.getSQL());

              
// in src/main/org/h2/table/Column.java
throw DbException.get(ErrorCode.VALUE_TOO_LONG_2,
                        getCreateSQL(), s + " (" + value.getPrecision() + ")");

              
// in src/main/org/h2/table/TableLinkConnection.java
throw DbException.convert(e);

              
// in src/main/org/h2/table/MetaTable.java
throw DbException.throwInternalError("type="+type);

              
// in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
// in src/main/org/h2/table/MetaTable.java
throw DbException.convert(e);

              
// in src/main/org/h2/table/MetaTable.java
throw DbException.throwInternalError("action="+action);

              
// in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
// in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
// in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
// in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
// in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
// in src/main/org/h2/table/MetaTable.java
throw DbException.getUnsupportedException("META");

              
// in src/main/org/h2/table/MetaTable.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/table/TableView.java
throw DbException.getSyntaxError(sql, 0);

              
// in src/main/org/h2/table/TableView.java
throw DbException.getUnsupportedException("VIEW");

              
// in src/main/org/h2/table/TableView.java
throw DbException.getUnsupportedException("VIEW");

              
// in src/main/org/h2/table/TableView.java
throw DbException.getUnsupportedException("VIEW");

              
// in src/main/org/h2/table/TableView.java
throw DbException.getUnsupportedException("VIEW");

              
// in src/main/org/h2/table/TableView.java
throw DbException.getUnsupportedException("VIEW");

              
// in src/main/org/h2/table/TableView.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/table/TableView.java
throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, createException, getSQL(), msg);

              
// in src/main/org/h2/table/Table.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, col.getSQL());

              
// in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.DUPLICATE_COLUMN_NAME_1, columnName);

              
// in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.DUPLICATE_COLUMN_NAME_1, newName);

              
// in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.COLUMN_IS_REFERENCED_1, constraint.getSQL());

              
// in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.COLUMN_IS_REFERENCED_1, index.getSQL());

              
// in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnName);

              
// in src/main/org/h2/table/Table.java
throw DbException.get(ErrorCode.INDEX_NOT_FOUND_1, Constants.PREFIX_PRIMARY_KEY);

              
// in src/main/org/h2/table/TableFilter.java
throw DbException.throwInternalError();

              
// in src/main/org/h2/security/CipherFactory.java
throw DbException.get(ErrorCode.UNSUPPORTED_CIPHER, algorithm);

              
// in src/main/org/h2/security/CipherFactory.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/security/CipherFactory.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/security/CipherFactory.java
throw DbException.convertToIOException(e);

              
// in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
// in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
// in src/main/org/h2/fulltext/FullTextLucene.java
throw throwException("Fulltext search for in-memory databases is not supported.");

              
// in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
// in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
// in src/main/org/h2/fulltext/FullTextLucene.java
throw throwException("No primary key for table " + tableName);

              
// in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
// in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
// in src/main/org/h2/fulltext/FullTextLucene.java
throw convertException(e);

              
// in src/main/org/h2/fulltext/FullText.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/fulltext/FullText.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/fulltext/FullText.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/fulltext/FullText.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/fulltext/FullText.java
throw DbException.toSQLException(e);

              
// in src/main/org/h2/fulltext/FullText.java
throw throwException("Unsupported column data type: " + type);

              
// in src/main/org/h2/fulltext/FullText.java
throw throwException("Unsupported key data type: " + type);

              
// in src/main/org/h2/fulltext/FullText.java
throw throwException("Column not found: " + key);

              
// in src/main/org/h2/fulltext/FullText.java
throw DbException.convertIOException(e, "Tokenizer error");

              
// in src/main/org/h2/fulltext/FullText.java
throw throwException("No primary key for table " + tableName);

              
// in src/main/org/h2/fulltext/FullTextSettings.java
throw FullText.throwException("Fulltext search for private (unnamed) in-memory databases is not supported.");

              
// in src/tools/org/h2/android/H2Cursor.java
throw H2Database.unsupported();

              
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
throw DbException.convertIOException(e, name);

              
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
throw DbException.convertIOException(e, name);

              
// in src/tools/org/h2/dev/fs/FileShell.java
throw DbException.convertIOException(e, "cwd");

              
// in src/tools/org/h2/dev/fs/FileShell.java
throw DbException.convert(e);

              
// in src/tools/org/h2/dev/fs/FileShell.java
throw DbException.convertIOException(e, zipFileName);

              
// in src/tools/org/h2/dev/fs/FilePathZip2.java
throw DbException.getUnsupportedException("write");

              
// in src/tools/org/h2/dev/fs/FilePathZip2.java
throw DbException.getUnsupportedException("write");

              
// in src/tools/org/h2/dev/fs/FilePathZip2.java
throw DbException.convertIOException(e, "listFiles " + path);

              
// in src/tools/org/h2/dev/fs/FilePathZip2.java
throw DbException.getUnsupportedException("write");

              
// in src/tools/org/h2/dev/fs/FilePathZip2.java
throw DbException.getUnsupportedException("write");

              
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
throw convert(e);

              
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
throw convert(e);

              
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
throw convert(e);

              
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
throw convert(e);

              
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
throw convert(e);

              
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
throw convert(e);

              
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
throw convert(e);

              
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
throw convert(e);

              
// in src/tools/org/h2/dev/util/ReaderInputStream.java
throw DbException.convert(e);

              
// in src/tools/org/h2/dev/util/FileViewer.java
throw DbException.toSQLException(e);

              
// in src/tools/org/h2/build/BuildBase.java
throw e.getCause();

              
// in src/tools/org/h2/jaqu/Db.java
throw convert(e);

              
// in src/tools/org/h2/jaqu/Db.java
throw convert(e);

              
// in src/tools/org/h2/jaqu/Db.java
throw convert(e);

              
// in src/tools/org/h2/jaqu/util/GenerateModels.java
throw DbException.convertIOException(io, "could not generate model").getSQLException();

              
// in src/tools/org/h2/java/JavaParser.java
throw getSyntaxException("Constructor of wrong type: " + type);

              
// in src/tools/org/h2/java/JavaParser.java
throw getSyntaxException("this usage in static context");

              
// in src/tools/org/h2/java/JavaParser.java
throw getSyntaxException("this usage in static context");

              
// in src/tools/org/h2/java/JavaParser.java
throw getSyntaxException(string + " expected, got " + current.token);

              
// in src/tools/org/h2/java/JavaParser.java
throw getSyntaxException("identifier expected, got " + current.token);

              
// in src/tools/org/h2/java/JavaParser.java
throw getFormatException(s, s.length() - 1);

              
// in src/tools/org/h2/java/JavaParser.java
throw getFormatException(s, i);

              
// in src/tools/org/h2/java/JavaParser.java
throw getFormatException(s, i);

              
// in src/tools/org/h2/java/JavaParser.java
throw getFormatException(s, i);

            
- -
- Variable 70
              
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
throw xa;

              
// in src/main/org/h2/message/DbException.java
throw e;

              
// in src/main/org/h2/message/DbException.java
throw (Error) e;

              
// in src/main/org/h2/tools/Csv.java
throw e;

              
// in src/main/org/h2/tools/CreateCluster.java
throw e;

              
// in src/main/org/h2/tools/Server.java
throw result;

              
// in src/main/org/h2/tools/Server.java
throw e;

              
// in src/main/org/h2/tools/Console.java
throw startException;

              
// in src/main/org/h2/schema/TriggerObject.java
throw e;

              
// in src/main/org/h2/store/PageStreamTrunk.java
throw e;

              
// in src/main/org/h2/store/PageLog.java
throw e;

              
// in src/main/org/h2/store/fs/FilePathNioMapped.java
throw e2;

              
// in src/main/org/h2/store/fs/FilePathNioMapped.java
throw e2;

              
// in src/main/org/h2/store/fs/FilePathNioMapped.java
throw e;

              
// in src/main/org/h2/store/fs/FilePathDisk.java
throw e;

              
// in src/main/org/h2/store/PageStore.java
throw e;

              
// in src/main/org/h2/store/PageStore.java
throw e;

              
// in src/main/org/h2/index/PageDataIndex.java
throw e;

              
// in src/main/org/h2/command/Parser.java
throw e;

              
// in src/main/org/h2/command/ddl/CreateTable.java
throw e;

              
// in src/main/org/h2/command/ddl/AlterView.java
throw e;

              
// in src/main/org/h2/command/dml/Merge.java
throw e;

              
// in src/main/org/h2/command/Command.java
throw e;

              
// in src/main/org/h2/command/Command.java
throw e;

              
// in src/main/org/h2/command/Command.java
throw e;

              
// in src/main/org/h2/command/Command.java
throw e;

              
// in src/main/org/h2/jdbc/JdbcConnection.java
throw e;

              
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
throw e;

              
// in src/main/org/h2/engine/Database.java
throw e;

              
// in src/main/org/h2/engine/Database.java
throw e;

              
// in src/main/org/h2/engine/DatabaseCloser.java
throw e;

              
// in src/main/org/h2/engine/Engine.java
throw e;

              
// in src/main/org/h2/engine/Engine.java
throw e;

              
// in src/main/org/h2/engine/Engine.java
throw e;

              
// in src/main/org/h2/engine/UndoLogRecord.java
throw e;

              
// in src/main/org/h2/engine/UndoLogRecord.java
throw e;

              
// in src/main/org/h2/engine/SessionRemote.java
throw e;

              
// in src/main/org/h2/engine/SessionRemote.java
throw e;

              
// in src/main/org/h2/engine/SessionRemote.java
throw e;

              
// in src/main/org/h2/engine/SessionRemote.java
throw e;

              
// in src/main/org/h2/engine/SessionRemote.java
throw closeError;

              
// in src/main/org/h2/engine/SessionRemote.java
throw e;

              
// in src/main/org/h2/engine/SessionRemote.java
throw e;

              
// in src/main/org/h2/engine/MetaRecord.java
throw e;

              
// in src/main/org/h2/engine/FunctionAlias.java
throw e;

              
// in src/main/org/h2/engine/FunctionAlias.java
throw e;

              
// in src/main/org/h2/util/NetUtils.java
throw e;

              
// in src/main/org/h2/util/NetUtils.java
throw e;

              
// in src/main/org/h2/util/NetUtils.java
throw e;

              
// in src/main/org/h2/util/Utils.java
throw e2;

              
// in src/main/org/h2/util/DateTimeUtils.java
throw e;

              
// in src/main/org/h2/util/DateTimeUtils.java
throw e;

              
// in src/main/org/h2/server/TcpServer.java
throw e;

              
// in src/main/org/h2/server/TcpServer.java
throw e;

              
// in src/main/org/h2/server/TcpServer.java
throw e;

              
// in src/main/org/h2/server/pg/PgServer.java
throw e;

              
// in src/main/org/h2/server/TcpServerThread.java
throw closeError;

              
// in src/main/org/h2/table/RegularTable.java
throw e2;

              
// in src/main/org/h2/table/RegularTable.java
throw de;

              
// in src/main/org/h2/table/RegularTable.java
throw e2;

              
// in src/main/org/h2/table/RegularTable.java
throw e;

              
// in src/main/org/h2/table/RegularTable.java
throw e2;

              
// in src/main/org/h2/table/TableLink.java
throw e;

              
// in src/main/org/h2/table/TableLink.java
throw e;

              
// in src/main/org/h2/table/TableLink.java
throw connectException;

              
// in src/main/org/h2/table/Column.java
throw e;

              
// in src/main/org/h2/table/TableView.java
throw e;

              
// in src/main/org/h2/table/TableView.java
throw v.createException;

              
// in src/tools/org/h2/build/BuildBase.java
throw e;

              
// in src/tools/org/h2/build/BuildBase.java
throw e;

            
- -
(Lib) RuntimeException 114
              
// in src/main/org/h2/util/Task.java
public Object get() { Exception e = getException(); if (e != null) { throw new RuntimeException(e); } return result; }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
private static RuntimeException convert(Exception e) { throw new RuntimeException("Exception: " + e, e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
private long getPosition(long nodeId) { Block b = getBlock(nodeId); if (b == null) { throw new RuntimeException("Block " + getBlockId(nodeId) + " not found"); } long pos = b.start; pos += (int) (nodeId & Integer.MAX_VALUE); return pos; }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
public void store() { if (!meta.isChanged() && mapsChanged.size() == 0) { // TODO truncate file if empty return; } commit(); // the length estimate is not correct, // as we don't know the exact positions and entry counts int lenEstimate = 1 + 8; for (StoredMap<?, ?> m : mapsChanged.values()) { meta.put("map." + m.getName(), String.valueOf(Long.MAX_VALUE) + "," + m.getKeyType().getName() + "," + m.getValueType().getName()); lenEstimate += length(m.getRoot()); } int blockId = ++lastBlockId; Block b = new Block(blockId); b.start = Long.MAX_VALUE; b.entryCount = Integer.MAX_VALUE; b.liveCount = Integer.MAX_VALUE; blocks.put(b.id, b); for (Block x : blocks.values()) { if (x.liveCount == 0) { meta.remove("block." + x.id); } else { meta.put("block." + x.id, "temp " + x.toString()); } } // modifying the meta can itself affect the metadata // TODO solve this in a better way for (Block x : new ArrayList<Block>(blocks.values())) { if (x.liveCount == 0) { meta.remove("block." + x.id); blocks.remove(x.id); } else { meta.put("block." + x.id, x.toString()); } } lenEstimate += length(meta.getRoot()); b.length = lenEstimate; long storePos = allocateBlock(lenEstimate); long nodeId = getId(blockId, 1 + 8); for (StoredMap<?, ?> m : mapsChanged.values()) { Node r = m.getRoot(); long p = r == null ? 0 : nodeId; meta.put("map." + m.getName(), String.valueOf(p) + "," + m.getKeyType().getName() + "," + m.getValueType().getName()); nodeId = updateId(r, nodeId); } int metaNodeOffset = (int) (nodeId - getId(blockId, 0)); // add a dummy entry so the count is correct meta.put("block." + b.id, b.toString()); int count = 0; for (StoredMap<?, ?> m : mapsChanged.values()) { count += count(m.getRoot()); } count += count(meta.getRoot()); b.start = storePos; b.entryCount = count; b.liveCount = b.entryCount; meta.put("block." + b.id, b.toString()); nodeId = updateId(meta.getRoot(), nodeId); int len = (int) (nodeId - getId(blockId, 0)); ByteBuffer buff = ByteBuffer.allocate(len); buff.put((byte) 'd'); buff.putInt(b.id); buff.putInt(metaNodeOffset); for (StoredMap<?, ?> m : mapsChanged.values()) { store(buff, m.getRoot()); } store(buff, meta.getRoot()); if (buff.hasRemaining()) { throw new RuntimeException("remaining: " + buff.remaining()); } buff.rewind(); try { file.position(storePos); file.write(buff); } catch (IOException e) { throw new RuntimeException(e); } rootBlockStart = storePos; writeHeader(); tempNodeId = 0; mapsChanged.clear(); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
private long readMetaRootId(long blockStart) { try { file.position(blockStart); ByteBuffer buff = ByteBuffer.wrap(new byte[16]); file.read(buff); buff.rewind(); if (buff.get() != 'd') { throw new RuntimeException("File corrupt"); } int blockId = buff.getInt(); int offset = buff.getInt(); return getId(blockId, offset); } catch (IOException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
Node readNode(StoredMap<?, ?> map, long id) { Node n = cache.get(id); if (n == null) { try { long pos = getPosition(id); file.position(pos); ByteBuffer buff = ByteBuffer.wrap(new byte[1024]); // TODO read fully; read only required bytes do { int len = file.read(buff); if (len < 0) { break; } } while (buff.remaining() > 0); buff.rewind(); n = Node.read(map, id, buff); } catch (Exception e) { throw new RuntimeException(e); } cache.put(id, n); } return n; }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
void removeNode(long id) { if (id > 0) { if (getBlock(id).liveCount == 0) { throw new RuntimeException("Negative live count: " + id); } getBlock(id).liveCount--; } }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
static Block fromString(String s) { Block b = new Block(0); Properties prop = new Properties(); try { prop.load(new ByteArrayInputStream(s.getBytes("UTF-8"))); b.id = Integer.parseInt(prop.get("id").toString()); b.start = Long.parseLong(prop.get("start").toString()); b.length = Long.parseLong(prop.get("length").toString()); b.entryCount = Integer.parseInt(prop.get("entryCount").toString()); b.liveCount = Integer.parseInt(prop.get("liveCount").toString()); return b; } catch (IOException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
static Class<?> getClass(String name) { if (name.equals("i")) { return Integer.class; } else if (name.equals("s")) { return String.class; } throw new RuntimeException("Unknown class name " + name); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
public int length(Object obj) { try { byte[] bytes = obj.toString().getBytes("UTF-8"); return getVarIntLen(bytes.length) + bytes.length; } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
public String read(ByteBuffer buff) { int len = readVarInt(buff); byte[] bytes = new byte[len]; buff.get(bytes); try { return new String(bytes, "UTF-8"); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
public void write(ByteBuffer buff, Object x) { try { byte[] bytes = x.toString().getBytes("UTF-8"); writeVarInt(buff, bytes.length); buff.put(bytes); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
static Class<?> getClass(String name) { if (name.equals("i")) { return Integer.class; } else if (name.equals("s")) { return String.class; } throw new RuntimeException("Unknown class name " + name); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
public int length(Object obj) { try { byte[] bytes = obj.toString().getBytes("UTF-8"); return getVarIntLen(bytes.length) + bytes.length; } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
public String read(ByteBuffer buff) { int len = readVarInt(buff); byte[] bytes = new byte[len]; buff.get(bytes); try { return new String(bytes, "UTF-8"); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
public void write(ByteBuffer buff, Object x) { try { byte[] bytes = x.toString().getBytes("UTF-8"); writeVarInt(buff, bytes.length); buff.put(bytes); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
private static RuntimeException convert(Exception e) { throw new RuntimeException("Exception: " + e, e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
private long getPosition(long pageId) { Block b = getBlock(pageId); if (b == null) { throw new RuntimeException("Block " + getBlockId(pageId) + " not found"); } long pos = b.start; pos += (int) (pageId & Integer.MAX_VALUE); return pos; }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
public void store() { if (!meta.isChanged() && mapsChanged.size() == 0) { // TODO truncate file if empty return; } commit(); // the length estimate is not correct, // as we don't know the exact positions and entry counts int lenEstimate = 1 + 8; for (BtreeMap<?, ?> m : mapsChanged.values()) { meta.put("map." + m.getName(), String.valueOf(Long.MAX_VALUE) + "," + m.getKeyType().getName() + "," + m.getValueType().getName()); Page p = m.getRoot(); if (p != null) { lenEstimate += p.lengthIncludingTempChildren(); } } int blockId = ++lastBlockId; Block b = new Block(blockId); b.start = Long.MAX_VALUE; b.entryCount = Integer.MAX_VALUE; b.liveCount = Integer.MAX_VALUE; blocks.put(b.id, b); for (Block x : blocks.values()) { if (x.liveCount == 0) { meta.remove("block." + x.id); } else { meta.put("block." + x.id, "temp-" + x.toString()); } } // modifying the meta can itself affect the metadata // TODO solve this in a better way ArrayList<Integer> removedBlocks = New.arrayList(); for (Block x : new ArrayList<Block>(blocks.values())) { if (x.liveCount == 0) { meta.remove("block." + x.id); removedBlocks.add(x.id); } else { meta.put("block." + x.id, x.toString()); } } lenEstimate += meta.getRoot().lengthIncludingTempChildren(); b.length = lenEstimate; blocks.remove(b.id); long storePos = allocateBlock(lenEstimate); blocks.put(b.id, b); for (int id : removedBlocks) { blocks.remove(id); } long pageId = getId(blockId, 1 + 8); for (BtreeMap<?, ?> m : mapsChanged.values()) { Page r = m.getRoot(); long p = r == null ? 0 : pageId; meta.put("map." + m.getName(), String.valueOf(p) + "," + m.getKeyType().getName() + "," + m.getValueType().getName()); if (r != null) { pageId = r.updatePageIds(pageId); } } int metaRootOffset = (int) (pageId - getId(blockId, 0)); // add a dummy entry so the count is correct meta.put("block." + b.id, b.toString()); int count = 0; for (BtreeMap<?, ?> m : mapsChanged.values()) { Page p = m.getRoot(); if (p != null) { count += p.countTemp(); } } count += meta.getRoot().countTemp(); b.start = storePos; b.entryCount = count; b.liveCount = b.entryCount; meta.put("block." + b.id, b.toString()); pageId = meta.getRoot().updatePageIds(pageId); int len = (int) (pageId - getId(blockId, 0)); ByteBuffer buff = ByteBuffer.allocate(len); buff.put((byte) 'd'); buff.putInt(b.id); buff.putInt(metaRootOffset); for (BtreeMap<?, ?> m : mapsChanged.values()) { Page p = m.getRoot(); if (p != null) { p.storeTemp(buff); } } meta.getRoot().storeTemp(buff); if (buff.hasRemaining()) { throw new RuntimeException("remaining: " + buff.remaining()); } buff.rewind(); try { file.position(storePos); file.write(buff); } catch (IOException e) { throw new RuntimeException(e); } rootBlockStart = storePos; writeHeader(); mapsChanged.clear(); temp.clear(); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
private long readMetaRootId(long blockStart) { try { file.position(blockStart); ByteBuffer buff = ByteBuffer.wrap(new byte[16]); file.read(buff); buff.rewind(); if (buff.get() != 'd') { throw new RuntimeException("File corrupt"); } int blockId = buff.getInt(); int offset = buff.getInt(); return getId(blockId, offset); } catch (IOException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
Page readPage(BtreeMap<?, ?> map, long id) { if (id < 0) { return temp.get((int) (-id - 1)); } Page p = cache.get(id); if (p == null) { try { long pos = getPosition(id); file.position(pos); ByteBuffer buff = ByteBuffer.wrap(new byte[8 * 1024]); // TODO read fully; read only required bytes do { int len = file.read(buff); if (len < 0) { break; } } while (buff.remaining() > 0); buff.rewind(); p = Page.read(map, id, buff); } catch (Exception e) { throw new RuntimeException(e); } cache.put(id, p); } return p; }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
void removePage(long id) { if (id > 0) { if (getBlock(id).liveCount == 0) { throw new RuntimeException("Negative live count: " + id); } getBlock(id).liveCount--; } }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
static Block fromString(String s) { Block b = new Block(0); Properties prop = new Properties(); try { prop.load(new ByteArrayInputStream(s.getBytes("UTF-8"))); b.id = Integer.parseInt(prop.get("id").toString()); b.start = Long.parseLong(prop.get("start").toString()); b.length = Long.parseLong(prop.get("length").toString()); b.entryCount = Integer.parseInt(prop.get("entryCount").toString()); b.liveCount = Integer.parseInt(prop.get("liveCount").toString()); return b; } catch (IOException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/util/Base64.java
private static void check(String a, String b) { if (!a.equals(b)) { throw new RuntimeException("mismatch: " + a + " <> " + b); } }
// in src/tools/org/h2/dev/util/Base64.java
private static void test(byte[] in, byte[] out) { if (in.length != out.length) { throw new RuntimeException("Length error"); } for (int i = 0; i < in.length; i++) { if (in[i] != out[i]) { throw new RuntimeException("Error at " + i); } } }
// in src/tools/org/h2/dev/util/Migrate.java
private void download(String target, String fileURL, String sha1Checksum) { File targetFile = new File(target); if (targetFile.exists()) { return; } mkdirs(targetFile.getAbsoluteFile().getParentFile()); ByteArrayOutputStream buff = new ByteArrayOutputStream(); try { println("Downloading " + fileURL); URL url = new URL(fileURL); InputStream in = new BufferedInputStream(url.openStream()); long last = System.currentTimeMillis(); int len = 0; while (true) { long now = System.currentTimeMillis(); if (now > last + 1000) { println("Downloaded " + len + " bytes"); last = now; } int x = in.read(); len++; if (x < 0) { break; } buff.write(x); } in.close(); } catch (IOException e) { throw new RuntimeException("Error downloading", e); } byte[] data = buff.toByteArray(); String got = getSHA1(data); if (sha1Checksum == null) { println("SHA1 checksum: " + got); } else { if (!got.equals(sha1Checksum)) { throw new RuntimeException("SHA1 checksum mismatch; got: " + got); } } writeFile(targetFile, data); }
// in src/tools/org/h2/dev/util/Migrate.java
private static void mkdirs(File f) { if (!f.exists()) { if (!f.mkdirs()) { throw new RuntimeException("Can not create directory " + f.getAbsolutePath()); } } }
// in src/tools/org/h2/dev/util/Migrate.java
private static String getSHA1(byte[] data) { MessageDigest md; try { md = MessageDigest.getInstance("SHA-1"); return convertBytesToString(md.digest(data)); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/util/Migrate.java
private static void writeFile(File file, byte[] data) { try { RandomAccessFile ra = new RandomAccessFile(file, "rw"); ra.write(data); ra.setLength(data.length); ra.close(); } catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); } }
// in src/tools/org/h2/dev/util/Migrate.java
private int exec(String[] command) { try { for (String c : command) { print(c + " "); } println(""); Process p = Runtime.getRuntime().exec(command); copyInThread(p.getInputStream(), quiet ? null : sysOut); copyInThread(p.getErrorStream(), quiet ? null : sysOut); p.waitFor(); return p.exitValue(); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/util/Migrate.java
public void run() { try { while (true) { int x = in.read(); if (x < 0) { return; } if (out != null) { out.write(x); } } } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/doc/MergeDocs.java
private static String removeHeaderFooter(String fileName, String text) { // String start = "<body"; // String end = "</body>"; String start = "<!-- } -->"; String end = "<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html>"; int idx = text.indexOf(end); if (idx < 0) { throw new RuntimeException("Footer not found in file " + fileName); } text = text.substring(0, idx); idx = text.indexOf(start) + start.length(); text = text.substring(idx + 1); return text; }
// in src/tools/org/h2/build/doc/XMLParser.java
private void error(String expected) { throw new RuntimeException("Expected: " + expected + " got: " + xml.substring(pos, Math.min(pos + 1000, xml.length()))); }
// in src/tools/org/h2/build/doc/RailroadImages.java
private void savePng(BufferedImage img, String fileName) { int w = img.getWidth(); int h = img.getHeight(); BufferedImage smaller = new BufferedImage(w / DIV, h / DIV, img.getType()); Graphics2D g = smaller.createGraphics(); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g.drawImage(img, 0, 0, w / DIV, h / DIV, 0, 0, w, h, null); g.dispose(); try { ImageIO.write(smaller, "png", new File(outDir + "/" + fileName)); } catch (IOException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/BuildBase.java
private FileList filter(boolean keep, String pattern) { boolean start = false; if (pattern.endsWith("*")) { pattern = pattern.substring(0, pattern.length() - 1); start = true; } else if (pattern.startsWith("*")) { pattern = pattern.substring(1); } if (pattern.indexOf('*') >= 0) { throw new RuntimeException("Unsupported pattern, may only start or end with *:" + pattern); } // normalize / and \ pattern = replaceAll(pattern, "/", File.separator); FileList list = new FileList(); for (File f : this) { String path = f.getPath(); boolean match = start ? path.startsWith(pattern) : path.endsWith(pattern); if (match == keep) { list.add(f); } } return list; }
// in src/tools/org/h2/build/BuildBase.java
private void runShell() { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String last = "", line; System.out.println("Shell mode. Type the target, then [Enter]. Just [Enter] repeats the last target."); while (true) { System.out.print("build> "); try { line = reader.readLine(); } catch (IOException e) { throw new RuntimeException(e); } if (line == null || line.equals("exit") || line.equals("quit")) { break; } else if (line.length() == 0) { line = last; } long time = System.currentTimeMillis(); try { runTarget(line); } catch (Exception e) { System.out.println(e); } println("Done in " + (System.currentTimeMillis() - time) + " ms"); last = line; } }
// in src/tools/org/h2/build/BuildBase.java
private static Object invoke(Method m, Object instance, Object[] args) { try { try { return m.invoke(instance, args); } catch (InvocationTargetException e) { throw e.getCause(); } } catch (Error e) { throw e; } catch (RuntimeException e) { throw e; } catch (Throwable e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/BuildBase.java
protected int exec(String command, StringList args) { try { print(command); StringList cmd = new StringList(); cmd = cmd.plus(command); if (args != null) { for (String a : args) { print(" " + a); } cmd.addAll(args); } println(""); ProcessBuilder pb = new ProcessBuilder(); pb.command(cmd.array()); pb.redirectErrorStream(true); Process p = pb.start(); copyInThread(p.getInputStream(), quiet ? null : sysOut); p.waitFor(); return p.exitValue(); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/BuildBase.java
public void run() { try { while (true) { int x = in.read(); if (x < 0) { return; } if (out != null) { out.write(x); } } } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/BuildBase.java
protected static String getStaticField(String className, String fieldName) { try { Class<?> clazz = Class.forName(className); Field field = clazz.getField(fieldName); return field.get(null).toString(); } catch (Exception e) { throw new RuntimeException("Can not read field " + className + "." + fieldName, e); } }
// in src/tools/org/h2/build/BuildBase.java
protected static String getStaticValue(String className, String methodName) { try { Class<?> clazz = Class.forName(className); Method method = clazz.getMethod(methodName); return method.invoke(null).toString(); } catch (Exception e) { throw new RuntimeException("Can not read value " + className + "." + methodName + "()", e); } }
// in src/tools/org/h2/build/BuildBase.java
protected void javadoc(String...args) { int result; PrintStream old = System.out; try { println("Javadoc"); if (quiet) { System.setOut(filter(System.out, new String[] { "Loading source files for package", "Constructing Javadoc information...", "Generating ", "Standard Doclet", "Building tree for all the packages and classes...", "Building index for all the packages and classes...", "Building index for all classes..." })); } else { System.setOut(filter(System.out, new String[] { "Loading source files for package ", "Generating ", })); } Class<?> clazz = Class.forName("com.sun.tools.javadoc.Main"); Method execute = clazz.getMethod("execute", String[].class); result = (Integer) invoke(execute, null, new Object[] { args }); } catch (Exception e) { result = exec("javadoc", args(args)); } finally { System.setOut(old); } if (result != 0) { throw new RuntimeException("An error occurred, result=" + result); } }
// in src/tools/org/h2/build/BuildBase.java
protected static String getSHA1(byte[] data) { MessageDigest md; try { md = MessageDigest.getInstance("SHA-1"); return convertBytesToString(md.digest(data)); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/BuildBase.java
protected void downloadUsingMaven(String target, String group, String artifact, String version, String sha1Checksum) { String repoDir = "http://repo1.maven.org/maven2"; File targetFile = new File(target); if (targetFile.exists()) { return; } String repoFile = group + "/" + artifact + "/" + version + "/" + artifact + "-" + version + ".jar"; mkdirs(targetFile.getAbsoluteFile().getParentFile()); String localMavenDir = getLocalMavenDir(); if (new File(localMavenDir).exists()) { File f = new File(localMavenDir, repoFile); if (!f.exists()) { try { execScript("mvn", args( "org.apache.maven.plugins:maven-dependency-plugin:2.1:get", "-D" + "repoUrl=" + repoDir, "-D" + "artifact="+ group +":"+ artifact +":" + version)); } catch (RuntimeException e) { println("Could not download using Maven: " + e.toString()); } } if (f.exists()) { byte[] data = readFile(f); String got = getSHA1(data); if (sha1Checksum == null) { println("SHA1 checksum: " + got); } else { if (!got.equals(sha1Checksum)) { throw new RuntimeException("SHA1 checksum mismatch; got: " + got + " expected: " + sha1Checksum + " for file " + f.getAbsolutePath()); } } writeFile(targetFile, data); return; } } String fileURL = repoDir + "/" + repoFile; download(target, fileURL, sha1Checksum); }
// in src/tools/org/h2/build/BuildBase.java
protected void download(String target, String fileURL, String sha1Checksum) { File targetFile = new File(target); if (targetFile.exists()) { return; } mkdirs(targetFile.getAbsoluteFile().getParentFile()); ByteArrayOutputStream buff = new ByteArrayOutputStream(); try { println("Downloading " + fileURL); URL url = new URL(fileURL); InputStream in = new BufferedInputStream(url.openStream()); long last = System.currentTimeMillis(); int len = 0; while (true) { long now = System.currentTimeMillis(); if (now > last + 1000) { println("Downloaded " + len + " bytes"); last = now; } int x = in.read(); len++; if (x < 0) { break; } buff.write(x); } in.close(); } catch (IOException e) { throw new RuntimeException("Error downloading " + fileURL + " to " + target, e); } byte[] data = buff.toByteArray(); String got = getSHA1(data); if (sha1Checksum == null) { println("SHA1 checksum: " + got); } else { if (!got.equals(sha1Checksum)) { throw new RuntimeException("SHA1 checksum mismatch; got: " + got + " expected: " + sha1Checksum + " for file " + target); } } writeFile(targetFile, data); }
// in src/tools/org/h2/build/BuildBase.java
public static void writeFile(File file, byte[] data) { try { RandomAccessFile ra = new RandomAccessFile(file, "rw"); ra.write(data); ra.setLength(data.length); ra.close(); } catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); } }
// in src/tools/org/h2/build/BuildBase.java
public static byte[] readFile(File file) { try { RandomAccessFile ra = new RandomAccessFile(file, "r"); long len = ra.length(); if (len >= Integer.MAX_VALUE) { throw new RuntimeException("File " + file.getPath() + " is too large"); } byte[] buffer = new byte[(int) len]; ra.readFully(buffer); ra.close(); return buffer; } catch (IOException e) { throw new RuntimeException("Error reading from file " + file, e); } }
// in src/tools/org/h2/build/BuildBase.java
protected void javac(StringList args, FileList files) { println("Compiling " + files.size() + " classes"); StringList params = new StringList(); params.addAll(args); params.addAll(getPaths(files.keep(".java"))); String[] array = params.array(); int result; PrintStream old = System.err; try { Class<?> clazz = Class.forName("com.sun.tools.javac.Main"); if (quiet) { System.setErr(filter(System.err, new String[] { "Note:" })); } Method compile = clazz.getMethod("compile", new Class<?>[] { String[].class }); Object instance = clazz.newInstance(); result = (Integer) invoke(compile, instance, new Object[] { array }); } catch (Exception e) { e.printStackTrace(); result = exec("javac", new StringList(array)); } finally { System.setErr(old); } if (result != 0) { throw new RuntimeException("An error occurred"); } }
// in src/tools/org/h2/build/BuildBase.java
protected void java(String className, StringList args) { println("Running " + className); String[] array = args == null ? new String[0] : args.array(); try { Method main = Class.forName(className).getMethod("main", String[].class); invoke(main, null, new Object[] { array }); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/BuildBase.java
protected static void mkdir(String dir) { File f = new File(dir); if (f.exists()) { if (f.isFile()) { throw new RuntimeException("Can not create directory " + dir + " because a file with this name exists"); } } else { mkdirs(f); } }
// in src/tools/org/h2/build/BuildBase.java
private static void mkdirs(File f) { if (!f.exists()) { if (!f.mkdirs()) { throw new RuntimeException("Can not create directory " + f.getAbsolutePath()); } } }
// in src/tools/org/h2/build/BuildBase.java
private void delete(File file) { if (file.exists()) { if (file.isDirectory()) { String path = file.getPath(); for (String fileName : file.list()) { delete(new File(path, fileName)); } } if (!file.delete()) { throw new RuntimeException("Can not delete " + file.getPath()); } } }
// in src/tools/org/h2/build/Build.java
private static void switchSource(boolean enableCheck) { try { String version = System.getProperty("version"); String check = enableCheck ? "+CHECK" : "-CHECK"; if (version == null) { SwitchSource.main("-dir", "src", "-auto", check); } else { SwitchSource.main("-dir", "src", "-version", version, check); } SwitchSource.main("-dir", "src", "-LUCENE2", "-LUCENE3", "+LUCENE" + getLuceneVersion()); } catch (IOException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/Build.java
public void jarClient() { compile(true, true, false); FileList files = files("temp"). exclude("temp/org/h2/build/*"). exclude("temp/org/h2/dev/*"). exclude("temp/org/h2/jaqu/*"). exclude("temp/org/h2/java/*"). exclude("temp/org/h2/jcr/*"). exclude("temp/org/h2/mode/*"). exclude("temp/org/h2/samples/*"). exclude("temp/org/h2/test/*"). exclude("*.bat"). exclude("*.sh"). exclude("*.txt"); long kb = jar("bin/h2client" + getJarSuffix(), files, "temp"); if (kb < 300 || kb > 400) { throw new RuntimeException("Expected file size 300 - 400 KB, got: " + kb); } }
// in src/tools/org/h2/build/Build.java
public void uploadBuild() { String password = System.getProperty("h2.ftpPassword"); if (password == null) { throw new RuntimeException("h2.ftpPassword not set"); } downloadTest(); FileList files = files("src/tools").keep("*/UploadBuild.java"); StringList args = args("-d", "temp", "-sourcepath", "src/tools" + File.pathSeparator + "src/test" + File.pathSeparator + "src/main"); mkdir("temp"); javac(args, files); String cp = "bin" + File.pathSeparator + "temp" + File.pathSeparator + "ext/h2mig_pagestore_addon.jar"; exec("java", args("-Xmx128m", "-cp", cp, "-Dh2.ftpPassword=" + password, "org.h2.build.doc.UploadBuild")); }
// in src/tools/org/h2/build/code/CheckTextFiles.java
private void check(File file) throws Exception { String name = file.getName(); if (file.isDirectory()) { if (name.equals("CVS") || name.equals(".svn")) { return; } for (File f : file.listFiles()) { check(f); } } else { String suffix = ""; int lastDot = name.lastIndexOf('.'); if (lastDot >= 0) { suffix = name.substring(lastDot + 1); } boolean check = false, ignore = false; for (String s : SUFFIX_CHECK) { if (suffix.equals(s)) { check = true; } } // if (name.endsWith(".html") && name.indexOf("_ja") > 0) { // int todoRemoveJapaneseFiles; // // Japanese html files are UTF-8 at this time // check = false; // ignore = true; // } if (name.endsWith(".utf8.txt") || (name.startsWith("_docs_") && name.endsWith(".properties"))) { check = false; ignore = true; } for (String s : SUFFIX_IGNORE) { if (suffix.equals(s)) { ignore = true; } } boolean checkLicense = true; for (String ig : suffixIgnoreLicense) { if (suffix.equals(ig) || name.endsWith(ig)) { checkLicense = false; break; } } if (ignore == check) { throw new RuntimeException("Unknown suffix: " + suffix + " for file: " + file.getAbsolutePath()); } useCRLF = false; for (String s : SUFFIX_CRLF) { if (suffix.equals(s)) { useCRLF = true; break; } } if (check) { checkOrFixFile(file, autoFix, checkLicense); } } }
// in src/tools/org/h2/build/code/CheckTextFiles.java
private void fail(File file, String error, int line) { if (line <= 0) { line = 1; } String name = file.getAbsolutePath(); int idx = name.lastIndexOf(File.separatorChar); if (idx >= 0) { name = name.replace(File.separatorChar, '.'); name = name + "(" + name.substring(idx + 1) + ":" + line + ")"; idx = name.indexOf("org."); if (idx > 0) { name = name.substring(idx); } } System.out.println("FAIL at " + name + " " + error + " " + file.getAbsolutePath()); hasError = true; if (failOnError) { throw new RuntimeException("FAIL"); } }
// in src/tools/org/h2/jaqu/Query.java
public long selectCount() { SQLStatement stat = getSelectStatement(false); stat.appendSQL("COUNT(*) "); appendFromWhere(stat); ResultSet rs = stat.executeQuery(); Statement s = null; try { s = rs.getStatement(); rs.next(); long value = rs.getLong(1); return value; } catch (SQLException e) { throw new RuntimeException(e); } finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(s); } }
// in src/tools/org/h2/jaqu/Query.java
private List<T> select(boolean distinct) { List<T> result = New.arrayList(); TableDefinition<T> def = from.getAliasDefinition(); SQLStatement stat = getSelectStatement(distinct); def.appendSelectList(stat); appendFromWhere(stat); ResultSet rs = stat.executeQuery(); Statement s = null; try { s = rs.getStatement(); while (rs.next()) { T item = from.newObject(); from.getAliasDefinition().readRow(item, rs); result.add(item); } } catch (SQLException e) { throw new RuntimeException(e); } finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(s); } return result; }
// in src/tools/org/h2/jaqu/Query.java
public int update() { if (updateColumnDeclarations.size() == 0) { throw new RuntimeException("Missing set or increment call."); } SQLStatement stat = new SQLStatement(db); stat.appendSQL("UPDATE "); from.appendSQL(stat); stat.appendSQL(" SET "); int i = 0; for (UpdateColumn declaration : updateColumnDeclarations) { if (i++ > 0) { stat.appendSQL(", "); } declaration.appendSQL(stat); } appendWhere(stat); StatementLogger.update(stat.getSQL()); return stat.executeUpdate(); }
// in src/tools/org/h2/jaqu/Query.java
private <X> List<X> select(Class<X> clazz, X x, boolean distinct) { List<X> result = New.arrayList(); TableDefinition<X> def = db.define(clazz); SQLStatement stat = getSelectStatement(distinct); def.appendSelectList(stat, this, x); appendFromWhere(stat); ResultSet rs = stat.executeQuery(); Statement s = null; try { s = rs.getStatement(); while (rs.next()) { X row = ClassUtils.newObject(clazz); def.readRow(row, rs); result.add(row); } } catch (SQLException e) { throw new RuntimeException(e); } finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(s); } return result; }
// in src/tools/org/h2/jaqu/Query.java
public <A> QueryWhere<T> where(Filter filter) { HashMap<String, Object> fieldMap = New.hashMap(); for (Field f : filter.getClass().getDeclaredFields()) { f.setAccessible(true); try { Object obj = f.get(filter); if (obj == from.getAlias()) { List<TableDefinition.FieldDefinition> fields = from.getAliasDefinition().getFields(); String name = f.getName(); for (TableDefinition.FieldDefinition field : fields) { String n = name + "." + field.field.getName(); Object o = field.field.get(obj); fieldMap.put(n, o); } } fieldMap.put(f.getName(), f.get(filter)); } catch (Exception e) { throw new RuntimeException(e); } } Token filterCode = new ClassReader().decompile(filter, fieldMap, "where"); // String filterQuery = filterCode.toString(); conditions.add(filterCode); return new QueryWhere<T>(this); }
// in src/tools/org/h2/jaqu/DbUpgrader.java
public boolean upgradeTable(Db db, String schema, String table, int fromVersion, int toVersion) { throw new RuntimeException("Please provide your own DbUpgrader implementation."); }
// in src/tools/org/h2/jaqu/bytecode/ClassReader.java
public Token decompile(Object instance, Map<String, Object> fields, String method) { this.fieldMap = fields; this.convertMethodName = method; Class<?> clazz = instance.getClass(); String className = clazz.getName(); debug("class name " + className); ByteArrayOutputStream buff = new ByteArrayOutputStream(); try { InputStream in = clazz.getClassLoader().getResource(className.replace('.', '/') + ".class").openStream(); while (true) { int x = in.read(); if (x < 0) { break; } buff.write(x); } } catch (IOException e) { throw new RuntimeException("Could not read class bytecode", e); } data = buff.toByteArray(); int header = readInt(); debug("header: " + Integer.toHexString(header)); int minorVersion = readShort(); int majorVersion = readShort(); debug("version: " + majorVersion + "." + minorVersion); int constantPoolCount = readShort(); constantPool = new Constant[constantPoolCount]; for (int i = 1; i < constantPoolCount; i++) { int type = readByte(); switch(type) { case 1: constantPool[i] = ConstantString.get(readString()); break; case 3: { int x = readInt(); constantPool[i] = ConstantNumber.get(x); break; } case 4: { int x = readInt(); constantPool[i] = ConstantNumber.get("" + Float.intBitsToFloat(x), x, Constant.Type.FLOAT); break; } case 5: { long x = readLong(); constantPool[i] = ConstantNumber.get(x); i++; break; } case 6: { long x = readLong(); constantPool[i] = ConstantNumber.get("" + Double.longBitsToDouble(x), x, Constant.Type.DOUBLE); i++; break; } case 7: { int x = readShort(); constantPool[i] = ConstantNumber.get(null, x, ConstantNumber.Type.CLASS_REF); break; } case 8: { int x = readShort(); constantPool[i] = ConstantNumber.get(null, x, ConstantNumber.Type.STRING_REF); break; } case 9: { int x = readInt(); constantPool[i] = ConstantNumber.get(null, x, ConstantNumber.Type.FIELD_REF); break; } case 10: { int x = readInt(); constantPool[i] = ConstantNumber.get(null, x, ConstantNumber.Type.METHOD_REF); break; } case 11: { int x = readInt(); constantPool[i] = ConstantNumber.get(null, x, ConstantNumber.Type.INTERFACE_METHOD_REF); break; } case 12: { int x = readInt(); constantPool[i] = ConstantNumber.get(null, x, ConstantNumber.Type.NAME_AND_TYPE); break; } default: throw new RuntimeException("Unsupported constant pool tag: " + type); } } int accessFlags = readShort(); debug("access flags: " + accessFlags); int classRef = readShort(); debug("class: " + constantPool[constantPool[classRef].intValue()]); int superClassRef = readShort(); debug(" extends " + constantPool[constantPool[superClassRef].intValue()]); int interfaceCount = readShort(); for (int i = 0; i < interfaceCount; i++) { int interfaceRef = readShort(); debug(" implements " + constantPool[constantPool[interfaceRef].intValue()]); } int fieldCount = readShort(); for (int i = 0; i < fieldCount; i++) { readField(); } int methodCount = readShort(); for (int i = 0; i < methodCount; i++) { readMethod(); } readAttributes(); return result; }
// in src/tools/org/h2/jaqu/bytecode/ClassReader.java
private void readByteCode() { int startPos = pos - startByteCode; int opCode = readByte(); String op; endOfMethod = false; condition = false; nextPc = 0; switch(opCode) { case 0: op = "nop"; break; case 1: op = "aconst_null"; stack.push(Null.INSTANCE); break; case 2: op = "iconst_m1"; stack.push(ConstantNumber.get("-1")); break; case 3: op = "iconst_0"; stack.push(ConstantNumber.get("0")); break; case 4: op = "iconst_1"; stack.push(ConstantNumber.get("1")); break; case 5: op = "iconst_2"; stack.push(ConstantNumber.get("2")); break; case 6: op = "iconst_3"; stack.push(ConstantNumber.get("3")); break; case 7: op = "iconst_4"; stack.push(ConstantNumber.get("4")); break; case 8: op = "iconst_5"; stack.push(ConstantNumber.get("5")); break; case 9: op = "lconst_0"; stack.push(ConstantNumber.get("0")); break; case 10: op = "lconst_1"; stack.push(ConstantNumber.get("1")); break; case 11: op = "fconst_0"; stack.push(ConstantNumber.get("0.0")); break; case 12: op = "fconst_1"; stack.push(ConstantNumber.get("1.0")); break; case 13: op = "fconst_2"; stack.push(ConstantNumber.get("2.0")); break; case 14: op = "dconst_0"; stack.push(ConstantNumber.get("0.0")); break; case 15: op = "dconst_1"; stack.push(ConstantNumber.get("1.0")); break; case 16: { int x = (byte) readByte(); op = "bipush " + x; stack.push(ConstantNumber.get(x)); break; } case 17: { int x = (short) readShort(); op = "sipush " + x; stack.push(ConstantNumber.get(x)); break; } case 18: { Token s = getConstant(readByte()); op = "ldc " + s; stack.push(s); break; } case 19: { Token s = getConstant(readShort()); op = "ldc_w " + s; stack.push(s); break; } case 20: { Token s = getConstant(readShort()); op = "ldc2_w " + s; stack.push(s); break; } case 21: { int x = readByte(); op = "iload " + x; stack.push(getVariable(x)); break; } case 22: { int x = readByte(); op = "lload " + x; stack.push(getVariable(x)); break; } case 23: { int x = readByte(); op = "fload " + x; stack.push(getVariable(x)); break; } case 24: { int x = readByte(); op = "dload " + x; stack.push(getVariable(x)); break; } case 25: { int x = readByte(); op = "aload " + x; stack.push(getVariable(x)); break; } case 26: op = "iload_0"; stack.push(getVariable(0)); break; case 27: op = "iload_1"; stack.push(getVariable(1)); break; case 28: op = "iload_2"; stack.push(getVariable(2)); break; case 29: op = "iload_3"; stack.push(getVariable(3)); break; case 30: op = "lload_0"; stack.push(getVariable(0)); break; case 31: op = "lload_1"; stack.push(getVariable(1)); break; case 32: op = "lload_2"; stack.push(getVariable(2)); break; case 33: op = "lload_3"; stack.push(getVariable(3)); break; case 34: op = "fload_0"; stack.push(getVariable(0)); break; case 35: op = "fload_1"; stack.push(getVariable(1)); break; case 36: op = "fload_2"; stack.push(getVariable(2)); break; case 37: op = "fload_3"; stack.push(getVariable(3)); break; case 38: op = "dload_0"; stack.push(getVariable(0)); break; case 39: op = "dload_1"; stack.push(getVariable(1)); break; case 40: op = "dload_2"; stack.push(getVariable(2)); break; case 41: op = "dload_3"; stack.push(getVariable(3)); break; case 42: op = "aload_0"; stack.push(getVariable(0)); break; case 43: op = "aload_1"; stack.push(getVariable(1)); break; case 44: op = "aload_2"; stack.push(getVariable(2)); break; case 45: op = "aload_3"; stack.push(getVariable(3)); break; case 46: { Token index = stack.pop(); Token ref = stack.pop(); op = "iaload"; stack.push(ArrayGet.get(ref, index)); break; } case 47: { Token index = stack.pop(); Token ref = stack.pop(); op = "laload"; stack.push(ArrayGet.get(ref, index)); break; } case 48: { Token index = stack.pop(); Token ref = stack.pop(); op = "faload"; stack.push(ArrayGet.get(ref, index)); break; } case 49: { Token index = stack.pop(); Token ref = stack.pop(); op = "daload"; stack.push(ArrayGet.get(ref, index)); break; } case 50: { Token index = stack.pop(); Token ref = stack.pop(); op = "aaload"; stack.push(ArrayGet.get(ref, index)); break; } case 51: { Token index = stack.pop(); Token ref = stack.pop(); op = "baload"; stack.push(ArrayGet.get(ref, index)); break; } case 52: { Token index = stack.pop(); Token ref = stack.pop(); op = "caload"; stack.push(ArrayGet.get(ref, index)); break; } case 53: { Token index = stack.pop(); Token ref = stack.pop(); op = "saload"; stack.push(ArrayGet.get(ref, index)); break; } case 54: { int var = readByte(); op = "istore " + var; setVariable(var, stack.pop()); break; } case 55: { int var = readByte(); op = "lstore " + var; setVariable(var, stack.pop()); break; } case 56: { int var = readByte(); op = "fstore " + var; setVariable(var, stack.pop()); break; } case 57: { int var = readByte(); op = "dstore " + var; setVariable(var, stack.pop()); break; } case 58: { int var = readByte(); op = "astore " + var; setVariable(var, stack.pop()); break; } case 59: op = "istore_0"; setVariable(0, stack.pop()); break; case 60: op = "istore_1"; setVariable(1, stack.pop()); break; case 61: op = "istore_2"; setVariable(2, stack.pop()); break; case 62: op = "istore_3"; setVariable(3, stack.pop()); break; case 63: op = "lstore_0"; setVariable(0, stack.pop()); break; case 64: op = "lstore_1"; setVariable(1, stack.pop()); break; case 65: op = "lstore_2"; setVariable(2, stack.pop()); break; case 66: op = "lstore_3"; setVariable(3, stack.pop()); break; case 67: op = "fstore_0"; setVariable(0, stack.pop()); break; case 68: op = "fstore_1"; setVariable(1, stack.pop()); break; case 69: op = "fstore_2"; setVariable(2, stack.pop()); break; case 70: op = "fstore_3"; setVariable(3, stack.pop()); break; case 71: op = "dstore_0"; setVariable(0, stack.pop()); break; case 72: op = "dstore_1"; setVariable(1, stack.pop()); break; case 73: op = "dstore_2"; setVariable(2, stack.pop()); break; case 74: op = "dstore_3"; setVariable(3, stack.pop()); break; case 75: op = "astore_0"; setVariable(0, stack.pop()); break; case 76: op = "astore_1"; setVariable(1, stack.pop()); break; case 77: op = "astore_2"; setVariable(2, stack.pop()); break; case 78: op = "astore_3"; setVariable(3, stack.pop()); break; case 79: { // String value = stack.pop(); // String index = stack.pop(); // String ref = stack.pop(); op = "iastore"; // TODO side effect - not supported break; } case 80: op = "lastore"; // TODO side effect - not supported break; case 81: op = "fastore"; // TODO side effect - not supported break; case 82: op = "dastore"; // TODO side effect - not supported break; case 83: op = "aastore"; // TODO side effect - not supported break; case 84: op = "bastore"; // TODO side effect - not supported break; case 85: op = "castore"; // TODO side effect - not supported break; case 86: op = "sastore"; // TODO side effect - not supported break; case 87: op = "pop"; stack.pop(); break; case 88: op = "pop2"; // TODO currently we don't know the stack types stack.pop(); stack.pop(); break; case 89: { op = "dup"; Token x = stack.pop(); stack.push(x); stack.push(x); break; } case 90: { op = "dup_x1"; Token a = stack.pop(); Token b = stack.pop(); stack.push(a); stack.push(b); stack.push(a); break; } case 91: { // TODO currently we don't know the stack types op = "dup_x2"; Token a = stack.pop(); Token b = stack.pop(); Token c = stack.pop(); stack.push(a); stack.push(c); stack.push(b); stack.push(a); break; } case 92: { // TODO currently we don't know the stack types op = "dup2"; Token a = stack.pop(); Token b = stack.pop(); stack.push(b); stack.push(a); stack.push(b); stack.push(a); break; } case 93: { // TODO currently we don't know the stack types op = "dup2_x1"; Token a = stack.pop(); Token b = stack.pop(); Token c = stack.pop(); stack.push(b); stack.push(a); stack.push(c); stack.push(b); stack.push(a); break; } case 94: { // TODO currently we don't know the stack types op = "dup2_x2"; Token a = stack.pop(); Token b = stack.pop(); Token c = stack.pop(); Token d = stack.pop(); stack.push(b); stack.push(a); stack.push(d); stack.push(c); stack.push(b); stack.push(a); break; } case 95: { op = "swap"; Token a = stack.pop(); Token b = stack.pop(); stack.push(a); stack.push(b); break; } case 96: { Token b = stack.pop(); Token a = stack.pop(); op = "iadd"; stack.push(Operation.get(a, Operation.Type.ADD, b)); break; } case 97: { Token b = stack.pop(); Token a = stack.pop(); op = "ladd"; stack.push(Operation.get(a, Operation.Type.ADD, b)); break; } case 98: { Token b = stack.pop(); Token a = stack.pop(); op = "fadd"; stack.push(Operation.get(a, Operation.Type.ADD, b)); break; } case 99: { Token b = stack.pop(); Token a = stack.pop(); op = "dadd"; stack.push(Operation.get(a, Operation.Type.ADD, b)); break; } case 100: { Token b = stack.pop(); Token a = stack.pop(); op = "isub"; stack.push(Operation.get(a, Operation.Type.SUBTRACT, b)); break; } case 101: { Token b = stack.pop(); Token a = stack.pop(); op = "lsub"; stack.push(Operation.get(a, Operation.Type.SUBTRACT, b)); break; } case 102: { Token b = stack.pop(); Token a = stack.pop(); op = "fsub"; stack.push(Operation.get(a, Operation.Type.SUBTRACT, b)); break; } case 103: { Token b = stack.pop(); Token a = stack.pop(); op = "dsub"; stack.push(Operation.get(a, Operation.Type.SUBTRACT, b)); break; } case 104: { Token b = stack.pop(); Token a = stack.pop(); op = "imul"; stack.push(Operation.get(a, Operation.Type.MULTIPLY, b)); break; } case 105: { Token b = stack.pop(); Token a = stack.pop(); op = "lmul"; stack.push(Operation.get(a, Operation.Type.MULTIPLY, b)); break; } case 106: { Token b = stack.pop(); Token a = stack.pop(); op = "fmul"; stack.push(Operation.get(a, Operation.Type.MULTIPLY, b)); break; } case 107: { Token b = stack.pop(); Token a = stack.pop(); op = "dmul"; stack.push(Operation.get(a, Operation.Type.MULTIPLY, b)); break; } case 108: { Token b = stack.pop(); Token a = stack.pop(); op = "idiv"; stack.push(Operation.get(a, Operation.Type.DIVIDE, b)); break; } case 109: { Token b = stack.pop(); Token a = stack.pop(); op = "ldiv"; stack.push(Operation.get(a, Operation.Type.DIVIDE, b)); break; } case 110: { Token b = stack.pop(); Token a = stack.pop(); op = "fdiv"; stack.push(Operation.get(a, Operation.Type.DIVIDE, b)); break; } case 111: { Token b = stack.pop(); Token a = stack.pop(); op = "ddiv"; stack.push(Operation.get(a, Operation.Type.DIVIDE, b)); break; } case 112: { Token b = stack.pop(); Token a = stack.pop(); op = "irem"; stack.push(Operation.get(a, Operation.Type.MOD, b)); break; } case 113: { Token b = stack.pop(); Token a = stack.pop(); op = "lrem"; stack.push(Operation.get(a, Operation.Type.MOD, b)); break; } case 114: { Token b = stack.pop(); Token a = stack.pop(); op = "frem"; stack.push(Operation.get(a, Operation.Type.MOD, b)); break; } case 115: { Token b = stack.pop(); Token a = stack.pop(); op = "drem"; stack.push(Operation.get(a, Operation.Type.MOD, b)); break; } // case 116: // op = "ineg"; // break; // case 117: // op = "lneg"; // break; // case 118: // op = "fneg"; // break; // case 119: // op = "dneg"; // break; // case 120: // op = "ishl"; // break; // case 121: // op = "lshl"; // break; // case 122: // op = "ishr"; // break; // case 123: // op = "lshr"; // break; // case 124: // op = "iushr"; // break; // case 125: // op = "lushr"; // break; // case 126: // op = "iand"; // break; // case 127: // op = "land"; // break; // case 128: // op = "ior"; // break; // case 129: // op = "lor"; // break; // case 130: // op = "ixor"; // break; // case 131: // op = "lxor"; // break; // case 132: { // int var = readByte(); // int off = (byte) readByte(); // op = "iinc " + var + " " + off; // break; // } // case 133: // op = "i2l"; // break; // case 134: // op = "i2f"; // break; // case 135: // op = "i2d"; // break; // case 136: // op = "l2i"; // break; // case 137: // op = "l2f"; // break; // case 138: // op = "l2d"; // break; // case 139: // op = "f2i"; // break; // case 140: // op = "f2l"; // break; // case 141: // op = "f2d"; // break; // case 142: // op = "d2i"; // break; // case 143: // op = "d2l"; // break; // case 144: // op = "d2f"; // break; // case 145: // op = "i2b"; // break; // case 146: // op = "i2c"; // break; // case 147: // op = "i2s"; // break; case 148: { Token b = stack.pop(), a = stack.pop(); stack.push(new Function("SIGN", Operation.get(a, Operation.Type.SUBTRACT, b))); op = "lcmp"; break; } // case 149: // op = "fcmpl"; // break; // case 150: // op = "fcmpg"; // break; // case 151: // op = "dcmpl"; // break; // case 152: // op = "dcmpg"; // break; case 153: condition = true; nextPc = getAbsolutePos(pos, readShort()); stack.push(Operation.get(stack.pop(), Operation.Type.EQUALS, ConstantNumber.get(0))); op = "ifeq " + nextPc; break; case 154: condition = true; nextPc = getAbsolutePos(pos, readShort()); stack.push(Operation.get(stack.pop(), Operation.Type.NOT_EQUALS, ConstantNumber.get(0))); op = "ifne " + nextPc; break; case 155: condition = true; nextPc = getAbsolutePos(pos, readShort()); stack.push(Operation.get(stack.pop(), Operation.Type.SMALLER, ConstantNumber.get(0))); op = "iflt " + nextPc; break; case 156: condition = true; nextPc = getAbsolutePos(pos, readShort()); stack.push(Operation.get(stack.pop(), Operation.Type.BIGGER_EQUALS, ConstantNumber.get(0))); op = "ifge " + nextPc; break; case 157: condition = true; nextPc = getAbsolutePos(pos, readShort()); stack.push(Operation.get(stack.pop(), Operation.Type.BIGGER, ConstantNumber.get(0))); op = "ifgt " + nextPc; break; case 158: condition = true; nextPc = getAbsolutePos(pos, readShort()); stack.push(Operation.get(stack.pop(), Operation.Type.SMALLER_EQUALS, ConstantNumber.get(0))); op = "ifle " + nextPc; break; case 159: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.EQUALS, b)); op = "if_icmpeq " + nextPc; break; } case 160: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.NOT_EQUALS, b)); op = "if_icmpne " + nextPc; break; } case 161: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.SMALLER, b)); op = "if_icmplt " + nextPc; break; } case 162: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.BIGGER_EQUALS, b)); op = "if_icmpge " + nextPc; break; } case 163: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.BIGGER, b)); op = "if_icmpgt " + nextPc; break; } case 164: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.SMALLER_EQUALS, b)); op = "if_icmple " + nextPc; break; } case 165: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.EQUALS, b)); op = "if_acmpeq " + nextPc; break; } case 166: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.NOT_EQUALS, b)); op = "if_acmpne " + nextPc; break; } case 167: nextPc = getAbsolutePos(pos, readShort()); op = "goto " + nextPc; break; // case 168: // // TODO not supported yet // op = "jsr " + getAbsolutePos(pos, readShort()); // break; // case 169: // // TODO not supported yet // op = "ret " + readByte(); // break; // case 170: { // int start = pos; // pos += 4 - ((pos - startByteCode) & 3); // int def = readInt(); // int low = readInt(), high = readInt(); // int n = high - low + 1; // op = "tableswitch default:" + getAbsolutePos(start, def); // StringBuilder buff = new StringBuilder(); // for (int i = 0; i < n; i++) { // buff.append(' ').append(low++). // append(":"). // append(getAbsolutePos(start, readInt())); // } // op += buff.toString(); // // pos += n * 4; // break; // } // case 171: { // int start = pos; // pos += 4 - ((pos - startByteCode) & 3); // int def = readInt(); // int n = readInt(); // op = "lookupswitch default:" + getAbsolutePos(start, def); // StringBuilder buff = new StringBuilder(); // for (int i = 0; i < n; i++) { // buff.append(' '). // append(readInt()). // append(":"). // append(getAbsolutePos(start, readInt())); // } // op += buff.toString(); // // pos += n * 8; // break; // } case 172: op = "ireturn"; endOfMethod = true; break; case 173: op = "lreturn"; endOfMethod = true; break; case 174: op = "freturn"; endOfMethod = true; break; case 175: op = "dreturn"; endOfMethod = true; break; case 176: op = "areturn"; endOfMethod = true; break; case 177: op = "return"; // no value returned stack.push(null); endOfMethod = true; break; // case 178: // op = "getstatic " + getField(readShort()); // break; // case 179: // op = "putstatic " + getField(readShort()); // break; case 180: { String field = getField(readShort()); Token p = stack.pop(); String s = p + "." + field.substring(field.lastIndexOf('.') + 1, field.indexOf(' ')); if (s.startsWith("this.")) { s = s.substring(5); } stack.push(Variable.get(s, fieldMap.get(s))); op = "getfield " + field; break; } // case 181: // op = "putfield " + getField(readShort()); // break; case 182: { String method = getMethod(readShort()); op = "invokevirtual " + method; if (method.equals("java/lang/String.equals (Ljava/lang/Object;)Z")) { Token a = stack.pop(); Token b = stack.pop(); stack.push(Operation.get(a, Operation.Type.EQUALS, b)); } else if (method.equals("java/lang/Integer.intValue ()I")) { // ignore } else if (method.equals("java/lang/Long.longValue ()J")) { // ignore } break; } case 183: { String method = getMethod(readShort()); op = "invokespecial " + method; break; } case 184: op = "invokestatic " + getMethod(readShort()); break; // case 185: { // int methodRef = readShort(); // readByte(); // readByte(); // op = "invokeinterface " + getMethod(methodRef); // break; // } case 187: { String className = constantPool[constantPool[readShort()].intValue()].toString(); op = "new " + className; break; } // case 188: // op = "newarray " + readByte(); // break; // case 189: // op = "anewarray " + cpString[readShort()]; // break; // case 190: // op = "arraylength"; // break; // case 191: // op = "athrow"; // break; // case 192: // op = "checkcast " + cpString[readShort()]; // break; // case 193: // op = "instanceof " + cpString[readShort()]; // break; // case 194: // op = "monitorenter"; // break; // case 195: // op = "monitorexit"; // break; // case 196: { // opCode = readByte(); // switch (opCode) { // case 21: // op = "wide iload " + readShort(); // break; // case 22: // op = "wide lload " + readShort(); // break; // case 23: // op = "wide fload " + readShort(); // break; // case 24: // op = "wide dload " + readShort(); // break; // case 25: // op = "wide aload " + readShort(); // break; // case 54: // op = "wide istore " + readShort(); // break; // case 55: // op = "wide lstore " + readShort(); // break; // case 56: // op = "wide fstore " + readShort(); // break; // case 57: // op = "wide dstore " + readShort(); // break; // case 58: // op = "wide astore " + readShort(); // break; // case 132: { // int var = readShort(); // int off = (short) readShort(); // op = "wide iinc " + var + " " + off; // break; // } // case 169: // op = "wide ret " + readShort(); // break; // default: // throw new RuntimeException( // "Unsupported wide opCode " + opCode); // } // break; // } // case 197: // op = "multianewarray " + cpString[readShort()] + " " + readByte(); // break; // case 198: { // condition = true; // nextPc = getAbsolutePos(pos, readShort()); // Token a = stack.pop(); // stack.push("(" + a + " IS NULL)"); // op = "ifnull " + nextPc; // break; // } // case 199: { // condition = true; // nextPc = getAbsolutePos(pos, readShort()); // Token a = stack.pop(); // stack.push("(" + a + " IS NOT NULL)"); // op = "ifnonnull " + nextPc; // break; // } case 200: op = "goto_w " + getAbsolutePos(pos, readInt()); break; case 201: op = "jsr_w " + getAbsolutePos(pos, readInt()); break; default: throw new RuntimeException("Unsupported opCode " + opCode); } debug(" " + startPos + ": " + op); }
// in src/tools/org/h2/jaqu/bytecode/ClassReader.java
private Constant getConstant(int constantRef) { Constant c = constantPool[constantRef]; switch (c.getType()) { case INT: case FLOAT: case DOUBLE: case LONG: return c; case STRING_REF: return constantPool[c.intValue()]; default: throw new RuntimeException("Not a constant: " + constantRef); } }
// in src/tools/org/h2/jaqu/DbInspector.java
public List<String> generateModel(String schema, String table, String packageName, boolean annotateSchema, boolean trimStrings) { try { List<String> models = New.arrayList(); List<TableInspector> tables = getTables(schema, table); for (TableInspector t : tables) { t.read(metaData); String model = t.generateModel(packageName, annotateSchema, trimStrings); models.add(model); } return models; } catch (SQLException s) { throw new RuntimeException(s); } }
// in src/tools/org/h2/jaqu/DbInspector.java
public <T> List<ValidationRemark> validateModel(T model, boolean throwOnError) { try { TableInspector inspector = getTable(model); inspector.read(metaData); @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) model.getClass(); TableDefinition<T> def = db.define(clazz); return inspector.validate(def, throwOnError); } catch (SQLException s) { throw new RuntimeException(s); } }
// in src/tools/org/h2/jaqu/DbInspector.java
private List<TableInspector> getTables(String schema, String table) throws SQLException { ResultSet rs = null; try { rs = getMetaData().getSchemas(); ArrayList<String> schemaList = New.arrayList(); while (rs.next()) { schemaList.add(rs.getString("TABLE_SCHEM")); } JdbcUtils.closeSilently(rs); String jaquTables = DbVersion.class.getAnnotation(JQTable.class).name(); List<TableInspector> tables = New.arrayList(); if (schemaList.size() == 0) { schemaList.add(null); } for (String s : schemaList) { rs = getMetaData().getTables(null, s, null, new String[] { "TABLE" }); while (rs.next()) { String t = rs.getString("TABLE_NAME"); if (!t.equalsIgnoreCase(jaquTables)) { tables.add(new TableInspector(s, t, getMetaData().storesUpperCaseIdentifiers(), dateTimeClass)); } } } if (StringUtils.isNullOrEmpty(schema) && StringUtils.isNullOrEmpty(table)) { // all schemas and tables return tables; } // schema subset OR table subset OR exact match List<TableInspector> matches = New.arrayList(); for (TableInspector t : tables) { if (t.matches(schema, table)) { matches.add(t); } } if (matches.size() == 0) { throw new RuntimeException( MessageFormat.format("Failed to find schema={0} table={1}", schema == null ? "" : schema, table == null ? "" : table)); } return matches; } finally { JdbcUtils.closeSilently(rs); } }
// in src/tools/org/h2/jaqu/TableDefinition.java
Object getValue(Object obj) { try { return field.get(obj); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/TableDefinition.java
void setValue(Object obj, Object o) { try { if (!field.isAccessible()) { field.setAccessible(true); } o = ClassUtils.convert(o, field.getType()); field.set(obj, o); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/TableDefinition.java
Object read(ResultSet rs, int columnIndex) { try { return rs.getObject(columnIndex); } catch (SQLException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/ValidationRemark.java
public ValidationRemark throwError(boolean throwOnError) { if (throwOnError && isError()) { throw new RuntimeException(toString()); } return this; }
// in src/tools/org/h2/jaqu/Db.java
private static <T> T instance(Class<T> clazz) { try { return clazz.newInstance(); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/Db.java
public synchronized void setDbUpgrader(DbUpgrader upgrader) { if (!upgrader.getClass().isAnnotationPresent(JQDatabase.class)) { throw new RuntimeException("DbUpgrader must be annotated with " + JQDatabase.class.getSimpleName()); } this.dbUpgrader = upgrader; upgradeChecked.clear(); }
// in src/tools/org/h2/jaqu/Db.java
public void close() { try { conn.close(); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/Db.java
PreparedStatement prepare(String sql, boolean returnGeneratedKeys) { try { if (returnGeneratedKeys) { return conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); } return conn.prepareStatement(sql); } catch (SQLException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/Db.java
public ResultSet executeQuery(String sql) { try { return conn.createStatement().executeQuery(sql); } catch (SQLException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/Db.java
public int executeUpdate(String sql) { try { Statement stat = conn.createStatement(); int updateCount = stat.executeUpdate(sql); stat.close(); return updateCount; } catch (SQLException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/Define.java
private static void checkInDefine() { if (currentTable == null) { throw new RuntimeException("This method may only be called " + "from within the define() method, and the define() method " + "is called by the framework."); } }
// in src/tools/org/h2/jaqu/ModelUtils.java
static String getDataType(FieldDefinition fieldDef, boolean strictTypeMapping) { Class<?> fieldClass = fieldDef.field.getType(); if (SUPPORTED_TYPES.containsKey(fieldClass)) { String type = SUPPORTED_TYPES.get(fieldClass); if (type.equals("VARCHAR") && fieldDef.maxLength <= 0) { // unspecified length strings are TEXT, not VARCHAR return "TEXT"; } return type; } if (!strictTypeMapping) { return "VARCHAR"; } throw new RuntimeException("Unsupported type " + fieldClass.getName()); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
public static Object convert(Object o, Class<?> targetType) { if (o == null) { return null; } Class<?> currentType = o.getClass(); if (targetType.isAssignableFrom(currentType)) { return o; } if (targetType == String.class) { if (Clob.class.isAssignableFrom(currentType)) { Clob c = (Clob) o; try { Reader r = c.getCharacterStream(); return IOUtils.readStringAndClose(r, -1); } catch (Exception e) { throw new RuntimeException("Error converting CLOB to String: " + e.toString(), e); } } return o.toString(); } if (Number.class.isAssignableFrom(currentType)) { Number n = (Number) o; if (targetType == Byte.class) { return n.byteValue(); } else if (targetType == Short.class) { return n.shortValue(); } else if (targetType == Integer.class) { return n.intValue(); } else if (targetType == Long.class) { return n.longValue(); } else if (targetType == Double.class) { return n.doubleValue(); } else if (targetType == Float.class) { return n.floatValue(); } } throw new RuntimeException("Can not convert the value " + o + " from " + currentType + " to " + targetType); }
// in src/tools/org/h2/jaqu/SQLStatement.java
ResultSet executeQuery() { try { return prepare(false).executeQuery(); } catch (SQLException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/SQLStatement.java
int executeUpdate() { PreparedStatement ps = null; try { ps = prepare(false); return ps.executeUpdate(); } catch (SQLException e) { throw new RuntimeException(e); } finally { JdbcUtils.closeSilently(ps); } }
// in src/tools/org/h2/jaqu/SQLStatement.java
long executeInsert() { PreparedStatement ps = null; try { ps = prepare(true); ps.executeUpdate(); long identity = -1; ResultSet rs = ps.getGeneratedKeys(); if (rs != null && rs.next()) { identity = rs.getLong(1); } JdbcUtils.closeSilently(rs); return identity; } catch (SQLException e) { throw new RuntimeException(e); } finally { JdbcUtils.closeSilently(ps); } }
// in src/tools/org/h2/jaqu/SQLStatement.java
private static void setValue(PreparedStatement prep, int parameterIndex, Object x) { try { prep.setObject(parameterIndex, x); } catch (SQLException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/java/Expr.java
private void init() { if (field == null) { Type t = base.getType(); if (t.arrayLevel > 0) { if ("length".equals(name)) { field = new FieldObj(); field.type = context.getClassObj("int").baseType; } else { throw new RuntimeException("Unknown array method: " + name); } } else { field = t.classObj.getField(name); } } }
// in src/tools/org/h2/java/ClassObj.java
MethodObj getMethod(String find, ArrayList<Expr> args) { ArrayList<MethodObj> list = methods.get(find); if (list == null) { throw new RuntimeException("Method not found: " + className + " " + find); } if (list.size() == 1) { return list.get(0); } for (MethodObj m : list) { if (!m.isVarArgs && m.parameters.size() != args.size()) { continue; } boolean match = true; int i = 0; for (FieldObj f : m.parameters.values()) { Expr a = args.get(i++); Type t = a.getType(); if (!t.equals(f.type)) { match = false; break; } } if (match) { return m; } } throw new RuntimeException("Method not found: " + className); }
// in src/tools/org/h2/java/JavaParser.java
ClassObj getWrapper(ClassObj c) { switch (c.id) { case 1: return getClass("java.lang.Boolean"); case 2: return getClass("java.lang.Byte"); case 3: return getClass("java.lang.Short"); case 4: return getClass("java.lang.Character"); case 5: return getClass("java.lang.Integer"); case 6: return getClass("java.lang.Long"); case 7: return getClass("java.lang.Float"); case 8: return getClass("java.lang.Double"); } throw new RuntimeException("not a primitive type: " + classObj); }
// in src/tools/org/h2/java/JavaParser.java
void parse(String baseDir, String className) { String fileName = baseDir + "/" + className.replace('.', '/') + ".java"; current = new ParseState(); try { RandomAccessFile file = new RandomAccessFile(fileName, "r"); byte[] buff = new byte[(int) file.length()]; file.readFully(buff); source = new String(buff, "UTF-8"); file.close(); } catch (IOException e) { throw new RuntimeException(e); } source = replaceUnicode(source); source = removeRemarks(source); try { readToken(); parseCompilationUnit(); } catch (Exception e) { throw new RuntimeException(source.substring(0, current.index) + "[*]" + source.substring(current.index), e); } }
// in src/tools/org/h2/java/JavaParser.java
private ClassObj getClass(String type) { ClassObj c = getClassIf(type); if (c == null) { throw new RuntimeException("Unknown type: " + type); } return c; }
// in src/tools/org/h2/java/JavaParser.java
private ClassObj getClassIf(String type) { ClassObj c = builtInTypes.get(type); if (c != null) { return c; } c = classes.get(type); if (c != null) { return c; } String mappedType = importMap.get(type); if (mappedType == null) { mappedType = JAVA_IMPORT_MAP.get(type); if (mappedType == null) { return null; } } c = classes.get(mappedType); if (c == null) { c = builtInTypes.get(mappedType); if (c == null) { throw new RuntimeException("Unknown class: " + mappedType); } } return c; }
58
              
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error downloading", e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/doc/RailroadImages.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Throwable e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read field " + className + "." + fieldName, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read value " + className + "." + methodName + "()", e); }
// in src/tools/org/h2/build/BuildBase.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error downloading " + fileURL + " to " + target, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error reading from file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error creating file " + destFile, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/Build.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/bytecode/ClassReader.java
catch (IOException e) { throw new RuntimeException("Could not read class bytecode", e); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { if (MAKE_ACCESSIBLE) { Constructor[] constructors = clazz.getDeclaredConstructors(); // try 0 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 0) { c.setAccessible(true); try { return clazz.newInstance(); } catch (Exception e2) { // ignore } } } // try 1 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 1) { c.setAccessible(true); try { return (T) c.newInstance(new Object[1]); } catch (Exception e2) { // ignore } } } } throw new RuntimeException("Exception trying to create " + clazz.getName() + ": " + e, e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { throw new RuntimeException("Error converting CLOB to String: " + e.toString(), e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/java/JavaParser.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { throw new RuntimeException(source.substring(0, current.index) + "[*]" + source.substring(current.index), e); }
0
(Lib) IOException 31
              
// in src/main/org/h2/tools/Restore.java
private static String getOriginalDbName(String fileName, String db) throws IOException { InputStream in = null; try { in = FileUtils.newInputStream(fileName); ZipInputStream zipIn = new ZipInputStream(in); String originalDbName = null; boolean multiple = false; while (true) { ZipEntry entry = zipIn.getNextEntry(); if (entry == null) { break; } String entryName = entry.getName(); zipIn.closeEntry(); String name = getDatabaseNameFromFileName(entryName); if (name != null) { if (db.equals(name)) { originalDbName = name; // we found the correct database break; } else if (originalDbName == null) { originalDbName = name; // we found a database, but maybe another one } else { // we have found multiple databases, but not the correct // one multiple = true; } } } zipIn.close(); if (multiple && !db.equals(originalDbName)) { throw new IOException("Multiple databases found, but not " + db); } return originalDbName; } finally { IOUtils.closeSilently(in); } }
// in src/main/org/h2/tools/Restore.java
public static void execute(String zipFileName, String directory, String db, boolean quiet) { InputStream in = null; try { if (!FileUtils.exists(zipFileName)) { throw new IOException("File not found: " + zipFileName); } String originalDbName = null; int originalDbLen = 0; if (db != null) { originalDbName = getOriginalDbName(zipFileName, db); if (originalDbName == null) { throw new IOException("No database named " + db + " found"); } if (originalDbName.startsWith(SysProperties.FILE_SEPARATOR)) { originalDbName = originalDbName.substring(1); } originalDbLen = originalDbName.length(); } in = FileUtils.newInputStream(zipFileName); ZipInputStream zipIn = new ZipInputStream(in); while (true) { ZipEntry entry = zipIn.getNextEntry(); if (entry == null) { break; } String fileName = entry.getName(); // restoring windows backups on linux and vice versa fileName = fileName.replace('\\', SysProperties.FILE_SEPARATOR.charAt(0)); fileName = fileName.replace('/', SysProperties.FILE_SEPARATOR.charAt(0)); if (fileName.startsWith(SysProperties.FILE_SEPARATOR)) { fileName = fileName.substring(1); } boolean copy = false; if (db == null) { copy = true; } else if (fileName.startsWith(originalDbName + ".")) { fileName = db + fileName.substring(originalDbLen); copy = true; } if (copy) { OutputStream o = null; try { o = FileUtils.newOutputStream(directory + SysProperties.FILE_SEPARATOR + fileName, false); IOUtils.copy(zipIn, o); o.close(); } finally { IOUtils.closeSilently(o); } } zipIn.closeEntry(); } zipIn.closeEntry(); zipIn.close(); } catch (IOException e) { throw DbException.convertIOException(e, zipFileName); } finally { IOUtils.closeSilently(in); } }
// in src/main/org/h2/tools/Shell.java
private String readLine() throws IOException { String line = reader.readLine(); if (line == null) { throw new IOException("Aborted"); } return line; }
// in src/main/org/h2/store/fs/FilePathNio.java
public FileChannel truncate(long newLength) throws IOException { try { channel.truncate(newLength); if (channel.position() > newLength) { // looks like a bug in this FileChannel implementation, as the // documentation says the position needs to be changed channel.position(newLength); } return this; } catch (NonWritableChannelException e) { throw new IOException("read only"); } }
// in src/main/org/h2/store/fs/FilePathNio.java
public int write(ByteBuffer src) throws IOException { try { return channel.write(src); } catch (NonWritableChannelException e) { throw new IOException("read only"); } }
// in src/main/org/h2/store/fs/FilePathMem.java
void touch(boolean openReadOnly) throws IOException { if (isReadOnly || openReadOnly) { throw new IOException("Read only"); } lastModified = System.currentTimeMillis(); }
// in src/main/org/h2/store/fs/FilePathSplit.java
private void closeAndThrow(int id, FileChannel[] array, FileChannel o, long maxLength) throws IOException { String message = "Expected file length: " + maxLength + " got: " + o.size() + " for " + getName(id); for (FileChannel f : array) { f.close(); } throw new IOException(message); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
private void unMap() throws IOException { if (mapped == null) { return; } // first write all data mapped.force(); // need to dispose old direct buffer, see bug // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038 boolean useSystemGc = true; if (SysProperties.NIO_CLEANER_HACK) { try { Method cleanerMethod = mapped.getClass().getMethod("cleaner"); cleanerMethod.setAccessible(true); Object cleaner = cleanerMethod.invoke(mapped); if (cleaner != null) { Method clearMethod = cleaner.getClass().getMethod("clean"); clearMethod.invoke(cleaner); } useSystemGc = false; } catch (Throwable e) { // useSystemGc is already true } finally { mapped = null; } } if (useSystemGc) { WeakReference<MappedByteBuffer> bufferWeakRef = new WeakReference<MappedByteBuffer>(mapped); mapped = null; long start = System.currentTimeMillis(); while (bufferWeakRef.get() != null) { if (System.currentTimeMillis() - start > GC_TIMEOUT_MS) { throw new IOException("Timeout (" + GC_TIMEOUT_MS + " ms) reached while trying to GC mapped buffer"); } System.gc(); Thread.yield(); } } }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
private void reMap() throws IOException { int oldPos = 0; if (mapped != null) { oldPos = pos; unMap(); } fileLength = file.length(); checkFileSizeLimit(fileLength); // maps new MappedByteBuffer; the old one is disposed during GC mapped = file.getChannel().map(mode, 0, fileLength); int limit = mapped.limit(); int capacity = mapped.capacity(); if (limit < fileLength || capacity < fileLength) { throw new IOException("Unable to map: length=" + limit + " capacity=" + capacity + " length=" + fileLength); } if (SysProperties.NIO_LOAD_MAPPED) { mapped.load(); } this.pos = Math.min(oldPos, (int) fileLength); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
private static void checkFileSizeLimit(long length) throws IOException { if (length > Integer.MAX_VALUE) { throw new IOException("File over 2GB is not supported yet when using this file system"); } }
// in src/main/org/h2/store/fs/FilePathZip.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { if (!inTempDir) { throw new IOException("File system is read-only"); } return new FilePathDisk().getPath(name).createTempFile(suffix, deleteOnExit, true); }
// in src/main/org/h2/store/fs/FilePathZip.java
public FileChannel truncate(long newLength) throws IOException { throw new IOException("File is read-only"); }
// in src/main/org/h2/store/fs/FilePathZip.java
public int write(ByteBuffer src) throws IOException { throw new IOException("File is read-only"); }
// in src/main/org/h2/server/web/WebThread.java
private String readHeaderLine() throws IOException { StringBuilder buff = new StringBuilder(); while (true) { headerBytes++; int c = input.read(); if (c == -1) { throw new IOException("Unexpected EOF"); } else if (c == '\r') { headerBytes++; if (input.read() == '\n') { return buff.length() > 0 ? buff.toString() : null; } } else if (c == '\n') { return buff.length() > 0 ? buff.toString() : null; } else { buff.append((char) c); } } }
// in src/tools/org/h2/dev/ftp/FtpClient.java
private void readCode(int optional, int expected) throws IOException { readLine(); if (code == optional) { readLine(); } if (code != expected) { throw new IOException("Expected: " + expected + " got: " + code + " " + message); } }
// in src/tools/org/h2/dev/fs/FileShell.java
private void end(String[] list, int index) throws IOException { if (list.length != index) { throw new IOException("End of command expected, got: " + list[index]); } }
// in src/tools/org/h2/dev/fs/FileShell.java
private int readFileList(String[] list, int i, ArrayList<String> target, boolean recursive) throws IOException { while (i < list.length) { String c = list[i++]; if (";".equals(c)) { break; } c = getFile(c); if (!FileUtils.exists(c)) { throw new IOException("File not found: " + c); } if (recursive) { addFilesRecursive(c, target); } else { target.add(c); } } return i; }
// in src/tools/org/h2/dev/fs/FileShell.java
private String readLine() throws IOException { String line = reader.readLine(); if (line == null) { throw new IOException("Aborted"); } return line; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { if (!inTempDir) { throw new IOException("File system is read-only"); } return new FilePathDisk().getPath(name).createTempFile(suffix, deleteOnExit, true); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public FileChannel truncate(long newLength) throws IOException { throw new IOException("File is read-only"); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public int write(ByteBuffer src) throws IOException { throw new IOException("File is read-only"); }
// in src/tools/org/h2/build/doc/SpellChecker.java
private void run(String dictionaryFileName, String dir) throws IOException { process(new File(dictionaryFileName)); process(new File(dir)); if (printDictionary) { System.out.println("USED WORDS"); String[] list = new String[used.size()]; used.toArray(list); Arrays.sort(list); StringBuilder buff = new StringBuilder(); for (String s : list) { if (buff.length() > 0) { if (buff.length() + s.length() > 80) { System.out.println(buff.toString()); buff.setLength(0); } else { buff.append(' '); } } buff.append(s); } System.out.println(buff.toString()); } if (unknown.size() > 0) { System.out.println(); System.out.println("UNKNOWN WORDS"); for (String s : unknown.keySet()) { // int count = unknown.get(s); System.out.print(s + " "); errorCount++; } System.out.println(); System.out.println(); } if (errorCount > 0) { throw new IOException(errorCount + " error found"); } }
// in src/tools/org/h2/build/doc/SpellChecker.java
private void process(File file) throws IOException { String name = file.getName(); if (name.endsWith(".svn") || name.endsWith(".DS_Store")) { return; } if (name.startsWith("_") && name.indexOf("_en") < 0) { return; } if (file.isDirectory()) { for (File f : file.listFiles()) { process(f); } } else { String fileName = file.getAbsolutePath(); int idx = fileName.lastIndexOf('.'); String suffix; if (idx < 0) { suffix = ""; } else { suffix = fileName.substring(idx + 1); } for (String s : IGNORE) { if (s.equals(suffix)) { return; } } for (String ignoreFile : IGNORE_FILES) { if (fileName.endsWith(ignoreFile)) { return; } } boolean ok = false; for (String s : SUFFIX) { if (s.equals(suffix)) { ok = true; break; } } if (!ok) { throw new IOException("Unsupported suffix: " + suffix + " for file: " + fileName); } String text = new String(BuildBase.readFile(file)); if (fileName.endsWith("dictionary.txt")) { addToDictionary = true; } else { addToDictionary = false; } scan(fileName, text); } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static void buildHtml(String templateDir, String targetDir, String language) throws IOException { File[] list = new File(templateDir).listFiles(); new File(targetDir).mkdirs(); // load the main 'translation' String propName = templateDir + "/_docs_" + MAIN_LANGUAGE + ".properties"; Properties prop = load(propName, false); propName = templateDir + "/_docs_" + language + ".properties"; if (!(new File(propName)).exists()) { throw new IOException("Translation not found: " + propName); } Properties transProp = load(propName, false); for (Object k : transProp.keySet()) { String key = (String) k; String t = transProp.getProperty(key); // overload with translations, but not the ones starting with # if (t.startsWith("##")) { prop.put(key, t.substring(2)); } else if (!t.startsWith("#")) { prop.put(key, t); } } ArrayList <String>fileNames = new ArrayList<String>(); for (File f : list) { String name = f.getName(); if (!name.endsWith(".jsp")) { continue; } // remove '.jsp' name = name.substring(0, name.length() - 4); fileNames.add(name); } for (File f : list) { String name = f.getName(); if (!name.endsWith(".jsp")) { continue; } // remove '.jsp' name = name.substring(0, name.length() - 4); String template = IOUtils.readStringAndClose(new FileReader(templateDir + "/" + name + ".jsp"), -1); HashMap<String, Object> map = New.hashMap(); for (Object k : prop.keySet()) { map.put(k.toString(), prop.get(k)); } String html = PageParser.parse(template, map); html = StringUtils.replaceAll(html, "lang=\"" + MAIN_LANGUAGE + "\"", "lang=\"" + language + "\""); for (String n : fileNames) { if ("frame".equals(n)) { // don't translate 'frame.html' to 'frame_ja.html', // otherwise we can't switch back to English continue; } html = StringUtils.replaceAll(html, n + ".html\"", n + "_" + language + ".html\""); } html = StringUtils.replaceAll(html, "_" + MAIN_LANGUAGE + ".html\"", ".html\""); String target; if (language.equals(MAIN_LANGUAGE)) { target = targetDir + "/" + name + ".html"; } else { target = targetDir + "/" + name + "_" + language + ".html"; } OutputStream out = new FileOutputStream(target); OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8"); writer.write(html); writer.close(); } }
// in src/tools/org/h2/build/doclet/Doclet.java
private boolean startDoc(RootDoc root) throws IOException { ClassDoc[] classes = root.classes(); String[][] options = root.options(); for (String[] op : options) { if (op[0].equals("destdir")) { destDir = op[1]; } } for (ClassDoc clazz : classes) { processClass(clazz); } if (errorCount > 0) { throw new IOException("FAILED: " + errorCount + " errors found"); } return true; }
// in src/tools/org/h2/build/code/SwitchSource.java
private void processFile(File f) throws IOException { RandomAccessFile read = new RandomAccessFile(f, "r"); byte[] buffer; try { long len = read.length(); if (len >= Integer.MAX_VALUE) { throw new IOException("Files bigger than Integer.MAX_VALUE are not supported"); } buffer = new byte[(int) len]; read.readFully(buffer); } finally { read.close(); } boolean found = false; // check for ## without creating a string for (int i = 0; i < buffer.length - 1; i++) { if (buffer[i] == '#' && buffer[i + 1] == '#') { found = true; break; } } if (!found) { return; } String source = new String(buffer); String target = source; for (String x : enable) { target = replaceAll(target, "/*## " + x + " ##", "//## " + x + " ##"); } for (String x : disable) { target = replaceAll(target, "//## " + x + " ##", "/*## " + x + " ##"); } if (!source.equals(target)) { String name = f.getPath(); File fileNew = new File(name + ".new"); FileWriter write = new FileWriter(fileNew); write.write(target); write.close(); File fileBack = new File(name + ".bak"); fileBack.delete(); f.renameTo(fileBack); File fileCopy = new File(name); if (!fileNew.renameTo(fileCopy)) { throw new IOException("Could not rename " + fileNew.getAbsolutePath() + " to " + name); } if (!fileBack.delete()) { throw new IOException("Could not delete " + fileBack.getAbsolutePath()); } // System.out.println(name); } }
2
              
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
409
              
// in src/main/org/h2/jdbcx/JdbcDataSource.java
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { initFactory(); in.defaultReadObject(); }
// in src/main/org/h2/tools/Restore.java
private static String getOriginalDbName(String fileName, String db) throws IOException { InputStream in = null; try { in = FileUtils.newInputStream(fileName); ZipInputStream zipIn = new ZipInputStream(in); String originalDbName = null; boolean multiple = false; while (true) { ZipEntry entry = zipIn.getNextEntry(); if (entry == null) { break; } String entryName = entry.getName(); zipIn.closeEntry(); String name = getDatabaseNameFromFileName(entryName); if (name != null) { if (db.equals(name)) { originalDbName = name; // we found the correct database break; } else if (originalDbName == null) { originalDbName = name; // we found a database, but maybe another one } else { // we have found multiple databases, but not the correct // one multiple = true; } } } zipIn.close(); if (multiple && !db.equals(originalDbName)) { throw new IOException("Multiple databases found, but not " + db); } return originalDbName; } finally { IOUtils.closeSilently(in); } }
// in src/main/org/h2/tools/ConvertTraceFile.java
private void convertFile(String traceFileName, String javaClassName, String script) throws IOException { LineNumberReader reader = new LineNumberReader(IOUtils.getBufferedReader( FileUtils.newInputStream(traceFileName))); PrintWriter javaWriter = new PrintWriter(IOUtils.getBufferedWriter( FileUtils.newOutputStream(javaClassName + ".java", false))); PrintWriter scriptWriter = new PrintWriter(IOUtils.getBufferedWriter( FileUtils.newOutputStream(script, false))); javaWriter.println("import java.io.*;"); javaWriter.println("import java.sql.*;"); javaWriter.println("import java.math.*;"); javaWriter.println("import java.util.Calendar;"); String cn = javaClassName.replace('\\', '/'); int idx = cn.lastIndexOf('/'); if (idx > 0) { cn = cn.substring(idx + 1); } javaWriter.println("public class " + cn + " {"); javaWriter.println(" public static void main(String... args) throws Exception {"); javaWriter.println(" Class.forName(\"org.h2.Driver\");"); while (true) { String line = reader.readLine(); if (line == null) { break; } if (line.startsWith("/**/")) { line = " " + line.substring(4); javaWriter.println(line); } else if (line.startsWith("/*SQL")) { int end = line.indexOf("*/"); String sql = line.substring(end + "*/".length()); sql = StringUtils.javaDecode(sql); line = line.substring("/*SQL".length(), end); if (line.length() > 0) { String statement = sql; int count = 0; long time = 0; line = line.trim(); if (line.length() > 0) { StringTokenizer tk = new StringTokenizer(line, " :"); while (tk.hasMoreElements()) { String token = tk.nextToken(); if ("l".equals(token)) { int len = Integer.parseInt(tk.nextToken()); statement = sql.substring(0, len) + ";"; } else if ("#".equals(token)) { count = Integer.parseInt(tk.nextToken()); } else if ("t".equals(token)) { time = Long.parseLong(tk.nextToken()); } } } addToStats(statement, count, time); } scriptWriter.println(sql); } } javaWriter.println(" }"); javaWriter.println('}'); reader.close(); javaWriter.close(); if (stats.size() > 0) { scriptWriter.println("-----------------------------------------"); scriptWriter.println("-- SQL Statement Statistics"); scriptWriter.println("-- time: total time in milliseconds (accumulated)"); scriptWriter.println("-- count: how many times the statement ran"); scriptWriter.println("-- result: total update count or row count"); scriptWriter.println("-----------------------------------------"); scriptWriter.println("-- self accu time count result sql"); int accumTime = 0; ArrayList<Stat> list = New.arrayList(stats.values()); Collections.sort(list); if (timeTotal == 0) { timeTotal = 1; } for (Stat stat : list) { accumTime += stat.time; StringBuilder buff = new StringBuilder(100); buff.append("-- "). append(padNumberLeft(100 * stat.time / timeTotal, 3)). append("% "). append(padNumberLeft(100 * accumTime / timeTotal, 3)). append('%'). append(padNumberLeft(stat.time, 8)). append(padNumberLeft(stat.executeCount, 8)). append(padNumberLeft(stat.resultCount, 8)). append(' '). append(removeNewlines(stat.sql)); scriptWriter.println(buff.toString()); } } scriptWriter.close(); }
// in src/main/org/h2/tools/Csv.java
public ResultSet read(Reader reader, String[] colNames) throws IOException { init(null, null); this.input = reader; return readResultSet(colNames); }
// in src/main/org/h2/tools/Csv.java
private ResultSet readResultSet(String[] colNames) throws IOException { this.columnNames = colNames; initRead(); SimpleResultSet result = new SimpleResultSet(this); makeColumnNamesUnique(); for (String columnName : columnNames) { result.addColumn(columnName, Types.VARCHAR, Integer.MAX_VALUE, 0); } return result; }
// in src/main/org/h2/tools/Csv.java
private void initWrite() throws IOException { if (output == null) { try { OutputStream out = FileUtils.newOutputStream(fileName, false); out = new BufferedOutputStream(out, Constants.IO_BUFFER_SIZE); output = new BufferedWriter(new OutputStreamWriter(out, characterSet)); } catch (Exception e) { close(); throw DbException.convertToIOException(e); } } }
// in src/main/org/h2/tools/Csv.java
private void writeRow(String[] values) throws IOException { for (int i = 0; i < values.length; i++) { if (i > 0) { if (fieldSeparatorWrite != null) { output.write(fieldSeparatorWrite); } } String s = values[i]; if (s != null) { if (escapeCharacter != 0) { if (fieldDelimiter != 0) { output.write(fieldDelimiter); } output.write(escape(s)); if (fieldDelimiter != 0) { output.write(fieldDelimiter); } } else { output.write(s); } } else if (nullString != null && nullString.length() > 0) { output.write(nullString); } } if (rowSeparatorWrite != null) { output.write(rowSeparatorWrite); } output.write(lineSeparator); }
// in src/main/org/h2/tools/Csv.java
private void initRead() throws IOException { if (input == null) { try { InputStream in = FileUtils.newInputStream(fileName); in = new BufferedInputStream(in, Constants.IO_BUFFER_SIZE); input = new InputStreamReader(in, characterSet); } catch (IOException e) { close(); throw e; } } if (!input.markSupported()) { input = new BufferedReader(input); } input.mark(1); int bom = input.read(); if (bom != 0xfeff) { // Microsoft Excel compatibility // ignore pseudo-BOM input.reset(); } inputBuffer = new char[Constants.IO_BUFFER_SIZE * 2]; if (columnNames == null) { readHeader(); } }
// in src/main/org/h2/tools/Csv.java
private void readHeader() throws IOException { ArrayList<String> list = New.arrayList(); while (true) { String v = readValue(); if (v == null) { if (endOfLine) { if (endOfFile || list.size() > 0) { break; } } else { v = "COLUMN" + list.size(); list.add(v); } } else { if (v.length() == 0) { v = "COLUMN" + list.size(); } else if (!caseSensitiveColumnNames && isSimpleColumnName(v)) { v = v.toUpperCase(); } list.add(v); if (endOfLine) { break; } } } columnNames = new String[list.size()]; list.toArray(columnNames); }
// in src/main/org/h2/tools/Csv.java
private int readChar() throws IOException { if (inputBufferPos >= inputBufferEnd) { return readBuffer(); } return inputBuffer[inputBufferPos++]; }
// in src/main/org/h2/tools/Csv.java
private int readBuffer() throws IOException { if (endOfFile) { return -1; } int keep; if (inputBufferStart >= 0) { keep = inputBufferPos - inputBufferStart; if (keep > 0) { char[] src = inputBuffer; if (keep + Constants.IO_BUFFER_SIZE > src.length) { inputBuffer = new char[src.length * 2]; } System.arraycopy(src, inputBufferStart, inputBuffer, 0, keep); } inputBufferStart = 0; } else { keep = 0; } inputBufferPos = keep; int len = input.read(inputBuffer, keep, Constants.IO_BUFFER_SIZE); if (len == -1) { // ensure bufferPos > bufferEnd // even after pushBack inputBufferEnd = -1024; endOfFile = true; // ensure the right number of characters are read // in case the input buffer is still used inputBufferPos++; return -1; } inputBufferEnd = keep + len; return inputBuffer[inputBufferPos++]; }
// in src/main/org/h2/tools/Csv.java
private String readValue() throws IOException { endOfLine = false; inputBufferStart = inputBufferPos; while (true) { int ch = readChar(); if (ch == fieldDelimiter) { // delimited value boolean containsEscape = false; inputBufferStart = inputBufferPos; int sep; while (true) { ch = readChar(); if (ch == fieldDelimiter) { ch = readChar(); if (ch != fieldDelimiter) { sep = 2; break; } containsEscape = true; } else if (ch == escapeCharacter) { ch = readChar(); if (ch < 0) { sep = 1; break; } containsEscape = true; } else if (ch < 0) { sep = 1; break; } } String s = new String(inputBuffer, inputBufferStart, inputBufferPos - inputBufferStart - sep); if (containsEscape) { s = unEscape(s); } inputBufferStart = -1; while (true) { if (ch == fieldSeparatorRead) { break; } else if (ch == '\n' || ch < 0 || ch == '\r') { endOfLine = true; break; } else if (ch == ' ' || ch == '\t') { // ignore } else { pushBack(); break; } ch = readChar(); } return s; } else if (ch == '\n' || ch < 0 || ch == '\r') { endOfLine = true; return null; } else if (ch == fieldSeparatorRead) { // null return null; } else if (ch <= ' ') { // ignore spaces continue; } else if (lineComment != 0 && ch == lineComment) { // comment until end of line inputBufferStart = -1; while (true) { ch = readChar(); if (ch == '\n' || ch < 0 || ch == '\r') { break; } } endOfLine = true; return null; } else { // un-delimited value while (true) { ch = readChar(); if (ch == fieldSeparatorRead) { break; } else if (ch == '\n' || ch < 0 || ch == '\r') { endOfLine = true; break; } } String s = new String(inputBuffer, inputBufferStart, inputBufferPos - inputBufferStart - 1); if (!preserveWhitespace) { s = s.trim(); } inputBufferStart = -1; // check un-delimited value for nullString return readNull(s); } } }
// in src/main/org/h2/tools/Recover.java
public static Reader readClob(String fileName) throws IOException { return new BufferedReader(new InputStreamReader(readBlob(fileName), "UTF-8")); }
// in src/main/org/h2/tools/Recover.java
public static InputStream readBlob(String fileName) throws IOException { return new BufferedInputStream(FileUtils.newInputStream(fileName)); }
// in src/main/org/h2/tools/Recover.java
private void dumpPageLogStream(PrintWriter writer, int logKey, int logFirstTrunkPage, int logFirstDataPage, long pageCount) throws IOException { Data s = Data.create(this, pageSize); DataReader in = new DataReader( new PageInputStream(writer, this, store, logKey, logFirstTrunkPage, logFirstDataPage, pageSize) ); writer.println("---- Transaction log ----"); CompressLZF compress = new CompressLZF(); while (true) { int x = in.readByte(); if (x < 0) { break; } if (x == PageLog.NOOP) { // ignore } else if (x == PageLog.UNDO) { int pageId = in.readVarInt(); int size = in.readVarInt(); byte[] data = new byte[pageSize]; if (size == 0) { in.readFully(data, 0, pageSize); } else if (size == 1) { // empty } else { byte[] compressBuffer = new byte[size]; in.readFully(compressBuffer, 0, size); try { compress.expand(compressBuffer, 0, size, data, 0, pageSize); } catch (ArrayIndexOutOfBoundsException e) { throw DbException.convertToIOException(e); } } String typeName = ""; int type = data[0]; boolean last = (type & Page.FLAG_LAST) != 0; type &= ~Page.FLAG_LAST; switch (type) { case Page.TYPE_EMPTY: typeName = "empty"; break; case Page.TYPE_DATA_LEAF: typeName = "data leaf " + (last ? "(last)" : ""); break; case Page.TYPE_DATA_NODE: typeName = "data node " + (last ? "(last)" : ""); break; case Page.TYPE_DATA_OVERFLOW: typeName = "data overflow " + (last ? "(last)" : ""); break; case Page.TYPE_BTREE_LEAF: typeName = "b-tree leaf " + (last ? "(last)" : ""); break; case Page.TYPE_BTREE_NODE: typeName = "b-tree node " + (last ? "(last)" : ""); break; case Page.TYPE_FREE_LIST: typeName = "free list " + (last ? "(last)" : ""); break; case Page.TYPE_STREAM_TRUNK: typeName = "log trunk"; break; case Page.TYPE_STREAM_DATA: typeName = "log data"; break; default: typeName = "ERROR: unknown type " + type; break; } writer.println("-- undo page " + pageId + " " + typeName); if (trace) { Data d = Data.create(null, data); dumpPage(writer, d, pageId, pageCount); } } else if (x == PageLog.ADD) { int sessionId = in.readVarInt(); setStorage(in.readVarInt()); Row row = PageLog.readRow(in, s); writer.println("-- session " + sessionId + " table " + storageId + " + " + row.toString()); if (transactionLog) { if (storageId == 0 && row.getColumnCount() >= 4) { int tableId = (int) row.getKey(); String sql = row.getValue(3).getString(); String name = extractTableOrViewName(sql); if (row.getValue(2).getInt() == DbObject.TABLE_OR_VIEW) { tableMap.put(tableId, name); } writer.println(sql + ";"); } else { String tableName = tableMap.get(storageId); if (tableName != null) { StatementBuilder buff = new StatementBuilder(); buff.append("INSERT INTO ").append(tableName).append(" VALUES("); for (int i = 0; i < row.getColumnCount(); i++) { buff.appendExceptFirst(", "); buff.append(row.getValue(i).getSQL()); } buff.append(");"); writer.println(buff.toString()); } } } } else if (x == PageLog.REMOVE) { int sessionId = in.readVarInt(); setStorage(in.readVarInt()); long key = in.readVarLong(); writer.println("-- session " + sessionId + " table " + storageId + " - " + key); if (transactionLog) { if (storageId == 0) { int tableId = (int) key; String tableName = tableMap.get(tableId); if (tableName != null) { writer.println("DROP TABLE IF EXISTS " + tableName + ";"); } } else { String tableName = tableMap.get(storageId); if (tableName != null) { String sql = "DELETE FROM " + tableName + " WHERE _ROWID_ = " + key + ";"; writer.println(sql); } } } } else if (x == PageLog.TRUNCATE) { int sessionId = in.readVarInt(); setStorage(in.readVarInt()); writer.println("-- session " + sessionId + " table " + storageId + " truncate"); if (transactionLog) { writer.println("TRUNCATE TABLE " + storageId); } } else if (x == PageLog.COMMIT) { int sessionId = in.readVarInt(); writer.println("-- commit " + sessionId); } else if (x == PageLog.ROLLBACK) { int sessionId = in.readVarInt(); writer.println("-- rollback " + sessionId); } else if (x == PageLog.PREPARE_COMMIT) { int sessionId = in.readVarInt(); String transaction = in.readString(); writer.println("-- prepare commit " + sessionId + " " + transaction); } else if (x == PageLog.NOOP) { // nothing to do } else if (x == PageLog.CHECKPOINT) { writer.println("-- checkpoint"); } else if (x == PageLog.FREE_LOG) { int size = in.readVarInt(); StringBuilder buff = new StringBuilder("-- free"); for (int i = 0; i < size; i++) { buff.append(' ').append(in.readVarInt()); } writer.println(buff); } else { writer.println("-- ERROR: unknown operation " + x); break; } } }
// in src/main/org/h2/tools/RunScript.java
private void process(Connection conn, String fileName, boolean continueOnError, String charsetName) throws SQLException, IOException { InputStream in = FileUtils.newInputStream(fileName); String path = FileUtils.getParent(fileName); try { in = new BufferedInputStream(in, Constants.IO_BUFFER_SIZE); Reader reader = new InputStreamReader(in, charsetName); process(conn, continueOnError, path, reader, charsetName); } finally { IOUtils.closeSilently(in); } }
// in src/main/org/h2/tools/RunScript.java
private void process(Connection conn, boolean continueOnError, String path, Reader reader, String charsetName) throws SQLException, IOException { Statement stat = conn.createStatement(); ScriptReader r = new ScriptReader(reader); while (true) { String sql = r.readStatement(); if (sql == null) { break; } String trim = sql.trim(); if (trim.length() == 0) { continue; } if (trim.startsWith("@") && StringUtils.toUpperEnglish(trim).startsWith("@INCLUDE")) { sql = trim; sql = sql.substring("@INCLUDE".length()).trim(); if (!FileUtils.isAbsolute(sql)) { sql = path + SysProperties.FILE_SEPARATOR + sql; } process(conn, sql, continueOnError, charsetName); } else { try { if (showResults && !trim.startsWith("-->")) { out.print(sql + ";"); } if (showResults || checkResults) { boolean query = stat.execute(sql); if (query) { ResultSet rs = stat.getResultSet(); int columns = rs.getMetaData().getColumnCount(); StringBuilder buff = new StringBuilder(); while (rs.next()) { buff.append("\n-->"); for (int i = 0; i < columns; i++) { String s = rs.getString(i + 1); if (s != null) { s = StringUtils.replaceAll(s, "\r\n", "\n"); s = StringUtils.replaceAll(s, "\n", "\n--> "); s = StringUtils.replaceAll(s, "\r", "\r--> "); } buff.append(' ').append(s); } } buff.append("\n;"); String result = buff.toString(); if (showResults) { out.print(result); } if (checkResults) { String expected = r.readStatement() + ";"; expected = StringUtils.replaceAll(expected, "\r\n", "\n"); expected = StringUtils.replaceAll(expected, "\r", "\n"); if (!expected.equals(result)) { expected = StringUtils.replaceAll(expected, " ", "+"); result = StringUtils.replaceAll(result, " ", "+"); throw new SQLException("Unexpected output for:\n" + sql.trim() + "\nGot:\n" + result + "\nExpected:\n" + expected); } } } } else { stat.execute(sql); } } catch (Exception e) { if (continueOnError) { e.printStackTrace(out); } else { throw DbException.toSQLException(e); } } } } }
// in src/main/org/h2/tools/Shell.java
private void connect() throws IOException, SQLException { String url = "jdbc:h2:~/test"; String user = "sa"; String driver = null; try { Properties prop; if ("null".equals(serverPropertiesDir)) { prop = new Properties(); } else { prop = SortedProperties.loadProperties(serverPropertiesDir + "/" + Constants.SERVER_PROPERTIES_NAME); } String data = null; boolean found = false; for (int i = 0;; i++) { String d = prop.getProperty(String.valueOf(i)); if (d == null) { break; } found = true; data = d; } if (found) { ConnectionInfo info = new ConnectionInfo(data); url = info.url; user = info.user; driver = info.driver; } } catch (IOException e) { // ignore } println("[Enter] " + url); print("URL "); url = readLine(url).trim(); if (driver == null) { driver = JdbcUtils.getDriver(url); } if (driver != null) { println("[Enter] " + driver); } print("Driver "); driver = readLine(driver).trim(); println("[Enter] " + user); print("User "); user = readLine(user); println("[Enter] Hide"); print("Password "); String password = readLine(); if (password.length() == 0) { password = readPassword(); } conn = JdbcUtils.getConnection(driver, url, user, password); stat = conn.createStatement(); println("Connected"); }
// in src/main/org/h2/tools/Shell.java
private String readPassword() throws IOException { try { Object console = Utils.callStaticMethod("java.lang.System.console"); print("Password "); char[] password = (char[]) Utils.callMethod(console, "readPassword"); return password == null ? null : new String(password); } catch (Exception e) { // ignore, use the default solution } Thread passwordHider = new Thread(this, "Password hider"); stopHide = false; passwordHider.start(); print("Password > "); String p = readLine(); stopHide = true; try { passwordHider.join(); } catch (InterruptedException e) { // ignore } print("\b\b"); return p; }
// in src/main/org/h2/tools/Shell.java
private String readLine(String defaultValue) throws IOException { String s = readLine(); return s.length() == 0 ? defaultValue : s; }
// in src/main/org/h2/tools/Shell.java
private String readLine() throws IOException { String line = reader.readLine(); if (line == null) { throw new IOException("Aborted"); } return line; }
// in src/main/org/h2/value/Transfer.java
public synchronized void init() throws IOException { if (socket != null) { in = new DataInputStream(new BufferedInputStream(socket.getInputStream(), Transfer.BUFFER_SIZE)); out = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), Transfer.BUFFER_SIZE)); } }
// in src/main/org/h2/value/Transfer.java
public void flush() throws IOException { out.flush(); }
// in src/main/org/h2/value/Transfer.java
public Transfer writeBoolean(boolean x) throws IOException { out.writeByte((byte) (x ? 1 : 0)); return this; }
// in src/main/org/h2/value/Transfer.java
public boolean readBoolean() throws IOException { return in.readByte() == 1; }
// in src/main/org/h2/value/Transfer.java
private Transfer writeByte(byte x) throws IOException { out.writeByte(x); return this; }
// in src/main/org/h2/value/Transfer.java
private byte readByte() throws IOException { return in.readByte(); }
// in src/main/org/h2/value/Transfer.java
public Transfer writeInt(int x) throws IOException { out.writeInt(x); return this; }
// in src/main/org/h2/value/Transfer.java
public int readInt() throws IOException { return in.readInt(); }
// in src/main/org/h2/value/Transfer.java
public Transfer writeLong(long x) throws IOException { out.writeLong(x); return this; }
// in src/main/org/h2/value/Transfer.java
public long readLong() throws IOException { return in.readLong(); }
// in src/main/org/h2/value/Transfer.java
private Transfer writeDouble(double i) throws IOException { out.writeDouble(i); return this; }
// in src/main/org/h2/value/Transfer.java
private Transfer writeFloat(float i) throws IOException { out.writeFloat(i); return this; }
// in src/main/org/h2/value/Transfer.java
private double readDouble() throws IOException { return in.readDouble(); }
// in src/main/org/h2/value/Transfer.java
private float readFloat() throws IOException { return in.readFloat(); }
// in src/main/org/h2/value/Transfer.java
public Transfer writeString(String s) throws IOException { if (s == null) { out.writeInt(-1); } else { int len = s.length(); out.writeInt(len); for (int i = 0; i < len; i++) { out.writeChar(s.charAt(i)); } } return this; }
// in src/main/org/h2/value/Transfer.java
public String readString() throws IOException { int len = in.readInt(); if (len == -1) { return null; } StringBuilder buff = new StringBuilder(len); for (int i = 0; i < len; i++) { buff.append(in.readChar()); } String s = buff.toString(); s = StringUtils.cache(s); return s; }
// in src/main/org/h2/value/Transfer.java
public Transfer writeBytes(byte[] data) throws IOException { if (data == null) { writeInt(-1); } else { writeInt(data.length); out.write(data); } return this; }
// in src/main/org/h2/value/Transfer.java
public Transfer writeBytes(byte[] buff, int off, int len) throws IOException { out.write(buff, off, len); return this; }
// in src/main/org/h2/value/Transfer.java
public byte[] readBytes() throws IOException { int len = readInt(); if (len == -1) { return null; } byte[] b = Utils.newBytes(len); in.readFully(b); return b; }
// in src/main/org/h2/value/Transfer.java
public void readBytes(byte[] buff, int off, int len) throws IOException { in.readFully(buff, off, len); }
// in src/main/org/h2/value/Transfer.java
public void writeValue(Value v) throws IOException { int type = v.getType(); writeInt(type); switch (type) { case Value.NULL: break; case Value.BYTES: case Value.JAVA_OBJECT: writeBytes(v.getBytesNoCopy()); break; case Value.UUID: { ValueUuid uuid = (ValueUuid) v; writeLong(uuid.getHigh()); writeLong(uuid.getLow()); break; } case Value.BOOLEAN: writeBoolean(v.getBoolean().booleanValue()); break; case Value.BYTE: writeByte(v.getByte()); break; case Value.TIME: if (version >= Constants.TCP_PROTOCOL_VERSION_9) { writeLong(((ValueTime) v).getNanos()); } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) { writeLong(DateTimeUtils.getTimeLocalWithoutDst(v.getTime())); } else { writeLong(v.getTime().getTime()); } break; case Value.DATE: if (version >= Constants.TCP_PROTOCOL_VERSION_9) { writeLong(((ValueDate) v).getDateValue()); } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) { writeLong(DateTimeUtils.getTimeLocalWithoutDst(v.getDate())); } else { writeLong(v.getDate().getTime()); } break; case Value.TIMESTAMP: { if (version >= Constants.TCP_PROTOCOL_VERSION_9) { ValueTimestamp ts = (ValueTimestamp) v; writeLong(ts.getDateValue()); writeLong(ts.getNanos()); } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) { Timestamp ts = v.getTimestamp(); writeLong(DateTimeUtils.getTimeLocalWithoutDst(ts)); writeInt(ts.getNanos()); } else { Timestamp ts = v.getTimestamp(); writeLong(ts.getTime()); writeInt(ts.getNanos()); } break; } case Value.DECIMAL: writeString(v.getString()); break; case Value.DOUBLE: writeDouble(v.getDouble()); break; case Value.FLOAT: writeFloat(v.getFloat()); break; case Value.INT: writeInt(v.getInt()); break; case Value.LONG: writeLong(v.getLong()); break; case Value.SHORT: writeInt(v.getShort()); break; case Value.STRING: case Value.STRING_IGNORECASE: case Value.STRING_FIXED: writeString(v.getString()); break; case Value.BLOB: { if (version >= Constants.TCP_PROTOCOL_VERSION_11) { if (v instanceof ValueLobDb) { ValueLobDb lob = (ValueLobDb) v; if (lob.isStored()) { writeLong(-1); writeInt(lob.getTableId()); writeLong(lob.getLobId()); writeLong(lob.getPrecision()); break; } } } long length = v.getPrecision(); if (length < 0) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "length=" + length); } writeLong(length); long written = IOUtils.copyAndCloseInput(v.getInputStream(), out); if (written != length) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "length:" + length + " written:" + written); } writeInt(LOB_MAGIC); break; } case Value.CLOB: { if (version >= Constants.TCP_PROTOCOL_VERSION_11) { if (v instanceof ValueLobDb) { ValueLobDb lob = (ValueLobDb) v; if (lob.isStored()) { writeLong(-1); writeInt(lob.getTableId()); writeLong(lob.getLobId()); writeLong(lob.getPrecision()); break; } } } long length = v.getPrecision(); if (length < 0) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "length=" + length); } writeLong(length); Reader reader = v.getReader(); Data.copyString(reader, out); writeInt(LOB_MAGIC); break; } case Value.ARRAY: { ValueArray va = (ValueArray) v; Value[] list = va.getList(); int len = list.length; Class<?> componentType = va.getComponentType(); if (componentType == Object.class) { writeInt(len); } else { writeInt(-(len + 1)); writeString(componentType.getName()); } for (Value value : list) { writeValue(value); } break; } case Value.RESULT_SET: { try { ResultSet rs = ((ValueResultSet) v).getResultSet(); rs.beforeFirst(); ResultSetMetaData meta = rs.getMetaData(); int columnCount = meta.getColumnCount(); writeInt(columnCount); for (int i = 0; i < columnCount; i++) { writeString(meta.getColumnName(i + 1)); writeInt(meta.getColumnType(i + 1)); writeInt(meta.getPrecision(i + 1)); writeInt(meta.getScale(i + 1)); } while (rs.next()) { writeBoolean(true); for (int i = 0; i < columnCount; i++) { int t = DataType.convertSQLTypeToValueType(meta.getColumnType(i + 1)); Value val = DataType.readValue(session, rs, i + 1, t); writeValue(val); } } writeBoolean(false); rs.beforeFirst(); } catch (SQLException e) { throw DbException.convertToIOException(e); } break; } default: throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "type=" + type); } }
// in src/main/org/h2/value/Transfer.java
public Value readValue() throws IOException { int type = readInt(); switch(type) { case Value.NULL: return ValueNull.INSTANCE; case Value.BYTES: return ValueBytes.getNoCopy(readBytes()); case Value.UUID: return ValueUuid.get(readLong(), readLong()); case Value.JAVA_OBJECT: return ValueJavaObject.getNoCopy(readBytes()); case Value.BOOLEAN: return ValueBoolean.get(readBoolean()); case Value.BYTE: return ValueByte.get(readByte()); case Value.DATE: if (version >= Constants.TCP_PROTOCOL_VERSION_9) { return ValueDate.fromDateValue(readLong()); } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) { return ValueDate.get(new Date(DateTimeUtils.getTimeUTCWithoutDst(readLong()))); } return ValueDate.get(new Date(readLong())); case Value.TIME: if (version >= Constants.TCP_PROTOCOL_VERSION_9) { return ValueTime.fromNanos(readLong()); } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) { return ValueTime.get(new Time(DateTimeUtils.getTimeUTCWithoutDst(readLong()))); } return ValueTime.get(new Time(readLong())); case Value.TIMESTAMP: { if (version >= Constants.TCP_PROTOCOL_VERSION_9) { return ValueTimestamp.fromDateValueAndNanos(readLong(), readLong()); } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) { Timestamp ts = new Timestamp(DateTimeUtils.getTimeUTCWithoutDst(readLong())); ts.setNanos(readInt()); return ValueTimestamp.get(ts); } Timestamp ts = new Timestamp(readLong()); ts.setNanos(readInt()); return ValueTimestamp.get(ts); } case Value.DECIMAL: return ValueDecimal.get(new BigDecimal(readString())); case Value.DOUBLE: return ValueDouble.get(readDouble()); case Value.FLOAT: return ValueFloat.get(readFloat()); case Value.INT: return ValueInt.get(readInt()); case Value.LONG: return ValueLong.get(readLong()); case Value.SHORT: return ValueShort.get((short) readInt()); case Value.STRING: return ValueString.get(readString()); case Value.STRING_IGNORECASE: return ValueStringIgnoreCase.get(readString()); case Value.STRING_FIXED: return ValueStringFixed.get(readString()); case Value.BLOB: { long length = readLong(); if (version >= Constants.TCP_PROTOCOL_VERSION_11) { if (length == -1) { int tableId = readInt(); long id = readLong(); long precision = readLong(); return ValueLobDb.create(Value.BLOB, session.getDataHandler().getLobStorage(), tableId, id, precision); } int len = (int) length; byte[] small = new byte[len]; IOUtils.readFully(in, small, 0, len); int magic = readInt(); if (magic != LOB_MAGIC) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic); } return ValueLobDb.createSmallLob(Value.BLOB, small, length); } Value v = session.getDataHandler().getLobStorage().createBlob(in, length); int magic = readInt(); if (magic != LOB_MAGIC) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic); } return v; } case Value.CLOB: { long length = readLong(); if (version >= Constants.TCP_PROTOCOL_VERSION_11) { if (length == -1) { int tableId = readInt(); long id = readLong(); long precision = readLong(); return ValueLobDb.create(Value.CLOB, session.getDataHandler().getLobStorage(), tableId, id, precision); } DataReader reader = new DataReader(in); int len = (int) length; char[] buff = new char[len]; IOUtils.readFully(reader, buff, len); int magic = readInt(); if (magic != LOB_MAGIC) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic); } byte[] small = new String(buff).getBytes("UTF-8"); return ValueLobDb.createSmallLob(Value.CLOB, small, length); } Value v = session.getDataHandler().getLobStorage().createClob(new DataReader(in), length); int magic = readInt(); if (magic != LOB_MAGIC) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic); } return v; } case Value.ARRAY: { int len = readInt(); Class<?> componentType = Object.class; if (len < 0) { len = -(len + 1); componentType = Utils.loadUserClass(readString()); } Value[] list = new Value[len]; for (int i = 0; i < len; i++) { list[i] = readValue(); } return ValueArray.get(componentType, list); } case Value.RESULT_SET: { SimpleResultSet rs = new SimpleResultSet(); int columns = readInt(); for (int i = 0; i < columns; i++) { rs.addColumn(readString(), readInt(), readInt(), readInt()); } while (true) { if (!readBoolean()) { break; } Object[] o = new Object[columns]; for (int i = 0; i < columns; i++) { o[i] = readValue().getObject(); } rs.addRow(o); } return ValueResultSet.get(rs); } default: throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "type=" + type); } }
// in src/main/org/h2/value/Transfer.java
public Transfer openNewConnection() throws IOException { InetAddress address = socket.getInetAddress(); int port = socket.getPort(); Socket s2 = NetUtils.createSocket(address, port, ssl); Transfer trans = new Transfer(null); trans.setSocket(s2); trans.setSSL(ssl); return trans; }
// in src/main/org/h2/result/ResultColumn.java
public static void writeColumn(Transfer out, ResultInterface result, int i) throws IOException { out.writeString(result.getAlias(i)); out.writeString(result.getSchemaName(i)); out.writeString(result.getTableName(i)); out.writeString(result.getColumnName(i)); out.writeInt(result.getColumnType(i)); out.writeLong(result.getColumnPrecision(i)); out.writeInt(result.getColumnScale(i)); out.writeInt(result.getDisplaySize(i)); out.writeBoolean(result.isAutoIncrement(i)); out.writeInt(result.getNullable(i)); }
// in src/main/org/h2/expression/ParameterRemote.java
public void readMetaData(Transfer transfer) throws IOException { dataType = transfer.readInt(); precision = transfer.readLong(); scale = transfer.readInt(); nullable = transfer.readInt(); }
// in src/main/org/h2/expression/ParameterRemote.java
public static void writeMetaData(Transfer transfer, ParameterInterface p) throws IOException { transfer.writeInt(p.getType()); transfer.writeLong(p.getPrecision()); transfer.writeInt(p.getScale()); transfer.writeInt(p.getNullable()); }
// in src/main/org/h2/store/PageInputStream.java
public int read() throws IOException { int len = read(buffer); return len < 0 ? -1 : (buffer[0] & 255); }
// in src/main/org/h2/store/PageInputStream.java
public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
// in src/main/org/h2/store/PageInputStream.java
public int read(byte[] b, int off, int len) throws IOException { if (len == 0) { return 0; } int read = 0; while (len > 0) { int r = readBlock(b, off, len); if (r < 0) { break; } read += r; off += r; len -= r; } return read == 0 ? -1 : read; }
// in src/main/org/h2/store/PageInputStream.java
private int readBlock(byte[] buff, int off, int len) throws IOException { try { fillBuffer(); if (endOfFile) { return -1; } int l = Math.min(remaining, len); data.read(dataPos, buff, off, l); remaining -= l; dataPos += l; return l; } catch (DbException e) { throw new EOFException(); } }
// in src/main/org/h2/store/LobStorage.java
public int read() throws IOException { byte[] buff = new byte[1]; int len = read(buff, 0, 1); return len < 0 ? len : (buff[0] & 255); }
// in src/main/org/h2/store/LobStorage.java
public int read(byte[] buff) throws IOException { return read(buff, 0, buff.length); }
// in src/main/org/h2/store/LobStorage.java
public int read(byte[] buff, int off, int length) throws IOException { if (length == 0) { return 0; } length = (int) Math.min(length, remainingBytes); if (length == 0) { return -1; } length = handler.readLob(lob, pos, buff, off, length); remainingBytes -= length; if (length == 0) { return -1; } pos += length; return length; }
// in src/main/org/h2/store/LobStorage.java
public int read() throws IOException { fillBuffer(); if (remainingBytes <= 0) { return -1; } remainingBytes--; return buffer[pos++] & 255; }
// in src/main/org/h2/store/LobStorage.java
public long skip(long n) throws IOException { long remaining = n; remaining -= skipSmall(remaining); if (remaining > BLOCK_LENGTH) { long toPos = length - remainingBytes + remaining; try { long[] seqPos = skipBuffer(lob, toPos); if (seqPos == null) { remaining -= super.skip(remaining); return n - remaining; } seq = (int) seqPos[0]; long p = seqPos[1]; remainingBytes = length - p; remaining = toPos - p; } catch (SQLException e) { throw DbException.convertToIOException(e); } pos = 0; buffer = null; } fillBuffer(); remaining -= skipSmall(remaining); remaining -= super.skip(remaining); return n - remaining; }
// in src/main/org/h2/store/LobStorage.java
public int read(byte[] buff) throws IOException { return readFully(buff, 0, buff.length); }
// in src/main/org/h2/store/LobStorage.java
public int read(byte[] buff, int off, int length) throws IOException { return readFully(buff, off, length); }
// in src/main/org/h2/store/LobStorage.java
private int readFully(byte[] buff, int off, int length) throws IOException { if (length == 0) { return 0; } int read = 0; while (length > 0) { fillBuffer(); if (remainingBytes <= 0) { break; } int len = (int) Math.min(length, remainingBytes); len = Math.min(len, buffer.length - pos); System.arraycopy(buffer, pos, buff, off, len); pos += len; read += len; remainingBytes -= len; off += len; length -= len; } return read == 0 ? -1 : read; }
// in src/main/org/h2/store/LobStorage.java
private void fillBuffer() throws IOException { if (buffer != null && pos < buffer.length) { return; } if (remainingBytes <= 0) { return; } try { buffer = readBlock(lob, seq++); pos = 0; } catch (SQLException e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/store/LobStorage.java
public InputStream getInputStream(long lobId, long byteCount) throws IOException { init(); if (conn == null) { if (byteCount < 0) { byteCount = Long.MAX_VALUE; } return new BufferedInputStream(new RemoteInputStream(handler, lobId, byteCount)); } if (byteCount == -1) { synchronized (handler) { try { String sql = "SELECT BYTE_COUNT FROM " + LOBS + " WHERE ID = ?"; PreparedStatement prep = prepare(sql); prep.setLong(1, lobId); ResultSet rs = prep.executeQuery(); if (!rs.next()) { throw DbException.get(ErrorCode.IO_EXCEPTION_1, "Missing lob: "+ lobId).getSQLException(); } byteCount = rs.getLong(1); reuse(sql, prep); } catch (SQLException e) { throw DbException.convertToIOException(e); } } } return new LobInputStream(lobId, byteCount); }
// in src/main/org/h2/store/LobStorage.java
public int read(byte[] buff, int offset, int len) throws IOException { if (buffer == null) { return -1; } if (pos >= buffer.length) { fillBuffer(); if (buffer == null) { return -1; } } len = Math.min(len, buffer.length - pos); System.arraycopy(buffer, pos, buff, offset, len); pos += len; return len; }
// in src/main/org/h2/store/LobStorage.java
public int read() throws IOException { if (buffer == null) { return -1; } if (pos >= buffer.length) { fillBuffer(); if (buffer == null) { return -1; } } return buffer[pos++]; }
// in src/main/org/h2/store/LobStorage.java
private void fillBuffer() throws IOException { int len = (int) Math.min(charBuffer.length, remaining); if (len > 0) { len = reader.read(charBuffer, 0, len); } else { len = -1; } if (len < 0) { buffer = null; } else { buffer = StringUtils.utf8Encode(new String(charBuffer, 0, len)); length += len; remaining -= len; } pos = 0; }
// in src/main/org/h2/store/LobStorage.java
public void close() throws IOException { reader.close(); }
// in src/main/org/h2/store/PageLog.java
public static Row readRow(DataReader in, Data data) throws IOException { long key = in.readVarLong(); int len = in.readVarInt(); data.reset(); data.checkCapacity(len); in.readFully(data.getBytes(), 0, len); int columnCount = data.readVarInt(); Value[] values = new Value[columnCount]; for (int i = 0; i < columnCount; i++) { values[i] = data.readValue(); } Row row = new Row(values, Row.MEMORY_CALCULATE); row.setKey(key); return row; }
// in src/main/org/h2/store/DataReader.java
public byte readByte() throws IOException { int x = in.read(); if (x < 0) { throw new FastEOFException(); } return (byte) x; }
// in src/main/org/h2/store/DataReader.java
public int readVarInt() throws IOException { int b = readByte(); if (b >= 0) { return b; } int x = b & 0x7f; b = readByte(); if (b >= 0) { return x | (b << 7); } x |= (b & 0x7f) << 7; b = readByte(); if (b >= 0) { return x | (b << 14); } x |= (b & 0x7f) << 14; b = readByte(); if (b >= 0) { return x | b << 21; } return x | ((b & 0x7f) << 21) | (readByte() << 28); }
// in src/main/org/h2/store/DataReader.java
public long readVarLong() throws IOException { long x = readByte(); if (x >= 0) { return x; } x &= 0x7f; for (int s = 7;; s += 7) { long b = readByte(); x |= (b & 0x7f) << s; if (b >= 0) { return x; } } }
// in src/main/org/h2/store/DataReader.java
public void readFully(byte[] buff, int offset, int len) throws IOException { int got = IOUtils.readFully(in, buff, offset, len); if (got < len) { throw new FastEOFException(); } }
// in src/main/org/h2/store/DataReader.java
public String readString() throws IOException { int len = readVarInt(); return readString(len); }
// in src/main/org/h2/store/DataReader.java
private String readString(int len) throws IOException { char[] chars = new char[len]; for (int i = 0; i < len; i++) { chars[i] = readChar(); } return new String(chars); }
// in src/main/org/h2/store/DataReader.java
private char readChar() throws IOException { int x = readByte() & 0xff; if (x < 0x80) { return (char) x; } else if (x >= 0xe0) { return (char) (((x & 0xf) << 12) + ((readByte() & 0x3f) << 6) + (readByte() & 0x3f)); } else { return (char) (((x & 0x1f) << 6) + (readByte() & 0x3f)); } }
// in src/main/org/h2/store/DataReader.java
public void close() throws IOException { // ignore }
// in src/main/org/h2/store/DataReader.java
public int read(char[] buff, int off, int len) throws IOException { int i = 0; try { for (; i < len; i++) { buff[i] = readChar(); } return len; } catch (EOFException e) { return i; } }
// in src/main/org/h2/store/FileStoreInputStream.java
public int read(byte[] buff) throws IOException { return read(buff, 0, buff.length); }
// in src/main/org/h2/store/FileStoreInputStream.java
public int read(byte[] b, int off, int len) throws IOException { if (len == 0) { return 0; } int read = 0; while (len > 0) { int r = readBlock(b, off, len); if (r < 0) { break; } read += r; off += r; len -= r; } return read == 0 ? -1 : read; }
// in src/main/org/h2/store/FileStoreInputStream.java
private int readBlock(byte[] buff, int off, int len) throws IOException { fillBuffer(); if (endOfFile) { return -1; } int l = Math.min(remainingInBuffer, len); page.read(buff, off, l); remainingInBuffer -= l; return l; }
// in src/main/org/h2/store/FileStoreInputStream.java
private void fillBuffer() throws IOException { if (remainingInBuffer > 0 || endOfFile) { return; } page.reset(); store.openFile(); if (store.length() == store.getFilePointer()) { close(); return; } store.readFully(page.getBytes(), 0, Constants.FILE_BLOCK_SIZE); page.reset(); remainingInBuffer = readInt(); if (remainingInBuffer < 0) { close(); return; } page.checkCapacity(remainingInBuffer); // get the length to read if (compress != null) { page.checkCapacity(Data.LENGTH_INT); readInt(); } page.setPos(page.length() + remainingInBuffer); page.fillAligned(); int len = page.length() - Constants.FILE_BLOCK_SIZE; page.reset(); readInt(); store.readFully(page.getBytes(), Constants.FILE_BLOCK_SIZE, len); page.reset(); readInt(); if (compress != null) { int uncompressed = readInt(); byte[] buff = Utils.newBytes(remainingInBuffer); page.read(buff, 0, remainingInBuffer); page.reset(); page.checkCapacity(uncompressed); CompressTool.expand(buff, page.getBytes(), 0); remainingInBuffer = uncompressed; } if (alwaysClose) { store.closeFile(); } }
// in src/main/org/h2/store/FileStoreInputStream.java
public int read() throws IOException { fillBuffer(); if (endOfFile) { return -1; } int i = page.readByte() & 0xff; remainingInBuffer--; return i; }
// in src/main/org/h2/store/Data.java
public static void copyString(Reader source, OutputStream target) throws IOException { char[] buff = new char[Constants.IO_BUFFER_SIZE]; Data d = new Data(null, new byte[3 * Constants.IO_BUFFER_SIZE]); while (true) { int l = source.read(buff); if (l < 0) { break; } d.writeStringWithoutLength(buff, l); target.write(d.data, 0, d.pos); d.reset(); } }
// in src/main/org/h2/store/fs/FileChannelInputStream.java
public int read() throws IOException { if (channel.position() >= channel.size()) { return -1; } FileUtils.readFully(channel, ByteBuffer.wrap(buffer)); return buffer[0] & 0xff; }
// in src/main/org/h2/store/fs/FileChannelInputStream.java
public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
// in src/main/org/h2/store/fs/FileChannelInputStream.java
public int read(byte[] b, int off, int len) throws IOException { if (channel.position() + len < channel.size()) { FileUtils.readFully(channel, ByteBuffer.wrap(b, off, len)); return len; } return super.read(b, off, len); }
// in src/main/org/h2/store/fs/FileChannelInputStream.java
public void close() throws IOException { channel.close(); }
// in src/main/org/h2/store/fs/FilePath.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { while (true) { FilePath p = getPath(name + getNextTempFileNamePart(false) + suffix); if (p.exists() || !p.createFile()) { // in theory, the random number could collide getNextTempFileNamePart(true); continue; } p.open("rw").close(); return p; } }
// in src/main/org/h2/store/fs/FilePathWrapper.java
public InputStream newInputStream() throws IOException { return base.newInputStream(); }
// in src/main/org/h2/store/fs/FilePathWrapper.java
public FileChannel open(String mode) throws IOException { return base.open(mode); }
// in src/main/org/h2/store/fs/FilePathWrapper.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { return wrap(base.createTempFile(suffix, deleteOnExit, inTempDir)); }
// in src/main/org/h2/store/fs/FilePathNio.java
public FileChannel open(String mode) throws IOException { return new FileNio(name.substring(getScheme().length() + 1), mode); }
// in src/main/org/h2/store/fs/FilePathNio.java
public void implCloseChannel() throws IOException { channel.close(); }
// in src/main/org/h2/store/fs/FilePathNio.java
public long position() throws IOException { return channel.position(); }
// in src/main/org/h2/store/fs/FilePathNio.java
public long size() throws IOException { return channel.size(); }
// in src/main/org/h2/store/fs/FilePathNio.java
public int read(ByteBuffer dst) throws IOException { return channel.read(dst); }
// in src/main/org/h2/store/fs/FilePathNio.java
public FileChannel position(long pos) throws IOException { channel.position(pos); return this; }
// in src/main/org/h2/store/fs/FilePathNio.java
public FileChannel truncate(long newLength) throws IOException { try { channel.truncate(newLength); if (channel.position() > newLength) { // looks like a bug in this FileChannel implementation, as the // documentation says the position needs to be changed channel.position(newLength); } return this; } catch (NonWritableChannelException e) { throw new IOException("read only"); } }
// in src/main/org/h2/store/fs/FilePathNio.java
public void force(boolean metaData) throws IOException { channel.force(metaData); }
// in src/main/org/h2/store/fs/FilePathNio.java
public int write(ByteBuffer src) throws IOException { try { return channel.write(src); } catch (NonWritableChannelException e) { throw new IOException("read only"); } }
// in src/main/org/h2/store/fs/FilePathNio.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return channel.tryLock(); }
// in src/main/org/h2/store/fs/FilePathMem.java
public FileChannel truncate(long newLength) throws IOException { if (newLength < size()) { data.touch(readOnly); pos = Math.min(pos, newLength); data.truncate(newLength); } return this; }
// in src/main/org/h2/store/fs/FilePathMem.java
public int write(ByteBuffer src) throws IOException { int len = src.remaining(); if (len == 0) { return 0; } data.touch(readOnly); pos = data.readWrite(pos, src.array(), src.position(), len, true); src.position(src.position() + len); return len; }
// in src/main/org/h2/store/fs/FilePathMem.java
public int read(ByteBuffer dst) throws IOException { int len = dst.remaining(); if (len == 0) { return 0; } long newPos = data.readWrite(pos, dst.array(), dst.position(), len, false); len = (int) (newPos - pos); if (len <= 0) { return -1; } dst.position(dst.position() + len); pos = newPos; return len; }
// in src/main/org/h2/store/fs/FilePathMem.java
public void implCloseChannel() throws IOException { pos = 0; }
// in src/main/org/h2/store/fs/FilePathMem.java
public void force(boolean metaData) throws IOException { // do nothing }
// in src/main/org/h2/store/fs/FilePathMem.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return null; }
// in src/main/org/h2/store/fs/FilePathMem.java
void touch(boolean openReadOnly) throws IOException { if (isReadOnly || openReadOnly) { throw new IOException("Read only"); } lastModified = System.currentTimeMillis(); }
// in src/main/org/h2/store/fs/FileChannelOutputStream.java
public void write(int b) throws IOException { buffer[0] = (byte) b; FileUtils.writeFully(channel, ByteBuffer.wrap(buffer)); }
// in src/main/org/h2/store/fs/FileChannelOutputStream.java
public void write(byte[] b) throws IOException { FileUtils.writeFully(channel, ByteBuffer.wrap(b)); }
// in src/main/org/h2/store/fs/FileChannelOutputStream.java
public void write(byte[] b, int off, int len) throws IOException { FileUtils.writeFully(channel, ByteBuffer.wrap(b, off, len)); }
// in src/main/org/h2/store/fs/FileChannelOutputStream.java
public void close() throws IOException { channel.close(); }
// in src/main/org/h2/store/fs/FilePathSplit.java
public InputStream newInputStream() throws IOException { InputStream input = getBase().newInputStream(); for (int i = 1;; i++) { FilePath f = getBase(i); if (f.exists()) { InputStream i2 = f.newInputStream(); input = new SequenceInputStream(input, i2); } else { break; } } return input; }
// in src/main/org/h2/store/fs/FilePathSplit.java
public FileChannel open(String mode) throws IOException { ArrayList<FileChannel> list = New.arrayList(); list.add(getBase().open(mode)); for (int i = 1;; i++) { FilePath f = getBase(i); if (f.exists()) { list.add(f.open(mode)); } else { break; } } FileChannel[] array = new FileChannel[list.size()]; list.toArray(array); long maxLength = array[0].size(); long length = maxLength; if (array.length == 1) { long defaultMaxLength = getDefaultMaxLength(); if (maxLength < defaultMaxLength) { maxLength = defaultMaxLength; } } else { if (maxLength == 0) { closeAndThrow(0, array, array[0], maxLength); } for (int i = 1; i < array.length - 1; i++) { FileChannel c = array[i]; long l = c.size(); length += l; if (l != maxLength) { closeAndThrow(i, array, c, maxLength); } } FileChannel c = array[array.length - 1]; long l = c.size(); length += l; if (l > maxLength) { closeAndThrow(array.length - 1, array, c, maxLength); } } return new FileSplit(this, mode, array, length, maxLength); }
// in src/main/org/h2/store/fs/FilePathSplit.java
private void closeAndThrow(int id, FileChannel[] array, FileChannel o, long maxLength) throws IOException { String message = "Expected file length: " + maxLength + " got: " + o.size() + " for " + getName(id); for (FileChannel f : array) { f.close(); } throw new IOException(message); }
// in src/main/org/h2/store/fs/FilePathSplit.java
public void implCloseChannel() throws IOException { for (FileChannel c : list) { c.close(); } }
// in src/main/org/h2/store/fs/FilePathSplit.java
public int read(ByteBuffer dst) throws IOException { int len = dst.remaining(); if (len == 0) { return 0; } len = (int) Math.min(len, length - filePointer); if (len <= 0) { return -1; } long offset = filePointer % maxLength; len = (int) Math.min(len, maxLength - offset); FileChannel channel = getFileChannel(); channel.position(offset); len = channel.read(dst); filePointer += len; return len; }
// in src/main/org/h2/store/fs/FilePathSplit.java
private FileChannel getFileChannel() throws IOException { int id = (int) (filePointer / maxLength); while (id >= list.length) { int i = list.length; FileChannel[] newList = new FileChannel[i + 1]; System.arraycopy(list, 0, newList, 0, i); FilePath f = file.getBase(i); newList[i] = f.open(mode); list = newList; } return list[id]; }
// in src/main/org/h2/store/fs/FilePathSplit.java
public FileChannel truncate(long newLength) throws IOException { if (newLength >= length) { return this; } filePointer = Math.min(filePointer, newLength); int newFileCount = 1 + (int) (newLength / maxLength); if (newFileCount < list.length) { // delete some of the files FileChannel[] newList = new FileChannel[newFileCount]; // delete backwards, so that truncating is somewhat transactional for (int i = list.length - 1; i >= newFileCount; i--) { // verify the file is writable list[i].truncate(0); list[i].close(); try { file.getBase(i).delete(); } catch (DbException e) { throw DbException.convertToIOException(e); } } System.arraycopy(list, 0, newList, 0, newList.length); list = newList; } long size = newLength - maxLength * (newFileCount - 1); list[list.length - 1].truncate(size); this.length = newLength; return this; }
// in src/main/org/h2/store/fs/FilePathSplit.java
public void force(boolean metaData) throws IOException { for (FileChannel c : list) { c.force(metaData); } }
// in src/main/org/h2/store/fs/FilePathSplit.java
public int write(ByteBuffer src) throws IOException { if (filePointer >= length && filePointer > maxLength) { // may need to extend and create files long oldFilePointer = filePointer; long x = length - (length % maxLength) + maxLength; for (; x < filePointer; x += maxLength) { if (x > length) { // expand the file size position(x - 1); write(ByteBuffer.wrap(new byte[1])); } filePointer = oldFilePointer; } } long offset = filePointer % maxLength; int len = src.remaining(); FileChannel channel = getFileChannel(); channel.position(offset); int l = (int) Math.min(len, maxLength - offset); if (l == len) { l = channel.write(src); } else { int oldLimit = src.limit(); src.limit(src.position() + l); l = channel.write(src); src.limit(oldLimit); } filePointer += l; length = Math.max(length, filePointer); return l; }
// in src/main/org/h2/store/fs/FilePathSplit.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return list[0].tryLock(); }
// in src/main/org/h2/store/fs/FilePathRec.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { log(Recorder.CREATE_TEMP_FILE, unwrap(name) + ":" + suffix + ":" + deleteOnExit + ":" + inTempDir); return super.createTempFile(suffix, deleteOnExit, inTempDir); }
// in src/main/org/h2/store/fs/FilePathRec.java
public FileChannel open(String mode) throws IOException { return new FileRec(this, super.open(mode), name); }
// in src/main/org/h2/store/fs/FilePathRec.java
public void implCloseChannel() throws IOException { channel.close(); }
// in src/main/org/h2/store/fs/FilePathRec.java
public long position() throws IOException { return channel.position(); }
// in src/main/org/h2/store/fs/FilePathRec.java
public long size() throws IOException { return channel.size(); }
// in src/main/org/h2/store/fs/FilePathRec.java
public int read(ByteBuffer dst) throws IOException { return channel.read(dst); }
// in src/main/org/h2/store/fs/FilePathRec.java
public FileChannel position(long pos) throws IOException { channel.position(pos); return this; }
// in src/main/org/h2/store/fs/FilePathRec.java
public FileChannel truncate(long newLength) throws IOException { rec.log(Recorder.TRUNCATE, name, null, newLength); channel.truncate(newLength); return this; }
// in src/main/org/h2/store/fs/FilePathRec.java
public void force(boolean metaData) throws IOException { channel.force(metaData); }
// in src/main/org/h2/store/fs/FilePathRec.java
public int write(ByteBuffer src) throws IOException { byte[] buff = src.array(); int len = src.remaining(); if (src.position() != 0 || len != buff.length) { byte[] b = new byte[len]; System.arraycopy(buff, src.position(), b, 0, len); buff = b; } int result = channel.write(src); rec.log(Recorder.WRITE, name, buff, channel.position()); return result; }
// in src/main/org/h2/store/fs/FilePathRec.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return channel.tryLock(); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public FileChannel open(String mode) throws IOException { return new FileNioMapped(name.substring(getScheme().length() + 1), mode); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
private void unMap() throws IOException { if (mapped == null) { return; } // first write all data mapped.force(); // need to dispose old direct buffer, see bug // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038 boolean useSystemGc = true; if (SysProperties.NIO_CLEANER_HACK) { try { Method cleanerMethod = mapped.getClass().getMethod("cleaner"); cleanerMethod.setAccessible(true); Object cleaner = cleanerMethod.invoke(mapped); if (cleaner != null) { Method clearMethod = cleaner.getClass().getMethod("clean"); clearMethod.invoke(cleaner); } useSystemGc = false; } catch (Throwable e) { // useSystemGc is already true } finally { mapped = null; } } if (useSystemGc) { WeakReference<MappedByteBuffer> bufferWeakRef = new WeakReference<MappedByteBuffer>(mapped); mapped = null; long start = System.currentTimeMillis(); while (bufferWeakRef.get() != null) { if (System.currentTimeMillis() - start > GC_TIMEOUT_MS) { throw new IOException("Timeout (" + GC_TIMEOUT_MS + " ms) reached while trying to GC mapped buffer"); } System.gc(); Thread.yield(); } } }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
private void reMap() throws IOException { int oldPos = 0; if (mapped != null) { oldPos = pos; unMap(); } fileLength = file.length(); checkFileSizeLimit(fileLength); // maps new MappedByteBuffer; the old one is disposed during GC mapped = file.getChannel().map(mode, 0, fileLength); int limit = mapped.limit(); int capacity = mapped.capacity(); if (limit < fileLength || capacity < fileLength) { throw new IOException("Unable to map: length=" + limit + " capacity=" + capacity + " length=" + fileLength); } if (SysProperties.NIO_LOAD_MAPPED) { mapped.load(); } this.pos = Math.min(oldPos, (int) fileLength); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
private static void checkFileSizeLimit(long length) throws IOException { if (length > Integer.MAX_VALUE) { throw new IOException("File over 2GB is not supported yet when using this file system"); } }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public void implCloseChannel() throws IOException { if (file != null) { unMap(); file.close(); file = null; } }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public synchronized long size() throws IOException { return fileLength; }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public synchronized int read(ByteBuffer dst) throws IOException { try { int len = dst.remaining(); if (len == 0) { return 0; } len = (int) Math.min(len, fileLength - pos); if (len <= 0) { return -1; } mapped.position(pos); mapped.get(dst.array(), dst.position(), len); dst.position(dst.position() + len); pos += len; return len; } catch (IllegalArgumentException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; } catch (BufferUnderflowException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; } }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public FileChannel position(long pos) throws IOException { checkFileSizeLimit(pos); this.pos = (int) pos; return this; }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public synchronized FileChannel truncate(long newLength) throws IOException { if (newLength < size()) { setFileLength(newLength); } return this; }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public synchronized void setFileLength(long newLength) throws IOException { checkFileSizeLimit(newLength); int oldPos = pos; unMap(); for (int i = 0;; i++) { try { file.setLength(newLength); break; } catch (IOException e) { if (i > 16 || e.toString().indexOf("user-mapped section open") < 0) { throw e; } } System.gc(); } reMap(); pos = (int) Math.min(newLength, oldPos); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public void force(boolean metaData) throws IOException { mapped.force(); file.getFD().sync(); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public synchronized int write(ByteBuffer src) throws IOException { int len = src.remaining(); // check if need to expand file if (mapped.capacity() < pos + len) { setFileLength(pos + len); } mapped.position(pos); mapped.put(src); pos += len; return len; }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return file.getChannel().tryLock(); }
// in src/main/org/h2/store/fs/FilePathZip.java
public InputStream newInputStream() throws IOException { return new FileChannelInputStream(open("r")); }
// in src/main/org/h2/store/fs/FilePathZip.java
public FileChannel open(String mode) throws IOException { ZipFile file = openZipFile(); ZipEntry entry = file.getEntry(getEntryName()); if (entry == null) { throw new FileNotFoundException(name); } return new FileZip(file, entry); }
// in src/main/org/h2/store/fs/FilePathZip.java
private ZipFile openZipFile() throws IOException { String fileName = translateFileName(name); return new ZipFile(fileName); }
// in src/main/org/h2/store/fs/FilePathZip.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { if (!inTempDir) { throw new IOException("File system is read-only"); } return new FilePathDisk().getPath(name).createTempFile(suffix, deleteOnExit, true); }
// in src/main/org/h2/store/fs/FilePathZip.java
public int read(ByteBuffer dst) throws IOException { seek(); int len = in.read(dst.array(), dst.position(), dst.remaining()); if (len > 0) { dst.position(dst.position() + len); pos += len; inPos += len; } return len; }
// in src/main/org/h2/store/fs/FilePathZip.java
private void seek() throws IOException { if (inPos > pos) { if (in != null) { in.close(); } in = null; } if (in == null) { in = file.getInputStream(entry); inPos = 0; } if (inPos < pos) { long skip = pos - inPos; if (!skipUsingRead) { try { IOUtils.skipFully(in, skip); } catch (NullPointerException e) { // workaround for Android skipUsingRead = true; } } if (skipUsingRead) { while (skip > 0) { int s = (int) Math.min(SKIP_BUFFER.length, skip); s = in.read(SKIP_BUFFER, 0, s); skip -= s; } } inPos = pos; } }
// in src/main/org/h2/store/fs/FilePathZip.java
public FileChannel truncate(long newLength) throws IOException { throw new IOException("File is read-only"); }
// in src/main/org/h2/store/fs/FilePathZip.java
public void force(boolean metaData) throws IOException { // nothing to do }
// in src/main/org/h2/store/fs/FilePathZip.java
public int write(ByteBuffer src) throws IOException { throw new IOException("File is read-only"); }
// in src/main/org/h2/store/fs/FilePathZip.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return null; }
// in src/main/org/h2/store/fs/FilePathDisk.java
public InputStream newInputStream() throws IOException { if (name.indexOf(':') > 1) { // if the : is in position 1, a windows file access is assumed: C:.. or D: if (name.startsWith(CLASSPATH_PREFIX)) { String fileName = name.substring(CLASSPATH_PREFIX.length()); if (!fileName.startsWith("/")) { fileName = "/" + fileName; } InputStream in = getClass().getResourceAsStream(fileName); if (in == null) { in = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); } if (in == null) { throw new FileNotFoundException("resource " + fileName); } return in; } // otherwise an URL is assumed URL url = new URL(name); InputStream in = url.openStream(); return in; } FileInputStream in = new FileInputStream(name); IOUtils.trace("openFileInputStream", name, in); return in; }
// in src/main/org/h2/store/fs/FilePathDisk.java
public FileChannel open(String mode) throws IOException { FileDisk f; try { f = new FileDisk(name, mode); IOUtils.trace("open", name, f); } catch (IOException e) { freeMemoryAndFinalize(); try { f = new FileDisk(name, mode); } catch (IOException e2) { throw e; } } return f; }
// in src/main/org/h2/store/fs/FilePathDisk.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { String fileName = name + "."; String prefix = new File(fileName).getName(); File dir; if (inTempDir) { dir = new File(Utils.getProperty("java.io.tmpdir", ".")); } else { dir = new File(fileName).getAbsoluteFile().getParentFile(); } FileUtils.createDirectories(dir.getAbsolutePath()); while (true) { File f = new File(dir, prefix + getNextTempFileNamePart(false) + suffix); if (f.exists() || !f.createNewFile()) { // in theory, the random number could collide getNextTempFileNamePart(true); continue; } if (deleteOnExit) { try { f.deleteOnExit(); } catch (Throwable e) { // sometimes this throws a NullPointerException // at java.io.DeleteOnExitHook.add(DeleteOnExitHook.java:33) // we can ignore it } } return get(f.getCanonicalPath()); } }
// in src/main/org/h2/store/fs/FilePathDisk.java
public void force(boolean metaData) throws IOException { String m = SysProperties.SYNC_METHOD; if ("".equals(m)) { // do nothing } else if ("sync".equals(m)) { file.getFD().sync(); } else if ("force".equals(m)) { file.getChannel().force(true); } else if ("forceFalse".equals(m)) { file.getChannel().force(false); } else { file.getFD().sync(); } }
// in src/main/org/h2/store/fs/FilePathDisk.java
public FileChannel truncate(long newLength) throws IOException { if (newLength < file.length()) { // some implementations actually only support truncate file.setLength(newLength); } return this; }
// in src/main/org/h2/store/fs/FilePathDisk.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return file.getChannel().tryLock(); }
// in src/main/org/h2/store/fs/FilePathDisk.java
public void implCloseChannel() throws IOException { file.close(); }
// in src/main/org/h2/store/fs/FilePathDisk.java
public long position() throws IOException { return file.getFilePointer(); }
// in src/main/org/h2/store/fs/FilePathDisk.java
public long size() throws IOException { return file.length(); }
// in src/main/org/h2/store/fs/FilePathDisk.java
public int read(ByteBuffer dst) throws IOException { int len = file.read(dst.array(), dst.position(), dst.remaining()); if (len > 0) { dst.position(dst.position() + len); } return len; }
// in src/main/org/h2/store/fs/FilePathDisk.java
public FileChannel position(long pos) throws IOException { file.seek(pos); return this; }
// in src/main/org/h2/store/fs/FilePathDisk.java
public int write(ByteBuffer src) throws IOException { int len = src.remaining(); file.write(src.array(), src.position(), len); src.position(src.position() + len); return len; }
// in src/main/org/h2/store/fs/FileBase.java
public void force(boolean metaData) throws IOException { // ignore }
// in src/main/org/h2/store/fs/FileBase.java
public FileLock lock(long position, long size, boolean shared) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public MappedByteBuffer map(MapMode mode, long position, long size) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public int read(ByteBuffer dst, long position) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long transferFrom(ReadableByteChannel src, long position, long count) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long transferTo(long position, long count, WritableByteChannel target) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public FileLock tryLock(long position, long size, boolean shared) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public int write(ByteBuffer src, long position) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
protected void implCloseChannel() throws IOException { // ignore }
// in src/main/org/h2/store/fs/FileUtils.java
public static FileChannel open(String fileName, String mode) throws IOException { return FilePath.get(fileName).open(mode); }
// in src/main/org/h2/store/fs/FileUtils.java
public static InputStream newInputStream(String fileName) throws IOException { return FilePath.get(fileName).newInputStream(); }
// in src/main/org/h2/store/fs/FileUtils.java
public static void copy(String original, String copy) throws IOException { InputStream in = newInputStream(original); OutputStream out = newOutputStream(copy, false); IOUtils.copyAndClose(in, out); }
// in src/main/org/h2/store/fs/FileUtils.java
public static String createTempFile(String prefix, String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { return FilePath.get(prefix).createTempFile(suffix, deleteOnExit, inTempDir).toString(); }
// in src/main/org/h2/store/fs/FileUtils.java
public static void readFully(FileChannel channel, ByteBuffer dst) throws IOException { do { int r = channel.read(dst); if (r < 0) { throw new EOFException(); } } while (dst.remaining() > 0); }
// in src/main/org/h2/store/fs/FileUtils.java
public static void writeFully(FileChannel channel, ByteBuffer src) throws IOException { do { channel.write(src); } while (src.remaining() > 0); }
// in src/main/org/h2/store/PageStore.java
public synchronized int copyDirect(int pageId, OutputStream out) throws IOException { byte[] buffer = new byte[pageSize]; if (pageId >= pageCount) { return -1; } file.seek((long) pageId << pageSizeShift); file.readFullyDirect(buffer, 0, pageSize); readCount++; out.write(buffer, 0, pageSize); return pageId + 1; }
// in src/main/org/h2/store/FileStore.java
public void closeFile() throws IOException { file.close(); file = null; }
// in src/main/org/h2/store/FileStore.java
public void openFile() throws IOException { if (file == null) { file = FileUtils.open(name, mode); file.position(filePos); } }
// in src/main/org/h2/compress/LZFOutputStream.java
public void write(int b) throws IOException { if (pos >= buffer.length) { flush(); } buffer[pos++] = (byte) b; }
// in src/main/org/h2/compress/LZFOutputStream.java
private void compressAndWrite(byte[] buff, int len) throws IOException { if (len > 0) { ensureOutput(len); int compressed = compress.compress(buff, len, outBuffer, 0); if (compressed > len) { writeInt(-len); out.write(buff, 0, len); } else { writeInt(compressed); writeInt(len); out.write(outBuffer, 0, compressed); } } }
// in src/main/org/h2/compress/LZFOutputStream.java
private void writeInt(int x) throws IOException { out.write((byte) (x >> 24)); out.write((byte) (x >> 16)); out.write((byte) (x >> 8)); out.write((byte) x); }
// in src/main/org/h2/compress/LZFOutputStream.java
public void write(byte[] buff, int off, int len) throws IOException { while (len > 0) { int copy = Math.min(buffer.length - pos, len); System.arraycopy(buff, off, buffer, pos, copy); pos += copy; if (pos >= buffer.length) { flush(); } off += copy; len -= copy; } }
// in src/main/org/h2/compress/LZFOutputStream.java
public void flush() throws IOException { compressAndWrite(buffer, pos); pos = 0; }
// in src/main/org/h2/compress/LZFOutputStream.java
public void close() throws IOException { flush(); out.close(); }
// in src/main/org/h2/compress/LZFInputStream.java
private void fillBuffer() throws IOException { if (buffer != null && pos < bufferLength) { return; } int len = readInt(); if (decompress == null) { // EOF this.bufferLength = 0; } else if (len < 0) { len = -len; buffer = ensureSize(buffer, len); readFully(buffer, len); this.bufferLength = len; } else { inBuffer = ensureSize(inBuffer, len); int size = readInt(); readFully(inBuffer, len); buffer = ensureSize(buffer, size); try { decompress.expand(inBuffer, 0, len, buffer, 0, size); } catch (ArrayIndexOutOfBoundsException e) { DbException.convertToIOException(e); } this.bufferLength = size; } pos = 0; }
// in src/main/org/h2/compress/LZFInputStream.java
private void readFully(byte[] buff, int len) throws IOException { int off = 0; while (len > 0) { int l = in.read(buff, off, len); len -= l; off += l; } }
// in src/main/org/h2/compress/LZFInputStream.java
private int readInt() throws IOException { int x = in.read(); if (x < 0) { decompress = null; return 0; } x = (x << 24) + (in.read() << 16) + (in.read() << 8) + in.read(); return x; }
// in src/main/org/h2/compress/LZFInputStream.java
public int read() throws IOException { fillBuffer(); if (pos >= bufferLength) { return -1; } return buffer[pos++] & 255; }
// in src/main/org/h2/compress/LZFInputStream.java
public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
// in src/main/org/h2/compress/LZFInputStream.java
public int read(byte[] b, int off, int len) throws IOException { if (len == 0) { return 0; } int read = 0; while (len > 0) { int r = readBlock(b, off, len); if (r < 0) { break; } read += r; off += r; len -= r; } return read == 0 ? -1 : read; }
// in src/main/org/h2/compress/LZFInputStream.java
private int readBlock(byte[] b, int off, int len) throws IOException { fillBuffer(); if (pos >= bufferLength) { return -1; } int max = Math.min(len, bufferLength - pos); max = Math.min(max, b.length - off); System.arraycopy(buffer, pos, b, off, max); pos += max; return max; }
// in src/main/org/h2/compress/LZFInputStream.java
public void close() throws IOException { in.close(); }
// in src/main/org/h2/command/dml/ScriptCommand.java
private int writeLobStream(Value v) throws IOException { if (!tempLobTableCreated) { add("CREATE TABLE IF NOT EXISTS SYSTEM_LOB_STREAM" + "(ID INT NOT NULL, PART INT NOT NULL, CDATA VARCHAR, BDATA BINARY)", true); add("CREATE PRIMARY KEY SYSTEM_LOB_STREAM_PRIMARY_KEY " + "ON SYSTEM_LOB_STREAM(ID, PART)", true); add("CREATE ALIAS IF NOT EXISTS " + "SYSTEM_COMBINE_CLOB FOR \"" + this.getClass().getName() + ".combineClob\"", true); add("CREATE ALIAS IF NOT EXISTS " + "SYSTEM_COMBINE_BLOB FOR \"" + this.getClass().getName() + ".combineBlob\"", true); tempLobTableCreated = true; } int id = nextLobId++; switch (v.getType()) { case Value.BLOB: { byte[] bytes = new byte[lobBlockSize]; InputStream input = v.getInputStream(); try { for (int i = 0;; i++) { StringBuilder buff = new StringBuilder(lobBlockSize * 2); buff.append("INSERT INTO SYSTEM_LOB_STREAM VALUES(" + id + ", " + i + ", NULL, '"); int len = IOUtils.readFully(input, bytes, 0, lobBlockSize); if (len <= 0) { break; } buff.append(StringUtils.convertBytesToHex(bytes, len)).append("')"); String sql = buff.toString(); add(sql, true); } } finally { IOUtils.closeSilently(input); } break; } case Value.CLOB: { char[] chars = new char[lobBlockSize]; Reader reader = v.getReader(); try { for (int i = 0;; i++) { StringBuilder buff = new StringBuilder(lobBlockSize * 2); buff.append("INSERT INTO SYSTEM_LOB_STREAM VALUES(" + id + ", " + i + ", "); int len = IOUtils.readFully(reader, chars, lobBlockSize); if (len < 0) { break; } buff.append(StringUtils.quoteStringSQL(new String(chars, 0, len))). append(", NULL)"); String sql = buff.toString(); add(sql, true); } } finally { IOUtils.closeSilently(reader); } break; } default: DbException.throwInternalError("type:" + v.getType()); } return id; }
// in src/main/org/h2/command/dml/ScriptCommand.java
public static InputStream combineBlob(Connection conn, int id) throws SQLException { if (id < 0) { return null; } final ResultSet rs = getLobStream(conn, "BDATA", id); return new InputStream() { private InputStream current; private boolean closed; public int read() throws IOException { while (true) { try { if (current == null) { if (closed) { return -1; } if (!rs.next()) { close(); return -1; } current = rs.getBinaryStream(1); current = new BufferedInputStream(current); } int x = current.read(); if (x >= 0) { return x; } current = null; } catch (SQLException e) { throw DbException.convertToIOException(e); } } } public void close() throws IOException { if (closed) { return; } closed = true; try { rs.close(); } catch (SQLException e) { throw DbException.convertToIOException(e); } } }; }
// in src/main/org/h2/command/dml/ScriptCommand.java
public int read() throws IOException { while (true) { try { if (current == null) { if (closed) { return -1; } if (!rs.next()) { close(); return -1; } current = rs.getBinaryStream(1); current = new BufferedInputStream(current); } int x = current.read(); if (x >= 0) { return x; } current = null; } catch (SQLException e) { throw DbException.convertToIOException(e); } } }
// in src/main/org/h2/command/dml/ScriptCommand.java
public void close() throws IOException { if (closed) { return; } closed = true; try { rs.close(); } catch (SQLException e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/command/dml/ScriptCommand.java
public static Reader combineClob(Connection conn, int id) throws SQLException { if (id < 0) { return null; } final ResultSet rs = getLobStream(conn, "CDATA", id); return new Reader() { private Reader current; private boolean closed; public int read() throws IOException { while (true) { try { if (current == null) { if (closed) { return -1; } if (!rs.next()) { close(); return -1; } current = rs.getCharacterStream(1); current = new BufferedReader(current); } int x = current.read(); if (x >= 0) { return x; } current = null; } catch (SQLException e) { throw DbException.convertToIOException(e); } } } public void close() throws IOException { if (closed) { return; } closed = true; try { rs.close(); } catch (SQLException e) { throw DbException.convertToIOException(e); } } public int read(char[] buffer, int off, int len) throws IOException { if (len == 0) { return 0; } int c = read(); if (c == -1) { return -1; } buffer[off] = (char) c; int i = 1; for (; i < len; i++) { c = read(); if (c == -1) { break; } buffer[off + i] = (char) c; } return i; } }; }
// in src/main/org/h2/command/dml/ScriptCommand.java
public int read() throws IOException { while (true) { try { if (current == null) { if (closed) { return -1; } if (!rs.next()) { close(); return -1; } current = rs.getCharacterStream(1); current = new BufferedReader(current); } int x = current.read(); if (x >= 0) { return x; } current = null; } catch (SQLException e) { throw DbException.convertToIOException(e); } } }
// in src/main/org/h2/command/dml/ScriptCommand.java
public void close() throws IOException { if (closed) { return; } closed = true; try { rs.close(); } catch (SQLException e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/command/dml/ScriptCommand.java
public int read(char[] buffer, int off, int len) throws IOException { if (len == 0) { return 0; } int c = read(); if (c == -1) { return -1; } buffer[off] = (char) c; int i = 1; for (; i < len; i++) { c = read(); if (c == -1) { break; } buffer[off + i] = (char) c; } return i; }
// in src/main/org/h2/command/dml/ScriptCommand.java
private void add(String s, boolean insert) throws IOException { if (s == null) { return; } s += ";"; if (out != null) { byte[] buff = s.getBytes(charset); int len = MathUtils.roundUpInt(buff.length + lineSeparator.length, Constants.FILE_BLOCK_SIZE); buffer = Utils.copy(buff, buffer); if (len > buffer.length) { buffer = new byte[len]; } System.arraycopy(buff, 0, buffer, 0, buff.length); for (int i = buff.length; i < len - lineSeparator.length; i++) { buffer[i] = ' '; } for (int j = 0, i = len - lineSeparator.length; i < len; i++, j++) { buffer[i] = lineSeparator[j]; } out.write(buffer, 0, len); if (!insert) { Value[] row = { ValueString.get(s) }; result.addRow(row); } } else { Value[] row = { ValueString.get(s) }; result.addRow(row); } }
// in src/main/org/h2/command/dml/BackupCommand.java
private void backupPageStore(ZipOutputStream out, String fileName, PageStore store) throws IOException { Database db = session.getDatabase(); fileName = FileUtils.getName(fileName); out.putNextEntry(new ZipEntry(fileName)); int pos = 0; try { store.setBackup(true); while (true) { pos = store.copyDirect(pos, out); if (pos < 0) { break; } int max = store.getPageCount(); db.setProgress(DatabaseEventListener.STATE_BACKUP_FILE, fileName, pos, max); } } finally { store.setBackup(false); } out.closeEntry(); }
// in src/main/org/h2/command/dml/BackupCommand.java
private static void backupFile(ZipOutputStream out, String base, String fn) throws IOException { String f = FileUtils.toRealPath(fn); base = FileUtils.toRealPath(base); if (!f.startsWith(base)) { DbException.throwInternalError(f + " does not start with " + base); } f = f.substring(base.length()); f = correctFileName(f); out.putNextEntry(new ZipEntry(f)); InputStream in = FileUtils.newInputStream(fn); IOUtils.copyAndCloseInput(in, out); out.closeEntry(); }
// in src/main/org/h2/command/CommandRemote.java
private void sendParameters(Transfer transfer) throws IOException { int len = parameters.size(); transfer.writeInt(len); for (ParameterInterface p : parameters) { transfer.writeValue(p.getParamValue()); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public Writer setCharacterStream(long pos) throws SQLException { try { if (isDebugEnabled()) { debugCodeCall("setCharacterStream(" + pos + ");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } if (value.getPrecision() != 0) { throw DbException.getInvalidValueException("length", value.getPrecision()); } final JdbcConnection c = conn; // PipedReader / PipedWriter are a lot slower // than PipedInputStream / PipedOutputStream // (Sun/Oracle Java 1.6.0_20) final PipedInputStream in = new PipedInputStream(); final Task task = new Task() { public void call() { value = c.createClob(IOUtils.getReader(in), -1); } }; PipedOutputStream out = new PipedOutputStream(in) { public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } } }; task.execute(); return IOUtils.getBufferedWriter(out); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public OutputStream setBinaryStream(long pos) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBinaryStream("+pos+");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } if (value.getPrecision() != 0) { throw DbException.getInvalidValueException("length", value.getPrecision()); } final JdbcConnection c = conn; final PipedInputStream in = new PipedInputStream(); final Task task = new Task() { public void call() { value = c.createBlob(in, -1); } }; PipedOutputStream out = new PipedOutputStream(in) { public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } } }; task.execute(); return new BufferedOutputStream(out); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/bnf/Bnf.java
public static Bnf getInstance(Reader csv) throws SQLException, IOException { Bnf bnf = new Bnf(); if (csv == null) { byte[] data = Utils.getResource("/org/h2/res/help.csv"); csv = new InputStreamReader(new ByteArrayInputStream(data)); } bnf.parse(csv); return bnf; }
// in src/main/org/h2/bnf/Bnf.java
private void parse(Reader reader) throws SQLException, IOException { Rule functions = null; statements = New.arrayList(); Csv csv = new Csv(); csv.setLineCommentCharacter('#'); ResultSet rs = csv.read(reader, null); while (rs.next()) { String section = rs.getString("SECTION").trim(); if (section.startsWith("System")) { continue; } String topic = rs.getString("TOPIC"); syntax = rs.getString("SYNTAX").trim(); currentTopic = section; tokens = tokenize(); index = 0; Rule rule = parseRule(); if (section.startsWith("Command")) { rule = new RuleList(rule, new RuleElement(";\n\n", currentTopic), false); } RuleHead head = addRule(topic, section, rule); if (section.startsWith("Function")) { if (functions == null) { functions = rule; } else { functions = new RuleList(rule, functions, true); } } else if (section.startsWith("Commands")) { statements.add(head); } } addRule("@func@", "Function", functions); addFixedRule("@ymd@", RuleFixed.YMD); addFixedRule("@hms@", RuleFixed.HMS); addFixedRule("@nanos@", RuleFixed.NANOS); addFixedRule("anything_except_single_quote", RuleFixed.ANY_EXCEPT_SINGLE_QUOTE); addFixedRule("anything_except_double_quote", RuleFixed.ANY_EXCEPT_DOUBLE_QUOTE); addFixedRule("anything_until_end_of_line", RuleFixed.ANY_UNTIL_EOL); addFixedRule("anything_until_end_comment", RuleFixed.ANY_UNTIL_END); addFixedRule("anything_except_two_dollar_signs", RuleFixed.ANY_EXCEPT_2_DOLLAR); addFixedRule("anything", RuleFixed.ANY_WORD); addFixedRule("@hex_start@", RuleFixed.HEX_START); addFixedRule("@concat@", RuleFixed.CONCAT); addFixedRule("@az_@", RuleFixed.AZ_UNDERSCORE); addFixedRule("@af@", RuleFixed.AF); addFixedRule("@digit@", RuleFixed.DIGIT); addFixedRule("@open_bracket@", RuleFixed.OPEN_BRACKET); addFixedRule("@close_bracket@", RuleFixed.CLOSE_BRACKET); }
// in src/main/org/h2/engine/SessionRemote.java
private Transfer initTransfer(ConnectionInfo ci, String db, String server) throws IOException { Socket socket = NetUtils.createSocket(server, Constants.DEFAULT_TCP_PORT, ci.isSSL()); Transfer trans = new Transfer(this); trans.setSocket(socket); trans.setSSL(ci.isSSL()); trans.init(); trans.writeInt(Constants.TCP_PROTOCOL_VERSION_6); trans.writeInt(Constants.TCP_PROTOCOL_VERSION_11); trans.writeString(db); trans.writeString(ci.getOriginalURL()); trans.writeString(ci.getUserName()); trans.writeBytes(ci.getUserPasswordHash()); trans.writeBytes(ci.getFilePasswordHash()); String[] keys = ci.getKeys(); trans.writeInt(keys.length); for (String key : keys) { trans.writeString(key).writeString(ci.getProperty(key)); } try { done(trans); clientVersion = trans.readInt(); trans.setVersion(clientVersion); trans.writeInt(SessionRemote.SESSION_SET_ID); trans.writeString(sessionId); done(trans); } catch (DbException e) { trans.close(); throw e; } autoCommit = true; return trans; }
// in src/main/org/h2/engine/SessionRemote.java
public void done(Transfer transfer) throws IOException { transfer.flush(); int status = transfer.readInt(); if (status == STATUS_ERROR) { String sqlstate = transfer.readString(); String message = transfer.readString(); String sql = transfer.readString(); int errorCode = transfer.readInt(); String stackTrace = transfer.readString(); JdbcSQLException s = new JdbcSQLException(message, sql, sqlstate, errorCode, null, stackTrace); if (errorCode == ErrorCode.CONNECTION_BROKEN_1) { // allow re-connect IOException e = new IOException(s.toString()); e.initCause(s); throw e; } throw DbException.convert(s); } else if (status == STATUS_CLOSED) { transferList = null; } else if (status == STATUS_OK_STATE_CHANGED) { sessionStateChanged = true; } else if (status == STATUS_OK) { // ok } else { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "unexpected status " + status); } }
// in src/main/org/h2/util/SortedProperties.java
public static synchronized SortedProperties loadProperties(String fileName) throws IOException { SortedProperties prop = new SortedProperties(); if (FileUtils.exists(fileName)) { InputStream in = null; try { in = FileUtils.newInputStream(fileName); prop.load(in); } finally { if (in != null) { in.close(); } } } return prop; }
// in src/main/org/h2/util/SortedProperties.java
public synchronized void store(String fileName) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); store(out, null); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); InputStreamReader reader = new InputStreamReader(in, "ISO8859-1"); LineNumberReader r = new LineNumberReader(reader); Writer w; try { w = new OutputStreamWriter(FileUtils.newOutputStream(fileName, false)); } catch (Exception e) { throw DbException.convertToIOException(e); } PrintWriter writer = new PrintWriter(new BufferedWriter(w)); while (true) { String line = r.readLine(); if (line == null) { break; } if (!line.startsWith("#")) { writer.print(line + "\n"); } } writer.close(); }
// in src/main/org/h2/util/ScriptReader.java
private String readStatementLoop() throws IOException { bufferStart = bufferPos; int c = read(); while (true) { if (c < 0) { endOfFile = true; if (bufferPos - 1 == bufferStart) { return null; } break; } else if (c == ';') { break; } switch (c) { case '$': { c = read(); if (c == '$' && (bufferPos - bufferStart < 3 || buffer[bufferPos - 3] <= ' ')) { // dollar quoted string while (true) { c = read(); if (c < 0) { break; } if (c == '$') { c = read(); if (c < 0) { break; } if (c == '$') { break; } } } c = read(); } break; } case '\'': while (true) { c = read(); if (c < 0) { break; } if (c == '\'') { break; } } c = read(); break; case '"': while (true) { c = read(); if (c < 0) { break; } if (c == '\"') { break; } } c = read(); break; case '/': { c = read(); if (c == '*') { // block comment startRemark(false); while (true) { c = read(); if (c < 0) { break; } if (c == '*') { c = read(); if (c < 0) { clearRemark(); break; } if (c == '/') { endRemark(); break; } } } c = read(); } else if (c == '/') { // single line comment startRemark(false); while (true) { c = read(); if (c < 0) { clearRemark(); break; } if (c == '\r' || c == '\n') { endRemark(); break; } } c = read(); } break; } case '-': { c = read(); if (c == '-') { // single line comment startRemark(false); while (true) { c = read(); if (c < 0) { clearRemark(); break; } if (c == '\r' || c == '\n') { endRemark(); break; } } c = read(); } break; } default: { c = read(); } } } return new String(buffer, bufferStart, bufferPos - 1 - bufferStart); }
// in src/main/org/h2/util/ScriptReader.java
private int read() throws IOException { if (bufferPos >= bufferEnd) { return readBuffer(); } return buffer[bufferPos++]; }
// in src/main/org/h2/util/ScriptReader.java
private int readBuffer() throws IOException { if (endOfFile) { return -1; } int keep = bufferPos - bufferStart; if (keep > 0) { char[] src = buffer; if (keep + Constants.IO_BUFFER_SIZE > src.length) { buffer = new char[src.length * 2]; } System.arraycopy(src, bufferStart, buffer, 0, keep); } remarkStart -= bufferStart; bufferStart = 0; bufferPos = keep; int len = reader.read(buffer, keep, Constants.IO_BUFFER_SIZE); if (len == -1) { // ensure bufferPos > bufferEnd bufferEnd = -1024; endOfFile = true; // ensure the right number of characters are read // in case the input buffer is still used bufferPos++; return -1; } bufferEnd = keep + len; return buffer[bufferPos++]; }
// in src/main/org/h2/util/SourceCompiler.java
private static void copyInThread(final InputStream in, final OutputStream out) { new Task() { public void call() throws IOException { IOUtils.copy(in, out); } }.execute(); }
// in src/main/org/h2/util/SourceCompiler.java
public void call() throws IOException { IOUtils.copy(in, out); }
// in src/main/org/h2/util/NetUtils.java
public static Socket createLoopbackSocket(int port, boolean ssl) throws IOException { InetAddress address = getBindAddress(); if (address == null) { address = InetAddress.getLocalHost(); } try { return createSocket(getHostAddress(address), port, ssl); } catch (IOException e) { try { return createSocket("localhost", port, ssl); } catch (IOException e2) { // throw the original exception throw e; } } }
// in src/main/org/h2/util/NetUtils.java
public static Socket createSocket(String server, int defaultPort, boolean ssl) throws IOException { int port = defaultPort; // IPv6: RFC 2732 format is '[a:b:c:d:e:f:g:h]' or // '[a:b:c:d:e:f:g:h]:port' // RFC 2396 format is 'a.b.c.d' or 'a.b.c.d:port' or 'hostname' or // 'hostname:port' int startIndex = server.startsWith("[") ? server.indexOf(']') : 0; int idx = server.indexOf(':', startIndex); if (idx >= 0) { port = Integer.decode(server.substring(idx + 1)); server = server.substring(0, idx); } InetAddress address = InetAddress.getByName(server); return createSocket(address, port, ssl); }
// in src/main/org/h2/util/NetUtils.java
public static Socket createSocket(InetAddress address, int port, boolean ssl) throws IOException { long start = System.currentTimeMillis(); for (int i = 0;; i++) { try { if (ssl) { return CipherFactory.createSocket(address, port); } Socket socket = new Socket(); socket.connect(new InetSocketAddress(address, port), SysProperties.SOCKET_CONNECT_TIMEOUT); return socket; } catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } } } }
// in src/main/org/h2/util/IOUtils.java
public static void skipFully(InputStream in, long skip) throws IOException { try { while (skip > 0) { long skipped = in.skip(skip); if (skipped <= 0) { throw new EOFException(); } skip -= skipped; } } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/util/IOUtils.java
public static void skipFully(Reader reader, long skip) throws IOException { try { while (skip > 0) { long skipped = reader.skip(skip); if (skipped <= 0) { throw new EOFException(); } skip -= skipped; } } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/util/IOUtils.java
public static long copyAndClose(InputStream in, OutputStream out) throws IOException { try { long len = copyAndCloseInput(in, out); out.close(); return len; } catch (Exception e) { throw DbException.convertToIOException(e); } finally { closeSilently(out); } }
// in src/main/org/h2/util/IOUtils.java
public static long copyAndCloseInput(InputStream in, OutputStream out) throws IOException { try { return copy(in, out); } catch (Exception e) { throw DbException.convertToIOException(e); } finally { closeSilently(in); } }
// in src/main/org/h2/util/IOUtils.java
public static long copy(InputStream in, OutputStream out) throws IOException { return copy(in, out, Long.MAX_VALUE); }
// in src/main/org/h2/util/IOUtils.java
public static long copy(InputStream in, OutputStream out, long length) throws IOException { try { long copied = 0; int len = (int) Math.min(length, Constants.IO_BUFFER_SIZE); byte[] buffer = new byte[len]; while (length > 0) { len = in.read(buffer, 0, len); if (len < 0) { break; } if (out != null) { out.write(buffer, 0, len); } copied += len; length -= len; len = (int) Math.min(length, Constants.IO_BUFFER_SIZE); } return copied; } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/util/IOUtils.java
public static long copyAndCloseInput(Reader in, Writer out, long length) throws IOException { try { long copied = 0; int len = (int) Math.min(length, Constants.IO_BUFFER_SIZE); char[] buffer = new char[len]; while (length > 0) { len = in.read(buffer, 0, len); if (len < 0) { break; } if (out != null) { out.write(buffer, 0, len); } length -= len; len = (int) Math.min(length, Constants.IO_BUFFER_SIZE); copied += len; } return copied; } catch (Exception e) { throw DbException.convertToIOException(e); } finally { in.close(); } }
// in src/main/org/h2/util/IOUtils.java
public static byte[] readBytesAndClose(InputStream in, int length) throws IOException { try { if (length <= 0) { length = Integer.MAX_VALUE; } int block = Math.min(Constants.IO_BUFFER_SIZE, length); ByteArrayOutputStream out = new ByteArrayOutputStream(block); copy(in, out, length); return out.toByteArray(); } catch (Exception e) { throw DbException.convertToIOException(e); } finally { in.close(); } }
// in src/main/org/h2/util/IOUtils.java
public static String readStringAndClose(Reader in, int length) throws IOException { try { if (length <= 0) { length = Integer.MAX_VALUE; } int block = Math.min(Constants.IO_BUFFER_SIZE, length); StringWriter out = new StringWriter(block); copyAndCloseInput(in, out, length); return out.toString(); } finally { in.close(); } }
// in src/main/org/h2/util/IOUtils.java
public static int readFully(InputStream in, byte[] buffer, int off, int max) throws IOException { try { int len = Math.min(max, buffer.length); int result = 0; while (len > 0) { int l = in.read(buffer, off, len); if (l < 0) { break; } result += l; off += l; len -= l; } return result; } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/util/IOUtils.java
public static int readFully(Reader in, char[] buffer, int max) throws IOException { try { int off = 0, len = Math.min(max, buffer.length); if (len == 0) { return 0; } while (true) { int l = len - off; if (l <= 0) { break; } l = in.read(buffer, off, l); if (l < 0) { break; } off += l; } return off <= 0 ? -1 : off; } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/util/Utils.java
public static Object deserialize(byte[] data) { try { ByteArrayInputStream in = new ByteArrayInputStream(data); ObjectInputStream is; if (SysProperties.USE_THREAD_CONTEXT_CLASS_LOADER) { final ClassLoader loader = Thread.currentThread().getContextClassLoader(); is = new ObjectInputStream(in) { protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { try { return Class.forName(desc.getName(), true, loader); } catch (ClassNotFoundException e) { return super.resolveClass(desc); } } }; } else { is = new ObjectInputStream(in); } return is.readObject(); } catch (Throwable e) { throw DbException.get(ErrorCode.DESERIALIZATION_FAILED_1, e, e.toString()); } }
// in src/main/org/h2/util/Utils.java
protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { try { return Class.forName(desc.getName(), true, loader); } catch (ClassNotFoundException e) { return super.resolveClass(desc); } }
// in src/main/org/h2/util/Utils.java
public static byte[] getResource(String name) throws IOException { byte[] data = RESOURCES.get(name); if (data == null) { data = loadResource(name); RESOURCES.put(name, data); } return data == null ? EMPTY_BYTES : data; }
// in src/main/org/h2/util/Utils.java
private static byte[] loadResource(String name) throws IOException { InputStream in = Utils.class.getResourceAsStream("data.zip"); if (in == null) { in = Utils.class.getResourceAsStream(name); if (in == null) { return null; } return IOUtils.readBytesAndClose(in, 0); } ZipInputStream zipIn = new ZipInputStream(in); try { while (true) { ZipEntry entry = zipIn.getNextEntry(); if (entry == null) { break; } String entryName = entry.getName(); if (!entryName.startsWith("/")) { entryName = "/" + entryName; } if (entryName.equals(name)) { ByteArrayOutputStream out = new ByteArrayOutputStream(); IOUtils.copy(zipIn, out); zipIn.closeEntry(); return out.toByteArray(); } zipIn.closeEntry(); } } catch (IOException e) { // if this happens we have a real problem e.printStackTrace(); } finally { zipIn.close(); } return null; }
// in src/main/org/h2/util/AutoCloseInputStream.java
private int autoClose(int x) throws IOException { if (x < 0) { close(); } return x; }
// in src/main/org/h2/util/AutoCloseInputStream.java
public void close() throws IOException { if (!closed) { in.close(); closed = true; } }
// in src/main/org/h2/util/AutoCloseInputStream.java
public int read(byte[] b, int off, int len) throws IOException { return closed ? -1 : autoClose(in.read(b, off, len)); }
// in src/main/org/h2/util/AutoCloseInputStream.java
public int read(byte[] b) throws IOException { return closed ? -1 : autoClose(in.read(b)); }
// in src/main/org/h2/util/AutoCloseInputStream.java
public int read() throws IOException { return closed ? -1 : autoClose(in.read()); }
// in src/main/org/h2/server/pg/PgServerThread.java
private String readString() throws IOException { ByteArrayOutputStream buff = new ByteArrayOutputStream(); while (true) { int x = dataIn.read(); if (x <= 0) { break; } buff.write(x); } return new String(buff.toByteArray(), getEncoding()); }
// in src/main/org/h2/server/pg/PgServerThread.java
private int readInt() throws IOException { return dataIn.readInt(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private int readShort() throws IOException { return dataIn.readShort(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private byte readByte() throws IOException { return dataIn.readByte(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void readFully(byte[] buff) throws IOException { dataIn.readFully(buff); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void process() throws IOException { int x; if (initDone) { x = dataInRaw.read(); if (x < 0) { stop = true; return; } } else { x = 0; } int len = dataInRaw.readInt(); len -= 4; byte[] data = Utils.newBytes(len); dataInRaw.readFully(data, 0, len); dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len)); switchBlock: switch (x) { case 0: server.trace("Init"); int version = readInt(); if (version == 80877102) { server.trace("CancelRequest (not supported)"); server.trace(" pid: " + readInt()); server.trace(" key: " + readInt()); } else if (version == 80877103) { server.trace("SSLRequest"); out.write('N'); } else { server.trace("StartupMessage"); server.trace(" version " + version + " (" + (version >> 16) + "." + (version & 0xff) + ")"); while (true) { String param = readString(); if (param.length() == 0) { break; } String value = readString(); if ("user".equals(param)) { this.userName = value; } else if ("database".equals(param)) { this.databaseName = value; } else if ("client_encoding".equals(param)) { // UTF8 clientEncoding = value; } else if ("DateStyle".equals(param)) { dateStyle = value; } // extra_float_digits 2 // geqo on (Genetic Query Optimization) server.trace(" param " + param + "=" + value); } sendAuthenticationCleartextPassword(); initDone = true; } break; case 'p': { server.trace("PasswordMessage"); String password = readString(); try { Properties info = new Properties(); info.put("MODE", "PostgreSQL"); info.put("USER", userName); info.put("PASSWORD", password); String url = "jdbc:h2:" + databaseName; ConnectionInfo ci = new ConnectionInfo(url, info); String baseDir = server.getBaseDir(); if (baseDir == null) { baseDir = SysProperties.getBaseDir(); } if (baseDir != null) { ci.setBaseDir(baseDir); } if (server.getIfExists()) { ci.setProperty("IFEXISTS", "TRUE"); } conn = new JdbcConnection(ci, false); // can not do this because when called inside // DriverManager.getConnection, a deadlock occurs // conn = DriverManager.getConnection(url, userName, password); initDb(); sendAuthenticationOk(); } catch (Exception e) { e.printStackTrace(); stop = true; } break; } case 'P': { server.trace("Parse"); Prepared p = new Prepared(); p.name = readString(); p.sql = getSQL(readString()); int count = readShort(); p.paramType = new int[count]; for (int i = 0; i < count; i++) { int type = readInt(); server.checkType(type); p.paramType[i] = type; } try { p.prep = (JdbcPreparedStatement) conn.prepareStatement(p.sql); prepared.put(p.name, p); sendParseComplete(); } catch (Exception e) { sendErrorResponse(e); } break; } case 'B': { server.trace("Bind"); Portal portal = new Portal(); portal.name = readString(); String prepName = readString(); Prepared prep = prepared.get(prepName); if (prep == null) { sendErrorResponse("Prepared not found"); break; } portal.prep = prep; portals.put(portal.name, portal); int formatCodeCount = readShort(); int[] formatCodes = new int[formatCodeCount]; for (int i = 0; i < formatCodeCount; i++) { formatCodes[i] = readShort(); } int paramCount = readShort(); for (int i = 0; i < paramCount; i++) { int paramLen = readInt(); byte[] d2 = Utils.newBytes(paramLen); readFully(d2); try { setParameter(prep.prep, i, d2, formatCodes); } catch (Exception e) { sendErrorResponse(e); break switchBlock; } } int resultCodeCount = readShort(); portal.resultColumnFormat = new int[resultCodeCount]; for (int i = 0; i < resultCodeCount; i++) { portal.resultColumnFormat[i] = readShort(); } sendBindComplete(); break; } case 'C': { char type = (char) readByte(); String name = readString(); server.trace("Close"); if (type == 'S') { Prepared p = prepared.remove(name); if (p != null) { JdbcUtils.closeSilently(p.prep); } } else if (type == 'P') { portals.remove(name); } else { server.trace("expected S or P, got " + type); sendErrorResponse("expected S or P"); break; } sendCloseComplete(); break; } case 'D': { char type = (char) readByte(); String name = readString(); server.trace("Describe"); if (type == 'S') { Prepared p = prepared.get(name); if (p == null) { sendErrorResponse("Prepared not found: " + name); } else { sendParameterDescription(p); } } else if (type == 'P') { Portal p = portals.get(name); if (p == null) { sendErrorResponse("Portal not found: " + name); } else { PreparedStatement prep = p.prep.prep; try { ResultSetMetaData meta = prep.getMetaData(); sendRowDescription(meta); } catch (Exception e) { sendErrorResponse(e); } } } else { server.trace("expected S or P, got " + type); sendErrorResponse("expected S or P"); } break; } case 'E': { String name = readString(); server.trace("Execute"); Portal p = portals.get(name); if (p == null) { sendErrorResponse("Portal not found: " + name); break; } int maxRows = readShort(); Prepared prepared = p.prep; JdbcPreparedStatement prep = prepared.prep; server.trace(prepared.sql); try { prep.setMaxRows(maxRows); boolean result = prep.execute(); if (result) { try { ResultSet rs = prep.getResultSet(); ResultSetMetaData meta = rs.getMetaData(); sendRowDescription(meta); while (rs.next()) { sendDataRow(rs); } sendCommandComplete(prep, 0); } catch (Exception e) { sendErrorResponse(e); } } else { sendCommandComplete(prep, prep.getUpdateCount()); } } catch (Exception e) { sendErrorResponse(e); } break; } case 'S': { server.trace("Sync"); sendReadyForQuery(); break; } case 'Q': { server.trace("Query"); String query = readString(); ScriptReader reader = new ScriptReader(new StringReader(query)); while (true) { JdbcStatement stat = null; try { String s = reader.readStatement(); if (s == null) { break; } s = getSQL(s); stat = (JdbcStatement) conn.createStatement(); boolean result = stat.execute(s); if (result) { ResultSet rs = stat.getResultSet(); ResultSetMetaData meta = rs.getMetaData(); try { sendRowDescription(meta); while (rs.next()) { sendDataRow(rs); } sendCommandComplete(stat, 0); } catch (Exception e) { sendErrorResponse(e); break; } } else { sendCommandComplete(stat, stat.getUpdateCount()); } } catch (SQLException e) { sendErrorResponse(e); break; } finally { JdbcUtils.closeSilently(stat); } } sendReadyForQuery(); break; } case 'X': { server.trace("Terminate"); close(); break; } default: server.trace("Unsupported: " + x + " (" + (char) x + ")"); break; } }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendCommandComplete(JdbcStatement stat, int updateCount) throws IOException { startMessage('C'); switch (stat.getLastExecutedCommandType()) { case CommandInterface.INSERT: writeStringPart("INSERT 0 "); writeString(Integer.toString(updateCount)); break; case CommandInterface.UPDATE: writeStringPart("UPDATE "); writeString(Integer.toString(updateCount)); break; case CommandInterface.DELETE: writeStringPart("DELETE "); writeString(Integer.toString(updateCount)); break; case CommandInterface.SELECT: case CommandInterface.CALL: writeString("SELECT"); break; case CommandInterface.BEGIN: writeString("BEGIN"); break; default: server.trace("check CommandComplete tag for command " + stat); writeStringPart("UPDATE "); writeString(Integer.toString(updateCount)); } sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendErrorResponse(Exception re) throws IOException { SQLException e = DbException.toSQLException(re); server.traceError(e); startMessage('E'); write('S'); writeString("ERROR"); write('C'); writeString(e.getSQLState()); write('M'); writeString(e.getMessage()); write('D'); writeString(e.toString()); write(0); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendParameterDescription(Prepared p) throws IOException { try { PreparedStatement prep = p.prep; ParameterMetaData meta = prep.getParameterMetaData(); int count = meta.getParameterCount(); startMessage('t'); writeShort(count); for (int i = 0; i < count; i++) { int type; if (p.paramType != null && p.paramType[i] != 0) { type = p.paramType[i]; } else { type = PgServer.PG_TYPE_VARCHAR; } server.checkType(type); writeInt(type); } sendMessage(); } catch (Exception e) { sendErrorResponse(e); } }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendNoData() throws IOException { startMessage('n'); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendErrorResponse(String message) throws IOException { server.trace("Exception: " + message); startMessage('E'); write('S'); writeString("ERROR"); write('C'); // PROTOCOL VIOLATION writeString("08P01"); write('M'); writeString(message); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendParseComplete() throws IOException { startMessage('1'); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendBindComplete() throws IOException { startMessage('2'); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendCloseComplete() throws IOException { startMessage('3'); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendAuthenticationCleartextPassword() throws IOException { startMessage('R'); writeInt(3); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendAuthenticationOk() throws IOException { startMessage('R'); writeInt(0); sendMessage(); sendParameterStatus("client_encoding", clientEncoding); sendParameterStatus("DateStyle", dateStyle); sendParameterStatus("integer_datetimes", "off"); sendParameterStatus("is_superuser", "off"); sendParameterStatus("server_encoding", "SQL_ASCII"); sendParameterStatus("server_version", "8.1.4"); sendParameterStatus("session_authorization", userName); sendParameterStatus("standard_conforming_strings", "off"); // TODO PostgreSQL TimeZone sendParameterStatus("TimeZone", "CET"); sendBackendKeyData(); sendReadyForQuery(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendReadyForQuery() throws IOException { startMessage('Z'); char c; try { if (conn.getAutoCommit()) { // idle c = 'I'; } else { // in a transaction block c = 'T'; } } catch (SQLException e) { // failed transaction block c = 'E'; } write((byte) c); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendBackendKeyData() throws IOException { startMessage('K'); writeInt(processId); writeInt(processId); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void writeString(String s) throws IOException { writeStringPart(s); write(0); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void writeStringPart(String s) throws IOException { write(s.getBytes(getEncoding())); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void writeInt(int i) throws IOException { dataOut.writeInt(i); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void writeShort(int i) throws IOException { dataOut.writeShort(i); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void write(byte[] data) throws IOException { dataOut.write(data); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void write(int b) throws IOException { dataOut.write(b); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendMessage() throws IOException { dataOut.flush(); byte[] buff = outBuffer.toByteArray(); int len = buff.length; dataOut = new DataOutputStream(out); dataOut.write(messageType); dataOut.writeInt(len + 4); dataOut.write(buff); dataOut.flush(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendParameterStatus(String param, String value) throws IOException { startMessage('S'); writeString(param); writeString(value); sendMessage(); }
// in src/main/org/h2/server/TcpServerThread.java
private void setParameters(Command command) throws IOException { int len = transfer.readInt(); ArrayList<? extends ParameterInterface> params = command.getParameters(); for (int i = 0; i < len; i++) { Parameter p = (Parameter) params.get(i); p.setValue(transfer.readValue()); } }
// in src/main/org/h2/server/TcpServerThread.java
private void process() throws IOException { int operation = transfer.readInt(); switch (operation) { case SessionRemote.SESSION_PREPARE_READ_PARAMS: case SessionRemote.SESSION_PREPARE: { int id = transfer.readInt(); String sql = transfer.readString(); int old = session.getModificationId(); Command command = session.prepareLocal(sql); boolean readonly = command.isReadOnly(); cache.addObject(id, command); boolean isQuery = command.isQuery(); ArrayList<? extends ParameterInterface> params = command.getParameters(); transfer.writeInt(getState(old)).writeBoolean(isQuery).writeBoolean(readonly) .writeInt(params.size()); if (operation == SessionRemote.SESSION_PREPARE_READ_PARAMS) { for (ParameterInterface p : params) { ParameterRemote.writeMetaData(transfer, p); } } transfer.flush(); break; } case SessionRemote.SESSION_CLOSE: { stop = true; closeSession(); transfer.writeInt(SessionRemote.STATUS_OK).flush(); close(); break; } case SessionRemote.COMMAND_COMMIT: { if (commit == null) { commit = session.prepareLocal("COMMIT"); } int old = session.getModificationId(); commit.executeUpdate(); transfer.writeInt(getState(old)).flush(); break; } case SessionRemote.COMMAND_GET_META_DATA: { int id = transfer.readInt(); int objectId = transfer.readInt(); Command command = (Command) cache.getObject(id, false); ResultInterface result = command.getMetaData(); cache.addObject(objectId, result); int columnCount = result.getVisibleColumnCount(); transfer.writeInt(SessionRemote.STATUS_OK).writeInt(columnCount).writeInt(0); for (int i = 0; i < columnCount; i++) { ResultColumn.writeColumn(transfer, result, i); } transfer.flush(); break; } case SessionRemote.COMMAND_EXECUTE_QUERY: { int id = transfer.readInt(); int objectId = transfer.readInt(); int maxRows = transfer.readInt(); int fetchSize = transfer.readInt(); Command command = (Command) cache.getObject(id, false); setParameters(command); int old = session.getModificationId(); ResultInterface result = command.executeQuery(maxRows, false); cache.addObject(objectId, result); int columnCount = result.getVisibleColumnCount(); int state = getState(old); transfer.writeInt(state).writeInt(columnCount); int rowCount = result.getRowCount(); transfer.writeInt(rowCount); for (int i = 0; i < columnCount; i++) { ResultColumn.writeColumn(transfer, result, i); } int fetch = Math.min(rowCount, fetchSize); for (int i = 0; i < fetch; i++) { sendRow(result); } transfer.flush(); break; } case SessionRemote.COMMAND_EXECUTE_UPDATE: { int id = transfer.readInt(); Command command = (Command) cache.getObject(id, false); setParameters(command); int old = session.getModificationId(); int updateCount = command.executeUpdate(); int status; if (session.isClosed()) { status = SessionRemote.STATUS_CLOSED; } else { status = getState(old); } transfer.writeInt(status).writeInt(updateCount).writeBoolean(session.getAutoCommit()); transfer.flush(); break; } case SessionRemote.COMMAND_CLOSE: { int id = transfer.readInt(); Command command = (Command) cache.getObject(id, true); if (command != null) { command.close(); cache.freeObject(id); } break; } case SessionRemote.RESULT_FETCH_ROWS: { int id = transfer.readInt(); int count = transfer.readInt(); ResultInterface result = (ResultInterface) cache.getObject(id, false); transfer.writeInt(SessionRemote.STATUS_OK); for (int i = 0; i < count; i++) { sendRow(result); } transfer.flush(); break; } case SessionRemote.RESULT_RESET: { int id = transfer.readInt(); ResultInterface result = (ResultInterface) cache.getObject(id, false); result.reset(); break; } case SessionRemote.RESULT_CLOSE: { int id = transfer.readInt(); ResultInterface result = (ResultInterface) cache.getObject(id, true); if (result != null) { result.close(); cache.freeObject(id); } break; } case SessionRemote.CHANGE_ID: { int oldId = transfer.readInt(); int newId = transfer.readInt(); Object obj = cache.getObject(oldId, false); cache.freeObject(oldId); cache.addObject(newId, obj); break; } case SessionRemote.SESSION_SET_ID: { sessionId = transfer.readString(); transfer.writeInt(SessionRemote.STATUS_OK).flush(); break; } case SessionRemote.SESSION_SET_AUTOCOMMIT: { boolean autoCommit = transfer.readBoolean(); session.setAutoCommit(autoCommit); transfer.writeInt(SessionRemote.STATUS_OK).flush(); break; } case SessionRemote.SESSION_UNDO_LOG_POS: { transfer.writeInt(SessionRemote.STATUS_OK). writeInt(session.getUndoLogPos()).flush(); break; } case SessionRemote.LOB_READ: { long lobId = transfer.readLong(); CachedInputStream in = lobs.get(lobId); if (in == null) { throw DbException.get(ErrorCode.OBJECT_CLOSED); } long offset = transfer.readLong(); if (in.getPos() != offset) { LobStorage lobStorage = session.getDataHandler().getLobStorage(); InputStream lobIn = lobStorage.getInputStream(lobId, -1); in = new CachedInputStream(lobIn); lobs.put(lobId, in); lobIn.skip(offset); } int length = transfer.readInt(); // limit the buffer size length = Math.min(16 * Constants.IO_BUFFER_SIZE, length); transfer.writeInt(SessionRemote.STATUS_OK); byte[] buff = new byte[length]; length = IOUtils.readFully(in, buff, 0, length); transfer.writeInt(length); transfer.writeBytes(buff, 0, length); transfer.flush(); break; } default: trace("Unknown operation: " + operation); closeSession(); close(); } }
// in src/main/org/h2/server/TcpServerThread.java
private void sendRow(ResultInterface result) throws IOException { if (result.next()) { transfer.writeBoolean(true); Value[] v = result.currentRow(); for (int i = 0; i < result.getVisibleColumnCount(); i++) { writeValue(v[i]); } } else { transfer.writeBoolean(false); } }
// in src/main/org/h2/server/TcpServerThread.java
private void writeValue(Value v) throws IOException { if (v.getType() == Value.CLOB || v.getType() == Value.BLOB) { if (v instanceof ValueLobDb) { ValueLobDb lob = (ValueLobDb) v; if (lob.isStored()) { long id = lob.getLobId(); lobs.put(id, new CachedInputStream(null)); } } } transfer.writeValue(v); }
// in src/main/org/h2/server/TcpServerThread.java
public int read(byte[] buff, int off, int len) throws IOException { len = super.read(buff, off, len); if (len > 0) { pos += len; } return len; }
// in src/main/org/h2/server/TcpServerThread.java
public int read() throws IOException { int x = in.read(); if (x >= 0) { pos++; } return x; }
// in src/main/org/h2/server/TcpServerThread.java
public long skip(long n) throws IOException { n = super.skip(n); if (n > 0) { pos += n; } return n; }
// in src/main/org/h2/server/web/WebThread.java
private String readHeaderLine() throws IOException { StringBuilder buff = new StringBuilder(); while (true) { headerBytes++; int c = input.read(); if (c == -1) { throw new IOException("Unexpected EOF"); } else if (c == '\r') { headerBytes++; if (input.read() == '\n') { return buff.length() > 0 ? buff.toString() : null; } } else if (c == '\n') { return buff.length() > 0 ? buff.toString() : null; } else { buff.append((char) c); } } }
// in src/main/org/h2/server/web/WebThread.java
private boolean parseHeader() throws IOException { boolean keepAlive = false; trace("parseHeader"); int len = 0; ifModifiedSince = null; boolean multipart = false; while (true) { String line = readHeaderLine(); if (line == null) { break; } trace(" " + line); String lower = StringUtils.toLowerEnglish(line); if (lower.startsWith("if-modified-since")) { ifModifiedSince = getHeaderLineValue(line); } else if (lower.startsWith("connection")) { String conn = getHeaderLineValue(line); if ("keep-alive".equals(conn)) { keepAlive = true; } } else if (lower.startsWith("content-type")) { String type = getHeaderLineValue(line); if (type.startsWith("multipart/form-data")) { multipart = true; } } else if (lower.startsWith("content-length")) { len = Integer.parseInt(getHeaderLineValue(line)); trace("len=" + len); } else if (lower.startsWith("user-agent")) { boolean isWebKit = lower.indexOf("webkit/") >= 0; if (isWebKit && session != null) { // workaround for what seems to be a WebKit bug: // http://code.google.com/p/chromium/issues/detail?id=6402 session.put("frame-border", "1"); session.put("frameset-border", "2"); } } else if (lower.startsWith("accept-language")) { Locale locale = session == null ? null : session.locale; if (locale == null) { String languages = getHeaderLineValue(line); StringTokenizer tokenizer = new StringTokenizer(languages, ",;"); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (!token.startsWith("q=")) { if (server.supportsLanguage(token)) { int dash = token.indexOf('-'); if (dash >= 0) { String language = token.substring(0, dash); String country = token.substring(dash + 1); locale = new Locale(language, country); } else { locale = new Locale(token, ""); } headerLanguage = locale.getLanguage(); if (session != null) { session.locale = locale; session.put("language", headerLanguage); server.readTranslations(session, headerLanguage); } break; } } } } } else if (line.trim().length() == 0) { break; } } if (multipart) { uploadMultipart(input, len); } else if (session != null && len > 0) { byte[] bytes = Utils.newBytes(len); for (int pos = 0; pos < len;) { pos += input.read(bytes, pos, len - pos); } String s = new String(bytes); parseAttributes(s); } return keepAlive; }
// in src/main/org/h2/server/web/WebThread.java
private void uploadMultipart(InputStream in, int len) throws IOException { if (!new File(WebServer.TRANSFER).exists()) { return; } String fileName = "temp.bin"; headerBytes = 0; String boundary = readHeaderLine(); while (true) { String line = readHeaderLine(); if (line == null) { break; } int index = line.indexOf("filename=\""); if (index > 0) { fileName = line.substring(index + "filename=\"".length(), line.lastIndexOf('"')); } trace(" " + line); } if (!WebServer.isSimpleName(fileName)) { return; } len -= headerBytes; File file = new File(WebServer.TRANSFER, fileName); OutputStream out = new FileOutputStream(file); IOUtils.copy(in, out, len); out.close(); // remove the boundary RandomAccessFile f = new RandomAccessFile(file, "rw"); int testSize = (int) Math.min(f.length(), Constants.IO_BUFFER_SIZE); f.seek(f.length() - testSize); byte[] bytes = Utils.newBytes(Constants.IO_BUFFER_SIZE); f.readFully(bytes, 0, testSize); String s = new String(bytes, "ASCII"); int x = s.lastIndexOf(boundary); f.setLength(f.length() - testSize + x - 2); f.close(); }
// in src/main/org/h2/server/web/WebServlet.java
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { req.setCharacterEncoding("utf-8"); String file = req.getPathInfo(); if (file == null) { resp.sendRedirect(req.getRequestURI() + "/"); return; } else if (file.startsWith("/")) { file = file.substring(1); } file = getAllowedFile(req, file); byte[] bytes = null; Properties attributes = new Properties(); Enumeration<?> en = req.getAttributeNames(); while (en.hasMoreElements()) { String name = en.nextElement().toString(); String value = req.getAttribute(name).toString(); attributes.put(name, value); } en = req.getParameterNames(); while (en.hasMoreElements()) { String name = en.nextElement().toString(); String value = req.getParameter(name); attributes.put(name, value); } WebSession session = null; String sessionId = attributes.getProperty("jsessionid"); if (sessionId != null) { session = server.getSession(sessionId); } WebApp app = new WebApp(server); app.setSession(session, attributes); String ifModifiedSince = req.getHeader("if-modified-since"); String hostAddr = req.getRemoteAddr(); file = app.processRequest(file, hostAddr); session = app.getSession(); String mimeType = app.getMimeType(); boolean cache = app.getCache(); if (cache && server.getStartDateTime().equals(ifModifiedSince)) { resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED); return; } bytes = server.getFile(file); if (bytes == null) { resp.sendError(HttpServletResponse.SC_NOT_FOUND); bytes = StringUtils.utf8Encode("File not found: " + file); } else { if (session != null && file.endsWith(".jsp")) { String page = StringUtils.utf8Decode(bytes); page = PageParser.parse(page, session.map); bytes = StringUtils.utf8Encode(page); } resp.setContentType(mimeType); if (!cache) { resp.setHeader("Cache-Control", "no-cache"); } else { resp.setHeader("Cache-Control", "max-age=10"); resp.setHeader("Last-Modified", server.getStartDateTime()); } } if (bytes != null) { ServletOutputStream out = resp.getOutputStream(); out.write(bytes); } }
// in src/main/org/h2/server/web/WebServlet.java
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { doGet(req, resp); }
// in src/main/org/h2/server/web/WebServer.java
byte[] getFile(String file) throws IOException { trace("getFile <" + file + ">"); if (file.startsWith(TRANSFER + "/") && new File(TRANSFER).exists()) { file = file.substring(TRANSFER.length() + 1); if (!isSimpleName(file)) { return null; } File f = new File(TRANSFER, file); if (!f.exists()) { return null; } return IOUtils.readBytesAndClose(new FileInputStream(f), -1); } byte[] data = Utils.getResource("/org/h2/server/web/res/" + file); if (data == null) { trace(" null"); } else { trace(" size=" + data.length); } return data; }
// in src/main/org/h2/security/CipherFactory.java
public static Socket createSocket(InetAddress address, int port) throws IOException { Socket socket = null; setKeystore(); SSLSocketFactory f = (SSLSocketFactory) SSLSocketFactory.getDefault(); SSLSocket secureSocket = (SSLSocket) f.createSocket(); secureSocket.connect(new InetSocketAddress(address, port), SysProperties.SOCKET_CONNECT_TIMEOUT); if (SysProperties.ENABLE_ANONYMOUS_SSL) { String[] list = secureSocket.getEnabledCipherSuites(); list = addAnonymous(list); secureSocket.setEnabledCipherSuites(list); } socket = secureSocket; return socket; }
// in src/main/org/h2/security/CipherFactory.java
public static ServerSocket createServerSocket(int port, InetAddress bindAddress) throws IOException { ServerSocket socket = null; setKeystore(); ServerSocketFactory f = SSLServerSocketFactory.getDefault(); SSLServerSocket secureSocket; if (bindAddress == null) { secureSocket = (SSLServerSocket) f.createServerSocket(port); } else { secureSocket = (SSLServerSocket) f.createServerSocket(port, 0, bindAddress); } if (SysProperties.ENABLE_ANONYMOUS_SSL) { String[] list = secureSocket.getEnabledCipherSuites(); list = addAnonymous(list); secureSocket.setEnabledCipherSuites(list); } socket = secureSocket; return socket; }
// in src/main/org/h2/security/CipherFactory.java
private static byte[] getKeyStoreBytes(KeyStore store, String password) throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); try { store.store(bout, password.toCharArray()); } catch (Exception e) { throw DbException.convertToIOException(e); } return bout.toByteArray(); }
// in src/main/org/h2/security/CipherFactory.java
public static KeyStore getKeyStore(String password) throws IOException { try { // The following source code can be re-generated // if you have a keystore file. // This code is (hopefully) more Java version independent // than using keystores directly. See also: // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4887561 // (1.4.2 cannot read keystore written with 1.4.1) // --- generated code start --- KeyStore store = KeyStore.getInstance(KeyStore.getDefaultType()); store.load(null, password.toCharArray()); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); store.load(null, password.toCharArray()); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec( StringUtils.convertHexToBytes( "30820277020100300d06092a864886f70d010101" + "0500048202613082025d02010002818100dc0a13" + "c602b7141110eade2f051b54777b060d0f74e6a1" + "10f9cce81159f271ebc88d8e8aa1f743b505fc2e" + "7dfe38d33b8d3f64d1b363d1af4d877833897954" + "cbaec2fa384c22a415498cf306bb07ac09b76b00" + "1cd68bf77ea0a628f5101959cf2993a9c23dbee7" + "9b19305977f8715ae78d023471194cc900b231ee" + "cb0aaea98d02030100010281810099aa4ff4d0a0" + "9a5af0bd953cb10c4d08c3d98df565664ac5582e" + "494314d5c3c92dddedd5d316a32a206be4ec0846" + "16fe57be15e27cad111aa3c21fa79e32258c6ca8" + "430afc69eddd52d3b751b37da6b6860910b94653" + "192c0db1d02abcfd6ce14c01f238eec7c20bd3bb" + "750940004bacba2880349a9494d10e139ecb2355" + "d101024100ffdc3defd9c05a2d377ef6019fa62b" + "3fbd5b0020a04cc8533bca730e1f6fcf5dfceea1" + "b044fbe17d9eababfbc7d955edad6bc60f9be826" + "ad2c22ba77d19a9f65024100dc28d43fdbbc9385" + "2cc3567093157702bc16f156f709fb7db0d9eec0" + "28f41fd0edcd17224c866e66be1744141fb724a1" + "0fd741c8a96afdd9141b36d67fff6309024077b1" + "cddbde0f69604bdcfe33263fb36ddf24aa3b9922" + "327915b890f8a36648295d0139ecdf68c245652c" + "4489c6257b58744fbdd961834a4cab201801a3b1" + "e52d024100b17142e8991d1b350a0802624759d4" + "8ae2b8071a158ff91fabeb6a8f7c328e762143dc" + "726b8529f42b1fab6220d1c676fdc27ba5d44e84" + "7c72c52064afd351a902407c6e23fe35bcfcd1a6" + "62aa82a2aa725fcece311644d5b6e3894853fd4c" + "e9fe78218c957b1ff03fc9e5ef8ffeb6bd58235f" + "6a215c97d354fdace7e781e4a63e8b")); PrivateKey privateKey = keyFactory.generatePrivate(keySpec); Certificate[] certs = { CertificateFactory .getInstance("X.509") .generateCertificate( new ByteArrayInputStream( StringUtils.convertHexToBytes( "3082018b3081f502044295ce6b300d06092a8648" + "86f70d0101040500300d310b3009060355040313" + "024832301e170d3035303532363133323630335a" + "170d3337303933303036353734375a300d310b30" + "0906035504031302483230819f300d06092a8648" + "86f70d010101050003818d0030818902818100dc" + "0a13c602b7141110eade2f051b54777b060d0f74" + "e6a110f9cce81159f271ebc88d8e8aa1f743b505" + "fc2e7dfe38d33b8d3f64d1b363d1af4d87783389" + "7954cbaec2fa384c22a415498cf306bb07ac09b7" + "6b001cd68bf77ea0a628f5101959cf2993a9c23d" + "bee79b19305977f8715ae78d023471194cc900b2" + "31eecb0aaea98d0203010001300d06092a864886" + "f70d01010405000381810083f4401a279453701b" + "ef9a7681a5b8b24f153f7d18c7c892133d97bd5f" + "13736be7505290a445a7d5ceb75522403e509751" + "5cd966ded6351ff60d5193de34cd36e5cb04d380" + "398e66286f99923fd92296645fd4ada45844d194" + "dfd815e6cd57f385c117be982809028bba1116c8" + "5740b3d27a55b1a0948bf291ddba44bed337b9"))), }; store.setKeyEntry("h2", privateKey, password.toCharArray(), certs); // --- generated code end --- return store; } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/security/CipherFactory.java
private static void setKeystore() throws IOException { Properties p = System.getProperties(); if (p.getProperty(KEYSTORE_KEY) == null) { String fileName = KEYSTORE; byte[] data = getKeyStoreBytes(getKeyStore(KEYSTORE_PASSWORD), KEYSTORE_PASSWORD); boolean needWrite = true; if (FileUtils.exists(fileName) && FileUtils.size(fileName) == data.length) { // don't need to overwrite the file if it did not change InputStream fin = FileUtils.newInputStream(fileName); byte[] now = IOUtils.readBytesAndClose(fin, 0); if (now != null && Utils.compareNotNull(data, now) == 0) { needWrite = false; } } if (needWrite) { try { OutputStream out = FileUtils.newOutputStream(fileName, false); out.write(data); out.close(); } catch (Exception e) { throw DbException.convertToIOException(e); } } String absolutePath = FileUtils.toRealPath(fileName); System.setProperty(KEYSTORE_KEY, absolutePath); } if (p.getProperty(KEYSTORE_PASSWORD_KEY) == null) { System.setProperty(KEYSTORE_PASSWORD_KEY, KEYSTORE_PASSWORD); } }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public static FtpClient open(String url) throws IOException { FtpClient client = new FtpClient(); client.connect(url); return client; }
// in src/tools/org/h2/dev/ftp/FtpClient.java
private void connect(String url) throws IOException { socket = NetUtils.createSocket(url, 21, false); InputStream in = socket.getInputStream(); OutputStream out = socket.getOutputStream(); reader = new BufferedReader(new InputStreamReader(in)); writer = new PrintWriter(new OutputStreamWriter(out, Constants.UTF8)); readCode(220); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
private void readLine() throws IOException { while (true) { message = reader.readLine(); if (message != null) { int idxSpace = message.indexOf(' '); int idxMinus = message.indexOf('-'); int idx = idxSpace < 0 ? idxMinus : idxMinus < 0 ? idxSpace : Math.min(idxSpace, idxMinus); if (idx < 0) { code = 0; } else { code = Integer.parseInt(message.substring(0, idx)); message = message.substring(idx + 1); } } break; } }
// in src/tools/org/h2/dev/ftp/FtpClient.java
private void readCode(int optional, int expected) throws IOException { readLine(); if (code == optional) { readLine(); } if (code != expected) { throw new IOException("Expected: " + expected + " got: " + code + " " + message); } }
// in src/tools/org/h2/dev/ftp/FtpClient.java
private void readCode(int expected) throws IOException { readCode(-1, expected); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void login(String userName, String password) throws IOException { send("USER " + userName); readCode(331); send("PASS " + password); readCode(230); send("SYST"); readCode(215); send("SITE"); readCode(500); send("STRU F"); readCode(200); send("TYPE I"); readCode(200); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void close() throws IOException { if (socket != null) { send("QUIT"); readCode(221); socket.close(); } }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void changeWorkingDirectory(String dir) throws IOException { send("CWD " + dir); readCode(250); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void changeDirectoryUp() throws IOException { send("CDUP"); readCode(250); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
void delete(String fileName) throws IOException { send("DELE " + fileName); readCode(226, 250); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void makeDirectory(String dir) throws IOException { send("MKD " + dir); readCode(226, 257); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
void mode(String mode) throws IOException { send("MODE " + mode); readCode(200); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
void modificationTime(String fileName) throws IOException { send("MDTM " + fileName); readCode(213); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
void noOperation() throws IOException { send("NOOP"); readCode(200); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
String printWorkingDirectory() throws IOException { send("PWD"); readCode(257); return removeQuotes(); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
private void passive() throws IOException { send("PASV"); readCode(226, 227); int first = message.indexOf('(') + 1; int last = message.indexOf(')'); String[] address = StringUtils.arraySplit(message.substring(first, last), ',', true); StatementBuilder buff = new StatementBuilder(); for (int i = 0; i < 4; i++) { buff.appendExceptFirst("."); buff.append(address[i]); } String ip = buff.toString(); InetAddress addr = InetAddress.getByName(ip); int port = (Integer.parseInt(address[4]) << 8) | Integer.parseInt(address[5]); socketData = NetUtils.createSocket(addr, port, false); inData = socketData.getInputStream(); outData = socketData.getOutputStream(); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
void rename(String fromFileName, String toFileName) throws IOException { send("RNFR " + fromFileName); readCode(350); send("RNTO " + toFileName); readCode(250); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public byte[] retrieve(String fileName) throws IOException { ByteArrayOutputStream buff = new ByteArrayOutputStream(); retrieve(fileName, buff, 0); return buff.toByteArray(); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
void retrieve(String fileName, OutputStream out, long restartAt) throws IOException { passive(); if (restartAt > 0) { send("REST " + restartAt); readCode(350); } send("RETR " + fileName); IOUtils.copyAndClose(inData, out); readCode(150, 226); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void removeDirectory(String dir) throws IOException { send("RMD " + dir); readCode(226, 250); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void removeDirectoryRecursive(String dir) throws IOException { for (File f : listFiles(dir)) { if (f.isDirectory()) { removeDirectoryRecursive(dir + "/" + f.getName()); } else { delete(dir + "/" + f.getName()); } } removeDirectory(dir); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
long size(String fileName) throws IOException { send("SIZE " + fileName); readCode(250); long size = Long.parseLong(message); return size; }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void store(String fileName, InputStream in) throws IOException { passive(); send("STOR " + fileName); readCode(150); IOUtils.copyAndClose(in, outData); readCode(226); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void storeRecursive(File file) throws IOException { if (file.isDirectory()) { makeDirectory(file.getName()); changeWorkingDirectory(file.getName()); for (File f : file.listFiles()) { storeRecursive(f); } changeWorkingDirectory(".."); } else { InputStream in = new FileInputStream(file); store(file.getName(), in); } }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public String nameList(String dir) throws IOException { passive(); send("NLST " + dir); readCode(150); ByteArrayOutputStream out = new ByteArrayOutputStream(); IOUtils.copyAndClose(inData, out); readCode(226); byte[] data = out.toByteArray(); return new String(data); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public String list(String dir) throws IOException { passive(); send("LIST " + dir); readCode(150); ByteArrayOutputStream out = new ByteArrayOutputStream(); IOUtils.copyAndClose(inData, out); readCode(226); byte[] data = out.toByteArray(); return new String(data); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public boolean exists(String dir, String name) throws IOException { for (File f : listFiles(dir)) { if (f.getName().equals(name)) { return true; } } return false; }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public File[] listFiles(String dir) throws IOException { String content = list(dir); String[] list = StringUtils.arraySplit(content.trim(), '\n', true); File[] files = new File[list.length]; for (int i = 0; i < files.length; i++) { String s = list[i]; while (true) { String s2 = StringUtils.replaceAll(s, " ", " "); if (s2.equals(s)) { break; } s = s2; } String[] tokens = StringUtils.arraySplit(s, ' ', true); boolean directory = tokens[0].charAt(0) == 'd'; long length = Long.parseLong(tokens[4]); String name = tokens[8]; File f = new FtpFile(name, directory, length); files[i] = f; } return files; }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
private void process(String command) throws IOException { int idx = command.indexOf(' '); String param = ""; if (idx >= 0) { param = command.substring(idx).trim(); command = command.substring(0, idx); } command = StringUtils.toUpperEnglish(command); if (command.length() == 0) { reply(506, "No command"); return; } server.trace(">" + command); FtpEventListener listener = server.getEventListener(); FtpEvent event = null; if (listener != null) { event = new FtpEvent(this, command, param); listener.beforeCommand(event); } replied = false; if (connected) { processConnected(command, param); } if (!replied) { if ("USER".equals(command)) { userName = param; reply(331, "Need password"); } else if ("QUIT".equals(command)) { reply(221, "Bye"); stop = true; } else if ("PASS".equals(command)) { if (userName == null) { reply(332, "Need username"); } else if (server.checkUserPasswordWrite(userName, param)) { reply(230, "Ok"); readonly = false; connected = true; } else if (server.checkUserPasswordReadOnly(userName)) { reply(230, "Ok, readonly"); readonly = true; connected = true; } else { reply(431, "Wrong user/password"); } } else if ("REIN".equals(command)) { userName = null; connected = false; currentDir = "/"; reply(200, "Ok"); } else if ("HELP".equals(command)) { reply(214, SERVER_NAME); } } if (!replied) { if (listener != null) { listener.onUnsupportedCommand(event); } reply(506, "Invalid command"); } if (listener != null) { listener.afterCommand(event); } }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
private void processConnected(String command, String param) throws IOException { switch (command.charAt(0)) { case 'C': if ("CWD".equals(command)) { String path = getPath(param); String fileName = getFileName(path); if (FileUtils.exists(fileName) && FileUtils.isDirectory(fileName)) { if (!path.endsWith("/")) { path += "/"; } currentDir = path; reply(250, "Ok"); } else { reply(550, "Failed"); } } else if ("CDUP".equals(command)) { if (currentDir.length() > 1) { int idx = currentDir.lastIndexOf("/", currentDir.length() - 2); currentDir = currentDir.substring(0, idx + 1); reply(250, "Ok"); } else { reply(550, "Failed"); } } break; case 'D': if ("DELE".equals(command)) { String fileName = getFileName(param); if (!readonly && FileUtils.exists(fileName) && !FileUtils.isDirectory(fileName) && FileUtils.tryDelete(fileName)) { if (server.getAllowTask() && fileName.endsWith(FtpServer.TASK_SUFFIX)) { server.stopTask(fileName); } reply(250, "Ok"); } else { reply(500, "Delete failed"); } } break; case 'L': if ("LIST".equals(command)) { processList(param, true); } break; case 'M': if ("MKD".equals(command)) { processMakeDir(param); } else if ("MODE".equals(command)) { if ("S".equals(StringUtils.toUpperEnglish(param))) { reply(200, "Ok"); } else { reply(504, "Invalid"); } } else if ("MDTM".equals(command)) { String fileName = getFileName(param); if (FileUtils.exists(fileName) && !FileUtils.isDirectory(fileName)) { reply(213, server.formatLastModified(fileName)); } else { reply(550, "Failed"); } } break; case 'N': if ("NLST".equals(command)) { processList(param, false); } else if ("NOOP".equals(command)) { reply(200, "Ok"); } break; case 'P': if ("PWD".equals(command)) { reply(257, StringUtils.quoteIdentifier(currentDir) + " directory"); } else if ("PASV".equals(command)) { ServerSocket dataSocket = FtpServer.createDataSocket(); data = new FtpData(server, control.getInetAddress(), dataSocket); data.start(); int port = dataSocket.getLocalPort(); reply(227, "Passive Mode (" + serverIpAddress + "," + (port >> 8) + "," + (port & 255) + ")"); } else if ("PORT".equals(command)) { String[] list = StringUtils.arraySplit(param, ',', true); String host = list[0] + "." + list[1] + "." + list[2] + "." + list[3]; int port = (Integer.parseInt(list[4]) << 8) | Integer.parseInt(list[5]); InetAddress address = InetAddress.getByName(host); if (address.equals(control.getInetAddress())) { data = new FtpData(server, address, port); reply(200, "Ok"); } else { server.trace("Port REJECTED:" + address + " expected:" + control.getInetAddress()); reply(550, "Failed"); } } break; case 'R': if ("RNFR".equals(command)) { String fileName = getFileName(param); if (FileUtils.exists(fileName)) { renameFrom = fileName; reply(350, "Ok"); } else { reply(450, "Not found"); } } else if ("RNTO".equals(command)) { if (renameFrom == null) { reply(503, "RNFR required"); } else { String fileOld = renameFrom; String fileNew = getFileName(param); boolean ok = false; if (!readonly) { try { FileUtils.moveTo(fileOld, fileNew); reply(250, "Ok"); ok = true; } catch (Exception e) { server.traceError(e); } } if (!ok) { reply(550, "Failed"); } } } else if ("RETR".equals(command)) { String fileName = getFileName(param); if (FileUtils.exists(fileName) && !FileUtils.isDirectory(fileName)) { reply(150, "Starting transfer"); try { data.send(fileName, restart); reply(226, "Ok"); } catch (IOException e) { server.traceError(e); reply(426, "Failed"); } restart = 0; } else { // Firefox compatibility // (still not good) processList(param, true); // reply(426, "Not a file"); } } else if ("RMD".equals(command)) { processRemoveDir(param); } else if ("REST".equals(command)) { try { restart = Integer.parseInt(param); reply(350, "Ok"); } catch (NumberFormatException e) { reply(500, "Invalid"); } } break; case 'S': if ("SYST".equals(command)) { reply(215, "UNIX Type: L8"); } else if ("SITE".equals(command)) { reply(500, "Not understood"); } else if ("SIZE".equals(command)) { param = getFileName(param); if (FileUtils.exists(param) && !FileUtils.isDirectory(param)) { reply(250, String.valueOf(FileUtils.size(param))); } else { reply(500, "Failed"); } } else if ("STOR".equals(command)) { String fileName = getFileName(param); if (!readonly && !FileUtils.exists(fileName) || !FileUtils.isDirectory(fileName)) { reply(150, "Starting transfer"); try { data.receive(fileName); if (server.getAllowTask() && param.endsWith(FtpServer.TASK_SUFFIX)) { server.startTask(fileName); } reply(226, "Ok"); } catch (Exception e) { server.traceError(e); reply(426, "Failed"); } } else { reply(550, "Failed"); } } else if ("STRU".equals(command)) { if ("F".equals(StringUtils.toUpperEnglish(param))) { reply(200, "Ok"); } else { reply(504, "Invalid"); } } break; case 'T': if ("TYPE".equals(command)) { param = StringUtils.toUpperEnglish(param); if ("A".equals(param) || "A N".equals(param)) { reply(200, "Ok"); } else if ("I".equals(param) || "L 8".equals(param)) { reply(200, "Ok"); } else { reply(500, "Invalid"); } } break; case 'X': if ("XMKD".equals(command)) { processMakeDir(param); } else if ("XRMD".equals(command)) { processRemoveDir(param); } break; } }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
private void processList(String param, boolean directories) throws IOException { String directory = getFileName(param); if (!FileUtils.exists(directory)) { reply(450, "Directory does not exist"); return; } else if (!FileUtils.isDirectory(directory)) { reply(450, "Not a directory"); return; } String list = server.getDirectoryListing(directory, directories); reply(150, "Starting transfer"); server.trace(list); // need to use the current locale (UTF-8 would be wrong for the Windows // Explorer) data.send(list.getBytes()); reply(226, "Done"); }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
private void connect() throws IOException { if (active) { socket = new Socket(address, port); } else { waitUntilConnected(); } }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
synchronized void receive(String fileName) throws IOException { connect(); try { InputStream in = socket.getInputStream(); OutputStream out = FileUtils.newOutputStream(fileName, false); IOUtils.copy(in, out); out.close(); } finally { socket.close(); } server.trace("closed"); }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
synchronized void send(String fileName, long skip) throws IOException { connect(); try { OutputStream out = socket.getOutputStream(); InputStream in = FileUtils.newInputStream(fileName); IOUtils.skipFully(in, skip); IOUtils.copy(in, out); in.close(); } finally { socket.close(); } server.trace("closed"); }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
synchronized void send(byte[] data) throws IOException { connect(); try { OutputStream out = socket.getOutputStream(); out.write(data); } finally { socket.close(); } server.trace("closed"); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
void startTask(String path) throws IOException { stopTask(path); if (path.endsWith(".zip.task")) { trace("expand: " + path); Process p = Runtime.getRuntime().exec("jar -xf " + path, null, new File(root)); new StreamRedirect(path, p.getInputStream(), null).start(); return; } Properties prop = SortedProperties.loadProperties(path); String command = prop.getProperty("command"); String outFile = path.substring(0, path.length() - TASK_SUFFIX.length()); String errorFile = root + "/" + prop.getProperty("error", outFile + ".err.txt"); String outputFile = root + "/" + prop.getProperty("output", outFile + ".out.txt"); trace("start process: " + path + " / " + command); Process p = Runtime.getRuntime().exec(command, null, new File(root)); new StreamRedirect(path, p.getErrorStream(), errorFile).start(); new StreamRedirect(path, p.getInputStream(), outputFile).start(); tasks.put(path, p); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
String readStringNull(InputStream in) throws IOException { StringBuilder buff = new StringBuilder(); while (true) { int x = in.read(); if (x <= 0) { break; } buff.append((char) x); } return buff.toString(); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
private boolean processClient(InputStream inStream, OutputStream outStream) throws IOException { DataInputStream dataIn = new DataInputStream(inStream); ByteArrayOutputStream buff = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(buff); if (state == STATE_INIT_CLIENT) { state = STATE_REGULAR; int len = dataIn.readInt(); dataOut.writeInt(len); len -= 4; byte[] data = new byte[len]; dataIn.readFully(data, 0, len); dataOut.write(data); dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len)); int version = dataIn.readInt(); if (version == 80877102) { println("CancelRequest"); println(" pid: " + dataIn.readInt()); println(" key: " + dataIn.readInt()); } else if (version == 80877103) { println("SSLRequest"); } else { println("StartupMessage"); println(" version " + version + " (" + (version >> 16) + "." + (version & 0xff) + ")"); while (true) { String param = readStringNull(dataIn); if (param.length() == 0) { break; } String value = readStringNull(dataIn); println(" param " + param + "=" + value); } } } else { int x = dataIn.read(); if (x < 0) { println("end"); return false; } // System.out.println(" x=" + (char)x+" " +x); dataOut.write(x); int len = dataIn.readInt(); dataOut.writeInt(len); len -= 4; byte[] data = new byte[len]; dataIn.readFully(data, 0, len); dataOut.write(data); dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len)); switch (x) { case 'B': { println("Bind"); println(" destPortal: " + readStringNull(dataIn)); println(" prepName: " + readStringNull(dataIn)); int formatCodesCount = dataIn.readShort(); for (int i = 0; i < formatCodesCount; i++) { println(" formatCode[" + i + "]=" + dataIn.readShort()); } int paramCount = dataIn.readShort(); for (int i = 0; i < paramCount; i++) { int paramLen = dataIn.readInt(); println(" length[" + i + "]=" + paramLen); byte[] d2 = new byte[paramLen]; dataIn.readFully(d2); } int resultCodeCount = dataIn.readShort(); for (int i = 0; i < resultCodeCount; i++) { println(" resultCodeCount[" + i + "]=" + dataIn.readShort()); } break; } case 'C': { println("Close"); println(" type: (S:prepared statement, P:portal): " + dataIn.read()); break; } case 'd': { println("CopyData"); break; } case 'c': { println("CopyDone"); break; } case 'f': { println("CopyFail"); println(" message: " + readStringNull(dataIn)); break; } case 'D': { println("Describe"); println(" type (S=prepared statement, P=portal): " + (char) dataIn.readByte()); println(" name: " + readStringNull(dataIn)); break; } case 'E': { println("Execute"); println(" name: " + readStringNull(dataIn)); println(" maxRows: " + dataIn.readShort()); break; } case 'H': { println("Flush"); break; } case 'F': { println("FunctionCall"); println(" objectId:" + dataIn.readInt()); int columns = dataIn.readShort(); for (int i = 0; i < columns; i++) { println(" formatCode[" + i + "]: " + dataIn.readShort()); } int count = dataIn.readShort(); for (int i = 0; i < count; i++) { int l = dataIn.readInt(); println(" len[" + i + "]: " + l); if (l >= 0) { for (int j = 0; j < l; j++) { dataIn.readByte(); } } } println(" resultFormat: " + dataIn.readShort()); break; } case 'P': { println("Parse"); println(" name:" + readStringNull(dataIn)); println(" query:" + readStringNull(dataIn)); int count = dataIn.readShort(); for (int i = 0; i < count; i++) { println(" [" + i + "]: " + dataIn.readInt()); } break; } case 'p': { println("PasswordMessage"); println(" password: " + readStringNull(dataIn)); break; } case 'Q': { println("Query"); println(" sql : " + readStringNull(dataIn)); break; } case 'S': { println("Sync"); break; } case 'X': { println("Terminate"); break; } default: println("############## UNSUPPORTED: " + (char) x); } } dataOut.flush(); byte[] buffer = buff.toByteArray(); printData(buffer, buffer.length); try { outStream.write(buffer, 0, buffer.length); outStream.flush(); } catch (IOException e) { e.printStackTrace(); } return true; }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
private boolean processServer(InputStream inStream, OutputStream outStream) throws IOException { DataInputStream dataIn = new DataInputStream(inStream); ByteArrayOutputStream buff = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(buff); int x = dataIn.read(); if (x < 0) { println("end"); return false; } // System.out.println(" x=" + (char)x+" " +x); dataOut.write(x); int len = dataIn.readInt(); dataOut.writeInt(len); len -= 4; byte[] data = new byte[len]; dataIn.readFully(data, 0, len); dataOut.write(data); dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len)); switch (x) { case 'R': { println("Authentication"); int value = dataIn.readInt(); if (value == 0) { println(" Ok"); } else if (value == 2) { println(" KerberosV5"); } else if (value == 3) { println(" CleartextPassword"); } else if (value == 4) { println(" CryptPassword"); byte b1 = dataIn.readByte(); byte b2 = dataIn.readByte(); println(" salt1=" + b1 + " salt2=" + b2); } else if (value == 5) { println(" MD5Password"); byte b1 = dataIn.readByte(); byte b2 = dataIn.readByte(); byte b3 = dataIn.readByte(); byte b4 = dataIn.readByte(); println(" salt1=" + b1 + " salt2=" + b2 + " 3=" + b3 + " 4=" + b4); } else if (value == 6) { println(" SCMCredential"); } break; } case 'K': { println("BackendKeyData"); println(" process ID " + dataIn.readInt()); println(" key " + dataIn.readInt()); break; } case '2': { println("BindComplete"); break; } case '3': { println("CloseComplete"); break; } case 'C': { println("CommandComplete"); println(" command tag: " + readStringNull(dataIn)); break; } case 'd': { println("CopyData"); break; } case 'c': { println("CopyDone"); break; } case 'G': { println("CopyInResponse"); println(" format: " + dataIn.readByte()); int columns = dataIn.readShort(); for (int i = 0; i < columns; i++) { println(" formatCode[" + i + "]: " + dataIn.readShort()); } break; } case 'H': { println("CopyOutResponse"); println(" format: " + dataIn.readByte()); int columns = dataIn.readShort(); for (int i = 0; i < columns; i++) { println(" formatCode[" + i + "]: " + dataIn.readShort()); } break; } case 'D': { println("DataRow"); int columns = dataIn.readShort(); println(" columns : " + columns); for (int i = 0; i < columns; i++) { int l = dataIn.readInt(); if (l > 0) { for (int j = 0; j < l; j++) { dataIn.readByte(); } } // println(" ["+i+"] len: " + l); } break; } case 'I': { println("EmptyQueryResponse"); break; } case 'E': { println("ErrorResponse"); while (true) { int fieldType = dataIn.readByte(); if (fieldType == 0) { break; } String msg = readStringNull(dataIn); // http://developer.postgresql.org/pgdocs/postgres/protocol-error-fields.html // S Severity // C Code: the SQLSTATE code // M Message // D Detail // H Hint // P Position // p Internal position // q Internal query // W Where // F File // L Line // R Routine println(" fieldType: " + fieldType + " msg: " + msg); } break; } case 'V': { println("FunctionCallResponse"); int resultLen = dataIn.readInt(); println(" len: " + resultLen); break; } case 'n': { println("NoData"); break; } case 'N': { println("NoticeResponse"); while (true) { int fieldType = dataIn.readByte(); if (fieldType == 0) { break; } String msg = readStringNull(dataIn); // http://developer.postgresql.org/pgdocs/postgres/protocol-error-fields.html // S Severity // C Code: the SQLSTATE code // M Message // D Detail // H Hint // P Position // p Internal position // q Internal query // W Where // F File // L Line // R Routine println(" fieldType: " + fieldType + " msg: " + msg); } break; } case 'A': { println("NotificationResponse"); println(" processID: " + dataIn.readInt()); println(" condition: " + readStringNull(dataIn)); println(" information: " + readStringNull(dataIn)); break; } case 't': { println("ParameterDescription"); println(" processID: " + dataIn.readInt()); int count = dataIn.readShort(); for (int i = 0; i < count; i++) { println(" [" + i + "] objectId: " + dataIn.readInt()); } break; } case 'S': { println("ParameterStatus"); println(" parameter " + readStringNull(dataIn) + " = " + readStringNull(dataIn)); break; } case '1': { println("ParseComplete"); break; } case 's': { println("ParseComplete"); break; } case 'Z': { println("ReadyForQuery"); println(" status (I:idle, T:transaction, E:failed): " + (char) dataIn.readByte()); break; } case 'T': { println("RowDescription"); int columns = dataIn.readShort(); println(" columns : " + columns); for (int i = 0; i < columns; i++) { println(" [" + i + "]"); println(" name:" + readStringNull(dataIn)); println(" tableId:" + dataIn.readInt()); println(" columnId:" + dataIn.readShort()); println(" dataTypeId:" + dataIn.readInt()); println(" dataTypeSize (pg_type.typlen):" + dataIn.readShort()); println(" modifier (pg_attribute.atttypmod):" + dataIn.readInt()); println(" format code:" + dataIn.readShort()); } break; } default: println("############## UNSUPPORTED: " + (char) x); } dataOut.flush(); byte[] buffer = buff.toByteArray(); printData(buffer, buffer.length); try { outStream.write(buffer, 0, buffer.length); outStream.flush(); } catch (IOException e) { e.printStackTrace(); } return true; }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public FileChannel open(String mode) throws IOException { String[] parsed = parse(name); FileChannel file = FileUtils.open(parsed[2], mode); return new FileCrypt(name, parsed[0], parsed[1], file); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public long position() throws IOException { return Math.max(0, file.position() - HEADER_LENGTH); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public long size() throws IOException { return Math.max(0, file.size() - HEADER_LENGTH - BLOCK_SIZE); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public FileChannel position(long pos) throws IOException { file.position(pos + HEADER_LENGTH); return this; }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public void force(boolean metaData) throws IOException { file.force(metaData); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return file.tryLock(); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public void implCloseChannel() throws IOException { file.close(); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public FileChannel truncate(long newLength) throws IOException { if (newLength >= size()) { return this; } int mod = (int) (newLength % BLOCK_SIZE); if (mod == 0) { file.truncate(HEADER_LENGTH + newLength); } else { file.truncate(HEADER_LENGTH + newLength + BLOCK_SIZE - mod); byte[] buff = new byte[BLOCK_SIZE - mod]; long pos = position(); position(newLength); write(buff, 0, buff.length); position(pos); } file.truncate(HEADER_LENGTH + newLength + BLOCK_SIZE); if (newLength < position()) { position(newLength); } return this; }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public int read(ByteBuffer dst) throws IOException { int len = dst.remaining(); if (len == 0) { return 0; } long pos = position(); len = (int) Math.min(len, size() - pos); if (len <= 0) { return -1; } int posMod = (int) (pos % BLOCK_SIZE); if (posMod == 0 && len % BLOCK_SIZE == 0) { readAligned(pos, dst.array(), dst.position(), len); } else { long p = pos - posMod; int l = len; if (posMod != 0) { l += posMod; } l = MathUtils.roundUpInt(l, BLOCK_SIZE); position(p); byte[] temp = new byte[l]; try { readAligned(p, temp, 0, l); System.arraycopy(temp, posMod, dst.array(), dst.position(), len); } finally { position(pos + len); } } dst.position(dst.position() + len); return len; }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public int write(ByteBuffer src) throws IOException { int len = src.remaining(); if (len == 0) { return 0; } write(src.array(), src.position(), len); src.position(src.position() + len); return len; }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
private void write(byte[] b, int off, int len) throws IOException { long pos = position(); int posMod = (int) (pos % BLOCK_SIZE); if (posMod == 0 && len % BLOCK_SIZE == 0) { byte[] temp = new byte[len]; System.arraycopy(b, off, temp, 0, len); writeAligned(pos, temp, 0, len); } else { long p = pos - posMod; int l = len; if (posMod != 0) { l += posMod; } l = MathUtils.roundUpInt(l, BLOCK_SIZE); position(p); byte[] temp = new byte[l]; if (file.size() < HEADER_LENGTH + p + l) { file.position(HEADER_LENGTH + p + l - 1); FileUtils.writeFully(file, ByteBuffer.wrap(new byte[1])); position(p); } readAligned(p, temp, 0, l); System.arraycopy(b, off, temp, posMod, len); position(p); try { writeAligned(p, temp, 0, l); } finally { position(pos + len); } } pos = file.position(); if (file.size() < pos + BLOCK_SIZE) { file.position(pos + BLOCK_SIZE - 1); FileUtils.writeFully(file, ByteBuffer.wrap(new byte[1])); file.position(pos); } }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
private void readAligned(long pos, byte[] b, int off, int len) throws IOException { FileUtils.readFully(file, ByteBuffer.wrap(b, off, len)); for (int p = 0; p < len; p += BLOCK_SIZE) { for (int i = 0; i < BLOCK_SIZE; i++) { // empty blocks are not decrypted if (b[p + off + i] != 0) { cipher.decrypt(b, p + off, BLOCK_SIZE); xorInitVector(b, p + off, BLOCK_SIZE, p + pos); break; } } } }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
private void writeAligned(long pos, byte[] b, int off, int len) throws IOException { for (int p = 0; p < len; p += BLOCK_SIZE) { for (int i = 0; i < BLOCK_SIZE; i++) { // empty blocks are not decrypted if (b[p + off + i] != 0) { xorInitVector(b, p + off, BLOCK_SIZE, p + pos); cipher.encrypt(b, p + off, BLOCK_SIZE); break; } } } FileUtils.writeFully(file, ByteBuffer.wrap(b, off, len)); }
// in src/tools/org/h2/dev/fs/FileShell.java
private void execute(String line) throws IOException { String[] commands = StringUtils.arraySplit(line, ';', true); for (String command : commands) { String[] list = StringUtils.arraySplit(command, ' ', true); if (!execute(list)) { break; } } }
// in src/tools/org/h2/dev/fs/FileShell.java
private boolean execute(String[] list) throws IOException { // TODO unit tests for everything (multiple commands, errors, ...) // TODO less (support large files) // TODO hex dump int i = 0; String c = list[i++]; if ("exit".equals(c) || "quit".equals(c)) { end(list, i); return false; } else if ("help".equals(c) || "?".equals(c)) { showHelp(); end(list, i); } else if ("cat".equals(c)) { String file = getFile(list[i++]); end(list, i); cat(file, Long.MAX_VALUE); } else if ("cd".equals(c)) { String dir = getFile(list[i++]); end(list, i); if (FileUtils.isDirectory(dir)) { currentWorkingDirectory = dir; println(dir); } else { println("Not a directory: " + dir); } } else if ("chmod".equals(c)) { String mode = list[i++]; String file = getFile(list[i++]); end(list, i); if ("-w".equals(mode)) { boolean success = FileUtils.setReadOnly(file); println(success ? "Success" : "Failed"); } else { println("Unsupported mode: " + mode); } } else if ("cp".equals(c)) { String source = getFile(list[i++]); String target = getFile(list[i++]); end(list, i); FileUtils.copy(source, target); } else if ("head".equals(c)) { String file = getFile(list[i++]); end(list, i); cat(file, 1024); } else if ("ls".equals(c)) { String dir = currentWorkingDirectory; if (i < list.length) { dir = getFile(list[i++]); } end(list, i); println(dir); for (String file : FileUtils.newDirectoryStream(dir)) { StringBuilder buff = new StringBuilder(); buff.append(FileUtils.isDirectory(file) ? "d" : "-"); buff.append(FileUtils.canWrite(file) ? "rw" : "r-"); buff.append(' '); buff.append(String.format("%10d", FileUtils.size(file))); buff.append(' '); long lastMod = FileUtils.lastModified(file); buff.append(new Timestamp(lastMod).toString()); buff.append(' '); buff.append(FileUtils.getName(file)); println(buff.toString()); } } else if ("mkdir".equals(c)) { String dir = getFile(list[i++]); end(list, i); FileUtils.createDirectories(dir); } else if ("mv".equals(c)) { String source = getFile(list[i++]); String target = getFile(list[i++]); end(list, i); FileUtils.moveTo(source, target); } else if ("pwd".equals(c)) { end(list, i); println(FileUtils.toRealPath(currentWorkingDirectory)); } else if ("rm".equals(c)) { if ("-r".equals(list[i])) { i++; String dir = getFile(list[i++]); end(list, i); FileUtils.deleteRecursive(dir, true); } else if ("-rf".equals(list[i])) { i++; String dir = getFile(list[i++]); end(list, i); FileUtils.deleteRecursive(dir, false); } else { String file = getFile(list[i++]); end(list, i); FileUtils.delete(file); } } else if ("touch".equals(c)) { String file = getFile(list[i++]); end(list, i); truncate(file, FileUtils.size(file)); } else if ("truncate".equals(c)) { if ("-s".equals(list[i])) { i++; long length = Long.decode(list[i++]); String file = getFile(list[i++]); end(list, i); truncate(file, length); } else { println("Unsupported option"); } } else if ("unzip".equals(c)) { String file = getFile(list[i++]); end(list, i); unzip(file, currentWorkingDirectory); } else if ("zip".equals(c)) { boolean recursive = false; if ("-r".equals(list[i])) { i++; recursive = true; } String target = getFile(list[i++]); ArrayList<String> source = New.arrayList(); readFileList(list, i, source, recursive); zip(target, currentWorkingDirectory, source); } return true; }
// in src/tools/org/h2/dev/fs/FileShell.java
private void end(String[] list, int index) throws IOException { if (list.length != index) { throw new IOException("End of command expected, got: " + list[index]); } }
// in src/tools/org/h2/dev/fs/FileShell.java
private int readFileList(String[] list, int i, ArrayList<String> target, boolean recursive) throws IOException { while (i < list.length) { String c = list[i++]; if (";".equals(c)) { break; } c = getFile(c); if (!FileUtils.exists(c)) { throw new IOException("File not found: " + c); } if (recursive) { addFilesRecursive(c, target); } else { target.add(c); } } return i; }
// in src/tools/org/h2/dev/fs/FileShell.java
private String readLine() throws IOException { String line = reader.readLine(); if (line == null) { throw new IOException("Aborted"); } return line; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { if (!inTempDir) { throw new IOException("File system is read-only"); } return new FilePathDisk().getPath(name).createTempFile(suffix, deleteOnExit, true); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public InputStream newInputStream() throws IOException { return new FileChannelInputStream(open("r")); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public FileChannel open(String mode) throws IOException { String entryName = getEntryName(); if (entryName.length() == 0) { throw new FileNotFoundException(); } ZipInputStream in = openZip(); while (true) { ZipEntry entry = in.getNextEntry(); if (entry == null) { break; } if (entry.getName().equals(entryName)) { return new FileZip2(name, entryName, in, size()); } in.closeEntry(); } in.close(); throw new FileNotFoundException(name); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
private ZipInputStream openZip() throws IOException { String fileName = translateFileName(name); return new ZipInputStream(FileUtils.newInputStream(fileName)); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public void implCloseChannel() throws IOException { try { in.close(); } catch (IOException e) { // ignore } }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public int read(ByteBuffer dst) throws IOException { seek(); int len = in.read(dst.array(), dst.position(), dst.remaining()); if (len > 0) { dst.position(dst.position() + len); pos += len; inPos += len; } return len; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
private void seek() throws IOException { if (inPos > pos) { if (in != null) { in.close(); } in = null; } if (in == null) { in = FileUtils.newInputStream(fullName); inPos = 0; } if (inPos < pos) { long skip = pos - inPos; if (!skipUsingRead) { try { IOUtils.skipFully(in, skip); } catch (NullPointerException e) { // workaround for Android skipUsingRead = true; } } if (skipUsingRead) { while (skip > 0) { int s = (int) Math.min(SKIP_BUFFER.length, skip); s = in.read(SKIP_BUFFER, 0, s); skip -= s; } } inPos = pos; } }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public FileChannel truncate(long newLength) throws IOException { throw new IOException("File is read-only"); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public void force(boolean metaData) throws IOException { // nothing to do }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public int write(ByteBuffer src) throws IOException { throw new IOException("File is read-only"); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return null; }
// in src/tools/org/h2/dev/store/FilePathCache.java
public static FileChannel wrap(FileChannel f) throws IOException { return new FileCache(f); }
// in src/tools/org/h2/dev/store/FilePathCache.java
public FileChannel open(String mode) throws IOException { return new FileCache(getBase().open(mode)); }
// in src/tools/org/h2/dev/store/FilePathCache.java
public FileChannel position(long newPosition) throws IOException { this.pos = newPosition; return this; }
// in src/tools/org/h2/dev/store/FilePathCache.java
public long position() throws IOException { return pos; }
// in src/tools/org/h2/dev/store/FilePathCache.java
private void positionBase(long pos) throws IOException { if (posBase != pos) { base.position(pos); posBase = pos; } }
// in src/tools/org/h2/dev/store/FilePathCache.java
public int read(ByteBuffer dst) throws IOException { long cachePos = getCachePos(pos); int off = (int) (pos - cachePos); int len = CACHE_BLOCK_SIZE - off; ByteBuffer buff = cache.get(cachePos); if (buff == null) { buff = ByteBuffer.allocate(CACHE_BLOCK_SIZE); positionBase(cachePos); int read = base.read(buff); posBase += read; if (read == CACHE_BLOCK_SIZE) { cache.put(cachePos, buff); } else { if (read < 0) { return -1; } len = Math.min(len, read); } } len = Math.min(len, dst.remaining()); System.arraycopy(buff.array(), off, dst.array(), dst.position(), len); dst.position(dst.position() + len); pos += len; return len; }
// in src/tools/org/h2/dev/store/FilePathCache.java
public long size() throws IOException { return size; }
// in src/tools/org/h2/dev/store/FilePathCache.java
public FileChannel truncate(long newSize) throws IOException { cache.clear(); base.truncate(newSize); size = Math.min(size, newSize); pos = Math.min(pos, newSize); posBase = pos; return this; }
// in src/tools/org/h2/dev/store/FilePathCache.java
public int write(ByteBuffer src) throws IOException { if (cache.size() > 0) { for (long p = getCachePos(pos), len = src.remaining(); len > 0; p += CACHE_BLOCK_SIZE, len -= CACHE_BLOCK_SIZE) { cache.remove(p); } } positionBase(pos); int len = base.write(src); posBase += len; pos += len; size = Math.max(size, pos); return len; }
// in src/tools/org/h2/dev/store/FilePathCache.java
public void force(boolean metaData) throws IOException { base.force(metaData); }
// in src/tools/org/h2/dev/store/FilePathCache.java
public FileLock tryLock(long position, long size, boolean shared) throws IOException { return base.tryLock(position, size, shared); }
// in src/tools/org/h2/dev/util/ReaderInputStream.java
private void fillBuffer() throws IOException { if (remaining == 0) { pos = 0; remaining = reader.read(chars, 0, Constants.IO_BUFFER_SIZE); if (remaining < 0) { return; } writer.write(chars, 0, remaining); writer.flush(); buffer = out.toByteArray(); remaining = buffer.length; out.reset(); } }
// in src/tools/org/h2/dev/util/ReaderInputStream.java
public int read() throws IOException { if (remaining == 0) { fillBuffer(); } if (remaining < 0) { return -1; } remaining--; return buffer[pos++] & 0xff; }
// in src/tools/org/h2/dev/util/FileViewer.java
private static void process(String fileName, String find, boolean head, boolean tail, long start, int lines, boolean quiet) throws IOException { RandomAccessFile file = new RandomAccessFile(fileName, "r"); long length = file.length(); if (head) { file.seek(start); list(start, "Head", readLines(file, lines)); } if (find != null) { file.seek(start); long pos = find(file, find.getBytes(), quiet); if (pos >= 0) { file.seek(pos); list(pos, "Found " + find, readLines(file, lines)); } } if (tail) { long pos = length - 100L * lines; ArrayList<String> list = null; while (pos > 0) { file.seek(pos); list = readLines(file, Integer.MAX_VALUE); if (list.size() > lines) { break; } pos -= 100L * lines; } // remove the first (maybe partial) line list.remove(0); while (list.size() > lines) { list.remove(0); } list(pos, "Tail", list); } }
// in src/tools/org/h2/dev/util/FileViewer.java
private static long find(RandomAccessFile file, byte[] find, boolean quiet) throws IOException { long pos = file.getFilePointer(); long length = file.length(); int bufferSize = 4 * 1024; byte[] data = new byte[bufferSize * 2]; long last = System.currentTimeMillis(); while (pos < length) { System.arraycopy(data, bufferSize, data, 0, bufferSize); if (pos + bufferSize > length) { file.readFully(data, bufferSize, (int) (length - pos)); return find(data, find, (int) (bufferSize + length - pos - find.length)); } if (!quiet) { long now = System.currentTimeMillis(); if (now > last + 5000) { System.out.println((100 * pos / length) + "%"); last = now; } } file.readFully(data, bufferSize, bufferSize); int f = find(data, find, bufferSize); if (f >= 0) { return f + pos - bufferSize; } pos += bufferSize; } return -1; }
// in src/tools/org/h2/dev/util/FileViewer.java
private static ArrayList<String> readLines(RandomAccessFile file, int maxLines) throws IOException { ArrayList<String> lines = new ArrayList<String>(); ByteArrayOutputStream buff = new ByteArrayOutputStream(100); boolean lastNewline = false; while (maxLines > 0) { int x = file.read(); if (x < 0) { break; } if (x == '\r' || x == '\n') { if (!lastNewline) { maxLines--; lastNewline = true; byte[] data = buff.toByteArray(); String s = new String(data); lines.add(s); buff.reset(); } continue; } if (lastNewline) { lastNewline = false; } buff.write(x); } byte[] data = buff.toByteArray(); if (data.length > 0) { String s = new String(data); lines.add(s); } return lines; }
// in src/tools/org/h2/build/doc/UploadBuild.java
private static void zip(String destFile, String directory, boolean storeOnly) throws IOException { OutputStream out = new FileOutputStream(destFile); ZipOutputStream zipOut = new ZipOutputStream(out); if (storeOnly) { zipOut.setMethod(ZipOutputStream.STORED); } zipOut.setLevel(Deflater.BEST_COMPRESSION); addFiles(new File(directory), new File(directory), zipOut); zipOut.finish(); zipOut.close(); }
// in src/tools/org/h2/build/doc/UploadBuild.java
private static void addFiles(File base, File file, ZipOutputStream out) throws IOException { if (file.isDirectory()) { for (File f : file.listFiles()) { addFiles(base, f, out); } } else { String path = file.getAbsolutePath().substring(base.getAbsolutePath().length()); path = path.replace('\\', '/'); if (path.startsWith("/")) { path = path.substring(1); } byte[] data = IOUtils.readBytesAndClose(new FileInputStream(file), -1); ZipEntry entry = new ZipEntry(path); CRC32 crc = new CRC32(); crc.update(data); entry.setSize(file.length()); entry.setCrc(crc.getValue()); out.putNextEntry(entry); out.write(data); out.closeEntry(); } }
// in src/tools/org/h2/build/doc/WebSite.java
private void loadFragments() throws IOException { File dir = new File(sourceDir, "html"); for (File f : dir.listFiles()) { if (f.getName().startsWith("fragments")) { FileInputStream in = new FileInputStream(f); byte[] bytes = IOUtils.readBytesAndClose(in, 0); String page = new String(bytes, "UTF-8"); fragments.put(f.getName(), page); } } }
// in src/tools/org/h2/build/doc/WebSite.java
private void copy(File source, File target, boolean replaceFragments, boolean web) throws IOException { if (source.isDirectory()) { target.mkdirs(); for (File f : source.listFiles()) { copy(f, new File(target, f.getName()), replaceFragments, web); } } else { String name = source.getName(); if (name.endsWith("onePage.html") || name.startsWith("fragments")) { return; } if (web) { if (name.endsWith("main.html") || name.endsWith("main_ja.html")) { return; } } else { if (name.endsWith("mainWeb.html") || name.endsWith("mainWeb_ja.html")) { return; } } FileInputStream in = new FileInputStream(source); byte[] bytes = IOUtils.readBytesAndClose(in, 0); if (name.endsWith(".html")) { String page = new String(bytes, "UTF-8"); if (web) { page = StringUtils.replaceAll(page, ANALYTICS_TAG, ANALYTICS_SCRIPT); } if (replaceFragments) { page = replaceFragments(name, page); page = StringUtils.replaceAll(page, "<a href=\"frame", "<a href=\"main"); page = StringUtils.replaceAll(page, "html/frame.html", "html/main.html"); } if (web) { page = StringUtils.replaceAll(page, TRANSLATE_START, ""); page = StringUtils.replaceAll(page, TRANSLATE_END, ""); page = StringUtils.replaceAll(page, "<pre>", "<pre class=\"notranslate\">"); page = StringUtils.replaceAll(page, "<code>", "<code class=\"notranslate\">"); } bytes = page.getBytes("UTF-8"); } FileOutputStream out = new FileOutputStream(target); out.write(bytes); out.close(); if (web) { if (name.endsWith("mainWeb.html")) { target.renameTo(new File(target.getParentFile(), "main.html")); } else if (name.endsWith("mainWeb_ja.html")) { target.renameTo(new File(target.getParentFile(), "main_ja.html")); } } } }
// in src/tools/org/h2/build/doc/SpellChecker.java
public static void main(String... args) throws IOException { String dir = Utils.getProperty("spellcheckDir", "src"); new SpellChecker().run("src/tools/org/h2/build/doc/dictionary.txt", dir); }
// in src/tools/org/h2/build/doc/SpellChecker.java
private void run(String dictionaryFileName, String dir) throws IOException { process(new File(dictionaryFileName)); process(new File(dir)); if (printDictionary) { System.out.println("USED WORDS"); String[] list = new String[used.size()]; used.toArray(list); Arrays.sort(list); StringBuilder buff = new StringBuilder(); for (String s : list) { if (buff.length() > 0) { if (buff.length() + s.length() > 80) { System.out.println(buff.toString()); buff.setLength(0); } else { buff.append(' '); } } buff.append(s); } System.out.println(buff.toString()); } if (unknown.size() > 0) { System.out.println(); System.out.println("UNKNOWN WORDS"); for (String s : unknown.keySet()) { // int count = unknown.get(s); System.out.print(s + " "); errorCount++; } System.out.println(); System.out.println(); } if (errorCount > 0) { throw new IOException(errorCount + " error found"); } }
// in src/tools/org/h2/build/doc/SpellChecker.java
private void process(File file) throws IOException { String name = file.getName(); if (name.endsWith(".svn") || name.endsWith(".DS_Store")) { return; } if (name.startsWith("_") && name.indexOf("_en") < 0) { return; } if (file.isDirectory()) { for (File f : file.listFiles()) { process(f); } } else { String fileName = file.getAbsolutePath(); int idx = fileName.lastIndexOf('.'); String suffix; if (idx < 0) { suffix = ""; } else { suffix = fileName.substring(idx + 1); } for (String s : IGNORE) { if (s.equals(suffix)) { return; } } for (String ignoreFile : IGNORE_FILES) { if (fileName.endsWith(ignoreFile)) { return; } } boolean ok = false; for (String s : SUFFIX) { if (s.equals(suffix)) { ok = true; break; } } if (!ok) { throw new IOException("Unsupported suffix: " + suffix + " for file: " + fileName); } String text = new String(BuildBase.readFile(file)); if (fileName.endsWith("dictionary.txt")) { addToDictionary = true; } else { addToDictionary = false; } scan(fileName, text); } }
// in src/tools/org/h2/build/BuildBase.java
private PrintStream filter(PrintStream out, final String[] exclude) { return new PrintStream(new FilterOutputStream(out) { private ByteArrayOutputStream buff = new ByteArrayOutputStream(); public void write(byte[] b) throws IOException { write(b, 0, b.length); } public void write(byte[] b, int off, int len) throws IOException { for (int i = off; i < len; i++) { write(b[i]); } } public void write(byte b) throws IOException { buff.write(b); if (b == '\n') { byte[] data = buff.toByteArray(); String line = new String(data, "UTF-8"); boolean print = true; for (String l : exclude) { if (line.startsWith(l)) { print = false; break; } } if (print) { out.write(data); } buff.reset(); } } public void close() throws IOException { write('\n'); } }); }
// in src/tools/org/h2/build/BuildBase.java
public void write(byte[] b) throws IOException { write(b, 0, b.length); }
// in src/tools/org/h2/build/BuildBase.java
public void write(byte[] b, int off, int len) throws IOException { for (int i = off; i < len; i++) { write(b[i]); } }
// in src/tools/org/h2/build/BuildBase.java
public void write(byte b) throws IOException { buff.write(b); if (b == '\n') { byte[] data = buff.toByteArray(); String line = new String(data, "UTF-8"); boolean print = true; for (String l : exclude) { if (line.startsWith(l)) { print = false; break; } } if (print) { out.write(data); } buff.reset(); } }
// in src/tools/org/h2/build/BuildBase.java
public void close() throws IOException { write('\n'); }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static void buildHtml(String templateDir, String targetDir, String language) throws IOException { File[] list = new File(templateDir).listFiles(); new File(targetDir).mkdirs(); // load the main 'translation' String propName = templateDir + "/_docs_" + MAIN_LANGUAGE + ".properties"; Properties prop = load(propName, false); propName = templateDir + "/_docs_" + language + ".properties"; if (!(new File(propName)).exists()) { throw new IOException("Translation not found: " + propName); } Properties transProp = load(propName, false); for (Object k : transProp.keySet()) { String key = (String) k; String t = transProp.getProperty(key); // overload with translations, but not the ones starting with # if (t.startsWith("##")) { prop.put(key, t.substring(2)); } else if (!t.startsWith("#")) { prop.put(key, t); } } ArrayList <String>fileNames = new ArrayList<String>(); for (File f : list) { String name = f.getName(); if (!name.endsWith(".jsp")) { continue; } // remove '.jsp' name = name.substring(0, name.length() - 4); fileNames.add(name); } for (File f : list) { String name = f.getName(); if (!name.endsWith(".jsp")) { continue; } // remove '.jsp' name = name.substring(0, name.length() - 4); String template = IOUtils.readStringAndClose(new FileReader(templateDir + "/" + name + ".jsp"), -1); HashMap<String, Object> map = New.hashMap(); for (Object k : prop.keySet()) { map.put(k.toString(), prop.get(k)); } String html = PageParser.parse(template, map); html = StringUtils.replaceAll(html, "lang=\"" + MAIN_LANGUAGE + "\"", "lang=\"" + language + "\""); for (String n : fileNames) { if ("frame".equals(n)) { // don't translate 'frame.html' to 'frame_ja.html', // otherwise we can't switch back to English continue; } html = StringUtils.replaceAll(html, n + ".html\"", n + "_" + language + ".html\""); } html = StringUtils.replaceAll(html, "_" + MAIN_LANGUAGE + ".html\"", ".html\""); String target; if (language.equals(MAIN_LANGUAGE)) { target = targetDir + "/" + name + ".html"; } else { target = targetDir + "/" + name + "_" + language + ".html"; } OutputStream out = new FileOutputStream(target); OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8"); writer.write(html); writer.close(); } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static void prepare(String baseDir, String path, boolean utf8) throws IOException { String suffix = utf8 ? ".prop" : ".properties"; File dir = new File(path); File main = null; ArrayList<File> translations = new ArrayList<File>(); for (File f : dir.listFiles()) { if (f.getName().endsWith(suffix) && f.getName().indexOf('_') >= 0) { if (f.getName().endsWith("_" + MAIN_LANGUAGE + suffix)) { main = f; } else { translations.add(f); } } } SortedProperties p = load(main.getAbsolutePath(), utf8); Properties base = load(baseDir + "/" + main.getName(), utf8); store(p, main.getAbsolutePath(), utf8); for (File trans : translations) { String language = trans.getName(); language = language.substring(language.lastIndexOf('_') + 1, language.lastIndexOf('.')); prepare(p, base, trans, utf8); } store(p, baseDir + "/" + main.getName(), utf8); }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static SortedProperties load(String fileName, boolean utf8) throws IOException { if (utf8) { String s = new String(IOUtils.readBytesAndClose(new FileInputStream(fileName), -1), "UTF-8"); return SortedProperties.fromLines(s); } return SortedProperties.loadProperties(fileName); }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static void store(SortedProperties p, String fileName, boolean utf8) throws IOException { if (utf8) { String s = p.toLines(); FileOutputStream f = new FileOutputStream(fileName); f.write(s.getBytes("UTF-8")); f.close(); } else { p.store(fileName); } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static void prepare(Properties main, Properties base, File trans, boolean utf8) throws IOException { SortedProperties p = load(trans.getAbsolutePath(), utf8); Properties oldTranslations = new Properties(); for (Object k : base.keySet()) { String key = (String) k; String m = base.getProperty(key); String t = p.getProperty(key); if (t != null && !t.startsWith("#")) { oldTranslations.setProperty(m, t); } } HashSet<String> toTranslate = new HashSet<String>(); // add missing keys, using # and the value from the main file for (Object k : main.keySet()) { String key = (String) k; String now = main.getProperty(key); if (!p.containsKey(key)) { String t = oldTranslations.getProperty(now); if (t == null) { // System.out.println(trans.getName() + // ": key " + key + " not found in " + // "translation file; added # 'translation'"); t = "#" + now; p.put(key, t); } else { p.put(key, t); } } else { String t = p.getProperty(key); String last = base.getProperty(key); if (t.startsWith("#") && !t.startsWith("##")) { // not translated before t = oldTranslations.getProperty(now); if (t == null) { t = "#" + now; } p.put(key, t); } else if (last != null && !last.equals(now)) { t = oldTranslations.getProperty(now); if (t == null) { // main data changed since the last run: review translation System.out.println(trans.getName() + ": key " + key + " changed, please review; last=" + last + " now=" + now); String old = p.getProperty(key); t = "#" + now + " #" + old; p.put(key, t); } else { p.put(key, t); } } } } for (String key : toTranslate) { String now = main.getProperty(key); String t; System.out.println(trans.getName() + ": key " + key + " not found in translation file; added dummy # 'translation'"); t = "#" + now; p.put(key, t); } // remove keys that don't exist in the main file (deleted or typo in the key) for (Object k : new ArrayList<Object>(p.keySet())) { String key = (String) k; if (!main.containsKey(key)) { p.remove(key); } } store(p, trans.getAbsolutePath(), utf8); }
// in src/tools/org/h2/build/doclet/ResourceDoclet.java
public static boolean start(RootDoc root) throws IOException { return new ResourceDoclet().startDoc(root); }
// in src/tools/org/h2/build/doclet/ResourceDoclet.java
private boolean startDoc(RootDoc root) throws IOException { ClassDoc[] classes = root.classes(); String[][] options = root.options(); for (String[] op : options) { if (op[0].equals("dest")) { destFile = op[1]; } } for (ClassDoc clazz : classes) { processClass(clazz); } resources.store(destFile); return true; }
// in src/tools/org/h2/build/doclet/Doclet.java
public static boolean start(RootDoc root) throws IOException { return new Doclet().startDoc(root); }
// in src/tools/org/h2/build/doclet/Doclet.java
private boolean startDoc(RootDoc root) throws IOException { ClassDoc[] classes = root.classes(); String[][] options = root.options(); for (String[] op : options) { if (op[0].equals("destdir")) { destDir = op[1]; } } for (ClassDoc clazz : classes) { processClass(clazz); } if (errorCount > 0) { throw new IOException("FAILED: " + errorCount + " errors found"); } return true; }
// in src/tools/org/h2/build/doclet/Doclet.java
private void processClass(ClassDoc clazz) throws IOException { String packageName = clazz.containingPackage().name(); String dir = destDir + "/" + packageName.replace('.', '/'); (new File(dir)).mkdirs(); String fileName = dir + "/" + clazz.name() + ".html"; String className = getClass(clazz); FileWriter out = new FileWriter(fileName); PrintWriter writer = new PrintWriter(new BufferedWriter(out)); writer.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" " + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"); String language = "en"; writer.println("<html xmlns=\"http://www.w3.org/1999/xhtml\" " + "lang=\"" + language + "\" xml:lang=\"" + language + "\">"); writer.println("<head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /><title>"); writer.println(className); writer.println("</title><link rel=\"stylesheet\" type=\"text/css\" href=\"../../../stylesheet.css\" />"); writer.println("<script type=\"text/javascript\" src=\"../../../animate.js\"></script>"); writer.println("</head><body onload=\"openLink();\">"); writer.println("<table class=\"content\"><tr class=\"content\"><td class=\"content\"><div class=\"contentDiv\">"); writer.println("<h1>" + className + "</h1>"); writer.println(formatText(clazz.commentText()) + "<br /><br />"); // methods ConstructorDoc[] constructors = clazz.constructors(); MethodDoc[] methods = clazz.methods(); ExecutableMemberDoc[] constructorsMethods = new ExecutableMemberDoc[constructors.length + methods.length]; System.arraycopy(constructors, 0, constructorsMethods, 0, constructors.length); System.arraycopy(methods, 0, constructorsMethods, constructors.length, methods.length); Arrays.sort(constructorsMethods, new Comparator<ExecutableMemberDoc>() { public int compare(ExecutableMemberDoc a, ExecutableMemberDoc b) { // sort static method before non-static methods if (a.isStatic() != b.isStatic()) { return a.isStatic() ? -1 : 1; } return a.name().compareTo(b.name()); } }); // // // Arrays.sort(methods, new Comparator<MethodDoc>() { // public int compare(MethodDoc a, MethodDoc b) { // // sort static method before non-static methods // if (a.isStatic() != b.isStatic()) { // return a.isStatic() ? -1 : 1; // } // return a.name().compareTo(b.name()); // } // }); ArrayList<String> signatures = new ArrayList<String>(); boolean hasMethods = false; int id = 0; for (int i = 0; i < constructorsMethods.length; i++) { ExecutableMemberDoc method = constructorsMethods[i]; String name = method.name(); if (skipMethod(method)) { continue; } if (!hasMethods) { writer.println("<table class=\"block\"><tr onclick=\"return allDetails()\"><th colspan=\"2\">Methods</th></tr>"); hasMethods = true; } String type = getTypeName(method.isStatic(), false, getReturnType(method)); writer.println("<tr id=\"__"+id+"\" onclick=\"return on("+ id +")\">"); writer.println("<td class=\"return\">" + type + "</td><td class=\"method\">"); Parameter[] params = method.parameters(); StringBuilder buff = new StringBuilder(); StringBuilder buffSignature = new StringBuilder(name); buff.append('('); for (int j = 0; j < params.length; j++) { if (j > 0) { buff.append(", "); } buffSignature.append('_'); Parameter param = params[j]; boolean isVarArgs = method.isVarArgs() && j == params.length - 1; String typeName = getTypeName(false, isVarArgs, param.type()); buff.append(typeName); buffSignature.append(StringUtils.replaceAll(typeName, "[]", "-")); buff.append(' '); buff.append(param.name()); } buff.append(')'); if (isDeprecated(method)) { name = "<span class=\"deprecated\">" + name + "</span>"; } String signature = buffSignature.toString(); while (signatures.size() < i) { signatures.add(null); } signatures.add(i, signature); writer.println("<a id=\"" + signature + "\" href=\"#" + signature + "\">" + name + "</a>" + buff.toString()); String firstSentence = getFirstSentence(method.firstSentenceTags()); if (firstSentence != null) { writer.println("<div class=\"methodText\">" + formatText(firstSentence) + "</div>"); } writer.println("</td></tr>"); writer.println("<tr onclick=\"return off("+ id +")\" class=\"detail\" id=\"_"+id+"\">"); writer.println("<td class=\"return\">" + type + "</td><td>"); writeMethodDetails(writer, clazz, method, signature); writer.println("</td></tr>"); id++; } if (hasMethods) { writer.println("</table>"); } // field overview FieldDoc[] fields = clazz.fields(); if (clazz.interfaces().length > 0) { fields = clazz.interfaces()[0].fields(); } Arrays.sort(fields, new Comparator<FieldDoc>() { public int compare(FieldDoc a, FieldDoc b) { return a.name().compareTo(b.name()); } }); int fieldId = 0; for (FieldDoc field : fields) { if (skipField(clazz, field)) { continue; } String name = field.name(); String text = field.commentText(); if (text == null || text.trim().length() == 0) { addError("Undocumented field (" + clazz.name() + ".java:" + field.position().line() + ") " + name); } if (text != null && text.startsWith("INTERNAL")) { continue; } if (fieldId == 0) { writer.println("<br /><table><tr><th colspan=\"2\">Fields</th></tr>"); } String type = getTypeName(true, false, field.type()); writer.println("<tr><td class=\"return\">" + type + "</td><td class=\"method\">"); String constant = field.constantValueExpression(); // add a link (a name) if there is a <code> tag String link = getFieldLink(text, constant, clazz, name); writer.print("<a href=\"#" + link + "\">" + name + "</a>"); if (constant == null) { writer.println(); } else { writer.println(" = " + constant); } writer.println("</td></tr>"); fieldId++; } if (fieldId > 0) { writer.println("</table>"); } // field details Arrays.sort(fields, new Comparator<FieldDoc>() { public int compare(FieldDoc a, FieldDoc b) { String ca = a.constantValueExpression(); if (ca == null) { ca = a.name(); } String cb = b.constantValueExpression(); if (cb == null) { cb = b.name(); } return ca.compareTo(cb); } }); for (FieldDoc field : fields) { writeFieldDetails(writer, clazz, field); } writer.println("</div></td></tr></table></body></html>"); writer.close(); out.close(); }
// in src/tools/org/h2/build/code/CheckJavadoc.java
private void checkJavadoc(File file) throws IOException { RandomAccessFile in = new RandomAccessFile(file, "r"); byte[] data = new byte[(int) file.length()]; in.readFully(data); in.close(); String text = new String(data); int comment = text.indexOf("/**"); if (comment < 0) { System.out.println("No Javadoc comment: " + file.getAbsolutePath()); errorCount++; } int open = text.indexOf('{'); if (open < 0 || open < comment) { System.out.println("No '{' or '{' before the first Javadoc comment: " + file.getAbsolutePath()); errorCount++; } int pos = 0; int lineNumber = 1; boolean inComment = false; while (true) { int next = text.indexOf("\n", pos); if (next < 0) { break; } String line = text.substring(pos, next).trim(); if (line.startsWith("/*")) { inComment = true; } if (inComment) { if (line.length() > MAX_COMMENT_LINE_SIZE && !line.trim().startsWith("* http://")) { System.out.println("Long line : " + file.getAbsolutePath() + " (" + file.getName() + ":" + lineNumber + ")"); errorCount++; } if (line.endsWith("*/")) { inComment = false; } } if (!inComment && line.startsWith("//") && line.length() > MAX_COMMENT_LINE_SIZE && !line.trim().startsWith("// http://")) { System.out.println("Long line: " + file.getAbsolutePath() + " (" + file.getName() + ":" + lineNumber + ")"); errorCount++; } else if (!inComment && line.length() > MAX_SOURCE_LINE_SIZE) { System.out.println("Long line: " + file.getAbsolutePath() + " (" + file.getName() + ":" + lineNumber + ")"); } lineNumber++; pos = next + 1; } }
// in src/tools/org/h2/build/code/SwitchSource.java
public static void main(String... args) throws IOException { new SwitchSource().run(args); }
// in src/tools/org/h2/build/code/SwitchSource.java
private void run(String... args) throws IOException { String dir = null; String version = null; for (int i = 0; i < args.length; i++) { String a = args[i]; if ("-dir".equals(a)) { dir = args[++i]; } else if ("-auto".equals(a)) { enable.add("AWT"); version = System.getProperty("java.specification.version"); } else if ("-version".equals(a)) { version = args[++i]; } else if (a.startsWith("-")) { String x = a.substring(1); disable.add(x); enable.remove(x); } else if (a.startsWith("+")) { String x = a.substring(1); enable.add(x); disable.remove(x); } else { showUsage(); return; } } if (version == null) { // ok } else if ("1.5".equals(version)) { disable.add("Java 1.6"); disable.add("Java 1.7"); } else if ("1.6".equals(version)) { enable.add("Java 1.6"); disable.add("Java 1.7"); } else if (version.compareTo("1.7") >= 0) { enable.add("Java 1.6"); enable.add("Java 1.7"); } else { throw new IllegalArgumentException("version: " + version); } if (dir == null) { showUsage(); } else { process(new File(dir)); } }
// in src/tools/org/h2/build/code/SwitchSource.java
private void process(File f) throws IOException { String name = f.getName(); if (name.startsWith(".svn")) { return; } else if (name.endsWith(".java")) { processFile(f); } else if (f.isDirectory()) { for (File file : f.listFiles()) { process(file); } } }
// in src/tools/org/h2/build/code/SwitchSource.java
private void processFile(File f) throws IOException { RandomAccessFile read = new RandomAccessFile(f, "r"); byte[] buffer; try { long len = read.length(); if (len >= Integer.MAX_VALUE) { throw new IOException("Files bigger than Integer.MAX_VALUE are not supported"); } buffer = new byte[(int) len]; read.readFully(buffer); } finally { read.close(); } boolean found = false; // check for ## without creating a string for (int i = 0; i < buffer.length - 1; i++) { if (buffer[i] == '#' && buffer[i + 1] == '#') { found = true; break; } } if (!found) { return; } String source = new String(buffer); String target = source; for (String x : enable) { target = replaceAll(target, "/*## " + x + " ##", "//## " + x + " ##"); } for (String x : disable) { target = replaceAll(target, "//## " + x + " ##", "/*## " + x + " ##"); } if (!source.equals(target)) { String name = f.getPath(); File fileNew = new File(name + ".new"); FileWriter write = new FileWriter(fileNew); write.write(target); write.close(); File fileBack = new File(name + ".bak"); fileBack.delete(); f.renameTo(fileBack); File fileCopy = new File(name); if (!fileNew.renameTo(fileCopy)) { throw new IOException("Could not rename " + fileNew.getAbsolutePath() + " to " + name); } if (!fileBack.delete()) { throw new IOException("Could not delete " + fileBack.getAbsolutePath()); } // System.out.println(name); } }
// in src/tools/org/h2/java/Test.java
public static void main(String... args) throws IOException { new Test().test(); }
// in src/tools/org/h2/java/Test.java
public void test() throws IOException { // gcc --std=c99 test.c // (for "mixed declarations and code") // not supported yet: // HexadecimalFloatingPointLiteral // int x()[] { return null; } // annotations // import static // import * // initializer blocks // access to static fields with instance variable // final variables (within blocks, parameter list) // Identifier : (labels) // ClassOrInterfaceDeclaration within blocks (or any other nested classes) // assert assertEquals("\\\\" + "u0000", JavaParser.replaceUnicode("\\\\" + "u0000")); assertEquals("\u0000", JavaParser.replaceUnicode("\\" + "u0000")); assertEquals("\u0000", JavaParser.replaceUnicode("\\" + "uu0000")); assertEquals("\\\\" + "\u0000", JavaParser.replaceUnicode("\\\\\\" + "u0000")); assertEquals("0", JavaParser.readNumber("0a")); assertEquals("0l", JavaParser.readNumber("0l")); assertEquals("0xFFL", JavaParser.readNumber("0xFFLx")); assertEquals("0xDadaCafe", JavaParser.readNumber("0xDadaCafex")); assertEquals("1.40e-45f", JavaParser.readNumber("1.40e-45fx")); assertEquals("1e1f", JavaParser.readNumber("1e1fx")); assertEquals("2.f", JavaParser.readNumber("2.fx")); assertEquals(".3d", JavaParser.readNumber(".3dx")); assertEquals("6.022137e+23f", JavaParser.readNumber("6.022137e+23f+1")); JavaParser parser = new JavaParser(); parser.parse("src/tools/org/h2", "java.lang.Object"); parser.parse("src/tools/org/h2", "java.lang.String"); parser.parse("src/tools/org/h2", "java.lang.Math"); parser.parse("src/tools/org/h2", "java.lang.Integer"); parser.parse("src/tools/org/h2", "java.lang.StringBuilder"); parser.parse("src/tools/org/h2", "java.io.PrintStream"); parser.parse("src/tools/org/h2", "java.lang.System"); parser.parse("src/tools/org/h2", "java.util.Arrays"); parser.parse("src/tools", "org.h2.java.TestApp"); PrintWriter w = new PrintWriter(System.out); parser.writeHeader(w); parser.writeSource(w); w.flush(); w = new PrintWriter(new FileWriter("bin/test.c")); parser.writeHeader(w); parser.writeSource(w); w.close(); }
(Lib) IllegalArgumentException 25
              
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
public synchronized void setMaxConnections(int max) { if (max < 1) { throw new IllegalArgumentException("Invalid maxConnections value: " + max); } this.maxConnections = max; // notify waiting threads if the value was increased notifyAll(); }
// in src/main/org/h2/tools/MultiDimension.java
public int normalize(int dimensions, double value, double min, double max) { if (value < min || value > max) { throw new IllegalArgumentException(min + "<" + value + "<" + max); } double x = (value - min) / (max - min); return (int) (x * getMaxValue(dimensions)); }
// in src/main/org/h2/tools/MultiDimension.java
public int getMaxValue(int dimensions) { if (dimensions < 2 || dimensions > 32) { throw new IllegalArgumentException("" + dimensions); } int bitsPerValue = getBitsPerValue(dimensions); return (int) ((1L << bitsPerValue) - 1); }
// in src/main/org/h2/tools/MultiDimension.java
public long interleave(int... values) { int dimensions = values.length; long max = getMaxValue(dimensions); int bitsPerValue = getBitsPerValue(dimensions); long x = 0; for (int i = 0; i < dimensions; i++) { long k = values[i]; if (k < 0 || k > max) { throw new IllegalArgumentException(0 + "<" + k + "<" + max); } for (int b = 0; b < bitsPerValue; b++) { x |= (k & (1L << b)) << (i + (dimensions - 1) * b); } } return x; }
// in src/main/org/h2/tools/MultiDimension.java
public long interleave(int x, int y) { if (x < 0) { throw new IllegalArgumentException(0 + "<" + x); } if (y < 0) { throw new IllegalArgumentException(0 + "<" + y); } long z = 0; for (int i = 0; i < 32; i++) { z |= (x & (1L << i)) << i; z |= (y & (1L << i)) << (i + 1); } return z; }
// in src/main/org/h2/tools/MultiDimension.java
private long[][] getMortonRanges(int[] min, int[] max) { int len = min.length; if (max.length != len) { throw new IllegalArgumentException(len + "=" + max.length); } for (int i = 0; i < len; i++) { if (min[i] > max[i]) { int temp = min[i]; min[i] = max[i]; max[i] = temp; } } int total = getSize(min, max, len); ArrayList<long[]> list = New.arrayList(); addMortonRanges(list, min, max, len, 0); combineEntries(list, total); long[][] ranges = new long[list.size()][2]; list.toArray(ranges); return ranges; }
// in src/main/org/h2/tools/MultiDimension.java
private void addMortonRanges(ArrayList<long[]> list, int[] min, int[] max, int len, int level) { if (level > 100) { throw new IllegalArgumentException("" + level); } int largest = 0, largestDiff = 0; long size = 1; for (int i = 0; i < len; i++) { int diff = max[i] - min[i]; if (diff < 0) { throw new IllegalArgumentException(""+ diff); } size *= diff + 1; if (size < 0) { throw new IllegalArgumentException("" + size); } if (diff > largestDiff) { largestDiff = diff; largest = i; } } long low = interleave(min), high = interleave(max); if (high < low) { throw new IllegalArgumentException(high + "<" + low); } long range = high - low + 1; if (range == size) { long[] item = { low, high }; list.add(item); } else { int middle = findMiddle(min[largest], max[largest]); int temp = max[largest]; max[largest] = middle; addMortonRanges(list, min, max, len, level + 1); max[largest] = temp; temp = min[largest]; min[largest] = middle + 1; addMortonRanges(list, min, max, len, level + 1); min[largest] = temp; } }
// in src/main/org/h2/tools/MultiDimension.java
private static int findMiddle(int a, int b) { int diff = b - a - 1; if (diff == 0) { return a; } if (diff == 1) { return a + 1; } int scale = 0; while ((1 << scale) < diff) { scale++; } scale--; int m = roundUp(a + 2, 1 << scale) - 1; if (m <= a || m >= b) { throw new IllegalArgumentException(a + "<" + m + "<" + b); } return m; }
// in src/main/org/h2/value/ValueTimestamp.java
private static ValueTimestamp parseTry(String s) { int dateEnd = s.indexOf(' '); if (dateEnd < 0) { // ISO 8601 compatibility dateEnd = s.indexOf('T'); } int timeStart; if (dateEnd < 0) { dateEnd = s.length(); timeStart = -1; } else { timeStart = dateEnd + 1; } long dateValue = DateTimeUtils.parseDateValue(s, 0, dateEnd); long nanos; if (timeStart < 0) { nanos = 0; } else { int timeEnd = s.length(); TimeZone tz = null; if (s.endsWith("Z")) { tz = TimeZone.getTimeZone("UTC"); timeEnd--; } else { int timeZoneStart = s.indexOf('+', dateEnd); if (timeZoneStart < 0) { timeZoneStart = s.indexOf('-', dateEnd); } if (timeZoneStart >= 0) { String tzName = "GMT" + s.substring(timeZoneStart); tz = TimeZone.getTimeZone(tzName); if (!tz.getID().startsWith(tzName)) { throw new IllegalArgumentException(tzName); } timeEnd = timeZoneStart; } else { timeZoneStart = s.indexOf(' ', dateEnd + 1); if (timeZoneStart > 0) { String tzName = s.substring(timeZoneStart + 1); tz = TimeZone.getTimeZone(tzName); if (!tz.getID().startsWith(tzName)) { throw new IllegalArgumentException(tzName); } timeEnd = timeZoneStart; } } } nanos = DateTimeUtils.parseTimeNanos(s, dateEnd + 1, timeEnd, true); if (tz != null) { int year = DateTimeUtils.yearFromDateValue(dateValue); int month = DateTimeUtils.monthFromDateValue(dateValue); int day = DateTimeUtils.dayFromDateValue(dateValue); long ms = nanos / 1000000; nanos -= ms * 1000000; long second = ms / 1000; ms -= second * 1000; int minute = (int) (second / 60); second -= minute * 60; int hour = minute / 60; minute -= hour * 60; long millis = DateTimeUtils.getMillis(tz, year, month, day, hour, minute, (int) second, (int) ms); ms = DateTimeUtils.convertToLocal(new Date(millis), Calendar.getInstance(TimeZone.getTimeZone("UTC"))); long md = DateTimeUtils.MILLIS_PER_DAY; long absoluteDay = (ms >= 0 ? ms : ms - md + 1) / md; ms -= absoluteDay * md; nanos += ms * 1000000; } } return ValueTimestamp.fromDateValueAndNanos(dateValue, nanos); }
// in src/main/org/h2/compress/CompressLZF.java
public void expand(byte[] in, int inPos, int inLen, byte[] out, int outPos, int outLen) { // if ((inPos | outPos | outLen) < 0) { if (inPos < 0 || outPos < 0 || outLen < 0) { throw new IllegalArgumentException(); } do { int ctrl = in[inPos++] & 255; if (ctrl < MAX_LITERAL) { // literal run of length = ctrl + 1, ctrl++; // copy to output and move forward this many bytes System.arraycopy(in, inPos, out, outPos, ctrl); outPos += ctrl; inPos += ctrl; } else { // back reference // the highest 3 bits are the match length int len = ctrl >> 5; // if the length is maxed, add the next byte to the length if (len == 7) { len += in[inPos++] & 255; } // minimum back-reference is 3 bytes, // so 2 was subtracted before storing size len += 2; // ctrl is now the offset for a back-reference... // the logical AND operation removes the length bits ctrl = -((ctrl & 0x1f) << 8) - 1; // the next byte augments/increases the offset ctrl -= in[inPos++] & 255; // copy the back-reference bytes from the given // location in output to current position ctrl += outPos; if (outPos + len >= out.length) { // reduce array bounds checking throw new ArrayIndexOutOfBoundsException(); } for (int i = 0; i < len; i++) { out[outPos++] = out[ctrl++]; } } } while (outPos < outLen); }
// in src/main/org/h2/util/DateTimeUtils.java
public static long parseDateValue(String s, int start, int end) { if (s.charAt(start) == '+') { // +year start++; } // start at position 1 to support "-year" int s1 = s.indexOf('-', start + 1); int s2 = s.indexOf('-', s1 + 1); if (s1 <= 0 || s2 <= s1) { throw new IllegalArgumentException(s); } int year = Integer.parseInt(s.substring(start, s1)); int month = Integer.parseInt(s.substring(s1 + 1, s2)); int day = Integer.parseInt(s.substring(s2 + 1, end)); if (!isValidDate(year, month, day)) { throw new IllegalArgumentException(year + "-" + month + "-" + day); } return dateValue(year, month, day); }
// in src/main/org/h2/util/DateTimeUtils.java
public static long parseTimeNanos(String s, int start, int end, boolean timeOfDay) { int hour = 0, minute = 0, second = 0; long nanos = 0; int s1 = s.indexOf(':', start); int s2 = s.indexOf(':', s1 + 1); int s3 = s.indexOf('.', s2 + 1); if (s1 <= 0 || s2 <= s1) { throw new IllegalArgumentException(s); } boolean negative; hour = Integer.parseInt(s.substring(start, s1)); if (hour < 0) { if (timeOfDay) { throw new IllegalArgumentException(s); } negative = true; hour = -hour; } else { negative = false; } minute = Integer.parseInt(s.substring(s1 + 1, s2)); if (s3 < 0) { second = Integer.parseInt(s.substring(s2 + 1, end)); } else { second = Integer.parseInt(s.substring(s2 + 1, s3)); String n = (s.substring(s3 + 1, end) + "000000000").substring(0, 9); nanos = Integer.parseInt(n); } if (hour >= 2000000 || minute < 0 || minute >= 60 || second < 0 || second >= 60) { throw new IllegalArgumentException(s); } if (timeOfDay && hour >= 24) { throw new IllegalArgumentException(s); } nanos += ((((hour * 60L) + minute) * 60) + second) * 1000000000; return negative ? -nanos : nanos; }
// in src/main/org/h2/util/StringUtils.java
public static String urlDecode(String encoded) { int length = encoded.length(); byte[] buff = new byte[length]; int j = 0; for (int i = 0; i < length; i++) { char ch = encoded.charAt(i); if (ch == '+') { buff[j++] = ' '; } else if (ch == '%') { buff[j++] = (byte) Integer.parseInt(encoded.substring(i + 1, i + 3), 16); i += 2; } else { if (SysProperties.CHECK) { if (ch > 127 || ch < ' ') { throw new IllegalArgumentException("Unexpected char " + (int) ch + " decoding " + encoded); } } buff[j++] = (byte) ch; } } String s = utf8Decode(buff, 0, j); return s; }
// in src/tools/org/h2/build/code/SwitchSource.java
private void run(String... args) throws IOException { String dir = null; String version = null; for (int i = 0; i < args.length; i++) { String a = args[i]; if ("-dir".equals(a)) { dir = args[++i]; } else if ("-auto".equals(a)) { enable.add("AWT"); version = System.getProperty("java.specification.version"); } else if ("-version".equals(a)) { version = args[++i]; } else if (a.startsWith("-")) { String x = a.substring(1); disable.add(x); enable.remove(x); } else if (a.startsWith("+")) { String x = a.substring(1); enable.add(x); disable.remove(x); } else { showUsage(); return; } } if (version == null) { // ok } else if ("1.5".equals(version)) { disable.add("Java 1.6"); disable.add("Java 1.7"); } else if ("1.6".equals(version)) { enable.add("Java 1.6"); disable.add("Java 1.7"); } else if (version.compareTo("1.7") >= 0) { enable.add("Java 1.6"); enable.add("Java 1.7"); } else { throw new IllegalArgumentException("version: " + version); } if (dir == null) { showUsage(); } else { process(new File(dir)); } }
0 0
(Lib) UnsupportedOperationException 20
              
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void addStatementEventListener(StatementEventListener listener) { throw new UnsupportedOperationException(); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void removeStatementEventListener(StatementEventListener listener) { throw new UnsupportedOperationException(); }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
public Connection getConnection(String user, String password) { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public FileLock lock(long position, long size, boolean shared) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public MappedByteBuffer map(MapMode mode, long position, long size) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public int read(ByteBuffer dst, long position) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long transferFrom(ReadableByteChannel src, long position, long count) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long transferTo(long position, long count, WritableByteChannel target) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public FileLock tryLock(long position, long size, boolean shared) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public int write(ByteBuffer src, long position) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/util/SoftHashMap.java
public Set<Entry<K, V>> entrySet() { throw new UnsupportedOperationException(); }
// in src/main/org/h2/server/web/WebApp.java
public void remove() { throw new UnsupportedOperationException(); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
public void remove() { throw new UnsupportedOperationException(); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
public void remove() { throw new UnsupportedOperationException(); }
// in src/tools/org/h2/jaqu/util/WeakIdentityHashMap.java
public Set<java.util.Map.Entry<K, V>> entrySet() { throw new UnsupportedOperationException(); }
// in src/tools/org/h2/jaqu/util/WeakIdentityHashMap.java
public Set<K> keySet() { throw new UnsupportedOperationException(); }
// in src/tools/org/h2/jaqu/util/WeakIdentityHashMap.java
public void putAll(Map<? extends K, ? extends V> m) { throw new UnsupportedOperationException(); }
// in src/tools/org/h2/jaqu/util/WeakIdentityHashMap.java
public Collection<V> values() { throw new UnsupportedOperationException(); }
0 0
(Domain) SQLException 16
              
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
public Connection getConnection() throws SQLException { long max = System.currentTimeMillis() + timeout * 1000; do { synchronized (this) { if (activeConnections < maxConnections) { return getConnectionNow(); } try { wait(1000); } catch (InterruptedException e) { // ignore } } } while (System.currentTimeMillis() <= max); throw new SQLException("Login timeout", "08001", 8001); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
private JdbcConnection getJdbcConnection(String user, char[] password) throws SQLException { if (isDebugEnabled()) { debugCode("getJdbcConnection("+quote(user)+", new char[0]);"); } Properties info = new Properties(); info.setProperty("user", user); info.put("password", password); Connection conn = Driver.load().connect(url, info); if (conn == null) { throw new SQLException("No suitable driver found for " + url, "08001", 8001); } else if (!(conn instanceof JdbcConnection)) { throw new SQLException("Connecting with old version is not supported: " + url, "08001", 8001); } return (JdbcConnection) conn; }
// in src/main/org/h2/tools/Script.java
public void runTool(String... args) throws SQLException { String url = null; String user = "sa"; String password = ""; String file = "backup.sql"; String options1 = null, options2 = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-script")) { file = args[++i]; } else if (arg.equals("-options")) { StringBuilder buff1 = new StringBuilder(); StringBuilder buff2 = new StringBuilder(); i++; for (; i < args.length; i++) { String a = args[i]; String upper = StringUtils.toUpperEnglish(a); if ("SIMPLE".equals(upper) || upper.startsWith("NO") || "DROP".equals(upper)) { buff1.append(' '); buff1.append(args[i]); } else { buff2.append(' '); buff2.append(args[i]); } } options1 = buff1.toString(); options2 = buff2.toString(); } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (url == null) { showUsage(); throw new SQLException("URL not set"); } if (options1 != null) { processScript(url, user, password, file, options1, options2); } else { execute(url, user, password, file); } }
// in src/main/org/h2/tools/ChangeFileEncryption.java
public void runTool(String... args) throws SQLException { String dir = "."; String cipher = null; char[] decryptPassword = null; char[] encryptPassword = null; String db = null; boolean quiet = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-cipher")) { cipher = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-decrypt")) { decryptPassword = args[++i].toCharArray(); } else if (arg.equals("-encrypt")) { encryptPassword = args[++i].toCharArray(); } else if (arg.equals("-quiet")) { quiet = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if ((encryptPassword == null && decryptPassword == null) || cipher == null) { showUsage(); throw new SQLException("Encryption or decryption password not set, or cipher not set"); } try { process(dir, db, cipher, decryptPassword, encryptPassword, quiet); } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/ChangeFileEncryption.java
private void process(String dir, String db, String cipher, char[] decryptPassword, char[] encryptPassword, boolean quiet) throws SQLException { dir = FileLister.getDir(dir); ChangeFileEncryption change = new ChangeFileEncryption(); if (encryptPassword != null) { for (char c : encryptPassword) { if (c == ' ') { throw new SQLException("The file password may not contain spaces"); } } } change.out = out; change.directory = dir; change.cipherType = cipher; change.decrypt = getFileEncryptionKey(decryptPassword); change.encrypt = getFileEncryptionKey(encryptPassword); ArrayList<String> files = FileLister.getDatabaseFiles(dir, db, true); FileLister.tryUnlockDatabase(files, "encryption"); files = FileLister.getDatabaseFiles(dir, db, false); if (files.size() == 0 && !quiet) { printNoDatabaseFilesFound(dir, db); } // first, test only if the file can be renamed // (to find errors with locked files early) for (String fileName : files) { String temp = dir + "/temp.db"; FileUtils.delete(temp); FileUtils.moveTo(fileName, temp); FileUtils.moveTo(temp, fileName); } // if this worked, the operation will (hopefully) be successful // TODO changeFileEncryption: this is a workaround! // make the operation atomic (all files or none) for (String fileName : files) { // Don't process a lob directory, just the files in the directory. if (!FileUtils.isDirectory(fileName)) { change.process(fileName); } } }
// in src/main/org/h2/tools/Csv.java
public void reset() throws SQLException { throw new SQLException("Method is not supported", "CSV"); }
// in src/main/org/h2/tools/CreateCluster.java
public void runTool(String... args) throws SQLException { String urlSource = null; String urlTarget = null; String user = "sa"; String password = ""; String serverList = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-urlSource")) { urlSource = args[++i]; } else if (arg.equals("-urlTarget")) { urlTarget = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-serverList")) { serverList = args[++i]; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (urlSource == null || urlTarget == null || serverList == null) { showUsage(); throw new SQLException("Source URL, target URL, or server list not set"); } process(urlSource, urlTarget, user, password, serverList); }
// in src/main/org/h2/tools/CreateCluster.java
private void process(String urlSource, String urlTarget, String user, String password, String serverList) throws SQLException { Connection connSource = null, connTarget = null; Statement statSource = null, statTarget = null; String scriptFile = "backup.sql"; try { org.h2.Driver.load(); // verify that the database doesn't exist, // or if it exists (an old cluster instance), it is deleted boolean exists = true; try { connTarget = DriverManager.getConnection(urlTarget + ";IFEXISTS=TRUE;CLUSTER=" + Constants.CLUSTERING_ENABLED, user, password); Statement stat = connTarget.createStatement(); stat.execute("DROP ALL OBJECTS DELETE FILES"); stat.close(); exists = false; connTarget.close(); } catch (SQLException e) { if (e.getErrorCode() == ErrorCode.DATABASE_NOT_FOUND_1) { // database does not exists yet - ok exists = false; } else { throw e; } } if (exists) { throw new SQLException("Target database must not yet exist. Please delete it first: " + urlTarget); } // use cluster='' so connecting is possible // even if the cluster is enabled connSource = DriverManager.getConnection(urlSource + ";CLUSTER=''", user, password); statSource = connSource.createStatement(); // enable the exclusive mode and close other connections, // so that data can't change while restoring the second database statSource.execute("SET EXCLUSIVE 2"); try { // backup Script script = new Script(); script.setOut(out); OutputStream scriptOut = null; try { scriptOut = FileUtils.newOutputStream(scriptFile, false); Script.process(connSource, scriptOut); } finally { IOUtils.closeSilently(scriptOut); } // delete the target database and then restore connTarget = DriverManager.getConnection(urlTarget + ";CLUSTER=''", user, password); statTarget = connTarget.createStatement(); statTarget.execute("DROP ALL OBJECTS DELETE FILES"); connTarget.close(); RunScript runScript = new RunScript(); runScript.setOut(out); runScript.process(urlTarget, user, password, scriptFile, null, false); connTarget = DriverManager.getConnection(urlTarget, user, password); statTarget = connTarget.createStatement(); // set the cluster to the serverList on both databases statSource.executeUpdate("SET CLUSTER '" + serverList + "'"); statTarget.executeUpdate("SET CLUSTER '" + serverList + "'"); } finally { // switch back to the regular mode statSource.execute("SET EXCLUSIVE FALSE"); } } finally { FileUtils.delete(scriptFile); JdbcUtils.closeSilently(statSource); JdbcUtils.closeSilently(statTarget); JdbcUtils.closeSilently(connSource); JdbcUtils.closeSilently(connTarget); } }
// in src/main/org/h2/tools/RunScript.java
public void runTool(String... args) throws SQLException { String url = null; String user = "sa"; String password = ""; String script = "backup.sql"; String options = null; boolean continueOnError = false; boolean showTime = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-continueOnError")) { continueOnError = true; } else if (arg.equals("-checkResults")) { checkResults = true; } else if (arg.equals("-showResults")) { showResults = true; } else if (arg.equals("-script")) { script = args[++i]; } else if (arg.equals("-time")) { showTime = true; } else if (arg.equals("-driver")) { String driver = args[++i]; Utils.loadUserClass(driver); } else if (arg.equals("-options")) { StringBuilder buff = new StringBuilder(); i++; for (; i < args.length; i++) { buff.append(' ').append(args[i]); } options = buff.toString(); } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (url == null) { showUsage(); throw new SQLException("URL not set"); } long time = System.currentTimeMillis(); if (options != null) { processRunscript(url, user, password, script, options); } else { process(url, user, password, script, null, continueOnError); } if (showTime) { time = System.currentTimeMillis() - time; out.println("Done in " + time + " ms"); } }
// in src/main/org/h2/tools/RunScript.java
private void process(Connection conn, boolean continueOnError, String path, Reader reader, String charsetName) throws SQLException, IOException { Statement stat = conn.createStatement(); ScriptReader r = new ScriptReader(reader); while (true) { String sql = r.readStatement(); if (sql == null) { break; } String trim = sql.trim(); if (trim.length() == 0) { continue; } if (trim.startsWith("@") && StringUtils.toUpperEnglish(trim).startsWith("@INCLUDE")) { sql = trim; sql = sql.substring("@INCLUDE".length()).trim(); if (!FileUtils.isAbsolute(sql)) { sql = path + SysProperties.FILE_SEPARATOR + sql; } process(conn, sql, continueOnError, charsetName); } else { try { if (showResults && !trim.startsWith("-->")) { out.print(sql + ";"); } if (showResults || checkResults) { boolean query = stat.execute(sql); if (query) { ResultSet rs = stat.getResultSet(); int columns = rs.getMetaData().getColumnCount(); StringBuilder buff = new StringBuilder(); while (rs.next()) { buff.append("\n-->"); for (int i = 0; i < columns; i++) { String s = rs.getString(i + 1); if (s != null) { s = StringUtils.replaceAll(s, "\r\n", "\n"); s = StringUtils.replaceAll(s, "\n", "\n--> "); s = StringUtils.replaceAll(s, "\r", "\r--> "); } buff.append(' ').append(s); } } buff.append("\n;"); String result = buff.toString(); if (showResults) { out.print(result); } if (checkResults) { String expected = r.readStatement() + ";"; expected = StringUtils.replaceAll(expected, "\r\n", "\n"); expected = StringUtils.replaceAll(expected, "\r", "\n"); if (!expected.equals(result)) { expected = StringUtils.replaceAll(expected, " ", "+"); result = StringUtils.replaceAll(result, " ", "+"); throw new SQLException("Unexpected output for:\n" + sql.trim() + "\nGot:\n" + result + "\nExpected:\n" + expected); } } } } else { stat.execute(sql); } } catch (Exception e) { if (continueOnError) { e.printStackTrace(out); } else { throw DbException.toSQLException(e); } } } } }
// in src/main/org/h2/fulltext/FullText.java
protected static SQLException throwException(String message) throws SQLException { throw new SQLException(message, "FULLTEXT"); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
public void runTool(String... args) throws SQLException { String url = null; String user = "sa"; String password = ""; String schema = null; String table = null; String packageName = ""; String folder = null; boolean annotateSchema = true; boolean trimStrings = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-schema")) { schema = args[++i]; } else if (arg.equals("-table")) { table = args[++i]; } else if (arg.equals("-package")) { packageName = args[++i]; } else if (arg.equals("-folder")) { folder = args[++i]; } else if (arg.equals("-annotateSchema")) { try { annotateSchema = Boolean.parseBoolean(args[++i]); } catch (Throwable t) { throw new SQLException("Can not parse -annotateSchema value"); } } else if (arg.equals("-trimStrings")) { try { trimStrings = Boolean.parseBoolean(args[++i]); } catch (Throwable t) { throw new SQLException("Can not parse -trimStrings value"); } } else { throwUnsupportedOption(arg); } } if (url == null) { throw new SQLException("URL not set"); } execute(url, user, password, schema, table, packageName, folder, annotateSchema, trimStrings); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
protected SQLException throwUnsupportedOption(String option) throws SQLException { showUsage(); throw new SQLException("Unsupported option: " + option); }
2
              
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -annotateSchema value"); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -trimStrings value"); }
990
              
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void close() throws SQLException { debugCodeCall("close"); Connection lastHandle = handleConn; if (lastHandle != null) { listeners.clear(); lastHandle.close(); } if (physicalConn != null) { try { physicalConn.close(); } finally { physicalConn = null; } } }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public Connection getConnection() throws SQLException { debugCodeCall("getConnection"); Connection lastHandle = handleConn; if (lastHandle != null) { lastHandle.close(); } // this will ensure the rollback command is cached physicalConn.rollback(); handleConn = new PooledJdbcConnection(physicalConn); return handleConn; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public synchronized void close() throws SQLException { if (!isClosed) { try { rollback(); setAutoCommit(true); } catch (SQLException e) { // ignore } closedHandle(); isClosed = true; } }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public synchronized boolean isClosed() throws SQLException { return isClosed || super.isClosed(); }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
public Connection getConnection() throws SQLException { long max = System.currentTimeMillis() + timeout * 1000; do { synchronized (this) { if (activeConnections < maxConnections) { return getConnectionNow(); } try { wait(1000); } catch (InterruptedException e) { // ignore } } } while (System.currentTimeMillis() <= max); throw new SQLException("Login timeout", "08001", 8001); }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
private Connection getConnectionNow() throws SQLException { if (isDisposed) { throw new IllegalStateException("Connection pool has been disposed."); } PooledConnection pc; if (!recycledConnections.isEmpty()) { pc = recycledConnections.remove(recycledConnections.size() - 1); } else { pc = dataSource.getPooledConnection(); } Connection conn = pc.getConnection(); activeConnections++; pc.addConnectionEventListener(this); return conn; }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw DbException.getUnsupportedException("unwrap"); }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw DbException.getUnsupportedException("isWrapperFor"); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public Connection getConnection() throws SQLException { debugCodeCall("getConnection"); return getJdbcConnection(userName, StringUtils.cloneCharArray(passwordChars)); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public Connection getConnection(String user, String password) throws SQLException { if (isDebugEnabled()) { debugCode("getConnection("+quote(user)+", \"\");"); } return getJdbcConnection(user, convertToCharArray(password)); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
private JdbcConnection getJdbcConnection(String user, char[] password) throws SQLException { if (isDebugEnabled()) { debugCode("getJdbcConnection("+quote(user)+", new char[0]);"); } Properties info = new Properties(); info.setProperty("user", user); info.put("password", password); Connection conn = Driver.load().connect(url, info); if (conn == null) { throw new SQLException("No suitable driver found for " + url, "08001", 8001); } else if (!(conn instanceof JdbcConnection)) { throw new SQLException("Connecting with old version is not supported: " + url, "08001", 8001); } return (JdbcConnection) conn; }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public XAConnection getXAConnection() throws SQLException { debugCodeCall("getXAConnection"); int id = getNextId(XA_DATA_SOURCE); return new JdbcXAConnection(factory, id, getJdbcConnection(userName, StringUtils.cloneCharArray(passwordChars))); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public XAConnection getXAConnection(String user, String password) throws SQLException { if (isDebugEnabled()) { debugCode("getXAConnection("+quote(user)+", \"\");"); } int id = getNextId(XA_DATA_SOURCE); return new JdbcXAConnection(factory, id, getJdbcConnection(user, convertToCharArray(password))); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public PooledConnection getPooledConnection() throws SQLException { debugCodeCall("getPooledConnection"); return getXAConnection(); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public PooledConnection getPooledConnection(String user, String password) throws SQLException { if (isDebugEnabled()) { debugCode("getPooledConnection("+quote(user)+", \"\");"); } return getXAConnection(user, password); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/message/TraceObject.java
protected SQLException unsupported(String message) throws SQLException { try { throw DbException.getUnsupportedException(message); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/tools/TriggerAdapter.java
public void init(Connection conn, String schemaName, String triggerName, String tableName, boolean before, int type) throws SQLException { ResultSet rs = conn.getMetaData().getColumns( null, schemaName, tableName, null); oldSource = new TriggerRowSource(); newSource = new TriggerRowSource(); oldResultSet = new SimpleResultSet(oldSource); newResultSet = new SimpleResultSet(newSource); while (rs.next()) { String column = rs.getString("COLUMN_NAME"); int dataType = rs.getInt("DATA_TYPE"); int precision = rs.getInt("COLUMN_SIZE"); int scale = rs.getInt("DECIMAL_DIGITS"); oldResultSet.addColumn(column, dataType, precision, scale); newResultSet.addColumn(column, dataType, precision, scale); } this.schemaName = schemaName; this.triggerName = triggerName; this.tableName = tableName; this.before = before; this.type = type; }
// in src/main/org/h2/tools/TriggerAdapter.java
public void fire(Connection conn, Object[] oldRow, Object[] newRow) throws SQLException { fire(conn, wrap(oldResultSet, oldSource, oldRow), wrap(newResultSet, newSource, newRow)); }
// in src/main/org/h2/tools/TriggerAdapter.java
private static SimpleResultSet wrap(SimpleResultSet rs, TriggerRowSource source, Object[] row) throws SQLException { if (row == null) { return null; } source.setRow(row); rs.next(); return rs; }
// in src/main/org/h2/tools/TriggerAdapter.java
public void remove() throws SQLException { // do nothing by default }
// in src/main/org/h2/tools/TriggerAdapter.java
public void close() throws SQLException { // do nothing by default }
// in src/main/org/h2/tools/Restore.java
public static void main(String... args) throws SQLException { new Restore().runTool(args); }
// in src/main/org/h2/tools/Restore.java
public void runTool(String... args) throws SQLException { String zipFileName = "backup.zip"; String dir = "."; String db = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-file")) { zipFileName = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-quiet")) { // ignore } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } execute(zipFileName, dir, db, false); }
// in src/main/org/h2/tools/Script.java
public static void main(String... args) throws SQLException { new Script().runTool(args); }
// in src/main/org/h2/tools/Script.java
public void runTool(String... args) throws SQLException { String url = null; String user = "sa"; String password = ""; String file = "backup.sql"; String options1 = null, options2 = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-script")) { file = args[++i]; } else if (arg.equals("-options")) { StringBuilder buff1 = new StringBuilder(); StringBuilder buff2 = new StringBuilder(); i++; for (; i < args.length; i++) { String a = args[i]; String upper = StringUtils.toUpperEnglish(a); if ("SIMPLE".equals(upper) || upper.startsWith("NO") || "DROP".equals(upper)) { buff1.append(' '); buff1.append(args[i]); } else { buff2.append(' '); buff2.append(args[i]); } } options1 = buff1.toString(); options2 = buff2.toString(); } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (url == null) { showUsage(); throw new SQLException("URL not set"); } if (options1 != null) { processScript(url, user, password, file, options1, options2); } else { execute(url, user, password, file); } }
// in src/main/org/h2/tools/Script.java
private static void processScript(String url, String user, String password, String fileName, String options1, String options2) throws SQLException { Connection conn = null; Statement stat = null; try { org.h2.Driver.load(); conn = DriverManager.getConnection(url, user, password); stat = conn.createStatement(); String sql = "SCRIPT " + options1 + " TO '" + fileName + "' " + options2; stat.execute(sql); } finally { JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(conn); } }
// in src/main/org/h2/tools/Script.java
public static void execute(String url, String user, String password, String fileName) throws SQLException { OutputStream o = null; try { o = FileUtils.newOutputStream(fileName, false); execute(url, user, password, o); } finally { IOUtils.closeSilently(o); } }
// in src/main/org/h2/tools/Script.java
public static void execute(String url, String user, String password, OutputStream out) throws SQLException { Connection conn = null; try { org.h2.Driver.load(); conn = DriverManager.getConnection(url, user, password); process(conn, out); } finally { JdbcUtils.closeSilently(conn); } }
// in src/main/org/h2/tools/Script.java
static void process(Connection conn, OutputStream out) throws SQLException { Statement stat = null; try { stat = conn.createStatement(); PrintWriter writer = new PrintWriter(IOUtils.getBufferedWriter(out)); ResultSet rs = stat.executeQuery("SCRIPT"); while (rs.next()) { String s = rs.getString(1); writer.println(s); } writer.flush(); } finally { JdbcUtils.closeSilently(stat); } }
// in src/main/org/h2/tools/ChangeFileEncryption.java
public static void main(String... args) throws SQLException { new ChangeFileEncryption().runTool(args); }
// in src/main/org/h2/tools/ChangeFileEncryption.java
public void runTool(String... args) throws SQLException { String dir = "."; String cipher = null; char[] decryptPassword = null; char[] encryptPassword = null; String db = null; boolean quiet = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-cipher")) { cipher = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-decrypt")) { decryptPassword = args[++i].toCharArray(); } else if (arg.equals("-encrypt")) { encryptPassword = args[++i].toCharArray(); } else if (arg.equals("-quiet")) { quiet = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if ((encryptPassword == null && decryptPassword == null) || cipher == null) { showUsage(); throw new SQLException("Encryption or decryption password not set, or cipher not set"); } try { process(dir, db, cipher, decryptPassword, encryptPassword, quiet); } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/ChangeFileEncryption.java
public static void execute(String dir, String db, String cipher, char[] decryptPassword, char[] encryptPassword, boolean quiet) throws SQLException { try { new ChangeFileEncryption().process(dir, db, cipher, decryptPassword, encryptPassword, quiet); } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/ChangeFileEncryption.java
private void process(String dir, String db, String cipher, char[] decryptPassword, char[] encryptPassword, boolean quiet) throws SQLException { dir = FileLister.getDir(dir); ChangeFileEncryption change = new ChangeFileEncryption(); if (encryptPassword != null) { for (char c : encryptPassword) { if (c == ' ') { throw new SQLException("The file password may not contain spaces"); } } } change.out = out; change.directory = dir; change.cipherType = cipher; change.decrypt = getFileEncryptionKey(decryptPassword); change.encrypt = getFileEncryptionKey(encryptPassword); ArrayList<String> files = FileLister.getDatabaseFiles(dir, db, true); FileLister.tryUnlockDatabase(files, "encryption"); files = FileLister.getDatabaseFiles(dir, db, false); if (files.size() == 0 && !quiet) { printNoDatabaseFilesFound(dir, db); } // first, test only if the file can be renamed // (to find errors with locked files early) for (String fileName : files) { String temp = dir + "/temp.db"; FileUtils.delete(temp); FileUtils.moveTo(fileName, temp); FileUtils.moveTo(temp, fileName); } // if this worked, the operation will (hopefully) be successful // TODO changeFileEncryption: this is a workaround! // make the operation atomic (all files or none) for (String fileName : files) { // Don't process a lob directory, just the files in the directory. if (!FileUtils.isDirectory(fileName)) { change.process(fileName); } } }
// in src/main/org/h2/tools/ConvertTraceFile.java
public static void main(String... args) throws SQLException { new ConvertTraceFile().runTool(args); }
// in src/main/org/h2/tools/ConvertTraceFile.java
public void runTool(String... args) throws SQLException { String traceFile = "test.trace.db"; String javaClass = "Test"; String script = "test.sql"; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-traceFile")) { traceFile = args[++i]; } else if (arg.equals("-javaClass")) { javaClass = args[++i]; } else if (arg.equals("-script")) { script = args[++i]; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } try { convertFile(traceFile, javaClass, script); } catch (IOException e) { throw DbException.convertIOException(e, traceFile); } }
// in src/main/org/h2/tools/Backup.java
public static void main(String... args) throws SQLException { new Backup().runTool(args); }
// in src/main/org/h2/tools/Backup.java
public void runTool(String... args) throws SQLException { String zipFileName = "backup.zip"; String dir = "."; String db = null; boolean quiet = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-quiet")) { quiet = true; } else if (arg.equals("-file")) { zipFileName = args[++i]; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } try { process(zipFileName, dir, db, quiet); } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/Backup.java
public static void execute(String zipFileName, String directory, String db, boolean quiet) throws SQLException { try { new Backup().process(zipFileName, directory, db, quiet); } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/Backup.java
private void process(String zipFileName, String directory, String db, boolean quiet) throws SQLException { List<String> list; boolean allFiles = db != null && db.length() == 0; if (allFiles) { list = FileUtils.newDirectoryStream(directory); } else { list = FileLister.getDatabaseFiles(directory, db, true); } if (list.size() == 0) { if (!quiet) { printNoDatabaseFilesFound(directory, db); } return; } if (!quiet) { FileLister.tryUnlockDatabase(list, "backup"); } zipFileName = FileUtils.toRealPath(zipFileName); FileUtils.delete(zipFileName); OutputStream fileOut = null; try { fileOut = FileUtils.newOutputStream(zipFileName, false); ZipOutputStream zipOut = new ZipOutputStream(fileOut); String base = ""; for (String fileName : list) { if (fileName.endsWith(Constants.SUFFIX_PAGE_FILE) || allFiles) { base = FileUtils.getParent(fileName); break; } } for (String fileName : list) { String f = FileUtils.toRealPath(fileName); if (!f.startsWith(base)) { DbException.throwInternalError(f + " does not start with " + base); } if (f.endsWith(zipFileName)) { continue; } if (FileUtils.isDirectory(fileName)) { continue; } f = f.substring(base.length()); f = BackupCommand.correctFileName(f); ZipEntry entry = new ZipEntry(f); zipOut.putNextEntry(entry); InputStream in = null; try { in = FileUtils.newInputStream(fileName); IOUtils.copyAndCloseInput(in, zipOut); } catch (FileNotFoundException e) { // the file could have been deleted in the meantime // ignore this (in this case an empty file is created) } finally { IOUtils.closeSilently(in); } zipOut.closeEntry(); if (!quiet) { out.println("Processed: " + fileName); } } zipOut.closeEntry(); zipOut.close(); } catch (IOException e) { throw DbException.convertIOException(e, zipFileName); } finally { IOUtils.closeSilently(fileOut); } }
// in src/main/org/h2/tools/Csv.java
private int writeResultSet(ResultSet rs) throws SQLException { try { int rows = 0; ResultSetMetaData meta = rs.getMetaData(); int columnCount = meta.getColumnCount(); String[] row = new String[columnCount]; int[] sqlTypes = new int[columnCount]; for (int i = 0; i < columnCount; i++) { row[i] = meta.getColumnLabel(i + 1); sqlTypes[i] = meta.getColumnType(i + 1); } if (writeColumnHeader) { writeRow(row); } while (rs.next()) { for (int i = 0; i < columnCount; i++) { Object o; switch (sqlTypes[i]) { case Types.DATE: o = rs.getDate(i + 1); break; case Types.TIME: o = rs.getTime(i + 1); break; case Types.TIMESTAMP: o = rs.getTimestamp(i + 1); break; default: o = rs.getString(i + 1); } row[i] = o == null ? null : o.toString(); } writeRow(row); rows++; } output.close(); return rows; } catch (IOException e) { throw DbException.convertIOException(e, null); } finally { close(); JdbcUtils.closeSilently(rs); } }
// in src/main/org/h2/tools/Csv.java
public int write(Writer writer, ResultSet rs) throws SQLException { this.output = writer; return writeResultSet(rs); }
// in src/main/org/h2/tools/Csv.java
public int write(String outputFileName, ResultSet rs, String charset) throws SQLException { init(outputFileName, charset); try { initWrite(); return writeResultSet(rs); } catch (IOException e) { throw convertException("IOException writing " + outputFileName, e); } }
// in src/main/org/h2/tools/Csv.java
public int write(Connection conn, String outputFileName, String sql, String charset) throws SQLException { Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery(sql); int rows = write(outputFileName, rs, charset); stat.close(); return rows; }
// in src/main/org/h2/tools/Csv.java
public ResultSet read(String inputFileName, String[] colNames, String charset) throws SQLException { init(inputFileName, charset); try { return readResultSet(colNames); } catch (IOException e) { throw convertException("IOException reading " + inputFileName, e); } }
// in src/main/org/h2/tools/Csv.java
public Object[] readRow() throws SQLException { if (input == null) { return null; } String[] row = new String[columnNames.length]; try { int i = 0; while (true) { String v = readValue(); if (v == null) { if (endOfLine) { if (i == 0) { if (endOfFile) { return null; } // empty line continue; } break; } } if (i < row.length) { row[i++] = v; } if (endOfLine) { break; } } } catch (IOException e) { throw convertException("IOException reading from " + fileName, e); } return row; }
// in src/main/org/h2/tools/Csv.java
public void reset() throws SQLException { throw new SQLException("Method is not supported", "CSV"); }
// in src/main/org/h2/tools/CreateCluster.java
public static void main(String... args) throws SQLException { new CreateCluster().runTool(args); }
// in src/main/org/h2/tools/CreateCluster.java
public void runTool(String... args) throws SQLException { String urlSource = null; String urlTarget = null; String user = "sa"; String password = ""; String serverList = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-urlSource")) { urlSource = args[++i]; } else if (arg.equals("-urlTarget")) { urlTarget = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-serverList")) { serverList = args[++i]; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (urlSource == null || urlTarget == null || serverList == null) { showUsage(); throw new SQLException("Source URL, target URL, or server list not set"); } process(urlSource, urlTarget, user, password, serverList); }
// in src/main/org/h2/tools/CreateCluster.java
public void execute(String urlSource, String urlTarget, String user, String password, String serverList) throws SQLException { process(urlSource, urlTarget, user, password, serverList); }
// in src/main/org/h2/tools/CreateCluster.java
private void process(String urlSource, String urlTarget, String user, String password, String serverList) throws SQLException { Connection connSource = null, connTarget = null; Statement statSource = null, statTarget = null; String scriptFile = "backup.sql"; try { org.h2.Driver.load(); // verify that the database doesn't exist, // or if it exists (an old cluster instance), it is deleted boolean exists = true; try { connTarget = DriverManager.getConnection(urlTarget + ";IFEXISTS=TRUE;CLUSTER=" + Constants.CLUSTERING_ENABLED, user, password); Statement stat = connTarget.createStatement(); stat.execute("DROP ALL OBJECTS DELETE FILES"); stat.close(); exists = false; connTarget.close(); } catch (SQLException e) { if (e.getErrorCode() == ErrorCode.DATABASE_NOT_FOUND_1) { // database does not exists yet - ok exists = false; } else { throw e; } } if (exists) { throw new SQLException("Target database must not yet exist. Please delete it first: " + urlTarget); } // use cluster='' so connecting is possible // even if the cluster is enabled connSource = DriverManager.getConnection(urlSource + ";CLUSTER=''", user, password); statSource = connSource.createStatement(); // enable the exclusive mode and close other connections, // so that data can't change while restoring the second database statSource.execute("SET EXCLUSIVE 2"); try { // backup Script script = new Script(); script.setOut(out); OutputStream scriptOut = null; try { scriptOut = FileUtils.newOutputStream(scriptFile, false); Script.process(connSource, scriptOut); } finally { IOUtils.closeSilently(scriptOut); } // delete the target database and then restore connTarget = DriverManager.getConnection(urlTarget + ";CLUSTER=''", user, password); statTarget = connTarget.createStatement(); statTarget.execute("DROP ALL OBJECTS DELETE FILES"); connTarget.close(); RunScript runScript = new RunScript(); runScript.setOut(out); runScript.process(urlTarget, user, password, scriptFile, null, false); connTarget = DriverManager.getConnection(urlTarget, user, password); statTarget = connTarget.createStatement(); // set the cluster to the serverList on both databases statSource.executeUpdate("SET CLUSTER '" + serverList + "'"); statTarget.executeUpdate("SET CLUSTER '" + serverList + "'"); } finally { // switch back to the regular mode statSource.execute("SET EXCLUSIVE FALSE"); } } finally { FileUtils.delete(scriptFile); JdbcUtils.closeSilently(statSource); JdbcUtils.closeSilently(statTarget); JdbcUtils.closeSilently(connSource); JdbcUtils.closeSilently(connTarget); } }
// in src/main/org/h2/tools/Recover.java
public static void main(String... args) throws SQLException { new Recover().runTool(args); }
// in src/main/org/h2/tools/Recover.java
public void runTool(String... args) throws SQLException { String dir = "."; String db = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if ("-dir".equals(arg)) { dir = args[++i]; } else if ("-db".equals(arg)) { db = args[++i]; } else if ("-removePassword".equals(arg)) { remove = true; } else if ("-trace".equals(arg)) { trace = true; } else if ("-transactionLog".equals(arg)) { transactionLog = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } process(dir, db); }
// in src/main/org/h2/tools/Recover.java
public static void execute(String dir, String db) throws SQLException { try { new Recover().process(dir, db); } catch (DbException e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/Server.java
public static void main(String... args) throws SQLException { new Server().runTool(args); }
// in src/main/org/h2/tools/Server.java
private void verifyArgs(String... args) throws SQLException { for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg == null) { continue; } else if ("-?".equals(arg) || "-help".equals(arg)) { // ok } else if (arg.startsWith("-web")) { if ("-web".equals(arg)) { // ok } else if ("-webAllowOthers".equals(arg)) { // no parameters } else if ("-webDaemon".equals(arg)) { // no parameters } else if ("-webSSL".equals(arg)) { // no parameters } else if ("-webPort".equals(arg)) { i++; } else { throwUnsupportedOption(arg); } } else if ("-browser".equals(arg)) { // ok } else if (arg.startsWith("-tcp")) { if ("-tcp".equals(arg)) { // ok } else if ("-tcpAllowOthers".equals(arg)) { // no parameters } else if ("-tcpDaemon".equals(arg)) { // no parameters } else if ("-tcpSSL".equals(arg)) { // no parameters } else if ("-tcpPort".equals(arg)) { i++; } else if ("-tcpPassword".equals(arg)) { i++; } else if ("-tcpShutdown".equals(arg)) { i++; } else if ("-tcpShutdownForce".equals(arg)) { // ok } else { throwUnsupportedOption(arg); } } else if (arg.startsWith("-pg")) { if ("-pg".equals(arg)) { // ok } else if ("-pgAllowOthers".equals(arg)) { // no parameters } else if ("-pgDaemon".equals(arg)) { // no parameters } else if ("-pgPort".equals(arg)) { i++; } else { throwUnsupportedOption(arg); } } else if (arg.startsWith("-ftp")) { if ("-ftpPort".equals(arg)) { i++; } else if ("-ftpDir".equals(arg)) { i++; } else if ("-ftpRead".equals(arg)) { i++; } else if ("-ftpWrite".equals(arg)) { i++; } else if ("-ftpWritePassword".equals(arg)) { i++; } else if ("-ftpTask".equals(arg)) { // no parameters } else { throwUnsupportedOption(arg); } } else if ("-properties".equals(arg)) { i++; } else if ("-trace".equals(arg)) { // no parameters } else if ("-ifExists".equals(arg)) { // no parameters } else if ("-baseDir".equals(arg)) { i++; } else if ("-key".equals(arg)) { i += 2; } else if ("-tool".equals(arg)) { // no parameters } else { throwUnsupportedOption(arg); } } }
// in src/main/org/h2/tools/Server.java
public void runTool(String... args) throws SQLException { boolean tcpStart = false, pgStart = false, webStart = false; boolean browserStart = false; boolean tcpShutdown = false, tcpShutdownForce = false; String tcpPassword = ""; String tcpShutdownServer = ""; boolean startDefaultServers = true; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg == null) { continue; } else if ("-?".equals(arg) || "-help".equals(arg)) { showUsage(); return; } else if (arg.startsWith("-web")) { if ("-web".equals(arg)) { startDefaultServers = false; webStart = true; } else if ("-webAllowOthers".equals(arg)) { // no parameters } else if ("-webDaemon".equals(arg)) { // no parameters } else if ("-webSSL".equals(arg)) { // no parameters } else if ("-webPort".equals(arg)) { i++; } else { showUsageAndThrowUnsupportedOption(arg); } } else if ("-browser".equals(arg)) { startDefaultServers = false; browserStart = true; } else if (arg.startsWith("-tcp")) { if ("-tcp".equals(arg)) { startDefaultServers = false; tcpStart = true; } else if ("-tcpAllowOthers".equals(arg)) { // no parameters } else if ("-tcpDaemon".equals(arg)) { // no parameters } else if ("-tcpSSL".equals(arg)) { // no parameters } else if ("-tcpPort".equals(arg)) { i++; } else if ("-tcpPassword".equals(arg)) { tcpPassword = args[++i]; } else if ("-tcpShutdown".equals(arg)) { startDefaultServers = false; tcpShutdown = true; tcpShutdownServer = args[++i]; } else if ("-tcpShutdownForce".equals(arg)) { tcpShutdownForce = true; } else { showUsageAndThrowUnsupportedOption(arg); } } else if (arg.startsWith("-pg")) { if ("-pg".equals(arg)) { startDefaultServers = false; pgStart = true; } else if ("-pgAllowOthers".equals(arg)) { // no parameters } else if ("-pgDaemon".equals(arg)) { // no parameters } else if ("-pgPort".equals(arg)) { i++; } else { showUsageAndThrowUnsupportedOption(arg); } } else if ("-properties".equals(arg)) { i++; } else if ("-trace".equals(arg)) { // no parameters } else if ("-ifExists".equals(arg)) { // no parameters } else if ("-baseDir".equals(arg)) { i++; } else if ("-key".equals(arg)) { i += 2; } else { showUsageAndThrowUnsupportedOption(arg); } } verifyArgs(args); if (startDefaultServers) { tcpStart = true; pgStart = true; webStart = true; browserStart = true; } // TODO server: maybe use one single properties file? if (tcpShutdown) { out.println("Shutting down TCP Server at " + tcpShutdownServer); shutdownTcpServer(tcpShutdownServer, tcpPassword, tcpShutdownForce, false); } try { if (webStart) { web = createWebServer(args); web.setShutdownHandler(this); SQLException result = null; try { web.start(); } catch (Exception e) { result = DbException.toSQLException(e); } out.println(web.getStatus()); // start browser in any case (even if the server is already running) // because some people don't look at the output, // but are wondering why nothing happens if (browserStart) { try { openBrowser(web.getURL()); } catch (Exception e) { out.println(e.getMessage()); } } if (result != null) { throw result; } } if (tcpStart) { tcp = createTcpServer(args); tcp.start(); out.println(tcp.getStatus()); tcp.setShutdownHandler(this); } if (pgStart) { pg = createPgServer(args); pg.start(); out.println(pg.getStatus()); } } catch (SQLException e) { stopAll(); throw e; } }
// in src/main/org/h2/tools/Server.java
public static void shutdownTcpServer(String url, String password, boolean force, boolean all) throws SQLException { TcpServer.shutdown(url, password, force, all); }
// in src/main/org/h2/tools/Server.java
public static Server createWebServer(String... args) throws SQLException { WebServer service = new WebServer(); Server server = new Server(service, args); service.setShutdownHandler(server); return server; }
// in src/main/org/h2/tools/Server.java
public static Server createTcpServer(String... args) throws SQLException { TcpServer service = new TcpServer(); Server server = new Server(service, args); service.setShutdownHandler(server); return server; }
// in src/main/org/h2/tools/Server.java
public static Server createPgServer(String... args) throws SQLException { return new Server(new PgServer(), args); }
// in src/main/org/h2/tools/Server.java
public Server start() throws SQLException { try { started = true; service.start(); String name = service.getName() + " (" + service.getURL() + ")"; Thread t = new Thread(this, name); t.setDaemon(service.isDaemon()); t.start(); for (int i = 1; i < 64; i += i) { wait(i); if (isRunning(false)) { return this; } } if (isRunning(true)) { return this; } throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2, name, "timeout; " + "please check your network configuration, specially the file /etc/hosts"); } catch (DbException e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/Server.java
public static void startWebServer(Connection conn) throws SQLException { WebServer webServer = new WebServer(); Server web = new Server(webServer, new String[] { "-webPort", "0" }); web.start(); Server server = new Server(); server.web = web; webServer.setShutdownHandler(server); String url = webServer.addSession(conn); try { Server.openBrowser(url); while (!webServer.isStopped()) { Thread.sleep(1000); } } catch (Exception e) { // ignore } }
// in src/main/org/h2/tools/RunScript.java
public static void main(String... args) throws SQLException { new RunScript().runTool(args); }
// in src/main/org/h2/tools/RunScript.java
public void runTool(String... args) throws SQLException { String url = null; String user = "sa"; String password = ""; String script = "backup.sql"; String options = null; boolean continueOnError = false; boolean showTime = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-continueOnError")) { continueOnError = true; } else if (arg.equals("-checkResults")) { checkResults = true; } else if (arg.equals("-showResults")) { showResults = true; } else if (arg.equals("-script")) { script = args[++i]; } else if (arg.equals("-time")) { showTime = true; } else if (arg.equals("-driver")) { String driver = args[++i]; Utils.loadUserClass(driver); } else if (arg.equals("-options")) { StringBuilder buff = new StringBuilder(); i++; for (; i < args.length; i++) { buff.append(' ').append(args[i]); } options = buff.toString(); } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (url == null) { showUsage(); throw new SQLException("URL not set"); } long time = System.currentTimeMillis(); if (options != null) { processRunscript(url, user, password, script, options); } else { process(url, user, password, script, null, continueOnError); } if (showTime) { time = System.currentTimeMillis() - time; out.println("Done in " + time + " ms"); } }
// in src/main/org/h2/tools/RunScript.java
public static ResultSet execute(Connection conn, Reader reader) throws SQLException { Statement stat = conn.createStatement(); ResultSet rs = null; ScriptReader r = new ScriptReader(reader); while (true) { String sql = r.readStatement(); if (sql == null) { break; } if (sql.trim().length() == 0) { continue; } boolean resultSet = stat.execute(sql); if (resultSet) { if (rs != null) { rs.close(); rs = null; } rs = stat.getResultSet(); } } return rs; }
// in src/main/org/h2/tools/RunScript.java
private void process(Connection conn, String fileName, boolean continueOnError, String charsetName) throws SQLException, IOException { InputStream in = FileUtils.newInputStream(fileName); String path = FileUtils.getParent(fileName); try { in = new BufferedInputStream(in, Constants.IO_BUFFER_SIZE); Reader reader = new InputStreamReader(in, charsetName); process(conn, continueOnError, path, reader, charsetName); } finally { IOUtils.closeSilently(in); } }
// in src/main/org/h2/tools/RunScript.java
private void process(Connection conn, boolean continueOnError, String path, Reader reader, String charsetName) throws SQLException, IOException { Statement stat = conn.createStatement(); ScriptReader r = new ScriptReader(reader); while (true) { String sql = r.readStatement(); if (sql == null) { break; } String trim = sql.trim(); if (trim.length() == 0) { continue; } if (trim.startsWith("@") && StringUtils.toUpperEnglish(trim).startsWith("@INCLUDE")) { sql = trim; sql = sql.substring("@INCLUDE".length()).trim(); if (!FileUtils.isAbsolute(sql)) { sql = path + SysProperties.FILE_SEPARATOR + sql; } process(conn, sql, continueOnError, charsetName); } else { try { if (showResults && !trim.startsWith("-->")) { out.print(sql + ";"); } if (showResults || checkResults) { boolean query = stat.execute(sql); if (query) { ResultSet rs = stat.getResultSet(); int columns = rs.getMetaData().getColumnCount(); StringBuilder buff = new StringBuilder(); while (rs.next()) { buff.append("\n-->"); for (int i = 0; i < columns; i++) { String s = rs.getString(i + 1); if (s != null) { s = StringUtils.replaceAll(s, "\r\n", "\n"); s = StringUtils.replaceAll(s, "\n", "\n--> "); s = StringUtils.replaceAll(s, "\r", "\r--> "); } buff.append(' ').append(s); } } buff.append("\n;"); String result = buff.toString(); if (showResults) { out.print(result); } if (checkResults) { String expected = r.readStatement() + ";"; expected = StringUtils.replaceAll(expected, "\r\n", "\n"); expected = StringUtils.replaceAll(expected, "\r", "\n"); if (!expected.equals(result)) { expected = StringUtils.replaceAll(expected, " ", "+"); result = StringUtils.replaceAll(result, " ", "+"); throw new SQLException("Unexpected output for:\n" + sql.trim() + "\nGot:\n" + result + "\nExpected:\n" + expected); } } } } else { stat.execute(sql); } } catch (Exception e) { if (continueOnError) { e.printStackTrace(out); } else { throw DbException.toSQLException(e); } } } } }
// in src/main/org/h2/tools/RunScript.java
private static void processRunscript(String url, String user, String password, String fileName, String options) throws SQLException { Connection conn = null; Statement stat = null; try { org.h2.Driver.load(); conn = DriverManager.getConnection(url, user, password); stat = conn.createStatement(); String sql = "RUNSCRIPT FROM '" + fileName + "' " + options; stat.execute(sql); } finally { JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(conn); } }
// in src/main/org/h2/tools/RunScript.java
public static void execute(String url, String user, String password, String fileName, String charsetName, boolean continueOnError) throws SQLException { new RunScript().process(url, user, password, fileName, charsetName, continueOnError); }
// in src/main/org/h2/tools/RunScript.java
void process(String url, String user, String password, String fileName, String charsetName, boolean continueOnError) throws SQLException { try { org.h2.Driver.load(); Connection conn = DriverManager.getConnection(url, user, password); if (charsetName == null) { charsetName = Constants.UTF8; } try { process(conn, fileName, continueOnError, charsetName); } finally { conn.close(); } } catch (IOException e) { throw DbException.convertIOException(e, fileName); } }
// in src/main/org/h2/tools/Console.java
public static void main(String... args) throws SQLException { new Console().runTool(args); }
// in src/main/org/h2/tools/Console.java
public void runTool(String... args) throws SQLException { isWindows = Utils.getProperty("os.name", "").startsWith("Windows"); boolean tcpStart = false, pgStart = false, webStart = false, toolStart = false; boolean browserStart = false; boolean startDefaultServers = true; boolean printStatus = args != null && args.length > 0; String driver = null, url = null, user = null, password = null; boolean tcpShutdown = false, tcpShutdownForce = false; String tcpPassword = ""; String tcpShutdownServer = ""; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg == null) { continue; } else if ("-?".equals(arg) || "-help".equals(arg)) { showUsage(); return; } else if ("-url".equals(arg)) { startDefaultServers = false; url = args[++i]; } else if ("-driver".equals(arg)) { driver = args[++i]; } else if ("-user".equals(arg)) { user = args[++i]; } else if ("-password".equals(arg)) { password = args[++i]; } else if (arg.startsWith("-web")) { if ("-web".equals(arg)) { startDefaultServers = false; webStart = true; } else if ("-webAllowOthers".equals(arg)) { // no parameters } else if ("-webDaemon".equals(arg)) { // no parameters } else if ("-webSSL".equals(arg)) { // no parameters } else if ("-webPort".equals(arg)) { i++; } else { showUsageAndThrowUnsupportedOption(arg); } } else if ("-tool".equals(arg)) { startDefaultServers = false; webStart = true; toolStart = true; } else if ("-browser".equals(arg)) { startDefaultServers = false; webStart = true; browserStart = true; } else if (arg.startsWith("-tcp")) { if ("-tcp".equals(arg)) { startDefaultServers = false; tcpStart = true; } else if ("-tcpAllowOthers".equals(arg)) { // no parameters } else if ("-tcpDaemon".equals(arg)) { // no parameters } else if ("-tcpSSL".equals(arg)) { // no parameters } else if ("-tcpPort".equals(arg)) { i++; } else if ("-tcpPassword".equals(arg)) { tcpPassword = args[++i]; } else if ("-tcpShutdown".equals(arg)) { startDefaultServers = false; tcpShutdown = true; tcpShutdownServer = args[++i]; } else if ("-tcpShutdownForce".equals(arg)) { tcpShutdownForce = true; } else { showUsageAndThrowUnsupportedOption(arg); } } else if (arg.startsWith("-pg")) { if ("-pg".equals(arg)) { startDefaultServers = false; pgStart = true; } else if ("-pgAllowOthers".equals(arg)) { // no parameters } else if ("-pgDaemon".equals(arg)) { // no parameters } else if ("-pgPort".equals(arg)) { i++; } else { showUsageAndThrowUnsupportedOption(arg); } } else if ("-properties".equals(arg)) { i++; } else if ("-trace".equals(arg)) { // no parameters } else if ("-ifExists".equals(arg)) { // no parameters } else if ("-baseDir".equals(arg)) { i++; } else { showUsageAndThrowUnsupportedOption(arg); } } if (startDefaultServers) { webStart = true; toolStart = true; browserStart = true; tcpStart = true; pgStart = true; } if (tcpShutdown) { out.println("Shutting down TCP Server at " + tcpShutdownServer); Server.shutdownTcpServer(tcpShutdownServer, tcpPassword, tcpShutdownForce, false); } SQLException startException = null; boolean webRunning = false; if (url != null) { Connection conn = JdbcUtils.getConnection(driver, url, user, password); Server.startWebServer(conn); } if (webStart) { try { web = Server.createWebServer(args); web.setShutdownHandler(this); web.start(); if (printStatus) { out.println(web.getStatus()); } webRunning = true; } catch (SQLException e) { printProblem(e, web); startException = e; } } //## AWT ## if (toolStart && webRunning && !GraphicsEnvironment.isHeadless()) { loadFont(); try { if (!createTrayIcon()) { showWindow(); } } catch (Exception e) { e.printStackTrace(); } } //*/ // start browser in any case (even if the server is already running) // because some people don't look at the output, // but are wondering why nothing happens if (browserStart && web != null) { openBrowser(web.getURL()); } if (tcpStart) { try { tcp = Server.createTcpServer(args); tcp.start(); if (printStatus) { out.println(tcp.getStatus()); } tcp.setShutdownHandler(this); } catch (SQLException e) { printProblem(e, tcp); if (startException == null) { startException = e; } } } if (pgStart) { try { pg = Server.createPgServer(args); pg.start(); if (printStatus) { out.println(pg.getStatus()); } } catch (SQLException e) { printProblem(e, pg); if (startException == null) { startException = e; } } } if (startException != null) { shutdown(); throw startException; } }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getArray(Map<String, Class<?>> map) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getArray(long index, int count) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getArray(long index, int count, Map<String, Class<?>> map) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public ResultSet getResultSet() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public ResultSet getResultSet(Map<String, Class<?>> map) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public ResultSet getResultSet(long index, int count) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public ResultSet getResultSet(long index, int count, Map<String, Class<?>> map) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean next() throws SQLException { if (source != null) { rowId++; currentRow = source.readRow(); if (currentRow != null) { return true; } } else if (rows != null && rowId < rows.size()) { rowId++; if (rowId < rows.size()) { currentRow = rows.get(rowId); return true; } } if (autoClose) { close(); } return false; }
// in src/main/org/h2/tools/SimpleResultSet.java
public void beforeFirst() throws SQLException { rowId = -1; if (source != null) { source.reset(); } }
// in src/main/org/h2/tools/SimpleResultSet.java
public int findColumn(String columnLabel) throws SQLException { if (columnLabel != null && columns != null) { for (int i = 0, size = columns.size(); i < size; i++) { if (columnLabel.equalsIgnoreCase(getColumn(i).name)) { return i + 1; } } } throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnLabel).getSQLException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Array getArray(int columnIndex) throws SQLException { Object[] o = (Object[]) get(columnIndex); return o == null ? null : new SimpleArray(o); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Array getArray(String columnLabel) throws SQLException { return getArray(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public InputStream getAsciiStream(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public InputStream getAsciiStream(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public BigDecimal getBigDecimal(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof BigDecimal)) { o = new BigDecimal(o.toString()); } return (BigDecimal) o; }
// in src/main/org/h2/tools/SimpleResultSet.java
public BigDecimal getBigDecimal(String columnLabel) throws SQLException { return getBigDecimal(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public InputStream getBinaryStream(int columnIndex) throws SQLException { Blob b = (Blob) get(columnIndex); return b == null ? null : b.getBinaryStream(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public InputStream getBinaryStream(String columnLabel) throws SQLException { return getBinaryStream(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Blob getBlob(int columnIndex) throws SQLException { Blob b = (Blob) get(columnIndex); return b == null ? null : b; }
// in src/main/org/h2/tools/SimpleResultSet.java
public Blob getBlob(String columnLabel) throws SQLException { return getBlob(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean getBoolean(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Boolean)) { o = Boolean.valueOf(o.toString()); } return o == null ? false : ((Boolean) o).booleanValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean getBoolean(String columnLabel) throws SQLException { return getBoolean(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public byte getByte(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { o = Byte.decode(o.toString()); } return o == null ? 0 : ((Number) o).byteValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public byte getByte(String columnLabel) throws SQLException { return getByte(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public byte[] getBytes(int columnIndex) throws SQLException { return (byte[]) get(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public byte[] getBytes(String columnLabel) throws SQLException { return getBytes(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Reader getCharacterStream(int columnIndex) throws SQLException { Clob c = (Clob) get(columnIndex); return c == null ? null : c.getCharacterStream(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Reader getCharacterStream(String columnLabel) throws SQLException { return getCharacterStream(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Clob getClob(int columnIndex) throws SQLException { Clob c = (Clob) get(columnIndex); return c == null ? null : c; }
// in src/main/org/h2/tools/SimpleResultSet.java
public Clob getClob(String columnLabel) throws SQLException { return getClob(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Date getDate(int columnIndex) throws SQLException { return (Date) get(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Date getDate(String columnLabel) throws SQLException { return getDate(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Date getDate(int columnIndex, Calendar cal) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Date getDate(String columnLabel, Calendar cal) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public double getDouble(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { return Double.parseDouble(o.toString()); } return o == null ? 0 : ((Number) o).doubleValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public double getDouble(String columnLabel) throws SQLException { return getDouble(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public float getFloat(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { return Float.parseFloat(o.toString()); } return o == null ? 0 : ((Number) o).floatValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public float getFloat(String columnLabel) throws SQLException { return getFloat(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public int getInt(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { o = Integer.decode(o.toString()); } return o == null ? 0 : ((Number) o).intValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public int getInt(String columnLabel) throws SQLException { return getInt(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public long getLong(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { o = Long.decode(o.toString()); } return o == null ? 0 : ((Number) o).longValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public long getLong(String columnLabel) throws SQLException { return getLong(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Reader getNCharacterStream(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Reader getNCharacterStream(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public NClob getNClob(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public NClob getNClob(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getNString(int columnIndex) throws SQLException { return getString(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getNString(String columnLabel) throws SQLException { return getString(columnLabel); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getObject(int columnIndex) throws SQLException { return get(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getObject(String columnLabel) throws SQLException { return getObject(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Ref getRef(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Ref getRef(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public RowId getRowId(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public RowId getRowId(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public short getShort(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { o = Short.decode(o.toString()); } return o == null ? 0 : ((Number) o).shortValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public short getShort(String columnLabel) throws SQLException { return getShort(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public SQLXML getSQLXML(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public SQLXML getSQLXML(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getString(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o == null) { return null; } switch (columns.get(columnIndex - 1).sqlType) { case Types.CLOB: Clob c = (Clob) o; return c.getSubString(1, MathUtils.convertLongToInt(c.length())); } return o.toString(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getString(String columnLabel) throws SQLException { return getString(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Time getTime(int columnIndex) throws SQLException { return (Time) get(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Time getTime(String columnLabel) throws SQLException { return getTime(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Time getTime(int columnIndex, Calendar cal) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Time getTime(String columnLabel, Calendar cal) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Timestamp getTimestamp(int columnIndex) throws SQLException { return (Timestamp) get(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Timestamp getTimestamp(String columnLabel) throws SQLException { return getTimestamp(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public InputStream getUnicodeStream(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public InputStream getUnicodeStream(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public URL getURL(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public URL getURL(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateArray(int columnIndex, Array x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateArray(String columnLabel, Array x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBlob(int columnIndex, Blob x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBlob(String columnLabel, Blob x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBlob(int columnIndex, InputStream x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBlob(String columnLabel, InputStream x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBlob(int columnIndex, InputStream x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBlob(String columnLabel, InputStream x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBoolean(int columnIndex, boolean x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBoolean(String columnLabel, boolean x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateByte(int columnIndex, byte x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateByte(String columnLabel, byte x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBytes(int columnIndex, byte[] x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBytes(String columnLabel, byte[] x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateCharacterStream(String columnLabel, Reader x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateCharacterStream(String columnLabel, Reader x, int length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateCharacterStream(String columnLabel, Reader x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateClob(int columnIndex, Clob x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateClob(String columnLabel, Clob x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateClob(int columnIndex, Reader x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateClob(String columnLabel, Reader x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateClob(int columnIndex, Reader x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateClob(String columnLabel, Reader x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateDate(int columnIndex, Date x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateDate(String columnLabel, Date x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateDouble(int columnIndex, double x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateDouble(String columnLabel, double x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateFloat(int columnIndex, float x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateFloat(String columnLabel, float x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateInt(int columnIndex, int x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateInt(String columnLabel, int x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateLong(int columnIndex, long x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateLong(String columnLabel, long x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNCharacterStream(String columnLabel, Reader x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNCharacterStream(String columnLabel, Reader x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNClob(int columnIndex, NClob x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNClob(String columnLabel, NClob x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNClob(int columnIndex, Reader x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNClob(String columnLabel, Reader x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNClob(int columnIndex, Reader x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNClob(String columnLabel, Reader x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNString(int columnIndex, String x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNString(String columnLabel, String x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNull(int columnIndex) throws SQLException { update(columnIndex, null); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNull(String columnLabel) throws SQLException { update(columnLabel, null); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateObject(int columnIndex, Object x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateObject(String columnLabel, Object x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateObject(int columnIndex, Object x, int scale) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateObject(String columnLabel, Object x, int scale) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateRef(int columnIndex, Ref x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateRef(String columnLabel, Ref x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateRowId(int columnIndex, RowId x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateRowId(String columnLabel, RowId x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateShort(int columnIndex, short x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateShort(String columnLabel, short x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateSQLXML(int columnIndex, SQLXML x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateSQLXML(String columnLabel, SQLXML x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateString(int columnIndex, String x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateString(String columnLabel, String x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateTime(int columnIndex, Time x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateTime(String columnLabel, Time x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public int getColumnType(int columnIndex) throws SQLException { return getColumn(columnIndex - 1).sqlType; }
// in src/main/org/h2/tools/SimpleResultSet.java
public int getPrecision(int columnIndex) throws SQLException { return getColumn(columnIndex - 1).precision; }
// in src/main/org/h2/tools/SimpleResultSet.java
public int getScale(int columnIndex) throws SQLException { return getColumn(columnIndex - 1).scale; }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getColumnClassName(int columnIndex) throws SQLException { int sqlType = getColumn(columnIndex - 1).sqlType; int type = DataType.convertSQLTypeToValueType(sqlType); return DataType.getTypeClassName(type); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getColumnLabel(int columnIndex) throws SQLException { return getColumn(columnIndex - 1).name; }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getColumnName(int columnIndex) throws SQLException { return getColumnLabel(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getColumnTypeName(int columnIndex) throws SQLException { int sqlType = getColumn(columnIndex - 1).sqlType; int type = DataType.convertSQLTypeToValueType(sqlType); return DataType.getDataType(type).name; }
// in src/main/org/h2/tools/SimpleResultSet.java
public void afterLast() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void cancelRowUpdates() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void deleteRow() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void insertRow() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void moveToCurrentRow() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void moveToInsertRow() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void refreshRow() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateRow() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean first() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean isAfterLast() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean isBeforeFirst() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean isFirst() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean isLast() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean last() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean previous() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean rowDeleted() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean rowInserted() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean rowUpdated() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void setFetchDirection(int direction) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void setFetchSize(int rows) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean absolute(int row) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean relative(int offset) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getCursorName() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
private void update(int columnIndex, Object obj) throws SQLException { checkColumnIndex(columnIndex); this.currentRow[columnIndex - 1] = obj; }
// in src/main/org/h2/tools/SimpleResultSet.java
private void update(String columnLabel, Object obj) throws SQLException { this.currentRow[findColumn(columnLabel) - 1] = obj; }
// in src/main/org/h2/tools/SimpleResultSet.java
private void checkColumnIndex(int columnIndex) throws SQLException { if (columnIndex < 1 || columnIndex > columns.size()) { throw DbException.getInvalidValueException("columnIndex", columnIndex).getSQLException(); } }
// in src/main/org/h2/tools/SimpleResultSet.java
private Object get(int columnIndex) throws SQLException { if (currentRow == null) { throw DbException.get(ErrorCode.NO_DATA_AVAILABLE).getSQLException(); } checkColumnIndex(columnIndex); columnIndex--; Object o = columnIndex < currentRow.length ? currentRow[columnIndex] : null; wasNull = o == null; return o; }
// in src/main/org/h2/tools/SimpleResultSet.java
private Column getColumn(int i) throws SQLException { checkColumnIndex(i + 1); return columns.get(i); }
// in src/main/org/h2/tools/SimpleResultSet.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/MultiDimension.java
public ResultSet getResult(PreparedStatement prep, int[] min, int[] max) throws SQLException { long[][] ranges = getMortonRanges(min, max); int len = ranges.length; Long[] from = new Long[len]; Long[] to = new Long[len]; for (int i = 0; i < len; i++) { from[i] = Long.valueOf(ranges[i][0]); to[i] = Long.valueOf(ranges[i][1]); } prep.setObject(1, from); prep.setObject(2, to); len = min.length; for (int i = 0, idx = 3; i < len; i++) { prep.setInt(idx++, min[i]); prep.setInt(idx++, max[i]); } return prep.executeQuery(); }
// in src/main/org/h2/tools/Shell.java
public static void main(String... args) throws SQLException { new Shell().runTool(args); }
// in src/main/org/h2/tools/Shell.java
public void runTool(String... args) throws SQLException { String url = null; String user = ""; String password = ""; String sql = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-driver")) { String driver = args[++i]; Utils.loadUserClass(driver); } else if (arg.equals("-sql")) { sql = args[++i]; } else if (arg.equals("-properties")) { serverPropertiesDir = args[++i]; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (url != null) { org.h2.Driver.load(); conn = DriverManager.getConnection(url, user, password); stat = conn.createStatement(); } if (sql == null) { promptLoop(); } else { ScriptReader r = new ScriptReader(new StringReader(sql)); while (true) { String s = r.readStatement(); if (s == null) { break; } execute(s); } } }
// in src/main/org/h2/tools/Shell.java
private void connect() throws IOException, SQLException { String url = "jdbc:h2:~/test"; String user = "sa"; String driver = null; try { Properties prop; if ("null".equals(serverPropertiesDir)) { prop = new Properties(); } else { prop = SortedProperties.loadProperties(serverPropertiesDir + "/" + Constants.SERVER_PROPERTIES_NAME); } String data = null; boolean found = false; for (int i = 0;; i++) { String d = prop.getProperty(String.valueOf(i)); if (d == null) { break; } found = true; data = d; } if (found) { ConnectionInfo info = new ConnectionInfo(data); url = info.url; user = info.user; driver = info.driver; } } catch (IOException e) { // ignore } println("[Enter] " + url); print("URL "); url = readLine(url).trim(); if (driver == null) { driver = JdbcUtils.getDriver(url); } if (driver != null) { println("[Enter] " + driver); } print("Driver "); driver = readLine(driver).trim(); println("[Enter] " + user); print("User "); user = readLine(user); println("[Enter] Hide"); print("Password "); String password = readLine(); if (password.length() == 0) { password = readPassword(); } conn = JdbcUtils.getConnection(driver, url, user, password); stat = conn.createStatement(); println("Connected"); }
// in src/main/org/h2/tools/Shell.java
private int printResult(ResultSet rs, boolean asList) throws SQLException { if (asList) { return printResultAsList(rs); } return printResultAsTable(rs); }
// in src/main/org/h2/tools/Shell.java
private int printResultAsTable(ResultSet rs) throws SQLException { ResultSetMetaData meta = rs.getMetaData(); int len = meta.getColumnCount(); boolean truncated = false; ArrayList<String[]> rows = New.arrayList(); // buffer the header String[] columns = new String[len]; for (int i = 0; i < len; i++) { String s = meta.getColumnLabel(i + 1); columns[i] = s == null ? "" : s; } rows.add(columns); int rowCount = 0; while (rs.next()) { rowCount++; truncated |= loadRow(rs, len, rows); if (rowCount > MAX_ROW_BUFFER) { printRows(rows, len); rows.clear(); } } printRows(rows, len); rows.clear(); if (truncated) { println("(data is partially truncated)"); } return rowCount; }
// in src/main/org/h2/tools/Shell.java
private boolean loadRow(ResultSet rs, int len, ArrayList<String[]> rows) throws SQLException { boolean truncated = false; String[] row = new String[len]; for (int i = 0; i < len; i++) { String s = rs.getString(i + 1); if (s == null) { s = "null"; } // only truncate if more than one column if (len > 1 && s.length() > maxColumnSize) { s = s.substring(0, maxColumnSize); truncated = true; } row[i] = s; } rows.add(row); return truncated; }
// in src/main/org/h2/tools/Shell.java
private int printResultAsList(ResultSet rs) throws SQLException { ResultSetMetaData meta = rs.getMetaData(); int longestLabel = 0; int len = meta.getColumnCount(); String[] columns = new String[len]; for (int i = 0; i < len; i++) { String s = meta.getColumnLabel(i + 1); columns[i] = s; longestLabel = Math.max(longestLabel, s.length()); } StringBuilder buff = new StringBuilder(); int rowCount = 0; while (rs.next()) { rowCount++; buff.setLength(0); if (rowCount > 1) { println(""); } for (int i = 0; i < len; i++) { if (i > 0) { buff.append('\n'); } String label = columns[i]; buff.append(label); for (int j = label.length(); j < longestLabel; j++) { buff.append(' '); } buff.append(": ").append(rs.getString(i + 1)); } println(buff.toString()); } if (rowCount == 0) { for (int i = 0; i < len; i++) { if (i > 0) { buff.append('\n'); } String label = columns[i]; buff.append(label); } println(buff.toString()); } return rowCount; }
// in src/main/org/h2/tools/DeleteDbFiles.java
public static void main(String... args) throws SQLException { new DeleteDbFiles().runTool(args); }
// in src/main/org/h2/tools/DeleteDbFiles.java
public void runTool(String... args) throws SQLException { String dir = "."; String db = null; boolean quiet = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-quiet")) { quiet = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } process(dir, db, quiet); }
// in src/main/org/h2/value/ValueNull.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setNull(parameterIndex, DataType.convertTypeToSQLType(Value.NULL)); }
// in src/main/org/h2/value/ValueTime.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setTime(parameterIndex, getTime()); }
// in src/main/org/h2/value/ValueLob.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { long p = getPrecision(); if (p > Integer.MAX_VALUE || p <= 0) { p = -1; } if (type == Value.BLOB) { prep.setBinaryStream(parameterIndex, getInputStream(), (int) p); } else { prep.setCharacterStream(parameterIndex, getReader(), (int) p); } }
// in src/main/org/h2/value/ValueDate.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setDate(parameterIndex, getDate()); }
// in src/main/org/h2/value/ValueInt.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setInt(parameterIndex, value); }
// in src/main/org/h2/value/ValueByte.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setByte(parameterIndex, value); }
// in src/main/org/h2/value/ValueLong.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setLong(parameterIndex, value); }
// in src/main/org/h2/value/ValueFloat.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setFloat(parameterIndex, value); }
// in src/main/org/h2/value/ValueLobDb.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { long p = getPrecision(); if (p > Integer.MAX_VALUE || p <= 0) { p = -1; } if (type == Value.BLOB) { prep.setBinaryStream(parameterIndex, getInputStream(), (int) p); } else { prep.setCharacterStream(parameterIndex, getReader(), (int) p); } }
// in src/main/org/h2/value/ValueBytes.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setBytes(parameterIndex, value); }
// in src/main/org/h2/value/ValueTimestamp.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setTimestamp(parameterIndex, getTimestamp()); }
// in src/main/org/h2/value/ValueDouble.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setDouble(parameterIndex, value); }
// in src/main/org/h2/value/ValueShort.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setShort(parameterIndex, value); }
// in src/main/org/h2/value/ValueJavaObject.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { Object obj = Utils.deserialize(getBytesNoCopy()); prep.setObject(parameterIndex, obj, Types.JAVA_OBJECT); }
// in src/main/org/h2/value/ValueString.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setString(parameterIndex, value); }
// in src/main/org/h2/value/ValueUuid.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setBytes(parameterIndex, getBytes()); }
// in src/main/org/h2/value/ValueBoolean.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setBoolean(parameterIndex, value.booleanValue()); }
// in src/main/org/h2/value/ValueDecimal.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setBigDecimal(parameterIndex, value); }
// in src/main/org/h2/upgrade/DbUpgrade.java
public static Connection connectOrUpgrade(String url, Properties info) throws SQLException { if (!upgradeClassesPresent) { return null; } Properties i2 = new Properties(); i2.putAll(info); // clone so that the password (if set as a char array) is not cleared Object o = info.get("password"); if (o != null && o instanceof char[]) { i2.put("password", StringUtils.cloneCharArray((char[]) o)); } info = i2; ConnectionInfo ci = new ConnectionInfo(url, info); if (ci.isRemote() || !ci.isPersistent()) { return null; } String name = ci.getName(); if (FileUtils.exists(name + ".h2.db")) { return null; } if (!FileUtils.exists(name + ".data.db")) { return null; } if (ci.removeProperty("NO_UPGRADE", false)) { return connectWithOldVersion(url, info); } synchronized (DbUpgrade.class) { upgrade(ci, info); return null; }
// in src/main/org/h2/upgrade/DbUpgrade.java
private static Connection connectWithOldVersion(String url, Properties info) throws SQLException { url = "jdbc:h2v1_1:" + url.substring("jdbc:h2:".length()) + ";IGNORE_UNKNOWN_SETTINGS=TRUE"; return DriverManager.getConnection(url, info); }
// in src/main/org/h2/upgrade/DbUpgrade.java
private static void upgrade(ConnectionInfo ci, Properties info) throws SQLException { String name = ci.getName(); String data = name + ".data.db"; String index = name + ".index.db"; String lobs = name + ".lobs.db"; String backupData = data + ".backup"; String backupIndex = index + ".backup"; String backupLobs = lobs + ".backup"; String script = null; try { if (scriptInTempDir) { new File(Utils.getProperty("java.io.tmpdir", ".")).mkdirs(); script = File.createTempFile("h2dbmigration", "backup.sql").getAbsolutePath(); } else { script = name + ".script.sql"; } String oldUrl = "jdbc:h2v1_1:" + name + ";UNDO_LOG=0;LOG=0;LOCK_MODE=0"; String cipher = ci.getProperty("CIPHER", null); if (cipher != null) { oldUrl += ";CIPHER=" + cipher; } Connection conn = DriverManager.getConnection(oldUrl, info); Statement stat = conn.createStatement(); String uuid = UUID.randomUUID().toString(); if (cipher != null) { stat.execute("script to '" + script + "' cipher aes password '" + uuid + "' --hide--"); } else { stat.execute("script to '" + script + "'"); } conn.close(); FileUtils.moveTo(data, backupData); FileUtils.moveTo(index, backupIndex); if (FileUtils.exists(lobs)) { FileUtils.moveTo(lobs, backupLobs); } ci.removeProperty("IFEXISTS", false); conn = new JdbcConnection(ci, true); stat = conn.createStatement(); if (cipher != null) { stat.execute("runscript from '" + script + "' cipher aes password '" + uuid + "' --hide--"); } else { stat.execute("runscript from '" + script + "'"); } stat.execute("analyze"); stat.execute("shutdown compact"); stat.close(); conn.close(); if (deleteOldDb) { FileUtils.delete(backupData); FileUtils.delete(backupIndex); FileUtils.deleteRecursive(backupLobs, false); } } catch (Exception e) { if (FileUtils.exists(backupData)) { FileUtils.moveTo(backupData, data); } if (FileUtils.exists(backupIndex)) { FileUtils.moveTo(backupIndex, index); } if (FileUtils.exists(backupLobs)) { FileUtils.moveTo(backupLobs, lobs); } FileUtils.delete(name + ".h2.db"); throw DbException.toSQLException(e); } finally { if (script != null) { FileUtils.delete(script); } } }
// in src/main/org/h2/result/UpdatableRow.java
private void setKey(PreparedStatement prep, int start, Value[] current) throws SQLException { for (int i = 0, size = key.size(); i < size; i++) { String col = key.get(i); int idx = getColumnIndex(col); Value v = current[idx]; if (v == null || v == ValueNull.INSTANCE) { // rows with a unique key containing NULL are not supported, // as multiple such rows could exist throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } v.set(prep, start + i); } }
// in src/main/org/h2/result/UpdatableRow.java
public Value[] readRow(Value[] row) throws SQLException { StatementBuilder buff = new StatementBuilder("SELECT "); appendColumnList(buff, false); buff.append(" FROM "); appendTableName(buff); appendKeyCondition(buff); PreparedStatement prep = conn.prepareStatement(buff.toString()); setKey(prep, 1, row); ResultSet rs = prep.executeQuery(); if (!rs.next()) { throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } Value[] newRow = new Value[columnCount]; for (int i = 0; i < columnCount; i++) { int type = result.getColumnType(i); newRow[i] = DataType.readValue(conn.getSession(), rs, i + 1, type); } return newRow; }
// in src/main/org/h2/result/UpdatableRow.java
public void deleteRow(Value[] current) throws SQLException { StatementBuilder buff = new StatementBuilder("DELETE FROM "); appendTableName(buff); appendKeyCondition(buff); PreparedStatement prep = conn.prepareStatement(buff.toString()); setKey(prep, 1, current); int count = prep.executeUpdate(); if (count != 1) { // the row has already been deleted throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } }
// in src/main/org/h2/result/UpdatableRow.java
public void updateRow(Value[] current, Value[] updateRow) throws SQLException { StatementBuilder buff = new StatementBuilder("UPDATE "); appendTableName(buff); buff.append(" SET "); appendColumnList(buff, true); // TODO updatable result set: we could add all current values to the // where clause // - like this optimistic ('no') locking is possible appendKeyCondition(buff); PreparedStatement prep = conn.prepareStatement(buff.toString()); int j = 1; for (int i = 0; i < columnCount; i++) { Value v = updateRow[i]; if (v == null) { v = current[i]; } v.set(prep, j++); } setKey(prep, j, current); int count = prep.executeUpdate(); if (count != 1) { // the row has been deleted throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } }
// in src/main/org/h2/result/UpdatableRow.java
public void insertRow(Value[] row) throws SQLException { StatementBuilder buff = new StatementBuilder("INSERT INTO "); appendTableName(buff); buff.append('('); appendColumnList(buff, false); buff.append(")VALUES("); buff.resetCount(); for (int i = 0; i < columnCount; i++) { buff.appendExceptFirst(","); Value v = row[i]; if (v == null) { buff.append("DEFAULT"); } else { buff.append('?'); } } buff.append(')'); PreparedStatement prep = conn.prepareStatement(buff.toString()); for (int i = 0, j = 0; i < columnCount; i++) { Value v = row[i]; if (v != null) { v.set(prep, j++ + 1); } } int count = prep.executeUpdate(); if (count != 1) { throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } }
// in src/main/org/h2/schema/TriggerObject.java
public void close() throws SQLException { if (triggerCallback != null) { triggerCallback.close(); } }
// in src/main/org/h2/expression/JavaAggregate.java
private AggregateFunction getInstance() throws SQLException { AggregateFunction agg = userAggregate.getInstance(); agg.init(userConnection); return agg; }
// in src/main/org/h2/store/FileLister.java
public static void tryUnlockDatabase(List<String> files, String message) throws SQLException { for (String fileName : files) { if (fileName.endsWith(Constants.SUFFIX_LOCK_FILE)) { FileLock lock = new FileLock(new TraceSystem(null), fileName, Constants.LOCK_SLEEP); try { lock.lock(FileLock.LOCK_FILE); lock.unlock(); } catch (DbException e) { throw DbException.get( ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, message).getSQLException(); } } } }
// in src/main/org/h2/store/LobStorage.java
private long getNextLobId() throws SQLException { String sql = "SELECT MAX(LOB) FROM " + LOB_MAP; PreparedStatement prep = prepare(sql); ResultSet rs = prep.executeQuery(); rs.next(); long x = rs.getLong(1) + 1; reuse(sql, prep); sql = "SELECT MAX(ID) FROM " + LOBS; prep = prepare(sql); rs = prep.executeQuery(); rs.next(); x = Math.max(x, rs.getLong(1) + 1); reuse(sql, prep); return x; }
// in src/main/org/h2/store/LobStorage.java
byte[] readBlock(long lob, int seq) throws SQLException { synchronized (handler) { String sql = "SELECT COMPRESSED, DATA FROM " + LOB_MAP + " M " + "INNER JOIN " + LOB_DATA + " D ON M.BLOCK = D.BLOCK " + "WHERE M.LOB = ? AND M.SEQ = ?"; PreparedStatement prep = prepare(sql); prep.setLong(1, lob); prep.setInt(2, seq); ResultSet rs = prep.executeQuery(); if (!rs.next()) { throw DbException.get(ErrorCode.IO_EXCEPTION_1, "Missing lob entry: "+ lob + "/" + seq).getSQLException(); } int compressed = rs.getInt(1); byte[] buffer = rs.getBytes(2); if (compressed != 0) { buffer = compress.expand(buffer); } reuse(sql, prep); return buffer; } }
// in src/main/org/h2/store/LobStorage.java
long[] skipBuffer(long lob, long pos) throws SQLException { synchronized (handler) { String sql = "SELECT MAX(SEQ), MAX(POS) FROM " + LOB_MAP + " WHERE LOB = ? AND POS < ?"; PreparedStatement prep = prepare(sql); prep.setLong(1, lob); prep.setLong(2, pos); ResultSet rs = prep.executeQuery(); rs.next(); int seq = rs.getInt(1); pos = rs.getLong(2); boolean wasNull = rs.wasNull(); rs.close(); reuse(sql, prep); // upgraded: offset not set return wasNull ? null : new long[]{seq, pos}; } }
// in src/main/org/h2/store/LobStorage.java
private PreparedStatement prepare(String sql) throws SQLException { if (SysProperties.CHECK2) { if (!Thread.holdsLock(handler)) { throw DbException.throwInternalError(); } } PreparedStatement prep = prepared.remove(sql); if (prep == null) { prep = conn.prepareStatement(sql); } return prep; }
// in src/main/org/h2/store/LobStorage.java
void storeBlock(long lobId, int seq, long pos, byte[] b, String compressAlgorithm) throws SQLException { long block; boolean blockExists = false; if (compressAlgorithm != null) { b = compress.compress(b, compressAlgorithm); } int hash = Arrays.hashCode(b); synchronized (handler) { block = getHashCacheBlock(hash); if (block != -1) { String sql = "SELECT COMPRESSED, DATA FROM " + LOB_DATA + " WHERE BLOCK = ?"; PreparedStatement prep = prepare(sql); prep.setLong(1, block); ResultSet rs = prep.executeQuery(); if (rs.next()) { boolean compressed = rs.getInt(1) != 0; byte[] compare = rs.getBytes(2); if (compressed == (compressAlgorithm != null) && Arrays.equals(b, compare)) { blockExists = true; } } reuse(sql, prep); } if (!blockExists) { block = nextBlock++; setHashCacheBlock(hash, block); String sql = "INSERT INTO " + LOB_DATA + "(BLOCK, COMPRESSED, DATA) VALUES(?, ?, ?)"; PreparedStatement prep = prepare(sql); prep.setLong(1, block); prep.setInt(2, compressAlgorithm == null ? 0 : 1); prep.setBytes(3, b); prep.execute(); reuse(sql, prep); } String sql = "INSERT INTO " + LOB_MAP + "(LOB, SEQ, POS, HASH, BLOCK) VALUES(?, ?, ?, ?, ?)"; PreparedStatement prep = prepare(sql); prep.setLong(1, lobId); prep.setInt(2, seq); prep.setLong(3, pos); prep.setLong(4, hash); prep.setLong(5, block); prep.execute(); reuse(sql, prep); } }
// in src/main/org/h2/Driver.java
public Connection connect(String url, Properties info) throws SQLException { try { if (info == null) { info = new Properties(); } if (!acceptsURL(url)) { return null; } if (url.equals(DEFAULT_URL)) { return DEFAULT_CONNECTION.get(); } Connection c = DbUpgrade.connectOrUpgrade(url, info); if (c != null) { return c; } return new JdbcConnection(url, info); } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/command/dml/ScriptCommand.java
public static InputStream combineBlob(Connection conn, int id) throws SQLException { if (id < 0) { return null; } final ResultSet rs = getLobStream(conn, "BDATA", id); return new InputStream() { private InputStream current; private boolean closed; public int read() throws IOException { while (true) { try { if (current == null) { if (closed) { return -1; } if (!rs.next()) { close(); return -1; } current = rs.getBinaryStream(1); current = new BufferedInputStream(current); } int x = current.read(); if (x >= 0) { return x; } current = null; } catch (SQLException e) { throw DbException.convertToIOException(e); } } } public void close() throws IOException { if (closed) { return; } closed = true; try { rs.close(); } catch (SQLException e) { throw DbException.convertToIOException(e); } } }; }
// in src/main/org/h2/command/dml/ScriptCommand.java
public static Reader combineClob(Connection conn, int id) throws SQLException { if (id < 0) { return null; } final ResultSet rs = getLobStream(conn, "CDATA", id); return new Reader() { private Reader current; private boolean closed; public int read() throws IOException { while (true) { try { if (current == null) { if (closed) { return -1; } if (!rs.next()) { close(); return -1; } current = rs.getCharacterStream(1); current = new BufferedReader(current); } int x = current.read(); if (x >= 0) { return x; } current = null; } catch (SQLException e) { throw DbException.convertToIOException(e); } } } public void close() throws IOException { if (closed) { return; } closed = true; try { rs.close(); } catch (SQLException e) { throw DbException.convertToIOException(e); } } public int read(char[] buffer, int off, int len) throws IOException { if (len == 0) { return 0; } int c = read(); if (c == -1) { return -1; } buffer[off] = (char) c; int i = 1; for (; i < len; i++) { c = read(); if (c == -1) { break; } buffer[off + i] = (char) c; } return i; } }; }
// in src/main/org/h2/command/dml/ScriptCommand.java
private static ResultSet getLobStream(Connection conn, String column, int id) throws SQLException { PreparedStatement prep = conn.prepareStatement( "SELECT " + column + " FROM SYSTEM_LOB_STREAM WHERE ID=? ORDER BY PART"); prep.setInt(1, id); return prep.executeQuery(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Statement createStatement() throws SQLException { try { int id = getNextId(TraceObject.STATEMENT); if (isDebugEnabled()) { debugCodeAssign("Statement", TraceObject.STATEMENT, id, "createStatement()"); } checkClosed(); return new JdbcStatement(this, id, ResultSet.TYPE_FORWARD_ONLY, Constants.DEFAULT_RESULT_SET_CONCURRENCY, false); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { try { int id = getNextId(TraceObject.STATEMENT); if (isDebugEnabled()) { debugCodeAssign("Statement", TraceObject.STATEMENT, id, "createStatement(" + resultSetType + ", " + resultSetConcurrency + ")"); } checkTypeConcurrency(resultSetType, resultSetConcurrency); checkClosed(); return new JdbcStatement(this, id, resultSetType, resultSetConcurrency, false); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { try { int id = getNextId(TraceObject.STATEMENT); if (isDebugEnabled()) { debugCodeAssign("Statement", TraceObject.STATEMENT, id, "createStatement(" + resultSetType + ", " + resultSetConcurrency + ", " + resultSetHoldability + ")"); } checkTypeConcurrency(resultSetType, resultSetConcurrency); checkHoldability(resultSetHoldability); checkClosed(); return new JdbcStatement(this, id, resultSetType, resultSetConcurrency, false); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public PreparedStatement prepareStatement(String sql) throws SQLException { try { int id = getNextId(TraceObject.PREPARED_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("PreparedStatement", TraceObject.PREPARED_STATEMENT, id, "prepareStatement(" + quote(sql) + ")"); } checkClosed(); sql = translateSQL(sql); return new JdbcPreparedStatement(this, sql, id, ResultSet.TYPE_FORWARD_ONLY, Constants.DEFAULT_RESULT_SET_CONCURRENCY, false); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
PreparedStatement prepareAutoCloseStatement(String sql) throws SQLException { try { int id = getNextId(TraceObject.PREPARED_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("PreparedStatement", TraceObject.PREPARED_STATEMENT, id, "prepareStatement(" + quote(sql) + ")"); } checkClosed(); sql = translateSQL(sql); return new JdbcPreparedStatement(this, sql, id, ResultSet.TYPE_FORWARD_ONLY, Constants.DEFAULT_RESULT_SET_CONCURRENCY, true); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public DatabaseMetaData getMetaData() throws SQLException { try { int id = getNextId(TraceObject.DATABASE_META_DATA); if (isDebugEnabled()) { debugCodeAssign("DatabaseMetaData", TraceObject.DATABASE_META_DATA, id, "getMetaData()"); } checkClosed(); return new JdbcDatabaseMetaData(this, trace, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public synchronized void close() throws SQLException { try { debugCodeCall("close"); if (session == null) { return; } CloseWatcher.unregister(watcher); session.cancel(); if (executingStatement != null) { try { executingStatement.cancel(); } catch (NullPointerException e) { // ignore } } synchronized (session) { try { if (!session.isClosed()) { try { if (session.getUndoLogPos() != 0) { // roll back unless that would require to re-connect // (the transaction can't be rolled back after re-connecting) if (!session.isReconnectNeeded(true)) { try { rollbackInternal(); } catch (DbException e) { // ignore if the connection is broken right now if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } } } session.afterWriting(); } closePreparedCommands(); } finally { session.close(); } } } finally { session = null; } } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public synchronized void setAutoCommit(boolean autoCommit) throws SQLException { try { if (isDebugEnabled()) { debugCode("setAutoCommit(" + autoCommit + ");"); } checkClosed(); if (autoCommit && !session.getAutoCommit()) { commit(); } session.setAutoCommit(autoCommit); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public synchronized boolean getAutoCommit() throws SQLException { try { checkClosed(); debugCodeCall("getAutoCommit"); return session.getAutoCommit(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public synchronized void commit() throws SQLException { try { debugCodeCall("commit"); checkClosedForWrite(); try { commit = prepareCommand("COMMIT", commit); commit.executeUpdate(); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public synchronized void rollback() throws SQLException { try { debugCodeCall("rollback"); checkClosedForWrite(); try { rollbackInternal(); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public boolean isClosed() throws SQLException { try { debugCodeCall("isClosed"); return session == null || session.isClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public String nativeSQL(String sql) throws SQLException { try { debugCodeCall("nativeSQL", sql); checkClosed(); return translateSQL(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setReadOnly(boolean readOnly) throws SQLException { try { if (isDebugEnabled()) { debugCode("setReadOnly(" + readOnly + ");"); } checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public boolean isReadOnly() throws SQLException { try { debugCodeCall("isReadOnly"); checkClosed(); getReadOnly = prepareCommand("CALL READONLY()", getReadOnly); ResultInterface result = getReadOnly.executeQuery(0, false); result.next(); boolean readOnly = result.currentRow()[0].getBoolean().booleanValue(); return readOnly; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setCatalog(String catalog) throws SQLException { try { debugCodeCall("setCatalog", catalog); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public String getCatalog() throws SQLException { try { debugCodeCall("getCatalog"); checkClosed(); if (catalog == null) { CommandInterface cat = prepareCommand("CALL DATABASE()", Integer.MAX_VALUE); ResultInterface result = cat.executeQuery(0, false); result.next(); catalog = result.currentRow()[0].getString(); cat.close(); } return catalog; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public SQLWarning getWarnings() throws SQLException { try { debugCodeCall("getWarnings"); checkClosed(); return null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void clearWarnings() throws SQLException { try { debugCodeCall("clearWarnings"); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { try { int id = getNextId(TraceObject.PREPARED_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("PreparedStatement", TraceObject.PREPARED_STATEMENT, id, "prepareStatement(" + quote(sql) + ", " + resultSetType + ", " + resultSetConcurrency + ")"); } checkTypeConcurrency(resultSetType, resultSetConcurrency); checkClosed(); sql = translateSQL(sql); return new JdbcPreparedStatement(this, sql, id, resultSetType, resultSetConcurrency, false); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setTransactionIsolation(int level) throws SQLException { try { debugCodeCall("setTransactionIsolation", level); checkClosed(); int lockMode; switch(level) { case Connection.TRANSACTION_READ_UNCOMMITTED: lockMode = Constants.LOCK_MODE_OFF; break; case Connection.TRANSACTION_READ_COMMITTED: lockMode = Constants.LOCK_MODE_READ_COMMITTED; break; case Connection.TRANSACTION_REPEATABLE_READ: case Connection.TRANSACTION_SERIALIZABLE: lockMode = Constants.LOCK_MODE_TABLE; break; default: throw DbException.getInvalidValueException("level", level); } commit(); setLockMode = prepareCommand("SET LOCK_MODE ?", setLockMode); setLockMode.getParameters().get(0).setValue(ValueInt.get(lockMode), false); setLockMode.executeUpdate(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setQueryTimeout(int seconds) throws SQLException { try { debugCodeCall("setQueryTimeout", seconds); checkClosed(); setQueryTimeout = prepareCommand("SET QUERY_TIMEOUT ?", setQueryTimeout); setQueryTimeout.getParameters().get(0).setValue(ValueInt.get(seconds * 1000), false); setQueryTimeout.executeUpdate(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public int getQueryTimeout() throws SQLException { try { debugCodeCall("getQueryTimeout"); checkClosed(); getQueryTimeout = prepareCommand("SELECT VALUE FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME=?", getQueryTimeout); getQueryTimeout.getParameters().get(0).setValue(ValueString.get("QUERY_TIMEOUT"), false); ResultInterface result = getQueryTimeout.executeQuery(0, false); result.next(); int queryTimeout = result.currentRow()[0].getInt(); result.close(); if (queryTimeout == 0) { return 0; } // round to the next second, otherwise 999 millis would return 0 seconds return (queryTimeout + 999) / 1000; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public int getTransactionIsolation() throws SQLException { try { debugCodeCall("getTransactionIsolation"); checkClosed(); getLockMode = prepareCommand("CALL LOCK_MODE()", getLockMode); ResultInterface result = getLockMode.executeQuery(0, false); result.next(); int lockMode = result.currentRow()[0].getInt(); result.close(); int transactionIsolationLevel; switch(lockMode) { case Constants.LOCK_MODE_OFF: transactionIsolationLevel = Connection.TRANSACTION_READ_UNCOMMITTED; break; case Constants.LOCK_MODE_READ_COMMITTED: transactionIsolationLevel = Connection.TRANSACTION_READ_COMMITTED; break; case Constants.LOCK_MODE_TABLE: case Constants.LOCK_MODE_TABLE_GC: transactionIsolationLevel = Connection.TRANSACTION_SERIALIZABLE; break; default: throw DbException.throwInternalError("lockMode:" + lockMode); } return transactionIsolationLevel; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setHoldability(int holdability) throws SQLException { try { debugCodeCall("setHoldability", holdability); checkClosed(); checkHoldability(holdability); this.holdability = holdability; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public int getHoldability() throws SQLException { try { debugCodeCall("getHoldability"); checkClosed(); return holdability; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Map<String, Class<?>> getTypeMap() throws SQLException { try { debugCodeCall("getTypeMap"); checkClosed(); return null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setTypeMap(Map<String, Class<?>> map) throws SQLException { try { debugCode("setTypeMap(" + quoteMap(map) + ");"); checkMap(map); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public CallableStatement prepareCall(String sql) throws SQLException { try { int id = getNextId(TraceObject.CALLABLE_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("CallableStatement", TraceObject.CALLABLE_STATEMENT, id, "prepareCall(" + quote(sql) + ")"); } checkClosed(); sql = translateSQL(sql); return new JdbcCallableStatement(this, sql, id, ResultSet.TYPE_FORWARD_ONLY, Constants.DEFAULT_RESULT_SET_CONCURRENCY); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { try { int id = getNextId(TraceObject.CALLABLE_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("CallableStatement", TraceObject.CALLABLE_STATEMENT, id, "prepareCall(" + quote(sql) + ", " + resultSetType + ", " + resultSetConcurrency + ")"); } checkTypeConcurrency(resultSetType, resultSetConcurrency); checkClosed(); sql = translateSQL(sql); return new JdbcCallableStatement(this, sql, id, resultSetType, resultSetConcurrency); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { try { int id = getNextId(TraceObject.CALLABLE_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("CallableStatement", TraceObject.CALLABLE_STATEMENT, id, "prepareCall(" + quote(sql) + ", " + resultSetType + ", " + resultSetConcurrency + ", " + resultSetHoldability + ")"); } checkTypeConcurrency(resultSetType, resultSetConcurrency); checkHoldability(resultSetHoldability); checkClosed(); sql = translateSQL(sql); return new JdbcCallableStatement(this, sql, id, resultSetType, resultSetConcurrency); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Savepoint setSavepoint() throws SQLException { try { int id = getNextId(TraceObject.SAVEPOINT); if (isDebugEnabled()) { debugCodeAssign("Savepoint", TraceObject.SAVEPOINT, id, "setSavepoint()"); } checkClosed(); CommandInterface set = prepareCommand("SAVEPOINT " + JdbcSavepoint.getName(null, savepointId), Integer.MAX_VALUE); set.executeUpdate(); JdbcSavepoint savepoint = new JdbcSavepoint(this, savepointId, null, trace, id); savepointId++; return savepoint; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Savepoint setSavepoint(String name) throws SQLException { try { int id = getNextId(TraceObject.SAVEPOINT); if (isDebugEnabled()) { debugCodeAssign("Savepoint", TraceObject.SAVEPOINT, id, "setSavepoint(" + quote(name) + ")"); } checkClosed(); CommandInterface set = prepareCommand("SAVEPOINT " + JdbcSavepoint.getName(name, 0), Integer.MAX_VALUE); set.executeUpdate(); JdbcSavepoint savepoint = new JdbcSavepoint(this, 0, name, trace, id); return savepoint; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void rollback(Savepoint savepoint) throws SQLException { try { JdbcSavepoint sp = convertSavepoint(savepoint); debugCode("rollback(" + sp.getTraceObjectName() + ");"); checkClosedForWrite(); try { sp.rollback(); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void releaseSavepoint(Savepoint savepoint) throws SQLException { try { debugCode("releaseSavepoint(savepoint);"); checkClosed(); convertSavepoint(savepoint).release(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { try { int id = getNextId(TraceObject.PREPARED_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("PreparedStatement", TraceObject.PREPARED_STATEMENT, id, "prepareStatement(" + quote(sql) + ", " + resultSetType + ", " + resultSetConcurrency + ", " + resultSetHoldability + ")"); } checkTypeConcurrency(resultSetType, resultSetConcurrency); checkHoldability(resultSetHoldability); checkClosed(); sql = translateSQL(sql); return new JdbcPreparedStatement(this, sql, id, resultSetType, resultSetConcurrency, false); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { try { if (isDebugEnabled()) { debugCode("prepareStatement(" + quote(sql) + ", " + autoGeneratedKeys + ");"); } return prepareStatement(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { try { if (isDebugEnabled()) { debugCode("prepareStatement(" + quote(sql) + ", " + quoteIntArray(columnIndexes) + ");"); } return prepareStatement(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { try { if (isDebugEnabled()) { debugCode("prepareStatement(" + quote(sql) + ", " + quoteArray(columnNames) + ");"); } return prepareStatement(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Clob createClob() throws SQLException { try { int id = getNextId(TraceObject.CLOB); debugCodeAssign("Clob", TraceObject.CLOB, id, "createClob()"); checkClosedForWrite(); try { Value v = session.getDataHandler().getLobStorage().createClob( new InputStreamReader( new ByteArrayInputStream(Utils.EMPTY_BYTES)), 0); return new JdbcClob(this, v, id); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Blob createBlob() throws SQLException { try { int id = getNextId(TraceObject.BLOB); debugCodeAssign("Blob", TraceObject.BLOB, id, "createClob()"); checkClosedForWrite(); try { Value v = session.getDataHandler().getLobStorage().createBlob( new ByteArrayInputStream(Utils.EMPTY_BYTES), 0); return new JdbcBlob(this, v, id); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public NClob createNClob() throws SQLException { try { int id = getNextId(TraceObject.CLOB); debugCodeAssign("NClob", TraceObject.CLOB, id, "createNClob()"); checkClosedForWrite(); try { Value v = session.getDataHandler().getLobStorage().createClob( new InputStreamReader( new ByteArrayInputStream(Utils.EMPTY_BYTES)), 0); return new JdbcClob(this, v, id); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public SQLXML createSQLXML() throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Array createArrayOf(String typeName, Object[] elements) throws SQLException { throw unsupported("createArray"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Struct createStruct(String typeName, Object[] attributes) throws SQLException { throw unsupported("Struct"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public String getClientInfo(String name) throws SQLException { throw unsupported("clientInfo"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public ResultSet executeQuery() throws SQLException { try { int id = getNextId(TraceObject.RESULT_SET); if (isDebugEnabled()) { debugCodeAssign("ResultSet", TraceObject.RESULT_SET, id, "executeQuery()"); } synchronized (session) { checkClosed(); closeOldResultSet(); ResultInterface result; boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY; boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE; try { setExecutingStatement(command); result = command.executeQuery(maxRows, scrollable); } finally { setExecutingStatement(null); } resultSet = new JdbcResultSet(conn, this, result, id, closedByResultSet, scrollable, updatable, cachedColumnLabelMap); } return resultSet; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public int executeUpdate() throws SQLException { try { debugCodeCall("executeUpdate"); checkClosedForWrite(); try { return executeUpdateInternal(); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
private int executeUpdateInternal() throws SQLException { closeOldResultSet(); synchronized (session) { try { setExecutingStatement(command); updateCount = command.executeUpdate(); } finally { setExecutingStatement(null); } } return updateCount; }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public boolean execute() throws SQLException { try { int id = getNextId(TraceObject.RESULT_SET); if (isDebugEnabled()) { debugCodeCall("execute"); } checkClosedForWrite(); try { boolean returnsResultSet; synchronized (conn.getSession()) { closeOldResultSet(); try { setExecutingStatement(command); if (command.isQuery()) { returnsResultSet = true; boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY; boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE; ResultInterface result = command.executeQuery(maxRows, scrollable); resultSet = new JdbcResultSet(conn, this, result, id, closedByResultSet, scrollable, updatable); } else { returnsResultSet = false; updateCount = command.executeUpdate(); } } finally { setExecutingStatement(null); } } return returnsResultSet; }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void clearParameters() throws SQLException { try { debugCodeCall("clearParameters"); checkClosed(); ArrayList<? extends ParameterInterface> parameters = command.getParameters(); for (int i = 0, size = parameters.size(); i < size; i++) { ParameterInterface param = parameters.get(i); // can only delete old temp files if they are not in the batch param.setValue(null, batchParameters == null); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public ResultSet executeQuery(String sql) throws SQLException { try { debugCodeCall("executeQuery", sql); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void addBatch(String sql) throws SQLException { try { debugCodeCall("addBatch", sql); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public int executeUpdate(String sql) throws SQLException { try { debugCodeCall("executeUpdate", sql); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public boolean execute(String sql) throws SQLException { try { debugCodeCall("execute", sql); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNull(int parameterIndex, int sqlType) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNull("+parameterIndex+", "+sqlType+");"); } setParameter(parameterIndex, ValueNull.INSTANCE); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setInt(int parameterIndex, int x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setInt("+parameterIndex+", "+x+");"); } setParameter(parameterIndex, ValueInt.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setString(int parameterIndex, String x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setString("+parameterIndex+", "+quote(x)+");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBigDecimal("+parameterIndex+", " + quoteBigDecimal(x) + ");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueDecimal.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setDate(int parameterIndex, java.sql.Date x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setDate("+parameterIndex+", " + quoteDate(x) + ");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueDate.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setTime(int parameterIndex, java.sql.Time x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setTime("+parameterIndex+", " + quoteTime(x) + ");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueTime.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setTimestamp("+parameterIndex+", " + quoteTimestamp(x) + ");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueTimestamp.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setObject(int parameterIndex, Object x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setObject("+parameterIndex+", x);"); } if (x == null) { // throw Errors.getInvalidValueException("null", "x"); setParameter(parameterIndex, ValueNull.INSTANCE); } else { setParameter(parameterIndex, DataType.convertToValue(session, x, Value.UNKNOWN)); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { try { if (isDebugEnabled()) { debugCode("setObject("+parameterIndex+", x, "+targetSqlType+");"); } int type = DataType.convertSQLTypeToValueType(targetSqlType); if (x == null) { setParameter(parameterIndex, ValueNull.INSTANCE); } else { Value v = DataType.convertToValue(conn.getSession(), x, type); setParameter(parameterIndex, v.convertTo(type)); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException { try { if (isDebugEnabled()) { debugCode("setObject("+parameterIndex+", x, "+targetSqlType+", "+scale+");"); } setObject(parameterIndex, x, targetSqlType); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBoolean(int parameterIndex, boolean x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBoolean("+parameterIndex+", "+x+");"); } setParameter(parameterIndex, ValueBoolean.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setByte(int parameterIndex, byte x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setByte("+parameterIndex+", "+x+");"); } setParameter(parameterIndex, ValueByte.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setShort(int parameterIndex, short x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setShort("+parameterIndex+", (short) "+x+");"); } setParameter(parameterIndex, ValueShort.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setLong(int parameterIndex, long x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setLong("+parameterIndex+", "+x+"L);"); } setParameter(parameterIndex, ValueLong.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setFloat(int parameterIndex, float x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setFloat("+parameterIndex+", "+x+"f);"); } setParameter(parameterIndex, ValueFloat.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setDouble(int parameterIndex, double x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setDouble("+parameterIndex+", "+x+"d);"); } setParameter(parameterIndex, ValueDouble.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setRef(int parameterIndex, Ref x) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setDate(int parameterIndex, java.sql.Date x, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("setDate("+parameterIndex+", " + quoteDate(x) + ", calendar);"); } if (x == null) { setParameter(parameterIndex, ValueNull.INSTANCE); } else { setParameter(parameterIndex, DateTimeUtils.convertDate(x, calendar)); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setTime(int parameterIndex, java.sql.Time x, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("setTime("+parameterIndex+", " + quoteTime(x) + ", calendar);"); } if (x == null) { setParameter(parameterIndex, ValueNull.INSTANCE); } else { setParameter(parameterIndex, DateTimeUtils.convertTime(x, calendar)); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("setTimestamp("+parameterIndex+", " + quoteTimestamp(x) + ", calendar);"); } if (x == null) { setParameter(parameterIndex, ValueNull.INSTANCE); } else { setParameter(parameterIndex, DateTimeUtils.convertTimestamp(x, calendar)); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { throw unsupported("unicodeStream"); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNull("+parameterIndex+", "+sqlType+", "+quote(typeName)+");"); } setNull(parameterIndex, sqlType); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBlob(int parameterIndex, Blob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBlob("+parameterIndex+", x);"); } checkClosedForWrite(); try { Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createBlob(x.getBinaryStream(), -1); } setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBlob(int parameterIndex, InputStream x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBlob("+parameterIndex+", x);"); } checkClosedForWrite(); try { Value v = conn.createBlob(x, -1); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setClob(int parameterIndex, Clob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setClob("+parameterIndex+", x);"); } checkClosedForWrite(); try { Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createClob(x.getCharacterStream(), -1); } setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setClob(int parameterIndex, Reader x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setClob("+parameterIndex+", x);"); } checkClosedForWrite(); try { Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createClob(x, -1); } setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setArray(int parameterIndex, Array x) throws SQLException { throw unsupported("setArray"); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBytes(int parameterIndex, byte[] x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBytes("+parameterIndex+", "+quoteBytes(x)+");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueBytes.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBinaryStream("+parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createBlob(x, length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { setBinaryStream(parameterIndex, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { setBinaryStream(parameterIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { setAsciiStream(parameterIndex, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setAsciiStream("+parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createClob(IOUtils.getAsciiReader(x), length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { setAsciiStream(parameterIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setCharacterStream(int parameterIndex, Reader x, int length) throws SQLException { setCharacterStream(parameterIndex, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setCharacterStream(int parameterIndex, Reader x) throws SQLException { setCharacterStream(parameterIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setCharacterStream(int parameterIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setCharacterStream("+parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createClob(x, length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setURL(int parameterIndex, URL x) throws SQLException { throw unsupported("url"); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public ResultSetMetaData getMetaData() throws SQLException { try { debugCodeCall("getMetaData"); checkClosed(); ResultInterface result = command.getMetaData(); if (result == null) { return null; } int id = getNextId(TraceObject.RESULT_SET_META_DATA); if (isDebugEnabled()) { debugCodeAssign("ResultSetMetaData", TraceObject.RESULT_SET_META_DATA, id, "getMetaData()"); } String catalog = conn.getCatalog(); JdbcResultSetMetaData meta = new JdbcResultSetMetaData(null, this, result, catalog, session.getTrace(), id); return meta; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void clearBatch() throws SQLException { try { debugCodeCall("clearBatch"); checkClosed(); batchParameters = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void close() throws SQLException { try { super.close(); batchParameters = null; if (command != null) { command.close(); command = null; } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public int[] executeBatch() throws SQLException { try { debugCodeCall("executeBatch"); if (batchParameters == null) { // TODO batch: check what other database do if no parameters are set batchParameters = New.arrayList(); } int size = batchParameters.size(); int[] result = new int[size]; boolean error = false; SQLException next = null; checkClosedForWrite(); try { for (int i = 0; i < size; i++) { Value[] set = batchParameters.get(i); ArrayList<? extends ParameterInterface> parameters = command.getParameters(); for (int j = 0; j < set.length; j++) { Value value = set[j]; ParameterInterface param = parameters.get(j); param.setValue(value, false); } try { result[i] = executeUpdateInternal(); } catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; } } batchParameters = null; if (error) { JdbcBatchUpdateException e = new JdbcBatchUpdateException(next, result); throw e; } return result; } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void addBatch() throws SQLException { try { debugCodeCall("addBatch"); checkClosedForWrite(); try { ArrayList<? extends ParameterInterface> parameters = command.getParameters(); int size = parameters.size(); Value[] set = new Value[size]; for (int i = 0; i < size; i++) { ParameterInterface param = parameters.get(i); Value value = param.getParamValue(); set[i] = value; } if (batchParameters == null) { batchParameters = New.arrayList(); } batchParameters.add(set); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { try { debugCode("executeUpdate("+quote(sql)+", "+autoGeneratedKeys+");"); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { try { debugCode("executeUpdate(" + quote(sql) + ", " + quoteIntArray(columnIndexes) + ");"); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public int executeUpdate(String sql, String[] columnNames) throws SQLException { try { debugCode("executeUpdate(" + quote(sql) + ", " + quoteArray(columnNames) + ");"); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { try { debugCode("execute(" + quote(sql) + ", " + autoGeneratedKeys + ");"); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public boolean execute(String sql, int[] columnIndexes) throws SQLException { try { debugCode("execute(" + quote(sql) + ", " + quoteIntArray(columnIndexes) + ");"); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public boolean execute(String sql, String[] columnNames) throws SQLException { try { debugCode("execute(" + quote(sql) + ", " + quoteArray(columnNames) + ");"); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public ParameterMetaData getParameterMetaData() throws SQLException { try { int id = getNextId(TraceObject.PARAMETER_META_DATA); if (isDebugEnabled()) { debugCodeAssign("ParameterMetaData", TraceObject.PARAMETER_META_DATA, id, "getParameterMetaData()"); } checkClosed(); JdbcParameterMetaData meta = new JdbcParameterMetaData(session.getTrace(), this, command, id); return meta; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setRowId(int parameterIndex, RowId x) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNString(int parameterIndex, String x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNString("+parameterIndex+", "+quote(x)+");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNCharacterStream(int parameterIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNCharacterStream("+ parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createClob(x, length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNCharacterStream(int parameterIndex, Reader x) throws SQLException { setNCharacterStream(parameterIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNClob(int parameterIndex, NClob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNClob("+parameterIndex+", x);"); } checkClosedForWrite(); Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createClob(x.getCharacterStream(), -1); } setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNClob(int parameterIndex, Reader x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNClob("+parameterIndex+", x);"); } checkClosedForWrite(); try { Value v = conn.createClob(x, -1); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setClob(int parameterIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setClob("+parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createClob(x, length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBlob(int parameterIndex, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBlob("+parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createBlob(x, length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNClob(int parameterIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNClob("+parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createClob(x, length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setSQLXML(int parameterIndex, SQLXML x) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public int getColumnCount() throws SQLException { try { debugCodeCall("getColumnCount"); checkClosed(); return columnCount; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getColumnLabel(int column) throws SQLException { try { debugCodeCall("getColumnLabel", column); checkColumnIndex(column); return result.getAlias(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getColumnName(int column) throws SQLException { try { debugCodeCall("getColumnName", column); checkColumnIndex(column); return result.getColumnName(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public int getColumnType(int column) throws SQLException { try { debugCodeCall("getColumnType", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.convertTypeToSQLType(type); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getColumnTypeName(int column) throws SQLException { try { debugCodeCall("getColumnTypeName", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.getDataType(type).name; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getSchemaName(int column) throws SQLException { try { debugCodeCall("getSchemaName", column); checkColumnIndex(column); return result.getSchemaName(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getTableName(int column) throws SQLException { try { debugCodeCall("getTableName", column); checkColumnIndex(column); return result.getTableName(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getCatalogName(int column) throws SQLException { try { debugCodeCall("getCatalogName", column); checkColumnIndex(column); return catalog; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isAutoIncrement(int column) throws SQLException { try { debugCodeCall("isAutoIncrement", column); checkColumnIndex(column); return result.isAutoIncrement(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isCaseSensitive(int column) throws SQLException { try { debugCodeCall("isCaseSensitive", column); checkColumnIndex(column); return true; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isSearchable(int column) throws SQLException { try { debugCodeCall("isSearchable", column); checkColumnIndex(column); return true; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isCurrency(int column) throws SQLException { try { debugCodeCall("isCurrency", column); checkColumnIndex(column); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public int isNullable(int column) throws SQLException { try { debugCodeCall("isNullable", column); checkColumnIndex(column); return result.getNullable(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isSigned(int column) throws SQLException { try { debugCodeCall("isSigned", column); checkColumnIndex(column); return true; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isReadOnly(int column) throws SQLException { try { debugCodeCall("isReadOnly", column); checkColumnIndex(column); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isWritable(int column) throws SQLException { try { debugCodeCall("isWritable", column); checkColumnIndex(column); return true; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isDefinitelyWritable(int column) throws SQLException { try { debugCodeCall("isDefinitelyWritable", column); checkColumnIndex(column); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getColumnClassName(int column) throws SQLException { try { debugCodeCall("getColumnClassName", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.getTypeClassName(type); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public int getPrecision(int column) throws SQLException { try { debugCodeCall("getPrecision", column); checkColumnIndex(column); long prec = result.getColumnPrecision(--column); return MathUtils.convertLongToInt(prec); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public int getScale(int column) throws SQLException { try { debugCodeCall("getScale", column); checkColumnIndex(column); return result.getColumnScale(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public int getColumnDisplaySize(int column) throws SQLException { try { debugCodeCall("getColumnDisplaySize", column); checkColumnIndex(column); return result.getDisplaySize(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
public int getSavepointId() throws SQLException { try { debugCodeCall("getSavepointId"); checkValid(); if (name != null) { throw DbException.get(ErrorCode.SAVEPOINT_IS_NAMED); } return savepointId; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
public String getSavepointName() throws SQLException { try { debugCodeCall("getSavepointName"); checkValid(); if (name == null) { throw DbException.get(ErrorCode.SAVEPOINT_IS_UNNAMED); } return name; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public long length() throws SQLException { try { debugCodeCall("length"); checkClosed(); if (value.getType() == Value.CLOB) { long precision = value.getPrecision(); if (precision > 0) { return precision; } } return IOUtils.copyAndCloseInput(value.getReader(), null, Long.MAX_VALUE); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public void truncate(long len) throws SQLException { throw unsupported("LOB update"); }
// in src/main/org/h2/jdbc/JdbcClob.java
public InputStream getAsciiStream() throws SQLException { try { debugCodeCall("getAsciiStream"); checkClosed(); String s = value.getString(); return IOUtils.getInputStreamFromString(s); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public OutputStream setAsciiStream(long pos) throws SQLException { throw unsupported("LOB update"); }
// in src/main/org/h2/jdbc/JdbcClob.java
public Reader getCharacterStream() throws SQLException { try { debugCodeCall("getCharacterStream"); checkClosed(); return value.getReader(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public Writer setCharacterStream(long pos) throws SQLException { try { if (isDebugEnabled()) { debugCodeCall("setCharacterStream(" + pos + ");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } if (value.getPrecision() != 0) { throw DbException.getInvalidValueException("length", value.getPrecision()); } final JdbcConnection c = conn; // PipedReader / PipedWriter are a lot slower // than PipedInputStream / PipedOutputStream // (Sun/Oracle Java 1.6.0_20) final PipedInputStream in = new PipedInputStream(); final Task task = new Task() { public void call() { value = c.createClob(IOUtils.getReader(in), -1); } }; PipedOutputStream out = new PipedOutputStream(in) { public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } } }; task.execute(); return IOUtils.getBufferedWriter(out); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public String getSubString(long pos, int length) throws SQLException { try { if (isDebugEnabled()) { debugCode("getSubString(" + pos + ", " + length + ");"); } checkClosed(); if (pos < 1) { throw DbException.getInvalidValueException("pos", pos); } if (length < 0) { throw DbException.getInvalidValueException("length", length); } StringWriter writer = new StringWriter(Math.min(Constants.IO_BUFFER_SIZE, length)); Reader reader = value.getReader(); try { IOUtils.skipFully(reader, pos - 1); IOUtils.copyAndCloseInput(reader, writer, length); } finally { reader.close(); } return writer.toString(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public int setString(long pos, String str) throws SQLException { try { if (isDebugEnabled()) { debugCode("setString(" + pos + ", " + quote(str) + ");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } else if (str == null) { throw DbException.getInvalidValueException("str", str); } value = conn.createClob(new StringReader(str), -1); return str.length(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public int setString(long pos, String str, int offset, int len) throws SQLException { throw unsupported("LOB update"); }
// in src/main/org/h2/jdbc/JdbcClob.java
public long position(String pattern, long start) throws SQLException { throw unsupported("LOB search"); }
// in src/main/org/h2/jdbc/JdbcClob.java
public long position(Clob clobPattern, long start) throws SQLException { throw unsupported("LOB search"); }
// in src/main/org/h2/jdbc/JdbcClob.java
public Reader getCharacterStream(long pos, long length) throws SQLException { throw unsupported("LOB subset"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getTables(String catalogPattern, String schemaPattern, String tableNamePattern, String[] types) throws SQLException { try { if (isDebugEnabled()) { debugCode("getTables(" + quote(catalogPattern) + ", " + quote(schemaPattern) + ", " + quote(tableNamePattern) + ", " + quoteArray(types) + ");"); } checkClosed(); String tableType; if (types != null && types.length > 0) { StatementBuilder buff = new StatementBuilder("TABLE_TYPE IN("); for (int i = 0; i < types.length; i++) { buff.appendExceptFirst(", "); buff.append('?'); } tableType = buff.append(')').toString(); } else { tableType = "TRUE"; } PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TABLE_CATALOG TABLE_CAT, " + "TABLE_SCHEMA TABLE_SCHEM, " + "TABLE_NAME, " + "TABLE_TYPE, " + "REMARKS, " + "TYPE_NAME TYPE_CAT, " + "TYPE_NAME TYPE_SCHEM, " + "TYPE_NAME, " + "TYPE_NAME SELF_REFERENCING_COL_NAME, " + "TYPE_NAME REF_GENERATION, " + "SQL " + "FROM INFORMATION_SCHEMA.TABLES " + "WHERE TABLE_CATALOG LIKE ? ESCAPE ? " + "AND TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND TABLE_NAME LIKE ? ESCAPE ? " + "AND (" + tableType + ") " + "ORDER BY TABLE_TYPE, TABLE_SCHEMA, TABLE_NAME"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, getPattern(tableNamePattern)); prep.setString(6, "\\"); for (int i = 0; types != null && i < types.length; i++) { prep.setString(7 + i, types[i]); } return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getColumns(String catalogPattern, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { try { if (isDebugEnabled()) { debugCode("getColumns(" + quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(tableNamePattern)+", " +quote(columnNamePattern)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TABLE_CATALOG TABLE_CAT, " + "TABLE_SCHEMA TABLE_SCHEM, " + "TABLE_NAME, " + "COLUMN_NAME, " + "DATA_TYPE, " + "TYPE_NAME, " + "CHARACTER_MAXIMUM_LENGTH COLUMN_SIZE, " + "CHARACTER_MAXIMUM_LENGTH BUFFER_LENGTH, " + "NUMERIC_SCALE DECIMAL_DIGITS, " + "NUMERIC_PRECISION_RADIX NUM_PREC_RADIX, " + "NULLABLE, " + "REMARKS, " + "COLUMN_DEFAULT COLUMN_DEF, " + "DATA_TYPE SQL_DATA_TYPE, " + "ZERO() SQL_DATETIME_SUB, " + "CHARACTER_OCTET_LENGTH CHAR_OCTET_LENGTH, " + "ORDINAL_POSITION, " + "IS_NULLABLE IS_NULLABLE, " + "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_CATALOG, " + "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_SCHEMA, " + "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_TABLE, " + "SOURCE_DATA_TYPE, " + "CASE WHEN SEQUENCE_NAME IS NULL THEN CAST(? AS VARCHAR) ELSE CAST(? AS VARCHAR) END IS_AUTOINCREMENT, " + "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_CATLOG " + "FROM INFORMATION_SCHEMA.COLUMNS " + "WHERE TABLE_CATALOG LIKE ? ESCAPE ? " + "AND TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND TABLE_NAME LIKE ? ESCAPE ? " + "AND COLUMN_NAME LIKE ? ESCAPE ? " + "ORDER BY TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION"); prep.setString(1, "NO"); prep.setString(2, "YES"); prep.setString(3, getCatalogPattern(catalogPattern)); prep.setString(4, "\\"); prep.setString(5, getSchemaPattern(schemaPattern)); prep.setString(6, "\\"); prep.setString(7, getPattern(tableNamePattern)); prep.setString(8, "\\"); prep.setString(9, getPattern(columnNamePattern)); prep.setString(10, "\\"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getIndexInfo(String catalogPattern, String schemaPattern, String tableName, boolean unique, boolean approximate) throws SQLException { try { if (isDebugEnabled()) { debugCode("getIndexInfo(" + quote(catalogPattern) + ", " + quote(schemaPattern) + ", " + quote(tableName) + ", " + unique + ", " + approximate + ");"); } String uniqueCondition; if (unique) { uniqueCondition = "NON_UNIQUE=FALSE"; } else { uniqueCondition = "TRUE"; } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TABLE_CATALOG TABLE_CAT, " + "TABLE_SCHEMA TABLE_SCHEM, " + "TABLE_NAME, " + "NON_UNIQUE, " + "TABLE_CATALOG INDEX_QUALIFIER, " + "INDEX_NAME, " + "INDEX_TYPE TYPE, " + "ORDINAL_POSITION, " + "COLUMN_NAME, " + "ASC_OR_DESC, " // TODO meta data for number of unique values in an index + "CARDINALITY, " + "PAGES, " + "FILTER_CONDITION, " + "SORT_TYPE " + "FROM INFORMATION_SCHEMA.INDEXES " + "WHERE TABLE_CATALOG LIKE ? ESCAPE ? " + "AND TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND (" + uniqueCondition + ") " + "AND TABLE_NAME = ? " + "ORDER BY NON_UNIQUE, TYPE, TABLE_SCHEM, INDEX_NAME, ORDINAL_POSITION"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, tableName); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getPrimaryKeys(String catalogPattern, String schemaPattern, String tableName) throws SQLException { try { if (isDebugEnabled()) { debugCode("getPrimaryKeys(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(tableName)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TABLE_CATALOG TABLE_CAT, " + "TABLE_SCHEMA TABLE_SCHEM, " + "TABLE_NAME, " + "COLUMN_NAME, " + "ORDINAL_POSITION KEY_SEQ, " + "IFNULL(CONSTRAINT_NAME, INDEX_NAME) PK_NAME " + "FROM INFORMATION_SCHEMA.INDEXES " + "WHERE TABLE_CATALOG LIKE ? ESCAPE ? " + "AND TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND TABLE_NAME = ? " + "AND PRIMARY_KEY = TRUE " + "ORDER BY COLUMN_NAME"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, tableName); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public String getURL() throws SQLException { try { debugCodeCall("getURL"); return conn.getURL(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public String getUserName() throws SQLException { try { debugCodeCall("getUserName"); return conn.getUser(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public boolean isReadOnly() throws SQLException { try { debugCodeCall("isReadOnly"); return conn.isReadOnly(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getProcedures(String catalogPattern, String schemaPattern, String procedureNamePattern) throws SQLException { try { if (isDebugEnabled()) { debugCode("getProcedures(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(procedureNamePattern)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "ALIAS_CATALOG PROCEDURE_CAT, " + "ALIAS_SCHEMA PROCEDURE_SCHEM, " + "ALIAS_NAME PROCEDURE_NAME, " + "COLUMN_COUNT NUM_INPUT_PARAMS, " + "ZERO() NUM_OUTPUT_PARAMS, " + "ZERO() NUM_RESULT_SETS, " + "REMARKS, " + "RETURNS_RESULT PROCEDURE_TYPE, " + "ALIAS_NAME SPECIFIC_NAME " + "FROM INFORMATION_SCHEMA.FUNCTION_ALIASES " + "WHERE ALIAS_CATALOG LIKE ? ESCAPE ? " + "AND ALIAS_SCHEMA LIKE ? ESCAPE ? " + "AND ALIAS_NAME LIKE ? ESCAPE ? " + "ORDER BY PROCEDURE_SCHEM, PROCEDURE_NAME, NUM_INPUT_PARAMS"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, getPattern(procedureNamePattern)); prep.setString(6, "\\"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getProcedureColumns(String catalogPattern, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException { try { if (isDebugEnabled()) { debugCode("getProcedureColumns(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(procedureNamePattern)+", " +quote(columnNamePattern)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "ALIAS_CATALOG PROCEDURE_CAT, " + "ALIAS_SCHEMA PROCEDURE_SCHEM, " + "ALIAS_NAME PROCEDURE_NAME, " + "COLUMN_NAME, " + "COLUMN_TYPE, " + "DATA_TYPE, " + "TYPE_NAME, " + "PRECISION, " + "PRECISION LENGTH, " + "SCALE, " + "RADIX, " + "NULLABLE, " + "REMARKS, " + "COLUMN_DEFAULT COLUMN_DEF, " + "ZERO() SQL_DATA_TYPE, " + "ZERO() SQL_DATETIME_SUB, " + "ZERO() CHAR_OCTET_LENGTH, " + "POS ORDINAL_POSITION, " + "? IS_NULLABLE, " + "ALIAS_NAME SPECIFIC_NAME " + "FROM INFORMATION_SCHEMA.FUNCTION_COLUMNS " + "WHERE ALIAS_CATALOG LIKE ? ESCAPE ? " + "AND ALIAS_SCHEMA LIKE ? ESCAPE ? " + "AND ALIAS_NAME LIKE ? ESCAPE ? " + "AND COLUMN_NAME LIKE ? ESCAPE ? " + "ORDER BY PROCEDURE_SCHEM, PROCEDURE_NAME, ORDINAL_POSITION"); prep.setString(1, "YES"); prep.setString(2, getCatalogPattern(catalogPattern)); prep.setString(3, "\\"); prep.setString(4, getSchemaPattern(schemaPattern)); prep.setString(5, "\\"); prep.setString(6, getPattern(procedureNamePattern)); prep.setString(7, "\\"); prep.setString(8, getPattern(columnNamePattern)); prep.setString(9, "\\"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getSchemas() throws SQLException { try { debugCodeCall("getSchemas"); checkClosed(); PreparedStatement prep = conn .prepareAutoCloseStatement("SELECT " + "SCHEMA_NAME TABLE_SCHEM, " + "CATALOG_NAME TABLE_CATALOG, " +" IS_DEFAULT " + "FROM INFORMATION_SCHEMA.SCHEMATA " + "ORDER BY SCHEMA_NAME"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getCatalogs() throws SQLException { try { debugCodeCall("getCatalogs"); checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement( "SELECT CATALOG_NAME TABLE_CAT " + "FROM INFORMATION_SCHEMA.CATALOGS"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getTableTypes() throws SQLException { try { debugCodeCall("getTableTypes"); checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TYPE TABLE_TYPE " + "FROM INFORMATION_SCHEMA.TABLE_TYPES " + "ORDER BY TABLE_TYPE"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getColumnPrivileges(String catalogPattern, String schemaPattern, String table, String columnNamePattern) throws SQLException { try { if (isDebugEnabled()) { debugCode("getColumnPrivileges(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(table)+", " +quote(columnNamePattern)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TABLE_CATALOG TABLE_CAT, " + "TABLE_SCHEMA TABLE_SCHEM, " + "TABLE_NAME, " + "COLUMN_NAME, " + "GRANTOR, " + "GRANTEE, " + "PRIVILEGE_TYPE PRIVILEGE, " + "IS_GRANTABLE " + "FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES " + "WHERE TABLE_CATALOG LIKE ? ESCAPE ? " + "AND TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND TABLE_NAME = ? " + "AND COLUMN_NAME LIKE ? ESCAPE ? " + "ORDER BY COLUMN_NAME, PRIVILEGE"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, table); prep.setString(6, getPattern(columnNamePattern)); prep.setString(7, "\\"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getTablePrivileges(String catalogPattern, String schemaPattern, String tableNamePattern) throws SQLException { try { if (isDebugEnabled()) { debugCode("getTablePrivileges(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(tableNamePattern)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TABLE_CATALOG TABLE_CAT, " + "TABLE_SCHEMA TABLE_SCHEM, " + "TABLE_NAME, " + "GRANTOR, " + "GRANTEE, " + "PRIVILEGE_TYPE PRIVILEGE, " + "IS_GRANTABLE " + "FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES " + "WHERE TABLE_CATALOG LIKE ? ESCAPE ? " + "AND TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND TABLE_NAME LIKE ? ESCAPE ? " + "ORDER BY TABLE_SCHEM, TABLE_NAME, PRIVILEGE"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, getPattern(tableNamePattern)); prep.setString(6, "\\"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getBestRowIdentifier(String catalogPattern, String schemaPattern, String tableName, int scope, boolean nullable) throws SQLException { try { if (isDebugEnabled()) { debugCode("getBestRowIdentifier(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(tableName)+", " +scope+", "+nullable+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "CAST(? AS SMALLINT) SCOPE, " + "C.COLUMN_NAME, " + "C.DATA_TYPE, " + "C.TYPE_NAME, " + "C.CHARACTER_MAXIMUM_LENGTH COLUMN_SIZE, " + "C.CHARACTER_MAXIMUM_LENGTH BUFFER_LENGTH, " + "CAST(C.NUMERIC_SCALE AS SMALLINT) DECIMAL_DIGITS, " + "CAST(? AS SMALLINT) PSEUDO_COLUMN " + "FROM INFORMATION_SCHEMA.INDEXES I, " +" INFORMATION_SCHEMA.COLUMNS C " + "WHERE C.TABLE_NAME = I.TABLE_NAME " + "AND C.COLUMN_NAME = I.COLUMN_NAME " + "AND C.TABLE_CATALOG LIKE ? ESCAPE ? " + "AND C.TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND C.TABLE_NAME = ? " + "AND I.PRIMARY_KEY = TRUE " + "ORDER BY SCOPE"); // SCOPE prep.setInt(1, DatabaseMetaData.bestRowSession); // PSEUDO_COLUMN prep.setInt(2, DatabaseMetaData.bestRowNotPseudo); prep.setString(3, getCatalogPattern(catalogPattern)); prep.setString(4, "\\"); prep.setString(5, getSchemaPattern(schemaPattern)); prep.setString(6, "\\"); prep.setString(7, tableName); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getVersionColumns(String catalog, String schema, String tableName) throws SQLException { try { if (isDebugEnabled()) { debugCode("getVersionColumns(" +quote(catalog)+", " +quote(schema)+", " +quote(tableName)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "ZERO() SCOPE, " + "COLUMN_NAME, " + "CAST(DATA_TYPE AS INT) DATA_TYPE, " + "TYPE_NAME, " + "NUMERIC_PRECISION COLUMN_SIZE, " + "NUMERIC_PRECISION BUFFER_LENGTH, " + "NUMERIC_PRECISION DECIMAL_DIGITS, " + "ZERO() PSEUDO_COLUMN " + "FROM INFORMATION_SCHEMA.COLUMNS " + "WHERE FALSE"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getImportedKeys(String catalogPattern, String schemaPattern, String tableName) throws SQLException { try { if (isDebugEnabled()) { debugCode("getImportedKeys(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(tableName)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "PKTABLE_CATALOG PKTABLE_CAT, " + "PKTABLE_SCHEMA PKTABLE_SCHEM, " + "PKTABLE_NAME PKTABLE_NAME, " + "PKCOLUMN_NAME, " + "FKTABLE_CATALOG FKTABLE_CAT, " + "FKTABLE_SCHEMA FKTABLE_SCHEM, " + "FKTABLE_NAME, " + "FKCOLUMN_NAME, " + "ORDINAL_POSITION KEY_SEQ, " + "UPDATE_RULE, " + "DELETE_RULE, " + "FK_NAME, " + "PK_NAME, " + "DEFERRABILITY " + "FROM INFORMATION_SCHEMA.CROSS_REFERENCES " + "WHERE FKTABLE_CATALOG LIKE ? ESCAPE ? " + "AND FKTABLE_SCHEMA LIKE ? ESCAPE ? " + "AND FKTABLE_NAME = ? " + "ORDER BY PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, FK_NAME, KEY_SEQ"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, tableName); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getExportedKeys(String catalogPattern, String schemaPattern, String tableName) throws SQLException { try { if (isDebugEnabled()) { debugCode("getExportedKeys(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(tableName)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "PKTABLE_CATALOG PKTABLE_CAT, " + "PKTABLE_SCHEMA PKTABLE_SCHEM, " + "PKTABLE_NAME PKTABLE_NAME, " + "PKCOLUMN_NAME, " + "FKTABLE_CATALOG FKTABLE_CAT, " + "FKTABLE_SCHEMA FKTABLE_SCHEM, " + "FKTABLE_NAME, " + "FKCOLUMN_NAME, " + "ORDINAL_POSITION KEY_SEQ, " + "UPDATE_RULE, " + "DELETE_RULE, " + "FK_NAME, " + "PK_NAME, " + "DEFERRABILITY " + "FROM INFORMATION_SCHEMA.CROSS_REFERENCES " + "WHERE PKTABLE_CATALOG LIKE ? ESCAPE ? " + "AND PKTABLE_SCHEMA LIKE ? ESCAPE ? " + "AND PKTABLE_NAME = ? " + "ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, FK_NAME, KEY_SEQ"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, tableName); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getCrossReference(String primaryCatalogPattern, String primarySchemaPattern, String primaryTable, String foreignCatalogPattern, String foreignSchemaPattern, String foreignTable) throws SQLException { try { if (isDebugEnabled()) { debugCode("getCrossReference(" +quote(primaryCatalogPattern)+", " +quote(primarySchemaPattern)+", " +quote(primaryTable)+", " +quote(foreignCatalogPattern)+", " +quote(foreignSchemaPattern)+", " +quote(foreignTable)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "PKTABLE_CATALOG PKTABLE_CAT, " + "PKTABLE_SCHEMA PKTABLE_SCHEM, " + "PKTABLE_NAME PKTABLE_NAME, " + "PKCOLUMN_NAME, " + "FKTABLE_CATALOG FKTABLE_CAT, " + "FKTABLE_SCHEMA FKTABLE_SCHEM, " + "FKTABLE_NAME, " + "FKCOLUMN_NAME, " + "ORDINAL_POSITION KEY_SEQ, " + "UPDATE_RULE, " + "DELETE_RULE, " + "FK_NAME, " + "PK_NAME, " + "DEFERRABILITY " + "FROM INFORMATION_SCHEMA.CROSS_REFERENCES " + "WHERE PKTABLE_CATALOG LIKE ? ESCAPE ? " + "AND PKTABLE_SCHEMA LIKE ? ESCAPE ? " + "AND PKTABLE_NAME = ? " + "AND FKTABLE_CATALOG LIKE ? ESCAPE ? " + "AND FKTABLE_SCHEMA LIKE ? ESCAPE ? " + "AND FKTABLE_NAME = ? " + "ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, FK_NAME, KEY_SEQ"); prep.setString(1, getCatalogPattern(primaryCatalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(primarySchemaPattern)); prep.setString(4, "\\"); prep.setString(5, primaryTable); prep.setString(6, getCatalogPattern(foreignCatalogPattern)); prep.setString(7, "\\"); prep.setString(8, getSchemaPattern(foreignSchemaPattern)); prep.setString(9, "\\"); prep.setString(10, foreignTable); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws SQLException { try { if (isDebugEnabled()) { debugCode("getUDTs(" +quote(catalog)+", " +quote(schemaPattern)+", " +quote(typeNamePattern)+", " +quoteIntArray(types)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "CAST(NULL AS VARCHAR) TYPE_CAT, " + "CAST(NULL AS VARCHAR) TYPE_SCHEM, " + "CAST(NULL AS VARCHAR) TYPE_NAME, " + "CAST(NULL AS VARCHAR) CLASS_NAME, " + "CAST(NULL AS SMALLINT) DATA_TYPE, " + "CAST(NULL AS VARCHAR) REMARKS, " + "CAST(NULL AS SMALLINT) BASE_TYPE " + "FROM DUAL WHERE FALSE"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getTypeInfo() throws SQLException { try { debugCodeCall("getTypeInfo"); checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TYPE_NAME, " + "DATA_TYPE, " + "PRECISION, " + "PREFIX LITERAL_PREFIX, " + "SUFFIX LITERAL_SUFFIX, " + "PARAMS CREATE_PARAMS, " + "NULLABLE, " + "CASE_SENSITIVE, " + "SEARCHABLE, " + "FALSE UNSIGNED_ATTRIBUTE, " + "FALSE FIXED_PREC_SCALE, " + "AUTO_INCREMENT, " + "TYPE_NAME LOCAL_TYPE_NAME, " + "MINIMUM_SCALE, " + "MAXIMUM_SCALE, " + "DATA_TYPE SQL_DATA_TYPE, " + "ZERO() SQL_DATETIME_SUB, " + "RADIX NUM_PREC_RADIX " + "FROM INFORMATION_SCHEMA.TYPE_INFO " + "ORDER BY DATA_TYPE, POS"); ResultSet rs = prep.executeQuery(); return rs; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public String getNumericFunctions() throws SQLException { debugCodeCall("getNumericFunctions"); return getFunctions("Functions (Numeric)"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public String getStringFunctions() throws SQLException { debugCodeCall("getStringFunctions"); return getFunctions("Functions (String)"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public String getSystemFunctions() throws SQLException { debugCodeCall("getSystemFunctions"); return getFunctions("Functions (System)"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public String getTimeDateFunctions() throws SQLException { debugCodeCall("getTimeDateFunctions"); return getFunctions("Functions (Time and Date)"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
private String getFunctions(String section) throws SQLException { try { checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT TOPIC " + "FROM INFORMATION_SCHEMA.HELP WHERE SECTION = ?"); prep.setString(1, section); ResultSet rs = prep.executeQuery(); StatementBuilder buff = new StatementBuilder(); while (rs.next()) { String s = rs.getString(1).trim(); String[] array = StringUtils.arraySplit(s, ',', true); for (String a : array) { buff.appendExceptFirst(","); String f = a.trim(); if (f.indexOf(' ') >= 0) { // remove 'Function' from 'INSERT Function' f = f.substring(0, f.indexOf(' ')).trim(); } buff.append(f); } } rs.close(); prep.close(); return buff.toString(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException { throw unsupported("superTypes"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException { try { if (isDebugEnabled()) { debugCode("getSuperTables(" +quote(catalog)+", " +quote(schemaPattern)+", " +quote(tableNamePattern)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "CATALOG_NAME TABLE_CAT, " + "CATALOG_NAME TABLE_SCHEM, " + "CATALOG_NAME TABLE_NAME, " + "CATALOG_NAME SUPERTABLE_NAME " + "FROM INFORMATION_SCHEMA.CATALOGS " + "WHERE FALSE"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException { throw unsupported("attributes"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException { throw unsupported("getSchemas(., .)"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getClientInfoProperties() throws SQLException { throw unsupported("clientInfoProperties"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException { throw unsupported("getFunctionColumns"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException { throw unsupported("getFunctions"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean next() throws SQLException { try { debugCodeCall("next"); checkClosed(); return nextRow(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public ResultSetMetaData getMetaData() throws SQLException { try { int id = getNextId(TraceObject.RESULT_SET_META_DATA); if (isDebugEnabled()) { debugCodeAssign("ResultSetMetaData", TraceObject.RESULT_SET_META_DATA, id, "getMetaData()"); } checkClosed(); String catalog = conn.getCatalog(); JdbcResultSetMetaData meta = new JdbcResultSetMetaData(this, null, result, catalog, conn.getSession().getTrace(), id); return meta; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean wasNull() throws SQLException { try { debugCodeCall("wasNull"); checkClosed(); return wasNull; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int findColumn(String columnLabel) throws SQLException { try { debugCodeCall("findColumn", columnLabel); return getColumnIndex(columnLabel); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void close() throws SQLException { try { debugCodeCall("close"); closeInternal(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
void closeInternal() throws SQLException { if (result != null) { try { result.close(); if (closeStatement && stat != null) { stat.close(); } } finally { columnCount = 0; result = null; stat = null; conn = null; insertRow = null; updateRow = null; } } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Statement getStatement() throws SQLException { try { debugCodeCall("getStatement"); checkClosed(); if (closeStatement) { // if the result set was opened by a DatabaseMetaData call return null; } return stat; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public SQLWarning getWarnings() throws SQLException { try { debugCodeCall("getWarnings"); checkClosed(); return null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void clearWarnings() throws SQLException { try { debugCodeCall("clearWarnings"); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public String getString(int columnIndex) throws SQLException { try { debugCodeCall("getString", columnIndex); return get(columnIndex).getString(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public String getString(String columnLabel) throws SQLException { try { debugCodeCall("getString", columnLabel); return get(columnLabel).getString(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getInt(int columnIndex) throws SQLException { try { debugCodeCall("getInt", columnIndex); return get(columnIndex).getInt(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getInt(String columnLabel) throws SQLException { try { debugCodeCall("getInt", columnLabel); return get(columnLabel).getInt(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public BigDecimal getBigDecimal(int columnIndex) throws SQLException { try { debugCodeCall("getBigDecimal", columnIndex); return get(columnIndex).getBigDecimal(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Date getDate(int columnIndex) throws SQLException { try { debugCodeCall("getDate", columnIndex); return get(columnIndex).getDate(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Time getTime(int columnIndex) throws SQLException { try { debugCodeCall("getTime", columnIndex); return get(columnIndex).getTime(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Timestamp getTimestamp(int columnIndex) throws SQLException { try { debugCodeCall("getTimestamp", columnIndex); return get(columnIndex).getTimestamp(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public BigDecimal getBigDecimal(String columnLabel) throws SQLException { try { debugCodeCall("getBigDecimal", columnLabel); return get(columnLabel).getBigDecimal(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Date getDate(String columnLabel) throws SQLException { try { debugCodeCall("getDate", columnLabel); return get(columnLabel).getDate(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Time getTime(String columnLabel) throws SQLException { try { debugCodeCall("getTime", columnLabel); return get(columnLabel).getTime(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Timestamp getTimestamp(String columnLabel) throws SQLException { try { debugCodeCall("getTimestamp", columnLabel); return get(columnLabel).getTimestamp(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Object getObject(int columnIndex) throws SQLException { try { debugCodeCall("getObject", columnIndex); Value v = get(columnIndex); return conn.convertToDefaultObject(v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Object getObject(String columnLabel) throws SQLException { try { debugCodeCall("getObject", columnLabel); Value v = get(columnLabel); return conn.convertToDefaultObject(v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean getBoolean(int columnIndex) throws SQLException { try { debugCodeCall("getBoolean", columnIndex); Boolean v = get(columnIndex).getBoolean(); return v == null ? false : v.booleanValue(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean getBoolean(String columnLabel) throws SQLException { try { debugCodeCall("getBoolean", columnLabel); Boolean v = get(columnLabel).getBoolean(); return v == null ? false : v.booleanValue(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public byte getByte(int columnIndex) throws SQLException { try { debugCodeCall("getByte", columnIndex); return get(columnIndex).getByte(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public byte getByte(String columnLabel) throws SQLException { try { debugCodeCall("getByte", columnLabel); return get(columnLabel).getByte(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public short getShort(int columnIndex) throws SQLException { try { debugCodeCall("getShort", columnIndex); return get(columnIndex).getShort(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public short getShort(String columnLabel) throws SQLException { try { debugCodeCall("getShort", columnLabel); return get(columnLabel).getShort(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public long getLong(int columnIndex) throws SQLException { try { debugCodeCall("getLong", columnIndex); return get(columnIndex).getLong(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public long getLong(String columnLabel) throws SQLException { try { debugCodeCall("getLong", columnLabel); return get(columnLabel).getLong(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public float getFloat(int columnIndex) throws SQLException { try { debugCodeCall("getFloat", columnIndex); return get(columnIndex).getFloat(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public float getFloat(String columnLabel) throws SQLException { try { debugCodeCall("getFloat", columnLabel); return get(columnLabel).getFloat(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public double getDouble(int columnIndex) throws SQLException { try { debugCodeCall("getDouble", columnIndex); return get(columnIndex).getDouble(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public double getDouble(String columnLabel) throws SQLException { try { debugCodeCall("getDouble", columnLabel); return get(columnLabel).getDouble(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { try { if (isDebugEnabled()) { debugCode("getBigDecimal(" + StringUtils.quoteJavaString(columnLabel)+", "+scale+");"); } if (scale < 0) { throw DbException.getInvalidValueException("scale", scale); } BigDecimal bd = get(columnLabel).getBigDecimal(); return bd == null ? null : MathUtils.setScale(bd, scale); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { try { if (isDebugEnabled()) { debugCode("getBigDecimal(" + columnIndex + ", " + scale + ");"); } if (scale < 0) { throw DbException.getInvalidValueException("scale", scale); } BigDecimal bd = get(columnIndex).getBigDecimal(); return bd == null ? null : MathUtils.setScale(bd, scale); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public InputStream getUnicodeStream(int columnIndex) throws SQLException { throw unsupported("unicodeStream"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public InputStream getUnicodeStream(String columnLabel) throws SQLException { throw unsupported("unicodeStream"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException { throw unsupported("map"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException { throw unsupported("map"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Ref getRef(int columnIndex) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Ref getRef(String columnLabel) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Date getDate(int columnIndex, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("getDate(" + columnIndex + ", calendar)"); } return DateTimeUtils.convertDate(get(columnIndex), calendar); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Date getDate(String columnLabel, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("getDate(" + StringUtils.quoteJavaString(columnLabel) + ", calendar)"); } return DateTimeUtils.convertDate(get(columnLabel), calendar); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Time getTime(int columnIndex, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("getTime(" + columnIndex + ", calendar)"); } return DateTimeUtils.convertTime(get(columnIndex), calendar); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Time getTime(String columnLabel, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("getTime(" + StringUtils.quoteJavaString(columnLabel) + ", calendar)"); } return DateTimeUtils.convertTime(get(columnLabel), calendar); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Timestamp getTimestamp(int columnIndex, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("getTimestamp(" + columnIndex + ", calendar)"); } Value value = get(columnIndex); return DateTimeUtils.convertTimestamp(value, calendar); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Timestamp getTimestamp(String columnLabel, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("getTimestamp(" + StringUtils.quoteJavaString(columnLabel) + ", calendar)"); } Value value = get(columnLabel); return DateTimeUtils.convertTimestamp(value, calendar); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Blob getBlob(int columnIndex) throws SQLException { try { int id = getNextId(TraceObject.BLOB); debugCodeAssign("Blob", TraceObject.BLOB, id, "getBlob(" + columnIndex + ")"); Value v = get(columnIndex); return v == ValueNull.INSTANCE ? null : new JdbcBlob(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Blob getBlob(String columnLabel) throws SQLException { try { int id = getNextId(TraceObject.BLOB); debugCodeAssign("Blob", TraceObject.BLOB, id, "getBlob(" + quote(columnLabel) + ")"); Value v = get(columnLabel); return v == ValueNull.INSTANCE ? null : new JdbcBlob(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public byte[] getBytes(int columnIndex) throws SQLException { try { debugCodeCall("getBytes", columnIndex); return get(columnIndex).getBytes(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public byte[] getBytes(String columnLabel) throws SQLException { try { debugCodeCall("getBytes", columnLabel); return get(columnLabel).getBytes(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public InputStream getBinaryStream(int columnIndex) throws SQLException { try { debugCodeCall("getBinaryStream", columnIndex); return get(columnIndex).getInputStream(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public InputStream getBinaryStream(String columnLabel) throws SQLException { try { debugCodeCall("getBinaryStream", columnLabel); return get(columnLabel).getInputStream(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Clob getClob(int columnIndex) throws SQLException { try { int id = getNextId(TraceObject.CLOB); debugCodeAssign("Clob", TraceObject.CLOB, id, "getClob(" + columnIndex + ")"); Value v = get(columnIndex); return v == ValueNull.INSTANCE ? null : new JdbcClob(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Clob getClob(String columnLabel) throws SQLException { try { int id = getNextId(TraceObject.CLOB); debugCodeAssign("Clob", TraceObject.CLOB, id, "getClob(" + quote(columnLabel) + ")"); Value v = get(columnLabel); return v == ValueNull.INSTANCE ? null : new JdbcClob(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Array getArray(int columnIndex) throws SQLException { try { int id = getNextId(TraceObject.ARRAY); debugCodeAssign("Clob", TraceObject.ARRAY, id, "getArray(" + columnIndex + ")"); Value v = get(columnIndex); return v == ValueNull.INSTANCE ? null : new JdbcArray(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Array getArray(String columnLabel) throws SQLException { try { int id = getNextId(TraceObject.ARRAY); debugCodeAssign("Clob", TraceObject.ARRAY, id, "getArray(" + quote(columnLabel) + ")"); Value v = get(columnLabel); return v == ValueNull.INSTANCE ? null : new JdbcArray(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public InputStream getAsciiStream(int columnIndex) throws SQLException { try { debugCodeCall("getAsciiStream", columnIndex); String s = get(columnIndex).getString(); return s == null ? null : IOUtils.getInputStreamFromString(s); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public InputStream getAsciiStream(String columnLabel) throws SQLException { try { debugCodeCall("getAsciiStream", columnLabel); String s = get(columnLabel).getString(); return IOUtils.getInputStreamFromString(s); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Reader getCharacterStream(int columnIndex) throws SQLException { try { debugCodeCall("getCharacterStream", columnIndex); return get(columnIndex).getReader(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Reader getCharacterStream(String columnLabel) throws SQLException { try { debugCodeCall("getCharacterStream", columnLabel); return get(columnLabel).getReader(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public URL getURL(int columnIndex) throws SQLException { throw unsupported("url"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public URL getURL(String columnLabel) throws SQLException { throw unsupported("url"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNull(int columnIndex) throws SQLException { try { debugCodeCall("updateNull", columnIndex); update(columnIndex, ValueNull.INSTANCE); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNull(String columnLabel) throws SQLException { try { debugCodeCall("updateNull", columnLabel); update(columnLabel, ValueNull.INSTANCE); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBoolean(int columnIndex, boolean x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBoolean("+columnIndex+", "+x+");"); } update(columnIndex, ValueBoolean.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBoolean(String columnLabel, boolean x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBoolean("+quote(columnLabel)+", "+x+");"); } update(columnLabel, ValueBoolean.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateByte(int columnIndex, byte x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateByte("+columnIndex+", "+x+");"); } update(columnIndex, ValueByte.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateByte(String columnLabel, byte x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateByte("+columnLabel+", "+x+");"); } update(columnLabel, ValueByte.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBytes(int columnIndex, byte[] x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBytes("+columnIndex+", x);"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueBytes.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBytes(String columnLabel, byte[] x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBytes("+quote(columnLabel)+", x);"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueBytes.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateShort(int columnIndex, short x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateShort("+columnIndex+", (short) "+x+");"); } update(columnIndex, ValueShort.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateShort(String columnLabel, short x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateShort("+quote(columnLabel)+", (short) "+x+");"); } update(columnLabel, ValueShort.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateInt(int columnIndex, int x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateInt("+columnIndex+", "+x+");"); } update(columnIndex, ValueInt.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateInt(String columnLabel, int x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateInt("+quote(columnLabel)+", "+x+");"); } update(columnLabel, ValueInt.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateLong(int columnIndex, long x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateLong("+columnIndex+", "+x+"L);"); } update(columnIndex, ValueLong.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateLong(String columnLabel, long x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateLong("+quote(columnLabel)+", "+x+"L);"); } update(columnLabel, ValueLong.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateFloat(int columnIndex, float x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateFloat("+columnIndex+", "+x+"f);"); } update(columnIndex, ValueFloat.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateFloat(String columnLabel, float x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateFloat("+quote(columnLabel)+", "+x+"f);"); } update(columnLabel, ValueFloat.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateDouble(int columnIndex, double x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateDouble("+columnIndex+", "+x+"d);"); } update(columnIndex, ValueDouble.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateDouble(String columnLabel, double x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateDouble("+quote(columnLabel)+", "+x+"d);"); } update(columnLabel, ValueDouble.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBigDecimal("+columnIndex+", " + quoteBigDecimal(x) + ");"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueDecimal.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBigDecimal("+quote(columnLabel)+", " + quoteBigDecimal(x) + ");"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueDecimal.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateString(int columnIndex, String x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateString("+columnIndex+", "+quote(x)+");"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateString(String columnLabel, String x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateString("+quote(columnLabel)+", "+quote(x)+");"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateDate(int columnIndex, Date x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateDate("+columnIndex+", x);"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueDate.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateDate(String columnLabel, Date x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateDate("+quote(columnLabel)+", x);"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueDate.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateTime(int columnIndex, Time x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateTime("+columnIndex+", x);"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueTime.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateTime(String columnLabel, Time x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateTime("+quote(columnLabel)+", x);"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueTime.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateTimestamp("+columnIndex+", x);"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueTimestamp.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateTimestamp("+quote(columnLabel)+", x);"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueTimestamp.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { updateAsciiStream(columnIndex, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { updateAsciiStream(columnIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateAsciiStream("+columnIndex+", x, "+length+"L);"); } checkClosed(); Value v = conn.createClob(IOUtils.getAsciiReader(x), length); update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { updateAsciiStream(columnLabel, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { updateAsciiStream(columnLabel, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateAsciiStream("+quote(columnLabel)+", x, "+length+"L);"); } checkClosed(); Value v = conn.createClob(IOUtils.getAsciiReader(x), length); update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { updateBinaryStream(columnIndex, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { updateBinaryStream(columnIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBinaryStream("+columnIndex+", x, "+length+"L);"); } checkClosed(); Value v = conn.createBlob(x, length); update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { updateBinaryStream(columnLabel, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { updateBinaryStream(columnLabel, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBinaryStream("+quote(columnLabel)+", x, "+length+"L);"); } checkClosed(); Value v = conn.createBlob(x, length); update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateCharacterStream("+columnIndex+", x, "+length+"L);"); } checkClosed(); Value v = conn.createClob(x, length); update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { updateCharacterStream(columnIndex, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { updateCharacterStream(columnIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateCharacterStream(String columnLabel, Reader x, int length) throws SQLException { updateCharacterStream(columnLabel, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateCharacterStream(String columnLabel, Reader x) throws SQLException { updateCharacterStream(columnLabel, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateCharacterStream(String columnLabel, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateCharacterStream("+quote(columnLabel)+", x, "+length+"L);"); } checkClosed(); Value v = conn.createClob(x, length); update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateObject(int columnIndex, Object x, int scale) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateObject("+columnIndex+", x, "+scale+");"); } update(columnIndex, convertToUnknownValue(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateObject(String columnLabel, Object x, int scale) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateObject("+quote(columnLabel)+", x, "+scale+");"); } update(columnLabel, convertToUnknownValue(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateObject(int columnIndex, Object x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateObject("+columnIndex+", x);"); } update(columnIndex, convertToUnknownValue(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateObject(String columnLabel, Object x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateObject("+quote(columnLabel)+", x);"); } update(columnLabel, convertToUnknownValue(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateRef(int columnIndex, Ref x) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateRef(String columnLabel, Ref x) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBlob(int columnIndex, InputStream x) throws SQLException { updateBlob(columnIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBlob(int columnIndex, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBlob("+columnIndex+", x, " + length + "L);"); } checkClosed(); Value v = conn.createBlob(x, length); update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBlob(int columnIndex, Blob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBlob("+columnIndex+", x);"); } checkClosed(); Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createBlob(x.getBinaryStream(), -1); } update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBlob(String columnLabel, Blob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBlob("+quote(columnLabel)+", x);"); } checkClosed(); Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createBlob(x.getBinaryStream(), -1); } update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBlob(String columnLabel, InputStream x) throws SQLException { updateBlob(columnLabel, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBlob(String columnLabel, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBlob("+quote(columnLabel)+", x, " + length + "L);"); } checkClosed(); Value v = conn.createBlob(x, -1); update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateClob(int columnIndex, Clob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateClob("+columnIndex+", x);"); } checkClosed(); Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createClob(x.getCharacterStream(), -1); } update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateClob(int columnIndex, Reader x) throws SQLException { updateClob(columnIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateClob(int columnIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateClob("+columnIndex+", x, " + length + "L);"); } checkClosed(); Value v = conn.createClob(x, length); update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateClob(String columnLabel, Clob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateClob("+quote(columnLabel)+", x);"); } checkClosed(); Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createClob(x.getCharacterStream(), -1); } update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateClob(String columnLabel, Reader x) throws SQLException { updateClob(columnLabel, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateClob(String columnLabel, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateClob("+quote(columnLabel)+", x, " + length + "L);"); } checkClosed(); Value v = conn.createClob(x, length); update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateArray(int columnIndex, Array x) throws SQLException { throw unsupported("setArray"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateArray(String columnLabel, Array x) throws SQLException { throw unsupported("setArray"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public String getCursorName() throws SQLException { throw unsupported("cursorName"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getRow() throws SQLException { try { debugCodeCall("getRow"); checkClosed(); int rowId = result.getRowId(); if (rowId >= result.getRowCount()) { return 0; } return rowId + 1; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getConcurrency() throws SQLException { try { debugCodeCall("getConcurrency"); checkClosed(); if (!updatable) { return ResultSet.CONCUR_READ_ONLY; } UpdatableRow row = new UpdatableRow(conn, result); return row.isUpdatable() ? ResultSet.CONCUR_UPDATABLE : ResultSet.CONCUR_READ_ONLY; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getFetchDirection() throws SQLException { try { debugCodeCall("getFetchDirection"); checkClosed(); return ResultSet.FETCH_FORWARD; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getFetchSize() throws SQLException { try { debugCodeCall("getFetchSize"); checkClosed(); return result.getFetchSize(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void setFetchSize(int rows) throws SQLException { try { debugCodeCall("setFetchSize", rows); checkClosed(); if (rows < 0) { throw DbException.getInvalidValueException("rows", rows); } else if (rows > 0) { if (stat != null) { int maxRows = stat.getMaxRows(); if (maxRows > 0 && rows > maxRows) { throw DbException.getInvalidValueException("rows", rows); } } } else { rows = SysProperties.SERVER_RESULT_SET_FETCH_SIZE; } result.setFetchSize(rows); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void setFetchDirection(int direction) throws SQLException { throw unsupported("setFetchDirection"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getType() throws SQLException { try { debugCodeCall("getType"); checkClosed(); return stat == null ? ResultSet.TYPE_FORWARD_ONLY : stat.resultSetType; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean isBeforeFirst() throws SQLException { try { debugCodeCall("isBeforeFirst"); checkClosed(); int row = result.getRowId(); int count = result.getRowCount(); return count > 0 && row < 0; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean isAfterLast() throws SQLException { try { debugCodeCall("isAfterLast"); checkClosed(); int row = result.getRowId(); int count = result.getRowCount(); return count > 0 && row >= count; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean isFirst() throws SQLException { try { debugCodeCall("isFirst"); checkClosed(); int row = result.getRowId(); return row == 0 && row < result.getRowCount(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean isLast() throws SQLException { try { debugCodeCall("isLast"); checkClosed(); int row = result.getRowId(); return row >= 0 && row == result.getRowCount() - 1; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void beforeFirst() throws SQLException { try { debugCodeCall("beforeFirst"); checkClosed(); if (result.getRowId() >= 0) { resetResult(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void afterLast() throws SQLException { try { debugCodeCall("afterLast"); checkClosed(); while (nextRow()) { // nothing } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean first() throws SQLException { try { debugCodeCall("first"); checkClosed(); if (result.getRowId() < 0) { return nextRow(); } resetResult(); return nextRow(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean last() throws SQLException { try { debugCodeCall("last"); checkClosed(); return absolute(-1); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean absolute(int rowNumber) throws SQLException { try { debugCodeCall("absolute", rowNumber); checkClosed(); if (rowNumber < 0) { rowNumber = result.getRowCount() + rowNumber + 1; } else if (rowNumber > result.getRowCount() + 1) { rowNumber = result.getRowCount() + 1; } if (rowNumber <= result.getRowId()) { resetResult(); } while (result.getRowId() + 1 < rowNumber) { nextRow(); } int row = result.getRowId(); return row >= 0 && row < result.getRowCount(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean relative(int rowCount) throws SQLException { try { debugCodeCall("relative", rowCount); checkClosed(); int row = result.getRowId() + 1 + rowCount; if (row < 0) { row = 0; } else if (row > result.getRowCount()) { row = result.getRowCount() + 1; } return absolute(row); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean previous() throws SQLException { try { debugCodeCall("previous"); checkClosed(); return relative(-1); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void moveToInsertRow() throws SQLException { try { debugCodeCall("moveToInsertRow"); checkUpdatable(); insertRow = new Value[columnCount]; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void moveToCurrentRow() throws SQLException { try { debugCodeCall("moveToCurrentRow"); checkUpdatable(); insertRow = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean rowUpdated() throws SQLException { try { debugCodeCall("rowUpdated"); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean rowInserted() throws SQLException { try { debugCodeCall("rowInserted"); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean rowDeleted() throws SQLException { try { debugCodeCall("rowDeleted"); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void insertRow() throws SQLException { try { debugCodeCall("insertRow"); checkUpdatable(); if (insertRow == null) { throw DbException.get(ErrorCode.NOT_ON_UPDATABLE_ROW); } getUpdatableRow().insertRow(insertRow); insertRow = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateRow() throws SQLException { try { debugCodeCall("updateRow"); checkUpdatable(); if (insertRow != null) { throw DbException.get(ErrorCode.NOT_ON_UPDATABLE_ROW); } checkOnValidRow(); if (updateRow != null) { UpdatableRow row = getUpdatableRow(); Value[] current = new Value[columnCount]; for (int i = 0; i < updateRow.length; i++) { current[i] = get(i + 1); } row.updateRow(current, updateRow); for (int i = 0; i < updateRow.length; i++) { if (updateRow[i] == null) { updateRow[i] = current[i]; } } Value[] patch = row.readRow(updateRow); patchCurrentRow(patch); updateRow = null; } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void deleteRow() throws SQLException { try { debugCodeCall("deleteRow"); checkUpdatable(); if (insertRow != null) { throw DbException.get(ErrorCode.NOT_ON_UPDATABLE_ROW); } checkOnValidRow(); getUpdatableRow().deleteRow(result.currentRow()); updateRow = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void refreshRow() throws SQLException { try { debugCodeCall("refreshRow"); checkClosed(); if (insertRow != null) { throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } checkOnValidRow(); patchCurrentRow(getUpdatableRow().readRow(result.currentRow())); updateRow = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void cancelRowUpdates() throws SQLException { try { debugCodeCall("cancelRowUpdates"); checkClosed(); if (insertRow != null) { throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } updateRow = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
private UpdatableRow getUpdatableRow() throws SQLException { UpdatableRow row = new UpdatableRow(conn, result); if (!row.isUpdatable()) { throw DbException.get(ErrorCode.RESULT_SET_NOT_UPDATABLE); } return row; }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public RowId getRowId(int columnIndex) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public RowId getRowId(String columnLabel) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateRowId(int columnIndex, RowId x) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateRowId(String columnLabel, RowId x) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getHoldability() throws SQLException { try { debugCodeCall("getHoldability"); checkClosed(); return conn.getHoldability(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean isClosed() throws SQLException { try { debugCodeCall("isClosed"); return result == null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNString(int columnIndex, String x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateNString("+columnIndex+", "+quote(x)+");"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNString(String columnLabel, String x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateNString("+quote(columnLabel)+", "+quote(x)+");"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNClob(int columnIndex, NClob x) throws SQLException { throw unsupported("NClob"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNClob(int columnIndex, Reader x) throws SQLException { throw unsupported("NClob"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNClob(int columnIndex, Reader x, long length) throws SQLException { throw unsupported("NClob"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNClob(String columnLabel, Reader x) throws SQLException { throw unsupported("NClob"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNClob(String columnLabel, Reader x, long length) throws SQLException { throw unsupported("NClob"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNClob(String columnLabel, NClob x) throws SQLException { throw unsupported("NClob"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public NClob getNClob(int columnIndex) throws SQLException { try { int id = getNextId(TraceObject.CLOB); debugCodeAssign("NClob", TraceObject.CLOB, id, "getNClob(" + columnIndex + ")"); Value v = get(columnIndex); return v == ValueNull.INSTANCE ? null : new JdbcClob(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public NClob getNClob(String columnLabel) throws SQLException { try { int id = getNextId(TraceObject.CLOB); debugCodeAssign("NClob", TraceObject.CLOB, id, "getNClob(" + columnLabel + ")"); Value v = get(columnLabel); return v == ValueNull.INSTANCE ? null : new JdbcClob(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public SQLXML getSQLXML(int columnIndex) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public SQLXML getSQLXML(String columnLabel) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public String getNString(int columnIndex) throws SQLException { try { debugCodeCall("getNString", columnIndex); return get(columnIndex).getString(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public String getNString(String columnLabel) throws SQLException { try { debugCodeCall("getNString", columnLabel); return get(columnLabel).getString(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Reader getNCharacterStream(int columnIndex) throws SQLException { try { debugCodeCall("getNCharacterStream", columnIndex); return get(columnIndex).getReader(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Reader getNCharacterStream(String columnLabel) throws SQLException { try { debugCodeCall("getNCharacterStream", columnLabel); return get(columnLabel).getReader(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { updateNCharacterStream(columnIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateNCharacterStream("+columnIndex+", x, "+length+"L);"); } checkClosed(); Value v = conn.createClob(x, length); update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNCharacterStream(String columnLabel, Reader x) throws SQLException { updateNCharacterStream(columnLabel, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNCharacterStream(String columnLabel, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateNCharacterStream("+quote(columnLabel)+", x, "+length+"L);"); } checkClosed(); Value v = conn.createClob(x, length); update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/jdbc/JdbcArray.java
public Object getArray() throws SQLException { try { debugCodeCall("getArray"); checkClosed(); return get(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public Object getArray(Map<String, Class<?>> map) throws SQLException { try { debugCode("getArray("+quoteMap(map)+");"); checkMap(map); checkClosed(); return get(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public Object getArray(long index, int count) throws SQLException { try { debugCode("getArray(" + index + ", " + count + ");"); checkClosed(); return get(index, count); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public Object getArray(long index, int count, Map<String, Class<?>> map) throws SQLException { try { debugCode("getArray(" + index + ", " + count + ", " + quoteMap(map)+");"); checkClosed(); checkMap(map); return get(index, count); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public int getBaseType() throws SQLException { try { debugCodeCall("getBaseType"); checkClosed(); return Types.NULL; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public String getBaseTypeName() throws SQLException { try { debugCodeCall("getBaseTypeName"); checkClosed(); return "NULL"; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public ResultSet getResultSet() throws SQLException { try { debugCodeCall("getResultSet"); checkClosed(); return getResultSet(get(), 0); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public ResultSet getResultSet(Map<String, Class<?>> map) throws SQLException { try { debugCode("getResultSet("+quoteMap(map)+");"); checkClosed(); checkMap(map); return getResultSet(get(), 0); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public ResultSet getResultSet(long index, int count) throws SQLException { try { debugCode("getResultSet("+index+", " + count+");"); checkClosed(); return getResultSet(get(index, count), index); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public ResultSet getResultSet(long index, int count, Map<String, Class<?>> map) throws SQLException { try { debugCode("getResultSet("+index+", " + count+", " + quoteMap(map)+");"); checkClosed(); checkMap(map); return getResultSet(get(index, count), index); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public int getParameterCount() throws SQLException { try { debugCodeCall("getParameterCount"); checkClosed(); return paramCount; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public int getParameterMode(int param) throws SQLException { try { debugCodeCall("getParameterMode", param); getParameter(param); return parameterModeIn; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public int getParameterType(int param) throws SQLException { try { debugCodeCall("getParameterType", param); ParameterInterface p = getParameter(param); int type = p.getType(); if (type == Value.UNKNOWN) { type = Value.STRING; } return DataType.getDataType(type).sqlType; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public int getPrecision(int param) throws SQLException { try { debugCodeCall("getPrecision", param); ParameterInterface p = getParameter(param); return MathUtils.convertLongToInt(p.getPrecision()); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public int getScale(int param) throws SQLException { try { debugCodeCall("getScale", param); ParameterInterface p = getParameter(param); return p.getScale(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public int isNullable(int param) throws SQLException { try { debugCodeCall("isNullable", param); return getParameter(param).getNullable(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public boolean isSigned(int param) throws SQLException { try { debugCodeCall("isSigned", param); getParameter(param); return true; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public String getParameterClassName(int param) throws SQLException { try { debugCodeCall("getParameterClassName", param); ParameterInterface p = getParameter(param); int type = p.getType(); if (type == Value.UNKNOWN) { type = Value.STRING; } return DataType.getTypeClassName(type); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public String getParameterTypeName(int param) throws SQLException { try { debugCodeCall("getParameterTypeName", param); ParameterInterface p = getParameter(param); int type = p.getType(); if (type == Value.UNKNOWN) { type = Value.STRING; } return DataType.getDataType(type).name; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public int executeUpdate() throws SQLException { try { checkClosed(); if (command.isQuery()) { super.executeQuery(); return 0; } return super.executeUpdate(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { registerOutParameter(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { registerOutParameter(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { registerOutParameter(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { registerOutParameter(getIndexForName(parameterName), sqlType, typeName); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { registerOutParameter(getIndexForName(parameterName), sqlType, scale); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void registerOutParameter(String parameterName, int sqlType) throws SQLException { registerOutParameter(getIndexForName(parameterName), sqlType); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public boolean wasNull() throws SQLException { return getOpenResultSet().wasNull(); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public URL getURL(int parameterIndex) throws SQLException { throw unsupported("url"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public String getString(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getString(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public boolean getBoolean(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getBoolean(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public byte getByte(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getByte(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public short getShort(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getShort(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public int getInt(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getInt(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public long getLong(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getLong(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public float getFloat(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getFloat(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public double getDouble(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getDouble(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getBigDecimal(parameterIndex, scale); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public byte[] getBytes(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getBytes(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Date getDate(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getDate(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Time getTime(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getTime(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Timestamp getTimestamp(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getTimestamp(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Object getObject(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getObject(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getBigDecimal(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Object getObject(int parameterIndex, Map<String, Class<?>> map) throws SQLException { throw unsupported("map"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Ref getRef(int parameterIndex) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Blob getBlob(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getBlob(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Clob getClob(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getClob(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Array getArray(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getArray(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Date getDate(int parameterIndex, Calendar cal) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getDate(parameterIndex, cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Time getTime(int parameterIndex, Calendar cal) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getTime(parameterIndex, cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getTimestamp(parameterIndex, cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public URL getURL(String parameterName) throws SQLException { throw unsupported("url"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { return getTimestamp(getIndexForName(parameterName), cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Time getTime(String parameterName, Calendar cal) throws SQLException { return getTime(getIndexForName(parameterName), cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Date getDate(String parameterName, Calendar cal) throws SQLException { return getDate(getIndexForName(parameterName), cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Array getArray(String parameterName) throws SQLException { return getArray(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Clob getClob(String parameterName) throws SQLException { return getClob(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Blob getBlob(String parameterName) throws SQLException { return getBlob(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Ref getRef(String parameterName) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Object getObject(String parameterName, Map<String, Class<?>> map) throws SQLException { throw unsupported("map"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public BigDecimal getBigDecimal(String parameterName) throws SQLException { return getBigDecimal(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Object getObject(String parameterName) throws SQLException { return getObject(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Timestamp getTimestamp(String parameterName) throws SQLException { return getTimestamp(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Time getTime(String parameterName) throws SQLException { return getTime(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Date getDate(String parameterName) throws SQLException { return getDate(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public byte[] getBytes(String parameterName) throws SQLException { return getBytes(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public double getDouble(String parameterName) throws SQLException { return getDouble(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public float getFloat(String parameterName) throws SQLException { return getFloat(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public long getLong(String parameterName) throws SQLException { return getLong(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public int getInt(String parameterName) throws SQLException { return getInt(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public short getShort(String parameterName) throws SQLException { return getShort(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public byte getByte(String parameterName) throws SQLException { return getByte(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public boolean getBoolean(String parameterName) throws SQLException { return getBoolean(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public String getString(String parameterName) throws SQLException { return getString(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public RowId getRowId(int parameterIndex) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public RowId getRowId(String parameterName) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public NClob getNClob(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getNClob(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public NClob getNClob(String parameterName) throws SQLException { return getNClob(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public SQLXML getSQLXML(int parameterIndex) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public SQLXML getSQLXML(String parameterName) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public String getNString(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getNString(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public String getNString(String parameterName) throws SQLException { return getNString(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Reader getNCharacterStream(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getNCharacterStream(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Reader getNCharacterStream(String parameterName) throws SQLException { return getNCharacterStream(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Reader getCharacterStream(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getCharacterStream(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Reader getCharacterStream(String parameterName) throws SQLException { return getCharacterStream(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { setNull(getIndexForName(parameterName), sqlType, typeName); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNull(String parameterName, int sqlType) throws SQLException { setNull(getIndexForName(parameterName), sqlType); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { setTimestamp(getIndexForName(parameterName), x, cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { setTime(getIndexForName(parameterName), x, cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { setDate(getIndexForName(parameterName), x, cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setCharacterStream(String parameterName, Reader x, int length) throws SQLException { setCharacterStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setObject(String parameterName, Object x) throws SQLException { setObject(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { setObject(getIndexForName(parameterName), x, targetSqlType); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { setObject(getIndexForName(parameterName), x, targetSqlType, scale); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { setBinaryStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { setAsciiStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setTimestamp(String parameterName, Timestamp x) throws SQLException { setTimestamp(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setTime(String parameterName, Time x) throws SQLException { setTime(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setDate(String parameterName, Date x) throws SQLException { setDate(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBytes(String parameterName, byte[] x) throws SQLException { setBytes(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setString(String parameterName, String x) throws SQLException { setString(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { setBigDecimal(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setDouble(String parameterName, double x) throws SQLException { setDouble(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setFloat(String parameterName, float x) throws SQLException { setFloat(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setLong(String parameterName, long x) throws SQLException { setLong(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setInt(String parameterName, int x) throws SQLException { setInt(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setShort(String parameterName, short x) throws SQLException { setShort(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setByte(String parameterName, byte x) throws SQLException { setByte(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBoolean(String parameterName, boolean x) throws SQLException { setBoolean(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setURL(String parameterName, URL val) throws SQLException { throw unsupported("url"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setRowId(String parameterName, RowId x) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNString(String parameterName, String x) throws SQLException { setNString(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNCharacterStream(String parameterName, Reader x, long length) throws SQLException { setNCharacterStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNClob(String parameterName, NClob x) throws SQLException { setNClob(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setClob(String parameterName, Reader x, long length) throws SQLException { setClob(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBlob(String parameterName, InputStream x, long length) throws SQLException { setBlob(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNClob(String parameterName, Reader x, long length) throws SQLException { setNClob(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBlob(String parameterName, Blob x) throws SQLException { setBlob(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setClob(String parameterName, Clob x) throws SQLException { setClob(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setAsciiStream(String parameterName, InputStream x) throws SQLException { setAsciiStream(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { setAsciiStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBinaryStream(String parameterName, InputStream x) throws SQLException { setBinaryStream(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { setBinaryStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBlob(String parameterName, InputStream x) throws SQLException { setBlob(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setCharacterStream(String parameterName, Reader x) throws SQLException { setCharacterStream(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setCharacterStream(String parameterName, Reader x, long length) throws SQLException { setCharacterStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setClob(String parameterName, Reader x) throws SQLException { setClob(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNCharacterStream(String parameterName, Reader x) throws SQLException { setNCharacterStream(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNClob(String parameterName, Reader x) throws SQLException { setNClob(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setSQLXML(String parameterName, SQLXML x) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
private ResultSetMetaData getCheckedMetaData() throws SQLException { ResultSetMetaData meta = getMetaData(); if (meta == null) { throw DbException.getUnsupportedException("Supported only for calling stored procedures"); } return meta; }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
private void registerOutParameter(int parameterIndex) throws SQLException { try { checkClosed(); if (outParameters == null) { maxOutParameters = Math.min( getParameterMetaData().getParameterCount(), getCheckedMetaData().getColumnCount()); outParameters = new BitField(); } checkIndexBounds(parameterIndex); ParameterInterface param = command.getParameters().get(--parameterIndex); if (param.getParamValue() == null) { param.setValue(ValueNull.INSTANCE, false); } outParameters.set(parameterIndex); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
private void checkRegistered(int parameterIndex) throws SQLException { try { checkIndexBounds(parameterIndex); if (!outParameters.get(parameterIndex - 1)) { throw DbException.getInvalidValueException("parameterIndex", parameterIndex); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
private int getIndexForName(String parameterName) throws SQLException { try { checkClosed(); if (namedParameters == null) { ResultSetMetaData meta = getCheckedMetaData(); int columnCount = meta.getColumnCount(); HashMap<String, Integer> map = New.hashMap(columnCount); for (int i = 1; i <= columnCount; i++) { map.put(meta.getColumnLabel(i), i); } namedParameters = map; } Integer index = namedParameters.get(parameterName); if (index == null) { throw DbException.getInvalidValueException("parameterName", parameterName); } return index; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
private JdbcResultSet getOpenResultSet() throws SQLException { try { checkClosed(); if (resultSet == null) { throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } if (resultSet.isBeforeFirst()) { resultSet.next(); } return resultSet; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public long length() throws SQLException { try { debugCodeCall("length"); checkClosed(); if (value.getType() == Value.BLOB) { long precision = value.getPrecision(); if (precision > 0) { return precision; } } return IOUtils.copyAndCloseInput(value.getInputStream(), null); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public void truncate(long len) throws SQLException { throw unsupported("LOB update"); }
// in src/main/org/h2/jdbc/JdbcBlob.java
public byte[] getBytes(long pos, int length) throws SQLException { try { if (isDebugEnabled()) { debugCode("getBytes("+pos+", "+length+");"); } checkClosed(); ByteArrayOutputStream out = new ByteArrayOutputStream(); InputStream in = value.getInputStream(); try { IOUtils.skipFully(in, pos - 1); IOUtils.copy(in, out, length); } finally { in.close(); } return out.toByteArray(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public int setBytes(long pos, byte[] bytes) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBytes("+pos+", "+quoteBytes(bytes)+");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } value = conn.createBlob(new ByteArrayInputStream(bytes), -1); return bytes.length; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException { throw unsupported("LOB update"); }
// in src/main/org/h2/jdbc/JdbcBlob.java
public InputStream getBinaryStream() throws SQLException { try { debugCodeCall("getBinaryStream"); checkClosed(); return value.getInputStream(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public OutputStream setBinaryStream(long pos) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBinaryStream("+pos+");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } if (value.getPrecision() != 0) { throw DbException.getInvalidValueException("length", value.getPrecision()); } final JdbcConnection c = conn; final PipedInputStream in = new PipedInputStream(); final Task task = new Task() { public void call() { value = c.createBlob(in, -1); } }; PipedOutputStream out = new PipedOutputStream(in) { public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } } }; task.execute(); return new BufferedOutputStream(out); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public long position(byte[] pattern, long start) throws SQLException { if (isDebugEnabled()) { debugCode("position("+quoteBytes(pattern)+", "+start+");"); } if (Constants.BLOB_SEARCH) { try { checkClosed(); if (pattern == null) { return -1; } if (pattern.length == 0) { return 1; } // TODO performance: blob pattern search is slow BufferedInputStream in = new BufferedInputStream(value.getInputStream()); IOUtils.skipFully(in, start - 1); int pos = 0; int patternPos = 0; while (true) { int x = in.read(); if (x < 0) { break; } if (x == (pattern[patternPos] & 0xff)) { if (patternPos == 0) { in.mark(pattern.length); } if (patternPos == pattern.length) { return pos - patternPos; } patternPos++; } else { if (patternPos > 0) { in.reset(); pos -= patternPos; } } pos++; } return -1; } catch (Exception e) { throw logAndConvert(e); } } throw unsupported("LOB search"); }
// in src/main/org/h2/jdbc/JdbcBlob.java
public long position(Blob blobPattern, long start) throws SQLException { if (isDebugEnabled()) { debugCode("position(blobPattern, "+start+");"); } if (Constants.BLOB_SEARCH) { try { checkClosed(); if (blobPattern == null) { return -1; } ByteArrayOutputStream out = new ByteArrayOutputStream(); InputStream in = blobPattern.getBinaryStream(); while (true) { int x = in.read(); if (x < 0) { break; } out.write(x); } return position(out.toByteArray(), start); } catch (Exception e) { throw logAndConvert(e); } } throw unsupported("LOB subset"); }
// in src/main/org/h2/jdbc/JdbcBlob.java
public InputStream getBinaryStream(long pos, long length) throws SQLException { throw unsupported("LOB update"); }
// in src/main/org/h2/jdbc/JdbcStatement.java
public ResultSet executeQuery(String sql) throws SQLException { try { int id = getNextId(TraceObject.RESULT_SET); if (isDebugEnabled()) { debugCodeAssign("ResultSet", TraceObject.RESULT_SET, id, "executeQuery(" + quote(sql) + ")"); } synchronized (session) { checkClosed(); closeOldResultSet(); sql = JdbcConnection.translateSQL(sql, escapeProcessing); CommandInterface command = conn.prepareCommand(sql, fetchSize); ResultInterface result; boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY; boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE; setExecutingStatement(command); try { result = command.executeQuery(maxRows, scrollable); } finally { setExecutingStatement(null); } command.close(); resultSet = new JdbcResultSet(conn, this, result, id, closedByResultSet, scrollable, updatable); } return resultSet; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int executeUpdate(String sql) throws SQLException { try { debugCodeCall("executeUpdate", sql); return executeUpdateInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
private int executeUpdateInternal(String sql) throws SQLException { checkClosedForWrite(); try { closeOldResultSet(); sql = JdbcConnection.translateSQL(sql, escapeProcessing); CommandInterface command = conn.prepareCommand(sql, fetchSize); synchronized (session) { setExecutingStatement(command); try { updateCount = command.executeUpdate(); } finally { setExecutingStatement(null); } } command.close(); return updateCount; } finally { afterWriting(); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean execute(String sql) throws SQLException { try { debugCodeCall("execute", sql); return executeInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
private boolean executeInternal(String sql) throws SQLException { int id = getNextId(TraceObject.RESULT_SET); checkClosedForWrite(); try { closeOldResultSet(); sql = JdbcConnection.translateSQL(sql, escapeProcessing); CommandInterface command = conn.prepareCommand(sql, fetchSize); boolean returnsResultSet; synchronized (session) { setExecutingStatement(command); try { if (command.isQuery()) { returnsResultSet = true; boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY; boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE; ResultInterface result = command.executeQuery(maxRows, scrollable); resultSet = new JdbcResultSet(conn, this, result, id, closedByResultSet, scrollable, updatable); } else { returnsResultSet = false; updateCount = command.executeUpdate(); } } finally { setExecutingStatement(null); } } command.close(); return returnsResultSet; } finally { afterWriting(); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public ResultSet getResultSet() throws SQLException { try { checkClosed(); if (resultSet != null) { int id = resultSet.getTraceId(); debugCodeAssign("ResultSet", TraceObject.RESULT_SET, id, "getResultSet()"); } else { debugCodeCall("getResultSet"); } return resultSet; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getUpdateCount() throws SQLException { try { debugCodeCall("getUpdateCount"); checkClosed(); return updateCount; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void close() throws SQLException { try { debugCodeCall("close"); synchronized (session) { closeOldResultSet(); if (conn != null) { conn = null; } } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public SQLWarning getWarnings() throws SQLException { try { debugCodeCall("getWarnings"); checkClosed(); return null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void clearWarnings() throws SQLException { try { debugCodeCall("clearWarnings"); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setCursorName(String name) throws SQLException { try { debugCodeCall("setCursorName", name); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setFetchDirection(int direction) throws SQLException { try { debugCodeCall("setFetchDirection", direction); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getFetchDirection() throws SQLException { try { debugCodeCall("getFetchDirection"); checkClosed(); return ResultSet.FETCH_FORWARD; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getMaxRows() throws SQLException { try { debugCodeCall("getMaxRows"); checkClosed(); return maxRows; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setMaxRows(int maxRows) throws SQLException { try { debugCodeCall("setMaxRows", maxRows); checkClosed(); if (maxRows < 0) { throw DbException.getInvalidValueException("maxRows", maxRows); } this.maxRows = maxRows; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setFetchSize(int rows) throws SQLException { try { debugCodeCall("setFetchSize", rows); checkClosed(); if (rows < 0 || (rows > 0 && maxRows > 0 && rows > maxRows)) { throw DbException.getInvalidValueException("rows", rows); } if (rows == 0) { rows = SysProperties.SERVER_RESULT_SET_FETCH_SIZE; } fetchSize = rows; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getFetchSize() throws SQLException { try { debugCodeCall("getFetchSize"); checkClosed(); return fetchSize; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getResultSetConcurrency() throws SQLException { try { debugCodeCall("getResultSetConcurrency"); checkClosed(); return resultSetConcurrency; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getResultSetType() throws SQLException { try { debugCodeCall("getResultSetType"); checkClosed(); return resultSetType; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getMaxFieldSize() throws SQLException { try { debugCodeCall("getMaxFieldSize"); checkClosed(); return 0; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setMaxFieldSize(int max) throws SQLException { try { debugCodeCall("setMaxFieldSize", max); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setEscapeProcessing(boolean enable) throws SQLException { try { if (isDebugEnabled()) { debugCode("setEscapeProcessing("+enable+");"); } checkClosed(); escapeProcessing = enable; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void cancel() throws SQLException { try { debugCodeCall("cancel"); checkClosed(); // executingCommand can be reset by another thread CommandInterface c = executingCommand; try { if (c != null) { c.cancel(); } } finally { setExecutingStatement(null); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getQueryTimeout() throws SQLException { try { debugCodeCall("getQueryTimeout"); checkClosed(); return conn.getQueryTimeout(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setQueryTimeout(int seconds) throws SQLException { try { debugCodeCall("setQueryTimeout", seconds); checkClosed(); if (seconds < 0) { throw DbException.getInvalidValueException("seconds", seconds); } conn.setQueryTimeout(seconds); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void addBatch(String sql) throws SQLException { try { debugCodeCall("addBatch", sql); checkClosed(); sql = JdbcConnection.translateSQL(sql, escapeProcessing); if (batchCommands == null) { batchCommands = New.arrayList(); } batchCommands.add(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void clearBatch() throws SQLException { try { debugCodeCall("clearBatch"); checkClosed(); batchCommands = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int[] executeBatch() throws SQLException { try { debugCodeCall("executeBatch"); checkClosedForWrite(); try { if (batchCommands == null) { // TODO batch: check what other database do if no commands are set batchCommands = New.arrayList(); } int size = batchCommands.size(); int[] result = new int[size]; boolean error = false; SQLException next = null; for (int i = 0; i < size; i++) { String sql = batchCommands.get(i); try { result[i] = executeUpdateInternal(sql); } catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; } } batchCommands = null; if (error) { throw new JdbcBatchUpdateException(next, result); } return result; } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public ResultSet getGeneratedKeys() throws SQLException { try { int id = getNextId(TraceObject.RESULT_SET); if (isDebugEnabled()) { debugCodeAssign("ResultSet", TraceObject.RESULT_SET, id, "getGeneratedKeys()"); } checkClosed(); return conn.getGeneratedKeys(this, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean getMoreResults() throws SQLException { try { debugCodeCall("getMoreResults"); checkClosed(); closeOldResultSet(); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean getMoreResults(int current) throws SQLException { try { debugCodeCall("getMoreResults", current); switch (current) { case Statement.CLOSE_CURRENT_RESULT: case Statement.CLOSE_ALL_RESULTS: checkClosed(); closeOldResultSet(); break; case Statement.KEEP_CURRENT_RESULT: // nothing to do break; default: throw DbException.getInvalidValueException("current", current); } return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { try { if (isDebugEnabled()) { debugCode("executeUpdate("+quote(sql)+", "+autoGeneratedKeys+");"); } return executeUpdateInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { try { if (isDebugEnabled()) { debugCode("executeUpdate("+quote(sql)+", "+quoteIntArray(columnIndexes)+");"); } return executeUpdateInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int executeUpdate(String sql, String[] columnNames) throws SQLException { try { if (isDebugEnabled()) { debugCode("executeUpdate("+quote(sql)+", "+quoteArray(columnNames)+");"); } return executeUpdateInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { try { if (isDebugEnabled()) { debugCode("execute("+quote(sql)+", "+autoGeneratedKeys+");"); } return executeInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean execute(String sql, int[] columnIndexes) throws SQLException { try { if (isDebugEnabled()) { debugCode("execute("+quote(sql)+", "+quoteIntArray(columnIndexes)+");"); } return executeInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean execute(String sql, String[] columnNames) throws SQLException { try { if (isDebugEnabled()) { debugCode("execute("+quote(sql)+", "+quoteArray(columnNames)+");"); } return executeInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getResultSetHoldability() throws SQLException { try { debugCodeCall("getResultSetHoldability"); checkClosed(); return ResultSet.HOLD_CURSORS_OVER_COMMIT; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
protected void closeOldResultSet() throws SQLException { try { if (!closedByResultSet) { if (resultSet != null) { resultSet.closeInternal(); } } } finally { resultSet = null; updateCount = -1; } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean isClosed() throws SQLException { try { debugCodeCall("isClosed"); return conn == null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/bnf/Bnf.java
public static Bnf getInstance(Reader csv) throws SQLException, IOException { Bnf bnf = new Bnf(); if (csv == null) { byte[] data = Utils.getResource("/org/h2/res/help.csv"); csv = new InputStreamReader(new ByteArrayInputStream(data)); } bnf.parse(csv); return bnf; }
// in src/main/org/h2/bnf/Bnf.java
private void parse(Reader reader) throws SQLException, IOException { Rule functions = null; statements = New.arrayList(); Csv csv = new Csv(); csv.setLineCommentCharacter('#'); ResultSet rs = csv.read(reader, null); while (rs.next()) { String section = rs.getString("SECTION").trim(); if (section.startsWith("System")) { continue; } String topic = rs.getString("TOPIC"); syntax = rs.getString("SYNTAX").trim(); currentTopic = section; tokens = tokenize(); index = 0; Rule rule = parseRule(); if (section.startsWith("Command")) { rule = new RuleList(rule, new RuleElement(";\n\n", currentTopic), false); } RuleHead head = addRule(topic, section, rule); if (section.startsWith("Function")) { if (functions == null) { functions = rule; } else { functions = new RuleList(rule, functions, true); } } else if (section.startsWith("Commands")) { statements.add(head); } } addRule("@func@", "Function", functions); addFixedRule("@ymd@", RuleFixed.YMD); addFixedRule("@hms@", RuleFixed.HMS); addFixedRule("@nanos@", RuleFixed.NANOS); addFixedRule("anything_except_single_quote", RuleFixed.ANY_EXCEPT_SINGLE_QUOTE); addFixedRule("anything_except_double_quote", RuleFixed.ANY_EXCEPT_DOUBLE_QUOTE); addFixedRule("anything_until_end_of_line", RuleFixed.ANY_UNTIL_EOL); addFixedRule("anything_until_end_comment", RuleFixed.ANY_UNTIL_END); addFixedRule("anything_except_two_dollar_signs", RuleFixed.ANY_EXCEPT_2_DOLLAR); addFixedRule("anything", RuleFixed.ANY_WORD); addFixedRule("@hex_start@", RuleFixed.HEX_START); addFixedRule("@concat@", RuleFixed.CONCAT); addFixedRule("@az_@", RuleFixed.AZ_UNDERSCORE); addFixedRule("@af@", RuleFixed.AF); addFixedRule("@digit@", RuleFixed.DIGIT); addFixedRule("@open_bracket@", RuleFixed.OPEN_BRACKET); addFixedRule("@close_bracket@", RuleFixed.CLOSE_BRACKET); }
// in src/main/org/h2/util/JdbcUtils.java
public static Connection getConnection(String driver, String url, String user, String password) throws SQLException { Properties prop = new Properties(); if (user != null) { prop.setProperty("user", user); } if (password != null) { prop.setProperty("password", password); } return getConnection(driver, url, prop); }
// in src/main/org/h2/util/JdbcUtils.java
public static Connection getConnection(String driver, String url, Properties prop) throws SQLException { if (StringUtils.isNullOrEmpty(driver)) { JdbcUtils.load(url); } else { Class<?> d = Utils.loadUserClass(driver); if (java.sql.Driver.class.isAssignableFrom(d)) { return DriverManager.getConnection(url, prop); } else if (javax.naming.Context.class.isAssignableFrom(d)) { // JNDI context try { Context context = (Context) d.newInstance(); DataSource ds = (DataSource) context.lookup(url); String user = prop.getProperty("user"); String password = prop.getProperty("password"); if (StringUtils.isNullOrEmpty(user) && StringUtils.isNullOrEmpty(password)) { return ds.getConnection(); } return ds.getConnection(user, password); } catch (Exception e) { throw DbException.toSQLException(e); } } else { // don't know, but maybe it loaded a JDBC Driver return DriverManager.getConnection(url, prop); } } return DriverManager.getConnection(url, prop); }
// in src/main/org/h2/util/Tool.java
protected SQLException showUsageAndThrowUnsupportedOption(String option) throws SQLException { showUsage(); throw throwUnsupportedOption(option); }
// in src/main/org/h2/util/Tool.java
protected SQLException throwUnsupportedOption(String option) throws SQLException { throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, option).getSQLException(); }
// in src/main/org/h2/server/TcpServer.java
private void initManagementDb() throws SQLException { Properties prop = new Properties(); prop.setProperty("user", ""); prop.setProperty("password", managementPassword); // avoid using the driver manager Connection conn = Driver.load().connect("jdbc:h2:" + getManagementDbName(port), prop); managementDb = conn; Statement stat = null; try { stat = conn.createStatement(); stat.execute("CREATE ALIAS IF NOT EXISTS STOP_SERVER FOR \"" + TcpServer.class.getName() + ".stopServer\""); stat.execute("CREATE TABLE IF NOT EXISTS SESSIONS(ID INT PRIMARY KEY, URL VARCHAR, USER VARCHAR, CONNECTED TIMESTAMP)"); managementDbAdd = conn.prepareStatement("INSERT INTO SESSIONS VALUES(?, ?, ?, NOW())"); managementDbRemove = conn.prepareStatement("DELETE FROM SESSIONS WHERE ID=?"); } finally { JdbcUtils.closeSilently(stat); } SERVERS.put(port, this); }
// in src/main/org/h2/server/TcpServer.java
public synchronized void start() throws SQLException { stop = false; try { serverSocket = NetUtils.createServerSocket(port, ssl); } catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, ssl); } else { throw e; } } port = serverSocket.getLocalPort(); initManagementDb(); }
// in src/main/org/h2/server/TcpServer.java
public static synchronized void shutdown(String url, String password, boolean force, boolean all) throws SQLException { try { int port = Constants.DEFAULT_TCP_PORT; int idx = url.lastIndexOf(':'); if (idx >= 0) { String p = url.substring(idx + 1); if (StringUtils.isNumber(p)) { port = Integer.decode(p); } } String db = getManagementDbName(port); try { org.h2.Driver.load(); } catch (Throwable e) { throw DbException.convert(e); } for (int i = 0; i < 2; i++) { Connection conn = null; PreparedStatement prep = null; try { conn = DriverManager.getConnection("jdbc:h2:" + url + "/" + db, "", password); prep = conn.prepareStatement("CALL STOP_SERVER(?, ?, ?)"); prep.setInt(1, all ? 0 : port); prep.setString(2, password); prep.setInt(3, force ? SHUTDOWN_FORCE : SHUTDOWN_NORMAL); try { prep.execute(); } catch (SQLException e) { if (force) { // ignore } else { if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } } } break; } catch (SQLException e) { if (i == 1) { throw e; } } finally { JdbcUtils.closeSilently(prep); JdbcUtils.closeSilently(conn); } } } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/server/pg/PgServer.java
public static String getIndexColumn(Connection conn, int indexId, Integer ordinalPosition, Boolean pretty) throws SQLException { if (ordinalPosition == null || ordinalPosition.intValue() == 0) { PreparedStatement prep = conn.prepareStatement("select sql from information_schema.indexes where id=?"); prep.setInt(1, indexId); ResultSet rs = prep.executeQuery(); if (rs.next()) { return rs.getString(1); } return ""; } PreparedStatement prep = conn.prepareStatement( "select column_name from information_schema.indexes where id=? and ordinal_position=?"); prep.setInt(1, indexId); prep.setInt(2, ordinalPosition.intValue()); ResultSet rs = prep.executeQuery(); if (rs.next()) { return rs.getString(1); } return ""; }
// in src/main/org/h2/server/pg/PgServer.java
public static String getCurrentSchema(Connection conn) throws SQLException { ResultSet rs = conn.createStatement().executeQuery("call schema()"); rs.next(); return rs.getString(1); }
// in src/main/org/h2/server/pg/PgServer.java
public static int getOid(Connection conn, String tableName) throws SQLException { if (tableName.startsWith("\"") && tableName.endsWith("\"")) { tableName = tableName.substring(1, tableName.length() - 1); } PreparedStatement prep = conn.prepareStatement("select oid from pg_class where relName = ?"); prep.setString(1, tableName); ResultSet rs = prep.executeQuery(); if (!rs.next()) { return 0; } return rs.getInt(1); }
// in src/main/org/h2/server/pg/PgServer.java
public static String getUserById(Connection conn, int id) throws SQLException { PreparedStatement prep = conn.prepareStatement("SELECT NAME FROM INFORMATION_SCHEMA.USERS WHERE ID=?"); prep.setInt(1, id); ResultSet rs = prep.executeQuery(); if (rs.next()) { return rs.getString(1); } return null; }
// in src/main/org/h2/server/pg/PgServerThread.java
private void setParameter(PreparedStatement prep, int i, byte[] d2, int[] formatCodes) throws SQLException { boolean text = (i >= formatCodes.length) || (formatCodes[i] == 0); String s; try { if (text) { s = new String(d2, getEncoding()); } else { server.trace("Binary format not supported"); s = new String(d2, getEncoding()); } } catch (Exception e) { server.traceError(e); s = null; } // if(server.getLog()) { // server.log(" " + i + ": " + s); // } prep.setString(i + 1, s); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void initDb() throws SQLException { Statement stat = null; ResultSet rs = null; try { synchronized (server) { // better would be: set the database to exclusive mode rs = conn.getMetaData().getTables(null, "PG_CATALOG", "PG_VERSION", null); boolean tableFound = rs.next(); stat = conn.createStatement(); if (!tableFound) { installPgCatalog(stat); } rs = stat.executeQuery("SELECT * FROM PG_CATALOG.PG_VERSION"); if (!rs.next() || rs.getInt(1) < 2) { // installation incomplete, or old version installPgCatalog(stat); } else { // version 2 or newer: check the read version int versionRead = rs.getInt(2); if (versionRead > 2) { throw DbException.throwInternalError("Incompatible PG_VERSION"); } } } stat.execute("set search_path = PUBLIC, pg_catalog"); HashSet<Integer> typeSet = server.getTypeSet(); if (typeSet.size() == 0) { rs = stat.executeQuery("SELECT OID FROM PG_CATALOG.PG_TYPE"); while (rs.next()) { typeSet.add(rs.getInt(1)); } } } finally { JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(rs); } }
// in src/main/org/h2/server/pg/PgServerThread.java
private static void installPgCatalog(Statement stat) throws SQLException { Reader r = null; try { r = new InputStreamReader(new ByteArrayInputStream(Utils .getResource("/org/h2/server/pg/pg_catalog.sql"))); ScriptReader reader = new ScriptReader(r); while (true) { String sql = reader.readStatement(); if (sql == null) { break; } stat.execute(sql); } reader.close(); } catch (IOException e) { throw DbException.convertIOException(e, "Can not read pg_catalog resource"); } finally { IOUtils.closeSilently(r); } }
// in src/main/org/h2/server/web/DbSchema.java
void readTables(DatabaseMetaData meta, String[] tableTypes) throws SQLException { ResultSet rs = meta.getTables(null, name, null, tableTypes); ArrayList<DbTableOrView> list = New.arrayList(); while (rs.next()) { DbTableOrView table = new DbTableOrView(this, rs); if (contents.isOracle && table.name.indexOf('$') > 0) { continue; } list.add(table); } rs.close(); tables = new DbTableOrView[list.size()]; list.toArray(tables); if (tables.length < MAX_TABLES_LIST_COLUMNS) { for (DbTableOrView tab : tables) { tab.readColumns(meta); } } }
// in src/main/org/h2/server/web/DbContents.java
synchronized void readContents(DatabaseMetaData meta) throws SQLException { String prod = StringUtils.toLowerEnglish(meta.getDatabaseProductName()); isSQLite = prod.indexOf("sqlite") >= 0; String url = meta.getURL(); if (url != null) { isH2 = url.startsWith("jdbc:h2:"); if (isH2) { Statement stat = meta.getConnection().createStatement(); ResultSet rs = stat.executeQuery( "SELECT UPPER(VALUE) FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME='MODE'"); rs.next(); if ("MYSQL".equals(rs.getString(1))) { isH2ModeMySQL = true; } rs.close(); stat.close(); } isOracle = url.startsWith("jdbc:oracle:"); isPostgreSQL = url.startsWith("jdbc:postgresql:"); // isHSQLDB = url.startsWith("jdbc:hsqldb:"); isMySQL = url.startsWith("jdbc:mysql:"); isDerby = url.startsWith("jdbc:derby:"); isFirebird = url.startsWith("jdbc:firebirdsql:"); isMSSQLServer = url.startsWith("jdbc:sqlserver:"); } storedUpperCaseIdentifiers = meta.storesUpperCaseIdentifiers(); String defaultSchemaName = getDefaultSchemaName(meta); String[] schemaNames = getSchemaNames(meta); schemas = new DbSchema[schemaNames.length]; for (int i = 0; i < schemaNames.length; i++) { String schemaName = schemaNames[i]; boolean isDefault = defaultSchemaName == null || defaultSchemaName.equals(schemaName); DbSchema schema = new DbSchema(this, schemaName, isDefault); if (schema.isDefault) { defaultSchema = schema; } schemas[i] = schema; String[] tableTypes = { "TABLE", "SYSTEM TABLE", "VIEW", "SYSTEM VIEW", "TABLE LINK", "SYNONYM" }; schema.readTables(meta, tableTypes); } if (defaultSchema == null) { String best = null; for (DbSchema schema : schemas) { if ("dbo".equals(schema.name)) { // MS SQL Server defaultSchema = schema; break; } if (defaultSchema == null || best == null || schema.name.length() < best.length()) { best = schema.name; defaultSchema = schema; } } } }
// in src/main/org/h2/server/web/DbContents.java
private String[] getSchemaNames(DatabaseMetaData meta) throws SQLException { if (isMySQL || isSQLite) { return new String[] { "" }; } else if (isFirebird) { return new String[] { null }; } ResultSet rs = meta.getSchemas(); ArrayList<String> schemaList = New.arrayList(); while (rs.next()) { String schema = rs.getString(findColumn(rs, "TABLE_SCHEM", 1)); if (isOracle) { for (String ignore : new String[] { "CTXSYS", "DIP", "DBSNMP", "DMSYS", "EXFSYS", "FLOWS_020100", "FLOWS_FILES", "MDDATA", "MDSYS", "MGMT_VIEW", "OLAPSYS", "ORDSYS", "ORDPLUGINS", "OUTLN", "SI_INFORMTN_SCHEMA", "SYS", "SYSMAN", "SYSTEM", "TSMSYS", "WMSYS", "XDB" }) { if (ignore.equals(schema)) { schema = null; break; } } } else if (isMSSQLServer) { for (String ignore : new String[] { "sys", "db_accessadmin", "db_backupoperator", "db_datareader", "db_datawriter", "db_ddladmin", "db_denydatareader", "db_denydatawriter", "db_owner", "db_securityadmin" }) { if (ignore.equals(schema)) { schema = null; break; } } } if (schema == null) { continue; } schemaList.add(schema); } rs.close(); String[] list = new String[schemaList.size()]; schemaList.toArray(list); return list; }
// in src/main/org/h2/server/web/WebApp.java
private static int addIndexes(boolean mainSchema, DatabaseMetaData meta, String table, String schema, StringBuilder buff, int treeIndex) throws SQLException { ResultSet rs; try { rs = meta.getIndexInfo(null, schema, table, false, true); } catch (SQLException e) { // SQLite return treeIndex; } HashMap<String, IndexInfo> indexMap = New.hashMap(); while (rs.next()) { String name = rs.getString("INDEX_NAME"); IndexInfo info = indexMap.get(name); if (info == null) { int t = rs.getInt("TYPE"); String type; if (t == DatabaseMetaData.tableIndexClustered) { type = ""; } else if (t == DatabaseMetaData.tableIndexHashed) { type = " (${text.tree.hashed})"; } else if (t == DatabaseMetaData.tableIndexOther) { type = ""; } else { type = null; } if (name != null && type != null) { info = new IndexInfo(); info.name = name; type = (rs.getBoolean("NON_UNIQUE") ? "${text.tree.nonUnique}" : "${text.tree.unique}") + type; info.type = type; info.columns = rs.getString("COLUMN_NAME"); indexMap.put(name, info); } } else { info.columns += ", " + rs.getString("COLUMN_NAME"); } } rs.close(); if (indexMap.size() > 0) { String level = mainSchema ? ", 1, 1" : ", 2, 1"; String levelIndex = mainSchema ? ", 2, 1" : ", 3, 1"; String levelColumnType = mainSchema ? ", 3, 2" : ", 4, 2"; buff.append("setNode(" + treeIndex + level + ", 'index_az', '${text.tree.indexes}', null);\n"); treeIndex++; for (IndexInfo info : indexMap.values()) { buff.append("setNode(" + treeIndex + levelIndex + ", 'index', '" + PageParser.escapeJavaScript(info.name) + "', null);\n"); treeIndex++; buff.append("setNode(" + treeIndex + levelColumnType + ", 'type', '" + info.type + "', null);\n"); treeIndex++; buff.append("setNode(" + treeIndex + levelColumnType + ", 'type', '" + PageParser.escapeJavaScript(info.columns) + "', null);\n"); treeIndex++; } } return treeIndex; }
// in src/main/org/h2/server/web/WebApp.java
private int addTablesAndViews(DbSchema schema, boolean mainSchema, StringBuilder buff, int treeIndex) throws SQLException { if (schema == null) { return treeIndex; } Connection conn = session.getConnection(); DatabaseMetaData meta = session.getMetaData(); int level = mainSchema ? 0 : 1; boolean showColumns = mainSchema || !schema.isSystem; String indentation = ", " + level + ", " + (showColumns ? "1" : "2") + ", "; String indentNode = ", " + (level + 1) + ", 2, "; DbTableOrView[] tables = schema.tables; if (tables == null) { return treeIndex; } boolean isOracle = schema.contents.isOracle; boolean notManyTables = tables.length < DbSchema.MAX_TABLES_LIST_INDEXES; for (DbTableOrView table : tables) { if (table.isView) { continue; } int tableId = treeIndex; String tab = table.quotedName; if (!mainSchema) { tab = schema.quotedName + "." + tab; } tab = escapeIdentifier(tab); buff.append("setNode(" + treeIndex + indentation + " 'table', '" + PageParser.escapeJavaScript(table.name) + "', 'javascript:ins(\\'" + tab + "\\',true)');\n"); treeIndex++; if (mainSchema || showColumns) { StringBuilder columnsBuffer = new StringBuilder(); treeIndex = addColumns(mainSchema, table, buff, treeIndex, notManyTables, columnsBuffer); if (!isOracle && notManyTables) { treeIndex = addIndexes(mainSchema, meta, table.name, schema.name, buff, treeIndex); } buff.append("addTable('" + PageParser.escapeJavaScript(table.name) + "', '" + PageParser.escapeJavaScript(columnsBuffer.toString()) + "', " + tableId + ");\n"); } } tables = schema.tables; for (DbTableOrView view : tables) { if (!view.isView) { continue; } int tableId = treeIndex; String tab = view.quotedName; if (!mainSchema) { tab = view.schema.quotedName + "." + tab; } tab = escapeIdentifier(tab); buff.append("setNode(" + treeIndex + indentation + " 'view', '" + PageParser.escapeJavaScript(view.name) + "', 'javascript:ins(\\'" + tab + "\\',true)');\n"); treeIndex++; if (mainSchema) { StringBuilder columnsBuffer = new StringBuilder(); treeIndex = addColumns(mainSchema, view, buff, treeIndex, notManyTables, columnsBuffer); if (schema.contents.isH2) { PreparedStatement prep = null; try { prep = conn.prepareStatement("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME=?"); prep.setString(1, view.name); ResultSet rs = prep.executeQuery(); if (rs.next()) { String sql = rs.getString("SQL"); buff.append("setNode(" + treeIndex + indentNode + " 'type', '" + PageParser.escapeJavaScript(sql) + "', null);\n"); treeIndex++; } rs.close(); } finally { JdbcUtils.closeSilently(prep); } } buff.append("addTable('" + PageParser.escapeJavaScript(view.name) + "', '" + PageParser.escapeJavaScript(columnsBuffer.toString()) + "', " + tableId + ");\n"); } } return treeIndex; }
// in src/main/org/h2/server/web/WebApp.java
private ResultSet getMetaResultSet(Connection conn, String sql) throws SQLException { DatabaseMetaData meta = conn.getMetaData(); if (isBuiltIn(sql, "@best_row_identifier")) { String[] p = split(sql); int scale = p[4] == null ? 0 : Integer.parseInt(p[4]); boolean nullable = p[5] == null ? false : Boolean.valueOf(p[5]).booleanValue(); return meta.getBestRowIdentifier(p[1], p[2], p[3], scale, nullable); } else if (isBuiltIn(sql, "@catalogs")) { return meta.getCatalogs(); } else if (isBuiltIn(sql, "@columns")) { String[] p = split(sql); return meta.getColumns(p[1], p[2], p[3], p[4]); } else if (isBuiltIn(sql, "@column_privileges")) { String[] p = split(sql); return meta.getColumnPrivileges(p[1], p[2], p[3], p[4]); } else if (isBuiltIn(sql, "@cross_references")) { String[] p = split(sql); return meta.getCrossReference(p[1], p[2], p[3], p[4], p[5], p[6]); } else if (isBuiltIn(sql, "@exported_keys")) { String[] p = split(sql); return meta.getExportedKeys(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@imported_keys")) { String[] p = split(sql); return meta.getImportedKeys(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@index_info")) { String[] p = split(sql); boolean unique = p[4] == null ? false : Boolean.valueOf(p[4]).booleanValue(); boolean approx = p[5] == null ? false : Boolean.valueOf(p[5]).booleanValue(); return meta.getIndexInfo(p[1], p[2], p[3], unique, approx); } else if (isBuiltIn(sql, "@primary_keys")) { String[] p = split(sql); return meta.getPrimaryKeys(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@procedures")) { String[] p = split(sql); return meta.getProcedures(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@procedure_columns")) { String[] p = split(sql); return meta.getProcedureColumns(p[1], p[2], p[3], p[4]); } else if (isBuiltIn(sql, "@schemas")) { return meta.getSchemas(); } else if (isBuiltIn(sql, "@tables")) { String[] p = split(sql); String[] types = p[4] == null ? null : StringUtils.arraySplit(p[4], ',', false); return meta.getTables(p[1], p[2], p[3], types); } else if (isBuiltIn(sql, "@table_privileges")) { String[] p = split(sql); return meta.getTablePrivileges(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@table_types")) { return meta.getTableTypes(); } else if (isBuiltIn(sql, "@type_info")) { return meta.getTypeInfo(); } else if (isBuiltIn(sql, "@udts")) { String[] p = split(sql); int[] types; if (p[4] == null) { types = null; } else { String[] t = StringUtils.arraySplit(p[4], ',', false); types = new int[t.length]; for (int i = 0; i < t.length; i++) { types[i] = Integer.parseInt(t[i]); } } return meta.getUDTs(p[1], p[2], p[3], types); } else if (isBuiltIn(sql, "@version_columns")) { String[] p = split(sql); return meta.getVersionColumns(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@memory")) { SimpleResultSet rs = new SimpleResultSet(); rs.addColumn("Type", Types.VARCHAR, 0, 0); rs.addColumn("KB", Types.VARCHAR, 0, 0); rs.addRow("Used Memory", "" + Utils.getMemoryUsed()); rs.addRow("Free Memory", "" + Utils.getMemoryFree()); return rs; } else if (isBuiltIn(sql, "@info")) { SimpleResultSet rs = new SimpleResultSet(); rs.addColumn("KEY", Types.VARCHAR, 0, 0); rs.addColumn("VALUE", Types.VARCHAR, 0, 0); rs.addRow("conn.getCatalog", conn.getCatalog()); rs.addRow("conn.getAutoCommit", "" + conn.getAutoCommit()); rs.addRow("conn.getTransactionIsolation", "" + conn.getTransactionIsolation()); rs.addRow("conn.getWarnings", "" + conn.getWarnings()); String map; try { map = "" + conn.getTypeMap(); } catch (SQLException e) { map = e.toString(); } rs.addRow("conn.getTypeMap", "" + map); rs.addRow("conn.isReadOnly", "" + conn.isReadOnly()); rs.addRow("conn.getHoldability", "" + conn.getHoldability()); addDatabaseMetaData(rs, meta); return rs; } else if (isBuiltIn(sql, "@attributes")) { String[] p = split(sql); return meta.getAttributes(p[1], p[2], p[3], p[4]); } else if (isBuiltIn(sql, "@super_tables")) { String[] p = split(sql); return meta.getSuperTables(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@super_types")) { String[] p = split(sql); return meta.getSuperTypes(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@prof_stop")) { if (profiler != null) { profiler.stopCollecting(); SimpleResultSet rs = new SimpleResultSet(); rs.addColumn("Top Stack Trace(s)", Types.VARCHAR, 0, 0); rs.addRow(profiler.getTop(3)); profiler = null; return rs; } } return null; }
// in src/main/org/h2/server/web/WebApp.java
private String executeLoop(Connection conn, int count, String sql) throws SQLException { ArrayList<Integer> params = New.arrayList(); int idx = 0; while (!stop) { idx = sql.indexOf('?', idx); if (idx < 0) { break; } if (isBuiltIn(sql.substring(idx), "?/*rnd*/")) { params.add(1); sql = sql.substring(0, idx) + "?" + sql.substring(idx + "/*rnd*/".length() + 1); } else { params.add(0); } idx++; } boolean prepared; Random random = new Random(1); long time = System.currentTimeMillis(); if (isBuiltIn(sql, "@statement")) { sql = sql.substring("@statement".length()).trim(); prepared = false; Statement stat = conn.createStatement(); for (int i = 0; !stop && i < count; i++) { String s = sql; for (Integer type : params) { idx = s.indexOf('?'); if (type.intValue() == 1) { s = s.substring(0, idx) + random.nextInt(count) + s.substring(idx + 1); } else { s = s.substring(0, idx) + i + s.substring(idx + 1); } } if (stat.execute(s)) { ResultSet rs = stat.getResultSet(); while (!stop && rs.next()) { // maybe get the data as well } rs.close(); } } } else { prepared = true; PreparedStatement prep = conn.prepareStatement(sql); for (int i = 0; !stop && i < count; i++) { for (int j = 0; j < params.size(); j++) { Integer type = params.get(j); if (type.intValue() == 1) { prep.setInt(j + 1, random.nextInt(count)); } else { prep.setInt(j + 1, i); } } if (session.getContents().isSQLite) { // SQLite currently throws an exception on prep.execute() prep.executeUpdate(); } else { if (prep.execute()) { ResultSet rs = prep.getResultSet(); while (!stop && rs.next()) { // maybe get the data as well } rs.close(); } } } } time = System.currentTimeMillis() - time; StatementBuilder buff = new StatementBuilder(); buff.append(time).append(" ms: ").append(count).append(" * "); if (prepared) { buff.append("(Prepared) "); } else { buff.append("(Statement) "); } buff.append('('); for (int p : params) { buff.appendExceptFirst(", "); buff.append(p == 0 ? "i" : "rnd"); } return buff.append(") ").append(sql).toString(); }
// in src/main/org/h2/server/web/WebApp.java
private static String getParameterResultSet(ParameterMetaData meta) throws SQLException { StringBuilder buff = new StringBuilder(); if (meta == null) { return "No parameter meta data"; } buff.append("<table cellspacing=0 cellpadding=0>"). append("<tr><th>className</th><th>mode</th><th>type</th>"). append("<th>typeName</th><th>precision</th><th>scale</th></tr>"); for (int i = 0; i < meta.getParameterCount(); i++) { buff.append("</tr><td>"). append(meta.getParameterClassName(i + 1)). append("</td><td>"). append(meta.getParameterMode(i + 1)). append("</td><td>"). append(meta.getParameterType(i + 1)). append("</td><td>"). append(meta.getParameterTypeName(i + 1)). append("</td><td>"). append(meta.getPrecision(i + 1)). append("</td><td>"). append(meta.getScale(i + 1)). append("</td></tr>"); } buff.append("</table>"); return buff.toString(); }
// in src/main/org/h2/server/web/WebApp.java
private String getResultSet(String sql, ResultSet rs, boolean metadata, boolean list, boolean edit, long time, boolean allowEdit) throws SQLException { int maxrows = getMaxrows(); time = System.currentTimeMillis() - time; StringBuilder buff = new StringBuilder(); if (edit) { buff.append("<form id=\"editing\" name=\"editing\" method=\"post\" " + "action=\"editResult.do?jsessionid=${sessionId}\" id=\"mainForm\" target=\"h2result\">" + "<input type=\"hidden\" name=\"op\" value=\"1\" />" + "<input type=\"hidden\" name=\"row\" value=\"\" />" + "<table cellspacing=0 cellpadding=0 id=\"editTable\">"); } else { buff.append("<table cellspacing=0 cellpadding=0>"); } if (metadata) { SimpleResultSet r = new SimpleResultSet(); r.addColumn("#", Types.INTEGER, 0, 0); r.addColumn("label", Types.VARCHAR, 0, 0); r.addColumn("catalog", Types.VARCHAR, 0, 0); r.addColumn("schema", Types.VARCHAR, 0, 0); r.addColumn("table", Types.VARCHAR, 0, 0); r.addColumn("column", Types.VARCHAR, 0, 0); r.addColumn("type", Types.INTEGER, 0, 0); r.addColumn("typeName", Types.VARCHAR, 0, 0); r.addColumn("class", Types.VARCHAR, 0, 0); r.addColumn("precision", Types.INTEGER, 0, 0); r.addColumn("scale", Types.INTEGER, 0, 0); r.addColumn("displaySize", Types.INTEGER, 0, 0); r.addColumn("autoIncrement", Types.BOOLEAN, 0, 0); r.addColumn("caseSensitive", Types.BOOLEAN, 0, 0); r.addColumn("currency", Types.BOOLEAN, 0, 0); r.addColumn("nullable", Types.INTEGER, 0, 0); r.addColumn("readOnly", Types.BOOLEAN, 0, 0); r.addColumn("searchable", Types.BOOLEAN, 0, 0); r.addColumn("signed", Types.BOOLEAN, 0, 0); r.addColumn("writable", Types.BOOLEAN, 0, 0); r.addColumn("definitelyWritable", Types.BOOLEAN, 0, 0); ResultSetMetaData m = rs.getMetaData(); for (int i = 1; i <= m.getColumnCount(); i++) { r.addRow(i, m.getColumnLabel(i), m.getCatalogName(i), m.getSchemaName(i), m.getTableName(i), m.getColumnName(i), m.getColumnType(i), m.getColumnTypeName(i), m.getColumnClassName(i), m.getPrecision(i), m.getScale(i), m.getColumnDisplaySize(i), m.isAutoIncrement(i), m.isCaseSensitive(i), m.isCurrency(i), m.isNullable(i), m.isReadOnly(i), m.isSearchable(i), m.isSigned(i), m.isWritable(i), m.isDefinitelyWritable(i)); } rs = r; } ResultSetMetaData meta = rs.getMetaData(); int columns = meta.getColumnCount(); int rows = 0; if (list) { buff.append("<tr><th>Column</th><th>Data</th></tr><tr>"); while (rs.next()) { if (maxrows > 0 && rows >= maxrows) { break; } rows++; buff.append("<tr><td>Row #</td><td>"). append(rows).append("</tr>"); for (int i = 0; i < columns; i++) { buff.append("<tr><td>"). append(PageParser.escapeHtml(meta.getColumnLabel(i + 1))). append("</td><td>"). append(escapeData(rs, i + 1)). append("</td></tr>"); } } } else { buff.append("<tr>"); if (edit) { buff.append("<th>${text.resultEdit.action}</th>"); } for (int i = 0; i < columns; i++) { buff.append("<th>"). append(PageParser.escapeHtml(meta.getColumnLabel(i + 1))). append("</th>"); } buff.append("</tr>"); while (rs.next()) { if (maxrows > 0 && rows >= maxrows) { break; } rows++; buff.append("<tr>"); if (edit) { buff.append("<td>"). append("<img onclick=\"javascript:editRow("). append(rs.getRow()). append(",'${sessionId}', '${text.resultEdit.save}', '${text.resultEdit.cancel}'"). append(")\" width=16 height=16 src=\"ico_write.gif\" " + "onmouseover = \"this.className ='icon_hover'\" " + "onmouseout = \"this.className ='icon'\" " + "class=\"icon\" alt=\"${text.resultEdit.edit}\" " + "title=\"${text.resultEdit.edit}\" border=\"1\"/>"). append("<a href=\"editResult.do?op=2&row="). append(rs.getRow()). append("&jsessionid=${sessionId}\" target=\"h2result\" >" + "<img width=16 height=16 src=\"ico_remove.gif\" " + "onmouseover = \"this.className ='icon_hover'\" " + "onmouseout = \"this.className ='icon'\" " + "class=\"icon\" alt=\"${text.resultEdit.delete}\" " + "title=\"${text.resultEdit.delete}\" border=\"1\" /></a>"). append("</td>"); } for (int i = 0; i < columns; i++) { buff.append("<td>"). append(escapeData(rs, i + 1)). append("</td>"); } buff.append("</tr>"); } } boolean isUpdatable = false; try { isUpdatable = rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE && rs.getType() != ResultSet.TYPE_FORWARD_ONLY; } catch (NullPointerException e) { // ignore // workaround for a JDBC-ODBC bridge problem } if (edit) { ResultSet old = session.result; if (old != null) { old.close(); } session.result = rs; } else { rs.close(); } if (edit) { buff.append("<tr><td>"). append("<img onclick=\"javascript:editRow(-1, '${sessionId}', '${text.resultEdit.save}', '${text.resultEdit.cancel}'"). append(")\" width=16 height=16 src=\"ico_add.gif\" " + "onmouseover = \"this.className ='icon_hover'\" " + "onmouseout = \"this.className ='icon'\" " + "class=\"icon\" alt=\"${text.resultEdit.add}\" " + "title=\"${text.resultEdit.add}\" border=\"1\"/>"). append("</td>"); for (int i = 0; i < columns; i++) { buff.append("<td></td>"); } buff.append("</tr>"); } buff.append("</table>"); if (edit) { buff.append("</form>"); } if (rows == 0) { buff.append("(${text.result.noRows}"); } else if (rows == 1) { buff.append("(${text.result.1row}"); } else { buff.append('(').append(rows).append(" ${text.result.rows}"); } buff.append(", "); time = System.currentTimeMillis() - time; buff.append(time).append(" ms)"); if (!edit && isUpdatable && allowEdit) { buff.append("<br /><br />" + "<form name=\"editResult\" method=\"post\" " + "action=\"query.do?jsessionid=${sessionId}\" target=\"h2result\">" + "<input type=\"submit\" class=\"button\" value=\"${text.resultEdit.editResult}\" />" + "<input type=\"hidden\" name=\"sql\" value=\"@edit "). append(PageParser.escapeHtmlData(sql)). append("\" /></form>"); } return buff.toString(); }
// in src/main/org/h2/server/web/WebApp.java
private static String escapeData(ResultSet rs, int columnIndex) throws SQLException { String d = rs.getString(columnIndex); if (d == null) { return "<i>null</i>"; } else if (d.length() > 100000) { String s; if (isBinary(rs.getMetaData().getColumnType(columnIndex))) { s = PageParser.escapeHtml(d.substring(0, 6)) + "... (" + (d.length() / 2) + " ${text.result.bytes})"; } else { s = PageParser.escapeHtml(d.substring(0, 100)) + "... (" + d.length() + " ${text.result.characters})"; } return "<div style='display: none'>=+</div>" + s; } else if (d.equals("null") || d.startsWith("= ") || d.startsWith("=+")) { return "<div style='display: none'>= </div>" + PageParser.escapeHtml(d); } else if (d.equals("")) { // PageParser.escapeHtml replaces "" with a non-breaking space return ""; } return PageParser.escapeHtml(d); }
// in src/main/org/h2/server/web/WebApp.java
private void unescapeData(String x, ResultSet rs, int columnIndex) throws SQLException { if (x.equals("null")) { rs.updateNull(columnIndex); return; } else if (x.startsWith("=+")) { // don't update return; } else if (x.equals("=*")) { // set an appropriate default value int type = rs.getMetaData().getColumnType(columnIndex); switch (type) { case Types.TIME: rs.updateString(columnIndex, "12:00:00"); break; case Types.TIMESTAMP: case Types.DATE: rs.updateString(columnIndex, "2001-01-01"); break; default: rs.updateString(columnIndex, "1"); break; } return; } else if (x.startsWith("= ")) { x = x.substring(2); } ResultSetMetaData meta = rs.getMetaData(); int type = meta.getColumnType(columnIndex); if (session.getContents().isH2) { rs.updateString(columnIndex, x); return; } switch (type) { case Types.BIGINT: rs.updateLong(columnIndex, Long.decode(x)); break; case Types.DECIMAL: rs.updateBigDecimal(columnIndex, new BigDecimal(x)); break; case Types.DOUBLE: case Types.FLOAT: rs.updateDouble(columnIndex, Double.parseDouble(x)); break; case Types.REAL: rs.updateFloat(columnIndex, Float.parseFloat(x)); break; case Types.INTEGER: rs.updateInt(columnIndex, Integer.decode(x)); break; case Types.TINYINT: rs.updateShort(columnIndex, Short.decode(x)); break; default: rs.updateString(columnIndex, x); } }
// in src/main/org/h2/server/web/DbTableOrView.java
void readColumns(DatabaseMetaData meta) throws SQLException { ResultSet rs = meta.getColumns(null, schema.name, name, null); ArrayList<DbColumn> list = New.arrayList(); while (rs.next()) { DbColumn column = new DbColumn(schema.contents, rs); list.add(column); } rs.close(); columns = new DbColumn[list.size()]; list.toArray(columns); }
// in src/main/org/h2/server/web/WebServer.java
Connection getConnection(String driver, String databaseUrl, String user, String password) throws SQLException { driver = driver.trim(); databaseUrl = databaseUrl.trim(); org.h2.Driver.load(); Properties p = new Properties(); p.setProperty("user", user.trim()); // do not trim the password, otherwise an // encrypted H2 database with empty user password doesn't work p.setProperty("password", password); if (databaseUrl.startsWith("jdbc:h2:")) { if (ifExists) { databaseUrl += ";IFEXISTS=TRUE"; } // PostgreSQL would throw a NullPointerException // if it is loaded before the H2 driver // because it can't deal with non-String objects in the connection Properties return org.h2.Driver.load().connect(databaseUrl, p); } // try { // Driver dr = (Driver) urlClassLoader. // loadClass(driver).newInstance(); // return dr.connect(url, p); // } catch(ClassNotFoundException e2) { // throw e2; // } return JdbcUtils.getConnection(driver, databaseUrl, p); }
// in src/main/org/h2/server/web/WebServer.java
public String addSession(Connection conn) throws SQLException { WebSession session = createNewSession("local"); session.setShutdownServerOnDisconnect(); session.setConnection(conn); session.put("url", conn.getMetaData().getURL()); String s = (String) session.get("sessionId"); return url + "/frame.jsp?jsessionid=" + s; }
// in src/main/org/h2/server/web/WebSession.java
void setConnection(Connection conn) throws SQLException { this.conn = conn; if (conn == null) { meta = null; } else { meta = conn.getMetaData(); } contents = new DbContents(); }
// in src/main/org/h2/table/TableLink.java
private void readMetaData() throws SQLException { DatabaseMetaData meta = conn.getConnection().getMetaData(); storesLowerCase = meta.storesLowerCaseIdentifiers(); storesMixedCase = meta.storesMixedCaseIdentifiers(); storesMixedCaseQuoted = meta.storesMixedCaseQuotedIdentifiers(); supportsMixedCaseIdentifiers = meta.supportsMixedCaseIdentifiers(); ResultSet rs = meta.getTables(null, originalSchema, originalTable, null); if (rs.next() && rs.next()) { throw DbException.get(ErrorCode.SCHEMA_NAME_MUST_MATCH, originalTable); } rs.close(); rs = meta.getColumns(null, originalSchema, originalTable, null); int i = 0; ArrayList<Column> columnList = New.arrayList(); HashMap<String, Column> columnMap = New.hashMap(); String catalog = null, schema = null; while (rs.next()) { String thisCatalog = rs.getString("TABLE_CAT"); if (catalog == null) { catalog = thisCatalog; } String thisSchema = rs.getString("TABLE_SCHEM"); if (schema == null) { schema = thisSchema; } if (!StringUtils.equals(catalog, thisCatalog) || !StringUtils.equals(schema, thisSchema)) { // if the table exists in multiple schemas or tables, // use the alternative solution columnMap.clear(); columnList.clear(); break; } String n = rs.getString("COLUMN_NAME"); n = convertColumnName(n); int sqlType = rs.getInt("DATA_TYPE"); long precision = rs.getInt("COLUMN_SIZE"); precision = convertPrecision(sqlType, precision); int scale = rs.getInt("DECIMAL_DIGITS"); scale = convertScale(sqlType, scale); int displaySize = MathUtils.convertLongToInt(precision); int type = DataType.convertSQLTypeToValueType(sqlType); Column col = new Column(n, type, precision, scale, displaySize); col.setTable(this, i++); columnList.add(col); columnMap.put(n, col); } rs.close(); if (originalTable.indexOf('.') < 0 && !StringUtils.isNullOrEmpty(schema)) { qualifiedTableName = schema + "." + originalTable; } else { qualifiedTableName = originalTable; } // check if the table is accessible Statement stat = null; try { stat = conn.getConnection().createStatement(); rs = stat.executeQuery("SELECT * FROM " + qualifiedTableName + " T WHERE 1=0"); if (columnList.size() == 0) { // alternative solution ResultSetMetaData rsMeta = rs.getMetaData(); for (i = 0; i < rsMeta.getColumnCount();) { String n = rsMeta.getColumnName(i + 1); n = convertColumnName(n); int sqlType = rsMeta.getColumnType(i + 1); long precision = rsMeta.getPrecision(i + 1); precision = convertPrecision(sqlType, precision); int scale = rsMeta.getScale(i + 1); scale = convertScale(sqlType, scale); int displaySize = rsMeta.getColumnDisplaySize(i + 1); int type = DataType.convertSQLTypeToValueType(sqlType); Column col = new Column(n, type, precision, scale, displaySize); col.setTable(this, i++); columnList.add(col); columnMap.put(n, col); } } rs.close(); } catch (Exception e) { throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, e, originalTable + "(" + e.toString() + ")"); } finally { JdbcUtils.closeSilently(stat); } Column[] cols = new Column[columnList.size()]; columnList.toArray(cols); setColumns(cols); int id = getId(); linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols), IndexType.createNonUnique(false)); indexes.add(linkedIndex); try { rs = meta.getPrimaryKeys(null, originalSchema, originalTable); } catch (Exception e) { // Some ODBC bridge drivers don't support it: // some combinations of "DataDirect SequeLink(R) for JDBC" // http://www.datadirect.com/index.ssp rs = null; } String pkName = ""; ArrayList<Column> list; if (rs != null && rs.next()) { // the problem is, the rows are not sorted by KEY_SEQ list = New.arrayList(); do { int idx = rs.getInt("KEY_SEQ"); if (pkName == null) { pkName = rs.getString("PK_NAME"); } while (list.size() < idx) { list.add(null); } String col = rs.getString("COLUMN_NAME"); col = convertColumnName(col); Column column = columnMap.get(col); if (idx == 0) { // workaround for a bug in the SQLite JDBC driver list.add(column); } else { list.set(idx - 1, column); } } while (rs.next()); addIndex(list, IndexType.createPrimaryKey(false, false)); rs.close(); } try { rs = meta.getIndexInfo(null, originalSchema, originalTable, false, true); } catch (Exception e) { // Oracle throws an exception if the table is not found or is a // SYNONYM rs = null; } String indexName = null; list = New.arrayList(); IndexType indexType = null; if (rs != null) { while (rs.next()) { if (rs.getShort("TYPE") == DatabaseMetaData.tableIndexStatistic) { // ignore index statistics continue; } String newIndex = rs.getString("INDEX_NAME"); if (pkName.equals(newIndex)) { continue; } if (indexName != null && !indexName.equals(newIndex)) { addIndex(list, indexType); indexName = null; } if (indexName == null) { indexName = newIndex; list.clear(); } boolean unique = !rs.getBoolean("NON_UNIQUE"); indexType = unique ? IndexType.createUnique(false, false) : IndexType.createNonUnique(false); String col = rs.getString("COLUMN_NAME"); col = convertColumnName(col); Column column = columnMap.get(col); list.add(column); } rs.close(); } if (indexName != null) { addIndex(list, indexType); } }
// in src/main/org/h2/fulltext/FullTextLucene.java
public static void init(Connection conn) throws SQLException { Statement stat = conn.createStatement(); stat.execute("CREATE SCHEMA IF NOT EXISTS " + SCHEMA); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".INDEXES(SCHEMA VARCHAR, TABLE VARCHAR, COLUMNS VARCHAR, PRIMARY KEY(SCHEMA, TABLE))"); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_CREATE_INDEX FOR \"" + FullTextLucene.class.getName() + ".createIndex\""); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_SEARCH FOR \"" + FullTextLucene.class.getName() + ".search\""); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_SEARCH_DATA FOR \"" + FullTextLucene.class.getName() + ".searchData\""); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_REINDEX FOR \"" + FullTextLucene.class.getName() + ".reindex\""); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_DROP_ALL FOR \"" + FullTextLucene.class.getName() + ".dropAll\""); try { getIndexAccess(conn); } catch (SQLException e) { throw convertException(e); } }
// in src/main/org/h2/fulltext/FullTextLucene.java
public static void createIndex(Connection conn, String schema, String table, String columnList) throws SQLException { init(conn); PreparedStatement prep = conn.prepareStatement("INSERT INTO " + SCHEMA + ".INDEXES(SCHEMA, TABLE, COLUMNS) VALUES(?, ?, ?)"); prep.setString(1, schema); prep.setString(2, table); prep.setString(3, columnList); prep.execute(); createTrigger(conn, schema, table); indexExistingRows(conn, schema, table); }
// in src/main/org/h2/fulltext/FullTextLucene.java
public static void reindex(Connection conn) throws SQLException { init(conn); removeAllTriggers(conn, TRIGGER_PREFIX); removeIndexFiles(conn); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("SELECT * FROM " + SCHEMA + ".INDEXES"); while (rs.next()) { String schema = rs.getString("SCHEMA"); String table = rs.getString("TABLE"); createTrigger(conn, schema, table); indexExistingRows(conn, schema, table); } }
// in src/main/org/h2/fulltext/FullTextLucene.java
public static void dropAll(Connection conn) throws SQLException { Statement stat = conn.createStatement(); stat.execute("DROP SCHEMA IF EXISTS " + SCHEMA); removeAllTriggers(conn, TRIGGER_PREFIX); removeIndexFiles(conn); }
// in src/main/org/h2/fulltext/FullTextLucene.java
public static ResultSet search(Connection conn, String text, int limit, int offset) throws SQLException { return search(conn, text, limit, offset, false); }
// in src/main/org/h2/fulltext/FullTextLucene.java
public static ResultSet searchData(Connection conn, String text, int limit, int offset) throws SQLException { return search(conn, text, limit, offset, true); }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected static void createTrigger(Connection conn, String schema, String table) throws SQLException { Statement stat = conn.createStatement(); String trigger = StringUtils.quoteIdentifier(schema) + "." + StringUtils.quoteIdentifier(TRIGGER_PREFIX + table); stat.execute("DROP TRIGGER IF EXISTS " + trigger); StringBuilder buff = new StringBuilder("CREATE TRIGGER IF NOT EXISTS "); // the trigger is also called on rollback because transaction rollback // will not undo the changes in the Lucene index buff.append(trigger). append(" AFTER INSERT, UPDATE, DELETE, ROLLBACK ON "). append(StringUtils.quoteIdentifier(schema)). append('.'). append(StringUtils.quoteIdentifier(table)). append(" FOR EACH ROW CALL \""). append(FullTextLucene.FullTextTrigger.class.getName()). append('\"'); stat.execute(buff.toString()); }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected static IndexAccess getIndexAccess(Connection conn) throws SQLException { String path = getIndexPath(conn); synchronized (INDEX_ACCESS) { IndexAccess access = INDEX_ACCESS.get(path); if (access == null) { try { /*## LUCENE2 ## boolean recreate = !IndexReader.indexExists(path); Analyzer analyzer = new StandardAnalyzer(); access = new IndexAccess(); access.modifier = new IndexModifier(path, analyzer, recreate); //*/ //## LUCENE3 ## File f = new File(path); Directory indexDir = FSDirectory.open(f); boolean recreate = !IndexReader.indexExists(indexDir); Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30); IndexWriter writer = new IndexWriter(indexDir, analyzer, recreate, IndexWriter.MaxFieldLength.UNLIMITED); //see http://wiki.apache.org/lucene-java/NearRealtimeSearch IndexReader reader = writer.getReader(); access = new IndexAccess(); access.writer = writer; access.reader = reader; access.searcher = new IndexSearcher(reader); //*/ } catch (IOException e) { throw convertException(e); } INDEX_ACCESS.put(path, access); } return access; } }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected static String getIndexPath(Connection conn) throws SQLException { Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("CALL DATABASE_PATH()"); rs.next(); String path = rs.getString(1); if (path == null) { throw throwException("Fulltext search for in-memory databases is not supported."); } int index = path.lastIndexOf(':'); // position 1 means a windows drive letter is used, ignore that if (index > 1) { path = path.substring(index + 1); } rs.close(); return path; }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected static void indexExistingRows(Connection conn, String schema, String table) throws SQLException { FullTextLucene.FullTextTrigger existing = new FullTextLucene.FullTextTrigger(); existing.init(conn, schema, null, table, false, Trigger.INSERT); String sql = "SELECT * FROM " + StringUtils.quoteIdentifier(schema) + "." + StringUtils.quoteIdentifier(table); ResultSet rs = conn.createStatement().executeQuery(sql); int columnCount = rs.getMetaData().getColumnCount(); while (rs.next()) { Object[] row = new Object[columnCount]; for (int i = 0; i < columnCount; i++) { row[i] = rs.getObject(i + 1); } existing.insert(row, false); } existing.commitIndex(); }
// in src/main/org/h2/fulltext/FullTextLucene.java
private static void removeIndexFiles(Connection conn) throws SQLException { String path = getIndexPath(conn); IndexAccess access = INDEX_ACCESS.get(path); if (access != null) { removeIndexAccess(access, path); } FileUtils.deleteRecursive(path, false); }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected static void removeIndexAccess(IndexAccess access, String indexPath) throws SQLException { synchronized (INDEX_ACCESS) { try { INDEX_ACCESS.remove(indexPath); /*## LUCENE2 ## access.modifier.flush(); access.modifier.close(); //*/ //## LUCENE3 ## access.searcher.close(); access.reader.close(); access.writer.close(); //*/ } catch (Exception e) { throw convertException(e); } } }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected static ResultSet search(Connection conn, String text, int limit, int offset, boolean data) throws SQLException { SimpleResultSet result = createResultSet(data); if (conn.getMetaData().getURL().startsWith("jdbc:columnlist:")) { // this is just to query the result set columns return result; } if (text == null || text.trim().length() == 0) { return result; } try { IndexAccess access = getIndexAccess(conn); /*## LUCENE2 ## access.modifier.flush(); String path = getIndexPath(conn); IndexReader reader = IndexReader.open(path); Analyzer analyzer = new StandardAnalyzer(); Searcher searcher = new IndexSearcher(reader); QueryParser parser = new QueryParser(LUCENE_FIELD_DATA, analyzer); Query query = parser.parse(text); Hits hits = searcher.search(query); int max = hits.length(); if (limit == 0) { limit = max; } for (int i = 0; i < limit && i + offset < max; i++) { Document doc = hits.doc(i + offset); float score = hits.score(i + offset); //*/ //## LUCENE3 ## // take a reference as the searcher may change Searcher searcher = access.searcher; // reuse the same analyzer; it's thread-safe; // also allows subclasses to control the analyzer used. Analyzer analyzer = access.writer.getAnalyzer(); QueryParser parser = new QueryParser(Version.LUCENE_30, LUCENE_FIELD_DATA, analyzer); Query query = parser.parse(text); // Lucene 3 insists on a hard limit and will not provide // a total hits value. Take at least 100 which is // an optimal limit for Lucene as any more // will trigger writing results to disk. int maxResults = (limit == 0 ? 100 : limit) + offset; TopDocs docs = searcher.search(query, maxResults); if (limit == 0) { limit = docs.totalHits; } for (int i = 0, len = docs.scoreDocs.length; i < limit && i + offset < docs.totalHits && i + offset < len; i++) { ScoreDoc sd = docs.scoreDocs[i + offset]; Document doc = searcher.doc(sd.doc); float score = sd.score; //*/ String q = doc.get(LUCENE_FIELD_QUERY); if (data) { int idx = q.indexOf(" WHERE "); JdbcConnection c = (JdbcConnection) conn; Session session = (Session) c.getSession(); Parser p = new Parser(session); String tab = q.substring(0, idx); ExpressionColumn expr = (ExpressionColumn) p.parseExpression(tab); String schemaName = expr.getOriginalTableAliasName(); String tableName = expr.getColumnName(); q = q.substring(idx + " WHERE ".length()); Object[][] columnData = parseKey(conn, q); result.addRow( schemaName, tableName, columnData[0], columnData[1], score); } else { result.addRow(q, score); } } /*## LUCENE2 ## // TODO keep it open if possible reader.close(); //*/ } catch (Exception e) { throw convertException(e); } return result; }
// in src/main/org/h2/fulltext/FullTextLucene.java
public void init(Connection conn, String schemaName, String triggerName, String tableName, boolean before, int type) throws SQLException { this.schema = schemaName; this.table = tableName; this.indexPath = getIndexPath(conn); this.indexAccess = getIndexAccess(conn); ArrayList<String> keyList = New.arrayList(); DatabaseMetaData meta = conn.getMetaData(); ResultSet rs = meta.getColumns(null, JdbcUtils.escapeMetaDataPattern(schemaName), JdbcUtils.escapeMetaDataPattern(tableName), null); ArrayList<String> columnList = New.arrayList(); while (rs.next()) { columnList.add(rs.getString("COLUMN_NAME")); } columnTypes = new int[columnList.size()]; columns = new String[columnList.size()]; columnList.toArray(columns); rs = meta.getColumns(null, JdbcUtils.escapeMetaDataPattern(schemaName), JdbcUtils.escapeMetaDataPattern(tableName), null); for (int i = 0; rs.next(); i++) { columnTypes[i] = rs.getInt("DATA_TYPE"); } if (keyList.size() == 0) { rs = meta.getPrimaryKeys(null, JdbcUtils.escapeMetaDataPattern(schemaName), tableName); while (rs.next()) { keyList.add(rs.getString("COLUMN_NAME")); } } if (keyList.size() == 0) { throw throwException("No primary key for table " + tableName); } ArrayList<String> indexList = New.arrayList(); PreparedStatement prep = conn.prepareStatement( "SELECT COLUMNS FROM " + SCHEMA + ".INDEXES WHERE SCHEMA=? AND TABLE=?"); prep.setString(1, schemaName); prep.setString(2, tableName); rs = prep.executeQuery(); if (rs.next()) { String cols = rs.getString(1); if (cols != null) { for (String s : StringUtils.arraySplit(cols, ',', true)) { indexList.add(s); } } } if (indexList.size() == 0) { indexList.addAll(columnList); } keys = new int[keyList.size()]; setColumns(keys, keyList, columnList); indexColumns = new int[indexList.size()]; setColumns(indexColumns, indexList, columnList); }
// in src/main/org/h2/fulltext/FullTextLucene.java
public void fire(Connection conn, Object[] oldRow, Object[] newRow) throws SQLException { if (oldRow != null) { if (newRow != null) { // update if (hasChanged(oldRow, newRow, indexColumns)) { delete(oldRow); insert(newRow, true); } } else { // delete delete(oldRow); } } else if (newRow != null) { // insert insert(newRow, true); } }
// in src/main/org/h2/fulltext/FullTextLucene.java
public void close() throws SQLException { if (indexAccess != null) { removeIndexAccess(indexAccess, indexPath); indexAccess = null; } }
// in src/main/org/h2/fulltext/FullTextLucene.java
void commitIndex() throws SQLException { try { indexAccess.writer.commit(); // recreate Searcher with the IndexWriter's reader. indexAccess.searcher.close(); indexAccess.reader.close(); IndexReader reader = indexAccess.writer.getReader(); indexAccess.reader = reader; indexAccess.searcher = new IndexSearcher(reader); } catch (IOException e) { throw convertException(e); } }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected void insert(Object[] row, boolean commitIndex) throws SQLException { /*## LUCENE2 ## String query = getQuery(row); Document doc = new Document(); doc.add(new Field(LUCENE_FIELD_QUERY, query, Field.Store.YES, Field.Index.UN_TOKENIZED)); long time = System.currentTimeMillis(); doc.add(new Field(LUCENE_FIELD_MODIFIED, DateTools.timeToString(time, DateTools.Resolution.SECOND), Field.Store.YES, Field.Index.UN_TOKENIZED)); StatementBuilder buff = new StatementBuilder(); for (int index : indexColumns) { String columnName = columns[index]; String data = asString(row[index], columnTypes[index]); // column names that start with _ must be escaped to avoid conflicts // with internal field names (_DATA, _QUERY, _modified) if (columnName.startsWith(LUCENE_FIELD_COLUMN_PREFIX)) { columnName = LUCENE_FIELD_COLUMN_PREFIX + columnName; } doc.add(new Field(columnName, data, Field.Store.NO, Field.Index.TOKENIZED)); buff.appendExceptFirst(" "); buff.append(data); } Field.Store storeText = STORE_DOCUMENT_TEXT_IN_INDEX ? Field.Store.YES : Field.Store.NO; doc.add(new Field(LUCENE_FIELD_DATA, buff.toString(), storeText, Field.Index.TOKENIZED)); try { indexAccess.modifier.addDocument(doc); } catch (IOException e) { throw convertException(e); } //*/ //## LUCENE3 ## String query = getQuery(row); Document doc = new Document(); doc.add(new Field(LUCENE_FIELD_QUERY, query, Field.Store.YES, Field.Index.NOT_ANALYZED)); long time = System.currentTimeMillis(); doc.add(new Field(LUCENE_FIELD_MODIFIED, DateTools.timeToString(time, DateTools.Resolution.SECOND), Field.Store.YES, Field.Index.NOT_ANALYZED)); StatementBuilder buff = new StatementBuilder(); for (int index : indexColumns) { String columnName = columns[index]; String data = asString(row[index], columnTypes[index]); // column names that start with _ // must be escaped to avoid conflicts // with internal field names (_DATA, _QUERY, _modified) if (columnName.startsWith(LUCENE_FIELD_COLUMN_PREFIX)) { columnName = LUCENE_FIELD_COLUMN_PREFIX + columnName; } doc.add(new Field(columnName, data, Field.Store.NO, Field.Index.ANALYZED)); buff.appendExceptFirst(" "); buff.append(data); } Field.Store storeText = STORE_DOCUMENT_TEXT_IN_INDEX ? Field.Store.YES : Field.Store.NO; doc.add(new Field(LUCENE_FIELD_DATA, buff.toString(), storeText, Field.Index.ANALYZED)); try { indexAccess.writer.addDocument(doc); if (commitIndex) { indexAccess.writer.commit(); // recreate Searcher with the IndexWriter's reader. indexAccess.searcher.close(); indexAccess.reader.close(); IndexReader reader = indexAccess.writer.getReader(); indexAccess.reader = reader; indexAccess.searcher = new IndexSearcher(reader); } } catch (IOException e) { throw convertException(e); } //*/ }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected void delete(Object[] row) throws SQLException { String query = getQuery(row); try { Term term = new Term(LUCENE_FIELD_QUERY, query); /*## LUCENE2 ## indexAccess.modifier.deleteDocuments(term); //*/ //## LUCENE3 ## indexAccess.writer.deleteDocuments(term); //*/ } catch (IOException e) { throw convertException(e); } }
// in src/main/org/h2/fulltext/FullTextLucene.java
private String getQuery(Object[] row) throws SQLException { StatementBuilder buff = new StatementBuilder(); if (schema != null) { buff.append(StringUtils.quoteIdentifier(schema)).append('.'); } buff.append(StringUtils.quoteIdentifier(table)).append(" WHERE "); for (int columnIndex : keys) { buff.appendExceptFirst(" AND "); buff.append(StringUtils.quoteIdentifier(columns[columnIndex])); Object o = row[columnIndex]; if (o == null) { buff.append(" IS NULL"); } else { buff.append('=').append(FullText.quoteSQL(o, columnTypes[columnIndex])); } } return buff.toString(); }
// in src/main/org/h2/fulltext/FullText.java
public static void init(Connection conn) throws SQLException { Statement stat = conn.createStatement(); stat.execute("CREATE SCHEMA IF NOT EXISTS " + SCHEMA); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".INDEXES(ID INT AUTO_INCREMENT PRIMARY KEY, SCHEMA VARCHAR, TABLE VARCHAR, COLUMNS VARCHAR, UNIQUE(SCHEMA, TABLE))"); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".WORDS(ID INT AUTO_INCREMENT PRIMARY KEY, NAME VARCHAR, UNIQUE(NAME))"); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".ROWS(ID IDENTITY, HASH INT, INDEXID INT, KEY VARCHAR, UNIQUE(HASH, INDEXID, KEY))"); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".MAP(ROWID INT, WORDID INT, PRIMARY KEY(WORDID, ROWID))"); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".IGNORELIST(LIST VARCHAR)"); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".SETTINGS(KEY VARCHAR PRIMARY KEY, VALUE VARCHAR)"); stat.execute("CREATE ALIAS IF NOT EXISTS FT_CREATE_INDEX FOR \"" + FullText.class.getName() + ".createIndex\""); stat.execute("CREATE ALIAS IF NOT EXISTS FT_DROP_INDEX FOR \"" + FullText.class.getName() + ".dropIndex\""); stat.execute("CREATE ALIAS IF NOT EXISTS FT_SEARCH FOR \"" + FullText.class.getName() + ".search\""); stat.execute("CREATE ALIAS IF NOT EXISTS FT_SEARCH_DATA FOR \"" + FullText.class.getName() + ".searchData\""); stat.execute("CREATE ALIAS IF NOT EXISTS FT_REINDEX FOR \"" + FullText.class.getName() + ".reindex\""); stat.execute("CREATE ALIAS IF NOT EXISTS FT_DROP_ALL FOR \"" + FullText.class.getName() + ".dropAll\""); FullTextSettings setting = FullTextSettings.getInstance(conn); ResultSet rs = stat.executeQuery("SELECT * FROM " + SCHEMA + ".IGNORELIST"); while (rs.next()) { String commaSeparatedList = rs.getString(1); setIgnoreList(setting, commaSeparatedList); } rs = stat.executeQuery("SELECT * FROM " + SCHEMA + ".SETTINGS"); while (rs.next()) { String key = rs.getString(1); if ("whitespaceChars".equals(key)) { String value = rs.getString(2); setting.setWhitespaceChars(value); } } rs = stat.executeQuery("SELECT * FROM " + SCHEMA + ".WORDS"); HashMap<String, Integer> map = setting.getWordList(); while (rs.next()) { String word = rs.getString("NAME"); int id = rs.getInt("ID"); word = setting.convertWord(word); if (word != null) { map.put(word, id); } } setting.setInitialized(true); }
// in src/main/org/h2/fulltext/FullText.java
public static void createIndex(Connection conn, String schema, String table, String columnList) throws SQLException { init(conn); PreparedStatement prep = conn.prepareStatement("INSERT INTO " + SCHEMA + ".INDEXES(SCHEMA, TABLE, COLUMNS) VALUES(?, ?, ?)"); prep.setString(1, schema); prep.setString(2, table); prep.setString(3, columnList); prep.execute(); createTrigger(conn, schema, table); indexExistingRows(conn, schema, table); }
// in src/main/org/h2/fulltext/FullText.java
public static void reindex(Connection conn) throws SQLException { init(conn); removeAllTriggers(conn, TRIGGER_PREFIX); FullTextSettings setting = FullTextSettings.getInstance(conn); setting.getWordList().clear(); Statement stat = conn.createStatement(); stat.execute("TRUNCATE TABLE " + SCHEMA + ".WORDS"); stat.execute("TRUNCATE TABLE " + SCHEMA + ".ROWS"); stat.execute("TRUNCATE TABLE " + SCHEMA + ".MAP"); ResultSet rs = stat.executeQuery("SELECT * FROM " + SCHEMA + ".INDEXES"); while (rs.next()) { String schema = rs.getString("SCHEMA"); String table = rs.getString("TABLE"); createTrigger(conn, schema, table); indexExistingRows(conn, schema, table); } }
// in src/main/org/h2/fulltext/FullText.java
public static void dropIndex(Connection conn, String schema, String table) throws SQLException { init(conn); PreparedStatement prep = conn.prepareStatement("SELECT ID FROM " + SCHEMA + ".INDEXES WHERE SCHEMA=? AND TABLE=?"); prep.setString(1, schema); prep.setString(2, table); ResultSet rs = prep.executeQuery(); if (!rs.next()) { return; } int indexId = rs.getInt(1); prep = conn.prepareStatement("DELETE FROM " + SCHEMA + ".INDEXES WHERE ID=?"); prep.setInt(1, indexId); prep.execute(); createOrDropTrigger(conn, schema, table, false); prep = conn.prepareStatement("DELETE FROM " + SCHEMA + ".ROWS WHERE INDEXID=? AND ROWNUM<10000"); while (true) { prep.setInt(1, indexId); int deleted = prep.executeUpdate(); if (deleted == 0) { break; } } prep = conn.prepareStatement("DELETE FROM " + SCHEMA + ".MAP M " + "WHERE NOT EXISTS (SELECT * FROM " + SCHEMA + ".ROWS R WHERE R.ID=M.ROWID) AND ROWID<10000"); while (true) { int deleted = prep.executeUpdate(); if (deleted == 0) { break; } } }
// in src/main/org/h2/fulltext/FullText.java
public static void dropAll(Connection conn) throws SQLException { init(conn); Statement stat = conn.createStatement(); stat.execute("DROP SCHEMA IF EXISTS " + SCHEMA); removeAllTriggers(conn, TRIGGER_PREFIX); FullTextSettings setting = FullTextSettings.getInstance(conn); setting.removeAllIndexes(); setting.getIgnoreList().clear(); setting.getWordList().clear(); }
// in src/main/org/h2/fulltext/FullText.java
public static ResultSet search(Connection conn, String text, int limit, int offset) throws SQLException { try { return search(conn, text, limit, offset, false); } catch (DbException e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/fulltext/FullText.java
public static ResultSet searchData(Connection conn, String text, int limit, int offset) throws SQLException { try { return search(conn, text, limit, offset, true); } catch (DbException e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/fulltext/FullText.java
public static void setIgnoreList(Connection conn, String commaSeparatedList) throws SQLException { try { init(conn); FullTextSettings setting = FullTextSettings.getInstance(conn); setIgnoreList(setting, commaSeparatedList); Statement stat = conn.createStatement(); stat.execute("TRUNCATE TABLE " + SCHEMA + ".IGNORELIST"); PreparedStatement prep = conn.prepareStatement("INSERT INTO " + SCHEMA + ".IGNORELIST VALUES(?)"); prep.setString(1, commaSeparatedList); prep.execute(); } catch (DbException e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/fulltext/FullText.java
public static void setWhitespaceChars(Connection conn, String whitespaceChars) throws SQLException { try { init(conn); FullTextSettings setting = FullTextSettings.getInstance(conn); setting.setWhitespaceChars(whitespaceChars); PreparedStatement prep = conn.prepareStatement("MERGE INTO " + SCHEMA + ".SETTINGS VALUES(?, ?)"); prep.setString(1, "whitespaceChars"); prep.setString(2, whitespaceChars); prep.execute(); } catch (DbException e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/fulltext/FullText.java
protected static String asString(Object data, int type) throws SQLException { if (data == null) { return "NULL"; } switch (type) { case Types.BIT: case Types.BOOLEAN: case Types.INTEGER: case Types.BIGINT: case Types.DECIMAL: case Types.DOUBLE: case Types.FLOAT: case Types.NUMERIC: case Types.REAL: case Types.SMALLINT: case Types.TINYINT: case Types.DATE: case Types.TIME: case Types.TIMESTAMP: case Types.LONGVARCHAR: case Types.CHAR: case Types.VARCHAR: return data.toString(); case Types.CLOB: try { if (data instanceof Clob) { data = ((Clob) data).getCharacterStream(); } return IOUtils.readStringAndClose((Reader) data, -1); } catch (IOException e) { throw DbException.toSQLException(e); } case Types.VARBINARY: case Types.LONGVARBINARY: case Types.BINARY: case Types.JAVA_OBJECT: case Types.OTHER: case Types.BLOB: case Types.STRUCT: case Types.REF: case Types.NULL: case Types.ARRAY: case Types.DATALINK: case Types.DISTINCT: throw throwException("Unsupported column data type: " + type); default: return ""; } }
// in src/main/org/h2/fulltext/FullText.java
protected static String quoteSQL(Object data, int type) throws SQLException { if (data == null) { return "NULL"; } switch (type) { case Types.BIT: case Types.BOOLEAN: case Types.INTEGER: case Types.BIGINT: case Types.DECIMAL: case Types.DOUBLE: case Types.FLOAT: case Types.NUMERIC: case Types.REAL: case Types.SMALLINT: case Types.TINYINT: return data.toString(); case Types.DATE: case Types.TIME: case Types.TIMESTAMP: case Types.LONGVARCHAR: case Types.CHAR: case Types.VARCHAR: return quoteString(data.toString()); case Types.VARBINARY: case Types.LONGVARBINARY: case Types.BINARY: return "'" + StringUtils.convertBytesToHex((byte[]) data) + "'"; case Types.CLOB: case Types.JAVA_OBJECT: case Types.OTHER: case Types.BLOB: case Types.STRUCT: case Types.REF: case Types.NULL: case Types.ARRAY: case Types.DATALINK: case Types.DISTINCT: throw throwException("Unsupported key data type: " + type); default: return ""; } }
// in src/main/org/h2/fulltext/FullText.java
protected static void removeAllTriggers(Connection conn, String prefix) throws SQLException { Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("SELECT * FROM INFORMATION_SCHEMA.TRIGGERS"); Statement stat2 = conn.createStatement(); while (rs.next()) { String schema = rs.getString("TRIGGER_SCHEMA"); String name = rs.getString("TRIGGER_NAME"); if (name.startsWith(prefix)) { name = StringUtils.quoteIdentifier(schema) + "." + StringUtils.quoteIdentifier(name); stat2.execute("DROP TRIGGER " + name); } } }
// in src/main/org/h2/fulltext/FullText.java
protected static void setColumns(int[] index, ArrayList<String> keys, ArrayList<String> columns) throws SQLException { for (int i = 0, keySize = keys.size(); i < keySize; i++) { String key = keys.get(i); int found = -1; int columnsSize = columns.size(); for (int j = 0; found == -1 && j < columnsSize; j++) { String column = columns.get(j); if (column.equals(key)) { found = j; } } if (found < 0) { throw throwException("Column not found: " + key); } index[i] = found; } }
// in src/main/org/h2/fulltext/FullText.java
protected static ResultSet search(Connection conn, String text, int limit, int offset, boolean data) throws SQLException { SimpleResultSet result = createResultSet(data); if (conn.getMetaData().getURL().startsWith("jdbc:columnlist:")) { // this is just to query the result set columns return result; } if (text == null || text.trim().length() == 0) { return result; } FullTextSettings setting = FullTextSettings.getInstance(conn); if (!setting.isInitialized()) { init(conn); } HashSet<String> words = New.hashSet(); addWords(setting, words, text); HashSet<Integer> rIds = null, lastRowIds = null; HashMap<String, Integer> allWords = setting.getWordList(); PreparedStatement prepSelectMapByWordId = setting.prepare(conn, SELECT_MAP_BY_WORD_ID); for (String word : words) { lastRowIds = rIds; rIds = New.hashSet(); Integer wId = allWords.get(word); if (wId == null) { continue; } prepSelectMapByWordId.setInt(1, wId.intValue()); ResultSet rs = prepSelectMapByWordId.executeQuery(); while (rs.next()) { Integer rId = rs.getInt(1); if (lastRowIds == null || lastRowIds.contains(rId)) { rIds.add(rId); } } } if (rIds == null || rIds.size() == 0) { return result; } PreparedStatement prepSelectRowById = setting.prepare(conn, SELECT_ROW_BY_ID); int rowCount = 0; for (int rowId : rIds) { prepSelectRowById.setInt(1, rowId); ResultSet rs = prepSelectRowById.executeQuery(); if (!rs.next()) { continue; } if (offset > 0) { offset--; } else { String key = rs.getString(1); int indexId = rs.getInt(2); IndexInfo index = setting.getIndexInfo(indexId); if (data) { Object[][] columnData = parseKey(conn, key); result.addRow( index.schema, index.table, columnData[0], columnData[1], 1.0); } else { String query = StringUtils.quoteIdentifier(index.schema) + "." + StringUtils.quoteIdentifier(index.table) + " WHERE " + key; result.addRow(query, 1.0); } rowCount++; if (limit > 0 && rowCount >= limit) { break; } } } return result; }
// in src/main/org/h2/fulltext/FullText.java
protected static void createTrigger(Connection conn, String schema, String table) throws SQLException { createOrDropTrigger(conn, schema, table, true); }
// in src/main/org/h2/fulltext/FullText.java
private static void createOrDropTrigger(Connection conn, String schema, String table, boolean create) throws SQLException { Statement stat = conn.createStatement(); String trigger = StringUtils.quoteIdentifier(schema) + "." + StringUtils.quoteIdentifier(TRIGGER_PREFIX + table); stat.execute("DROP TRIGGER IF EXISTS " + trigger); if (create) { StringBuilder buff = new StringBuilder("CREATE TRIGGER IF NOT EXISTS "); // needs to be called on rollback as well, because we use the init connection // do to changes in the index (not the user connection) buff.append(trigger). append(" AFTER INSERT, UPDATE, DELETE, ROLLBACK ON "). append(StringUtils.quoteIdentifier(schema)). append('.'). append(StringUtils.quoteIdentifier(table)). append(" FOR EACH ROW CALL \""). append(FullText.FullTextTrigger.class.getName()). append('\"'); stat.execute(buff.toString()); } }
// in src/main/org/h2/fulltext/FullText.java
protected static void indexExistingRows(Connection conn, String schema, String table) throws SQLException { FullText.FullTextTrigger existing = new FullText.FullTextTrigger(); existing.init(conn, schema, null, table, false, Trigger.INSERT); String sql = "SELECT * FROM " + StringUtils.quoteIdentifier(schema) + "." + StringUtils.quoteIdentifier(table); ResultSet rs = conn.createStatement().executeQuery(sql); int columnCount = rs.getMetaData().getColumnCount(); while (rs.next()) { Object[] row = new Object[columnCount]; for (int i = 0; i < columnCount; i++) { row[i] = rs.getObject(i + 1); } existing.fire(conn, null, row); } }
// in src/main/org/h2/fulltext/FullText.java
public void init(Connection conn, String schemaName, String triggerName, String tableName, boolean before, int type) throws SQLException { setting = FullTextSettings.getInstance(conn); if (!setting.isInitialized()) { FullText.init(conn); } ArrayList<String> keyList = New.arrayList(); DatabaseMetaData meta = conn.getMetaData(); ResultSet rs = meta.getColumns(null, JdbcUtils.escapeMetaDataPattern(schemaName), JdbcUtils.escapeMetaDataPattern(tableName), null); ArrayList<String> columnList = New.arrayList(); while (rs.next()) { columnList.add(rs.getString("COLUMN_NAME")); } columnTypes = new int[columnList.size()]; index = new IndexInfo(); index.schema = schemaName; index.table = tableName; index.columns = new String[columnList.size()]; columnList.toArray(index.columns); rs = meta.getColumns(null, JdbcUtils.escapeMetaDataPattern(schemaName), JdbcUtils.escapeMetaDataPattern(tableName), null); for (int i = 0; rs.next(); i++) { columnTypes[i] = rs.getInt("DATA_TYPE"); } if (keyList.size() == 0) { rs = meta.getPrimaryKeys(null, JdbcUtils.escapeMetaDataPattern(schemaName), tableName); while (rs.next()) { keyList.add(rs.getString("COLUMN_NAME")); } } if (keyList.size() == 0) { throw throwException("No primary key for table " + tableName); } ArrayList<String> indexList = New.arrayList(); PreparedStatement prep = conn.prepareStatement( "SELECT ID, COLUMNS FROM " + SCHEMA + ".INDEXES WHERE SCHEMA=? AND TABLE=?"); prep.setString(1, schemaName); prep.setString(2, tableName); rs = prep.executeQuery(); if (rs.next()) { index.id = rs.getInt(1); String columns = rs.getString(2); if (columns != null) { for (String s : StringUtils.arraySplit(columns, ',', true)) { indexList.add(s); } } } if (indexList.size() == 0) { indexList.addAll(columnList); } index.keys = new int[keyList.size()]; setColumns(index.keys, keyList, columnList); index.indexColumns = new int[indexList.size()]; setColumns(index.indexColumns, indexList, columnList); setting.addIndexInfo(index); prepInsertWord = conn.prepareStatement( "INSERT INTO " + SCHEMA + ".WORDS(NAME) VALUES(?)"); prepInsertRow = conn.prepareStatement( "INSERT INTO " + SCHEMA + ".ROWS(HASH, INDEXID, KEY) VALUES(?, ?, ?)"); prepInsertMap = conn.prepareStatement( "INSERT INTO " + SCHEMA + ".MAP(ROWID, WORDID) VALUES(?, ?)"); prepDeleteRow = conn.prepareStatement( "DELETE FROM " + SCHEMA + ".ROWS WHERE HASH=? AND INDEXID=? AND KEY=?"); prepDeleteMap = conn.prepareStatement( "DELETE FROM " + SCHEMA + ".MAP WHERE ROWID=? AND WORDID=?"); prepSelectRow = conn.prepareStatement( "SELECT ID FROM " + SCHEMA + ".ROWS WHERE HASH=? AND INDEXID=? AND KEY=?"); }
// in src/main/org/h2/fulltext/FullText.java
public void fire(Connection conn, Object[] oldRow, Object[] newRow) throws SQLException { if (oldRow != null) { if (newRow != null) { // update if (hasChanged(oldRow, newRow, index.indexColumns)) { delete(oldRow); insert(newRow); } } else { // delete delete(oldRow); } } else if (newRow != null) { // insert insert(newRow); } }
// in src/main/org/h2/fulltext/FullText.java
protected void insert(Object[] row) throws SQLException { String key = getKey(row); int hash = key.hashCode(); prepInsertRow.setInt(1, hash); prepInsertRow.setInt(2, index.id); prepInsertRow.setString(3, key); prepInsertRow.execute(); ResultSet rs = prepInsertRow.getGeneratedKeys(); rs.next(); int rowId = rs.getInt(1); prepInsertMap.setInt(1, rowId); int[] wordIds = getWordIds(row); for (int id : wordIds) { prepInsertMap.setInt(2, id); prepInsertMap.execute(); } }
// in src/main/org/h2/fulltext/FullText.java
protected void delete(Object[] row) throws SQLException { String key = getKey(row); int hash = key.hashCode(); prepSelectRow.setInt(1, hash); prepSelectRow.setInt(2, index.id); prepSelectRow.setString(3, key); ResultSet rs = prepSelectRow.executeQuery(); if (rs.next()) { int rowId = rs.getInt(1); prepDeleteMap.setInt(1, rowId); int[] wordIds = getWordIds(row); for (int id : wordIds) { prepDeleteMap.setInt(2, id); prepDeleteMap.executeUpdate(); } prepDeleteRow.setInt(1, hash); prepDeleteRow.setInt(2, index.id); prepDeleteRow.setString(3, key); prepDeleteRow.executeUpdate(); } }
// in src/main/org/h2/fulltext/FullText.java
private int[] getWordIds(Object[] row) throws SQLException { HashSet<String> words = New.hashSet(); for (int idx : index.indexColumns) { int type = columnTypes[idx]; Object data = row[idx]; if (type == Types.CLOB && data != null) { Reader reader; if (data instanceof Reader) { reader = (Reader) data; } else { reader = ((Clob) data).getCharacterStream(); } addWords(setting, words, reader); } else { String string = asString(data, type); addWords(setting, words, string); } } HashMap<String, Integer> allWords = setting.getWordList(); int[] wordIds = new int[words.size()]; Iterator<String> it = words.iterator(); for (int i = 0; it.hasNext(); i++) { String word = it.next(); Integer wId = allWords.get(word); int wordId; if (wId == null) { prepInsertWord.setString(1, word); prepInsertWord.execute(); ResultSet rs = prepInsertWord.getGeneratedKeys(); rs.next(); wordId = rs.getInt(1); allWords.put(word, wordId); } else { wordId = wId.intValue(); } wordIds[i] = wordId; } Arrays.sort(wordIds); return wordIds; }
// in src/main/org/h2/fulltext/FullText.java
private String getKey(Object[] row) throws SQLException { StatementBuilder buff = new StatementBuilder(); for (int columnIndex : index.keys) { buff.appendExceptFirst(" AND "); buff.append(StringUtils.quoteIdentifier(index.columns[columnIndex])); Object o = row[columnIndex]; if (o == null) { buff.append(" IS NULL"); } else { buff.append('=').append(quoteSQL(o, columnTypes[columnIndex])); } } return buff.toString(); }
// in src/main/org/h2/fulltext/FullText.java
protected static SQLException throwException(String message) throws SQLException { throw new SQLException(message, "FULLTEXT"); }
// in src/main/org/h2/fulltext/FullTextSettings.java
protected static FullTextSettings getInstance(Connection conn) throws SQLException { String path = getIndexPath(conn); FullTextSettings setting = SETTINGS.get(path); if (setting == null) { setting = new FullTextSettings(); SETTINGS.put(path, setting); } return setting; }
// in src/main/org/h2/fulltext/FullTextSettings.java
protected static String getIndexPath(Connection conn) throws SQLException { Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("CALL IFNULL(DATABASE_PATH(), 'MEM:' || DATABASE())"); rs.next(); String path = rs.getString(1); if ("MEM:UNNAMED".equals(path)) { throw FullText.throwException("Fulltext search for private (unnamed) in-memory databases is not supported."); } rs.close(); return path; }
// in src/main/org/h2/fulltext/FullTextSettings.java
protected synchronized PreparedStatement prepare(Connection conn, String sql) throws SQLException { SoftHashMap<String, PreparedStatement> c = cache.get(conn); if (c == null) { c = new SoftHashMap<String, PreparedStatement>(); cache.put(conn, c); } PreparedStatement prep = c.get(sql); if (prep != null && prep.getConnection().isClosed()) { prep = null; } if (prep == null) { prep = conn.prepareStatement(sql); c.put(sql, prep); } return prep; }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
public static void main(String... args) throws SQLException { new FtpServer().runTool(args); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
public void runTool(String... args) throws SQLException { for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg == null) { continue; } else if ("-?".equals(arg) || "-help".equals(arg)) { showUsage(); return; } else if (arg.startsWith("-ftp")) { if ("-ftpPort".equals(arg)) { i++; } else if ("-ftpDir".equals(arg)) { i++; } else if ("-ftpRead".equals(arg)) { i++; } else if ("-ftpWrite".equals(arg)) { i++; } else if ("-ftpWritePassword".equals(arg)) { i++; } else if ("-ftpTask".equals(arg)) { // no parameters } else { showUsageAndThrowUnsupportedOption(arg); } } else if ("-trace".equals(arg)) { // no parameters } else { showUsageAndThrowUnsupportedOption(arg); } } Server server = new Server(this, args); server.start(); out.println(server.getStatus()); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
public static Server createFtpServer(String... args) throws SQLException { return new Server(new FtpServer(), args); }
// in src/tools/org/h2/dev/fs/FileShell.java
public static void main(String... args) throws SQLException { new FileShell().runTool(args); }
// in src/tools/org/h2/dev/fs/FileShell.java
public void runTool(String... args) throws SQLException { try { currentWorkingDirectory = new File(".").getCanonicalPath(); } catch (IOException e) { throw DbException.convertIOException(e, "cwd"); } for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-run")) { try { execute(args[++i]); } catch (Exception e) { throw DbException.convert(e); } } else if (arg.equals("-verbose")) { verbose = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } promptLoop(); }
// in src/tools/org/h2/dev/util/FileViewer.java
public static void main(String... args) throws SQLException { new FileViewer().runTool(args); }
// in src/tools/org/h2/dev/util/FileViewer.java
public void runTool(String... args) throws SQLException { String file = null; String find = null; boolean head = false, tail = false; int lines = 30; boolean quiet = false; long start = 0; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-file")) { file = args[++i]; } else if (arg.equals("-find")) { find = args[++i]; } else if (arg.equals("-start")) { start = Long.decode(args[++i]).longValue(); } else if (arg.equals("-head")) { head = true; } else if (arg.equals("-tail")) { tail = true; } else if (arg.equals("-lines")) { lines = Integer.decode(args[++i]).intValue(); } else if (arg.equals("-quiet")) { quiet = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (file == null) { showUsage(); return; } if (!head && !tail && find == null) { head = true; } try { process(file, find, head, tail, start, lines, quiet); } catch (IOException e) { throw DbException.toSQLException(e); } }
// in src/tools/org/h2/mode/FunctionsMySQL.java
public static void register(Connection conn) throws SQLException { String[] init = { "UNIX_TIMESTAMP", "unixTimestamp", "FROM_UNIXTIME", "fromUnixTime", "DATE", "date", }; Statement stat = conn.createStatement(); for (int i = 0; i < init.length; i += 2) { String alias = init[i], method = init[i + 1]; stat.execute( "CREATE ALIAS IF NOT EXISTS " + alias + " FOR \"" + FunctionsMySQL.class.getName() + "." + method + "\""); } }
// in src/tools/org/h2/jaqu/TableInspector.java
void read(DatabaseMetaData metaData) throws SQLException { ResultSet rs = null; // primary keys try { rs = metaData.getPrimaryKeys(null, schema, table); while (rs.next()) { String c = rs.getString("COLUMN_NAME"); primaryKeys.add(c); } JdbcUtils.closeSilently(rs); // indexes rs = metaData.getIndexInfo(null, schema, table, false, true); indexes = New.hashMap(); while (rs.next()) { IndexInspector info = new IndexInspector(rs); if (info.type.equals(IndexType.UNIQUE) && info.name.toLowerCase().startsWith("primary")) { // skip primary key indexes continue; } if (indexes.containsKey(info.name)) { indexes.get(info.name).addColumn(rs); } else { indexes.put(info.name, info); } } JdbcUtils.closeSilently(rs); // columns rs = metaData.getColumns(null, schema, table, null); columns = New.hashMap(); while (rs.next()) { ColumnInspector col = new ColumnInspector(); col.name = rs.getString("COLUMN_NAME"); col.type = rs.getString("TYPE_NAME"); col.clazz = ModelUtils.getClassForSqlType(col.type, dateTimeClass); col.size = rs.getInt("COLUMN_SIZE"); col.allowNull = rs.getInt("NULLABLE") == DatabaseMetaData.columnNullable; col.isAutoIncrement = rs.getBoolean("IS_AUTOINCREMENT"); if (primaryKeys.size() == 1) { if (col.name.equalsIgnoreCase(primaryKeys.get(0))) { col.isPrimaryKey = true; } } if (!col.isAutoIncrement) { col.defaultValue = rs.getString("COLUMN_DEF"); } columns.put(col.name, col); } } finally { JdbcUtils.closeSilently(rs); } }
// in src/tools/org/h2/jaqu/TableInspector.java
public void addColumn(ResultSet rs) throws SQLException { columns.add(rs.getString("COLUMN_NAME")); }
// in src/tools/org/h2/jaqu/DbInspector.java
private DatabaseMetaData getMetaData() throws SQLException { if (metaData == null) { metaData = db.getConnection().getMetaData(); } return metaData; }
// in src/tools/org/h2/jaqu/DbInspector.java
private <T> TableInspector getTable(T model) throws SQLException { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) model.getClass(); TableDefinition<T> def = db.define(clazz); boolean forceUpperCase = getMetaData().storesUpperCaseIdentifiers(); String schema = (forceUpperCase && def.schemaName != null) ? def.schemaName.toUpperCase() : def.schemaName; String table = forceUpperCase ? def.tableName.toUpperCase() : def.tableName; List<TableInspector> tables = getTables(schema, table); return tables.get(0); }
// in src/tools/org/h2/jaqu/DbInspector.java
private List<TableInspector> getTables(String schema, String table) throws SQLException { ResultSet rs = null; try { rs = getMetaData().getSchemas(); ArrayList<String> schemaList = New.arrayList(); while (rs.next()) { schemaList.add(rs.getString("TABLE_SCHEM")); } JdbcUtils.closeSilently(rs); String jaquTables = DbVersion.class.getAnnotation(JQTable.class).name(); List<TableInspector> tables = New.arrayList(); if (schemaList.size() == 0) { schemaList.add(null); } for (String s : schemaList) { rs = getMetaData().getTables(null, s, null, new String[] { "TABLE" }); while (rs.next()) { String t = rs.getString("TABLE_NAME"); if (!t.equalsIgnoreCase(jaquTables)) { tables.add(new TableInspector(s, t, getMetaData().storesUpperCaseIdentifiers(), dateTimeClass)); } } } if (StringUtils.isNullOrEmpty(schema) && StringUtils.isNullOrEmpty(table)) { // all schemas and tables return tables; } // schema subset OR table subset OR exact match List<TableInspector> matches = New.arrayList(); for (TableInspector t : tables) { if (t.matches(schema, table)) { matches.add(t); } } if (matches.size() == 0) { throw new RuntimeException( MessageFormat.format("Failed to find schema={0} table={1}", schema == null ? "" : schema, table == null ? "" : table)); } return matches; } finally { JdbcUtils.closeSilently(rs); } }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
public static void main(String... args) throws SQLException { new GenerateModels().runTool(args); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
public void runTool(String... args) throws SQLException { String url = null; String user = "sa"; String password = ""; String schema = null; String table = null; String packageName = ""; String folder = null; boolean annotateSchema = true; boolean trimStrings = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-schema")) { schema = args[++i]; } else if (arg.equals("-table")) { table = args[++i]; } else if (arg.equals("-package")) { packageName = args[++i]; } else if (arg.equals("-folder")) { folder = args[++i]; } else if (arg.equals("-annotateSchema")) { try { annotateSchema = Boolean.parseBoolean(args[++i]); } catch (Throwable t) { throw new SQLException("Can not parse -annotateSchema value"); } } else if (arg.equals("-trimStrings")) { try { trimStrings = Boolean.parseBoolean(args[++i]); } catch (Throwable t) { throw new SQLException("Can not parse -trimStrings value"); } } else { throwUnsupportedOption(arg); } } if (url == null) { throw new SQLException("URL not set"); } execute(url, user, password, schema, table, packageName, folder, annotateSchema, trimStrings); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
public static void execute(String url, String user, String password, String schema, String table, String packageName, String folder, boolean annotateSchema, boolean trimStrings) throws SQLException { Connection conn = null; try { org.h2.Driver.load(); conn = DriverManager.getConnection(url, user, password); Db db = Db.open(url, user, password.toCharArray()); DbInspector inspector = new DbInspector(db); List<String> models = inspector.generateModel(schema, table, packageName, annotateSchema, trimStrings); File parentFile; if (StringUtils.isNullOrEmpty(folder)) { parentFile = new File(System.getProperty("user.dir")); } else { parentFile = new File(folder); } parentFile.mkdirs(); Pattern p = Pattern.compile("class ([a-zA-Z0-9]+)"); for (String model : models) { Matcher m = p.matcher(model); if (m.find()) { String className = m.group().substring("class".length()).trim(); File classFile = new File(parentFile, className + ".java"); Writer o = new FileWriter(classFile, false); PrintWriter writer = new PrintWriter(new BufferedWriter(o)); writer.write(model); writer.close(); System.out.println("Generated " + classFile.getAbsolutePath()); } } } catch (IOException io) { throw DbException.convertIOException(io, "could not generate model").getSQLException(); } finally { JdbcUtils.closeSilently(conn); } }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
protected SQLException throwUnsupportedOption(String option) throws SQLException { showUsage(); throw new SQLException("Unsupported option: " + option); }
(Lib) Exception 12
              
// in src/main/org/h2/tools/Server.java
public static void openBrowser(String url) throws Exception { try { String osName = StringUtils.toLowerEnglish(Utils.getProperty("os.name", "linux")); Runtime rt = Runtime.getRuntime(); String browser = Utils.getProperty(SysProperties.H2_BROWSER, null); if (browser != null) { if (browser.startsWith("call:")) { browser = browser.substring("call:".length()); Utils.callStaticMethod(browser, url); } else if (browser.indexOf("%url") >= 0) { String[] args = StringUtils.arraySplit(browser, ',', false); for (int i = 0; i < args.length; i++) { args[i] = StringUtils.replaceAll(args[i], "%url", url); } rt.exec(args); } else if (osName.indexOf("windows") >= 0) { rt.exec(new String[] { "cmd.exe", "/C", browser, url }); } else { rt.exec(new String[] { browser, url }); } return; } try { Class<?> desktopClass = Class.forName("java.awt.Desktop"); // Desktop.isDesktopSupported() Boolean supported = (Boolean) desktopClass. getMethod("isDesktopSupported"). invoke(null, new Object[0]); URI uri = new URI(url); if (supported) { // Desktop.getDesktop(); Object desktop = desktopClass.getMethod("getDesktop"). invoke(null, new Object[0]); // desktop.browse(uri); desktopClass.getMethod("browse", URI.class). invoke(desktop, uri); return; } } catch (Exception e) { // ignore } if (osName.indexOf("windows") >= 0) { rt.exec(new String[] { "rundll32", "url.dll,FileProtocolHandler", url }); } else if (osName.indexOf("mac") >= 0 || osName.indexOf("darwin") >= 0) { // Mac OS: to open a page with Safari, use "open -a Safari" Runtime.getRuntime().exec(new String[] { "open", url }); } else { String[] browsers = { "google-chrome", "firefox", "mozilla-firefox", "mozilla", "konqueror", "netscape", "opera", "midori" }; boolean ok = false; for (String b : browsers) { try { rt.exec(new String[] { b, url }); ok = true; break; } catch (Exception e) { // ignore and try the next } } if (!ok) { // No success in detection. throw new Exception("Browser detection failed and system property " + SysProperties.H2_BROWSER + " not set"); } } } catch (Exception e) { throw new Exception("Failed to start a browser to open the URL " + url + ": " + e.getMessage()); } }
// in src/tools/org/h2/build/doc/LinkChecker.java
private void listBadLinks() throws Exception { ArrayList<String> errors = new ArrayList<String>(); for (String link : links.keySet()) { if (!link.startsWith("http") && !link.endsWith("h2.pdf") && link.indexOf("_ja.") < 0) { if (targets.get(link) == null) { errors.add(links.get(link) + ": Link missing " + link); } } } for (String link : links.keySet()) { if (!link.startsWith("http")) { targets.remove(link); } } for (String name : targets.keySet()) { if (targets.get(name).equals("id")) { boolean ignore = false; for (String to : IGNORE_MISSING_LINKS_TO) { if (name.indexOf(to) >= 0) { ignore = true; break; } } if (!ignore) { errors.add("No link to " + name); } } } Collections.sort(errors); for (String error : errors) { System.out.println(error); } if (errors.size() > 0) { throw new Exception("Problems where found by the Link Checker"); } }
// in src/tools/org/h2/build/doc/XMLChecker.java
private static void checkXML(String xml, boolean html) throws Exception { // String lastElement = null; // <li>: replace <li>([^\r]*[^<]*) with <li>$1</li> // use this for html file, for example if <li> is not closed String[] noClose = {}; XMLParser parser = new XMLParser(xml); Stack<Object[]> stack = new Stack<Object[]>(); boolean rootElement = false; while (true) { int event = parser.next(); if (event == XMLParser.END_DOCUMENT) { break; } else if (event == XMLParser.START_ELEMENT) { if (stack.size() == 0) { if (rootElement) { throw new Exception("Second root element at " + parser.getRemaining()); } rootElement = true; } String name = parser.getName(); if (html) { for (String n : noClose) { if (name.equals(n)) { name = null; break; } } } if (name != null) { stack.add(new Object[] { name, parser.getPos() }); } } else if (event == XMLParser.END_ELEMENT) { String name = parser.getName(); if (html) { for (String n : noClose) { if (name.equals(n)) { throw new Exception("Unnecessary closing element " + name + " at " + parser.getRemaining()); } } } while (true) { Object[] pop = stack.pop(); String p = (String) pop[0]; if (p.equals(name)) { break; } String remaining = xml.substring((Integer) pop[1]); if (remaining.length() > 100) { remaining = remaining.substring(0, 100); } throw new Exception("Unclosed element " + p + " at " + remaining); } } else if (event == XMLParser.CHARACTERS) { // lastElement = parser.getText(); } else if (event == XMLParser.DTD) { // ignore } else if (event == XMLParser.COMMENT) { // ignore } else { int eventType = parser.getEventType(); throw new Exception("Unexpected event " + eventType + " at " + parser.getRemaining()); } } if (stack.size() != 0) { throw new Exception("Unclosed root element"); } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static String extract(String documentName, File f, String target) throws Exception { String xml = IOUtils.readStringAndClose(new InputStreamReader(new FileInputStream(f), "UTF-8"), -1); // the template contains ${} instead of text StringBuilder template = new StringBuilder(xml.length()); int id = 0; SortedProperties prop = new SortedProperties(); XMLParser parser = new XMLParser(xml); StringBuilder buff = new StringBuilder(); Stack<String> stack = new Stack<String>(); String tag = ""; boolean ignoreEnd = false; String nextKey = ""; // for debugging boolean templateIsCopy = false; while (true) { int event = parser.next(); if (event == XMLParser.END_DOCUMENT) { break; } else if (event == XMLParser.CHARACTERS) { String s = parser.getText(); if (s.trim().length() == 0) { if (buff.length() > 0) { buff.append(s); } else { template.append(s); } } else if ("p".equals(tag) || "li".equals(tag) || "a".equals(tag) || "td".equals(tag) || "th".equals(tag) || "h1".equals(tag) || "h2".equals(tag) || "h3".equals(tag) || "h4".equals(tag) || "body".equals(tag) || "b".equals(tag) || "code".equals(tag) || "form".equals(tag) || "span".equals(tag) || "em".equals(tag) || "div".equals(tag) || "label".equals(tag)) { if (buff.length() == 0) { nextKey = documentName + "_" + (1000 + id++) + "_" + tag; template.append(getSpace(s, true)); } else if (templateIsCopy) { buff.append(getSpace(s, true)); } buff.append(s); } else if ("pre".equals(tag) || "title".equals(tag) || "script".equals(tag) || "style".equals(tag)) { // ignore, don't translate template.append(s); } else { System.out.println(f.getName() + " invalid wrapper tag for text: " + tag + " text: " + s); System.out.println(parser.getRemaining()); throw new Exception(); } } else if (event == XMLParser.START_ELEMENT) { stack.add(tag); String name = parser.getName(); if ("code".equals(name) || "a".equals(name) || "b".equals(name) || "span".equals(name)) { // keep tags if wrapped, but not if this is the wrapper if (buff.length() > 0) { buff.append(parser.getToken()); ignoreEnd = false; } else { ignoreEnd = true; template.append(parser.getToken()); } } else if ("p".equals(tag) || "li".equals(tag) || "td".equals(tag) || "th".equals(tag) || "h1".equals(tag) || "h2".equals(tag) || "h3".equals(tag) || "h4".equals(tag) || "body".equals(tag) || "form".equals(tag)) { if (buff.length() > 0) { if (templateIsCopy) { template.append(buff.toString()); } else { template.append("${" + nextKey + "}"); } add(prop, nextKey, buff); } template.append(parser.getToken()); } else { template.append(parser.getToken()); } tag = name; } else if (event == XMLParser.END_ELEMENT) { String name = parser.getName(); if ("code".equals(name) || "a".equals(name) || "b".equals(name) || "span".equals(name) || "em".equals(name)) { if (ignoreEnd) { if (buff.length() > 0) { if (templateIsCopy) { template.append(buff.toString()); } else { template.append("${" + nextKey + "}"); } add(prop, nextKey, buff); } template.append(parser.getToken()); } else { if (buff.length() > 0) { buff.append(parser.getToken()); } } } else { if (buff.length() > 0) { if (templateIsCopy) { template.append(buff.toString()); } else { template.append("${" + nextKey + "}"); } add(prop, nextKey, buff); } template.append(parser.getToken()); } tag = stack.pop(); } else if (event == XMLParser.DTD) { template.append(parser.getToken()); } else if (event == XMLParser.COMMENT) { template.append(parser.getToken()); } else { int eventType = parser.getEventType(); throw new Exception("Unexpected event " + eventType + " at " + parser.getRemaining()); } // if(!xml.startsWith(template.toString())) { // System.out.println(nextKey); // System.out.println(template.substring(template.length()-60) // +";"); // System.out.println(xml.substring(template.length()-60, // template.length())); // System.out.println(template.substring(template.length()-55) // +";"); // System.out.println(xml.substring(template.length()-55, // template.length())); // break; // } } new File(target).mkdirs(); String propFileName = target + "/_docs_" + MAIN_LANGUAGE + ".properties"; Properties old = load(propFileName, false); prop.putAll(old); store(prop, propFileName, false); String t = template.toString(); if (templateIsCopy && !t.equals(xml)) { for (int i = 0; i < Math.min(t.length(), xml.length()); i++) { if (t.charAt(i) != xml.charAt(i)) { int start = Math.max(0, i - 30), end = Math.min(i + 30, xml.length()); t = t.substring(start, end); xml = xml.substring(start, end); } } System.out.println("xml--------------------------------------------------: "); System.out.println(xml); System.out.println("t---------------------------------------------------: "); System.out.println(t); System.exit(1); } return t; }
// in src/tools/org/h2/build/code/CheckTextFiles.java
private void run() throws Exception { String baseDir = "src"; check(new File(baseDir)); if (hasError) { throw new Exception("Errors found"); } }
// in src/tools/org/h2/build/code/CheckJavadoc.java
private void run() throws Exception { String baseDir = "src"; check(new File(baseDir)); if (errorCount > 0) { throw new Exception(errorCount + " errors found"); } }
1
              
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw new Exception("Failed to start a browser to open the URL " + url + ": " + e.getMessage()); }
60
              
// in src/main/org/h2/jmx/DatabaseInfo.java
public static void unregisterMBean(String name) throws Exception { ObjectName mbeanObjectName = MBEANS.remove(name); if (mbeanObjectName != null) { MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); mbeanServer.unregisterMBean(mbeanObjectName); } }
// in src/main/org/h2/tools/Server.java
public static void openBrowser(String url) throws Exception { try { String osName = StringUtils.toLowerEnglish(Utils.getProperty("os.name", "linux")); Runtime rt = Runtime.getRuntime(); String browser = Utils.getProperty(SysProperties.H2_BROWSER, null); if (browser != null) { if (browser.startsWith("call:")) { browser = browser.substring("call:".length()); Utils.callStaticMethod(browser, url); } else if (browser.indexOf("%url") >= 0) { String[] args = StringUtils.arraySplit(browser, ',', false); for (int i = 0; i < args.length; i++) { args[i] = StringUtils.replaceAll(args[i], "%url", url); } rt.exec(args); } else if (osName.indexOf("windows") >= 0) { rt.exec(new String[] { "cmd.exe", "/C", browser, url }); } else { rt.exec(new String[] { browser, url }); } return; } try { Class<?> desktopClass = Class.forName("java.awt.Desktop"); // Desktop.isDesktopSupported() Boolean supported = (Boolean) desktopClass. getMethod("isDesktopSupported"). invoke(null, new Object[0]); URI uri = new URI(url); if (supported) { // Desktop.getDesktop(); Object desktop = desktopClass.getMethod("getDesktop"). invoke(null, new Object[0]); // desktop.browse(uri); desktopClass.getMethod("browse", URI.class). invoke(desktop, uri); return; } } catch (Exception e) { // ignore } if (osName.indexOf("windows") >= 0) { rt.exec(new String[] { "rundll32", "url.dll,FileProtocolHandler", url }); } else if (osName.indexOf("mac") >= 0 || osName.indexOf("darwin") >= 0) { // Mac OS: to open a page with Safari, use "open -a Safari" Runtime.getRuntime().exec(new String[] { "open", url }); } else { String[] browsers = { "google-chrome", "firefox", "mozilla-firefox", "mozilla", "konqueror", "netscape", "opera", "midori" }; boolean ok = false; for (String b : browsers) { try { rt.exec(new String[] { b, url }); ok = true; break; } catch (Exception e) { // ignore and try the next } } if (!ok) { // No success in detection. throw new Exception("Browser detection failed and system property " + SysProperties.H2_BROWSER + " not set"); } } } catch (Exception e) { throw new Exception("Failed to start a browser to open the URL " + url + ": " + e.getMessage()); } }
// in src/main/org/h2/util/Utils.java
public static Object callStaticMethod(String classAndMethod, Object... params) throws Exception { int lastDot = classAndMethod.lastIndexOf('.'); String className = classAndMethod.substring(0, lastDot); String methodName = classAndMethod.substring(lastDot + 1); return callMethod(null, Class.forName(className), methodName, params); }
// in src/main/org/h2/util/Utils.java
public static Object callMethod( Object instance, String methodName, Object... params) throws Exception { return callMethod(instance, instance.getClass(), methodName, params); }
// in src/main/org/h2/util/Utils.java
private static Object callMethod( Object instance, Class<?> clazz, String methodName, Object... params) throws Exception { Method best = null; int bestMatch = 0; boolean isStatic = instance == null; for (Method m : clazz.getMethods()) { if (Modifier.isStatic(m.getModifiers()) == isStatic && m.getName().equals(methodName)) { int p = match(m.getParameterTypes(), params); if (p > bestMatch) { bestMatch = p; best = m; } } } if (best == null) { throw new NoSuchMethodException(methodName); } return best.invoke(instance, params); }
// in src/main/org/h2/util/Utils.java
public static Object newInstance(String className, Object... params) throws Exception { Constructor<?> best = null; int bestMatch = 0; for (Constructor<?> c : Class.forName(className).getConstructors()) { int p = match(c.getParameterTypes(), params); if (p > bestMatch) { bestMatch = p; best = c; } } if (best == null) { throw new NoSuchMethodException(className); } return best.newInstance(params); }
// in src/main/org/h2/util/Utils.java
public static Object getStaticField(String classAndField) throws Exception { int lastDot = classAndField.lastIndexOf('.'); String className = classAndField.substring(0, lastDot); String fieldName = classAndField.substring(lastDot + 1); return Class.forName(className).getField(fieldName).get(null); }
// in src/main/org/h2/util/Utils.java
public static Object getField(Object instance, String fieldName) throws Exception { return instance.getClass().getField(fieldName).get(instance); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendDataRow(ResultSet rs) throws Exception { int columns = rs.getMetaData().getColumnCount(); String[] values = new String[columns]; for (int i = 0; i < columns; i++) { values[i] = rs.getString(i + 1); } startMessage('D'); writeShort(columns); for (String s : values) { if (s == null) { writeInt(-1); } else { // TODO write Binary data byte[] d2 = s.getBytes(getEncoding()); writeInt(d2.length); write(d2); } } sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendRowDescription(ResultSetMetaData meta) throws Exception { if (meta == null) { sendNoData(); } else { int columns = meta.getColumnCount(); int[] types = new int[columns]; int[] precision = new int[columns]; String[] names = new String[columns]; for (int i = 0; i < columns; i++) { String name = meta.getColumnName(i + 1); names[i] = name; int type = meta.getColumnType(i + 1); type = PgServer.convertType(type); // the ODBC client needs the column pg_catalog.pg_index // to be of type 'int2vector' // if (name.equalsIgnoreCase("indkey") && // "pg_index".equalsIgnoreCase(meta.getTableName(i + 1))) { // type = PgServer.PG_TYPE_INT2VECTOR; // } precision[i] = meta.getColumnDisplaySize(i + 1); server.checkType(type); types[i] = type; } startMessage('T'); writeShort(columns); for (int i = 0; i < columns; i++) { writeString(StringUtils.toLowerEnglish(names[i])); // object ID writeInt(0); // attribute number of the column writeShort(0); // data type writeInt(types[i]); // pg_type.typlen writeShort(getTypeSize(types[i], precision[i])); // pg_attribute.atttypmod writeInt(-1); // text writeShort(0); } sendMessage(); } }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
public static void main(String... args) throws Exception { new PgTcpRedirect().loop(args); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
private void loop(String... args) throws Exception { // MySQL protocol: // http://www.redferni.uklinux.net/mysql/MySQL-Protocol.html // PostgreSQL protocol: // http://developer.postgresql.org/pgdocs/postgres/protocol.html // int portServer = 9083, portClient = 9084; // int portServer = 3306, portClient = 3307; // H2 PgServer // int portServer = 5435, portClient = 5433; // PostgreSQL int portServer = 5432, portClient = 5433; for (int i = 0; i < args.length; i++) { if ("-client".equals(args[i])) { portClient = Integer.parseInt(args[++i]); } else if ("-server".equals(args[i])) { portServer = Integer.parseInt(args[++i]); } } ServerSocket listener = new ServerSocket(portClient); while (true) { Socket client = listener.accept(); Socket server = new Socket("localhost", portServer); TcpRedirectThread c = new TcpRedirectThread(client, server, true); TcpRedirectThread s = new TcpRedirectThread(server, client, false); new Thread(c).start(); new Thread(s).start(); } }
// in src/tools/org/h2/dev/util/ThreadDumpFilter.java
public static void main(String... a) throws Exception { LineNumberReader in = new LineNumberReader(new InputStreamReader(System.in)); for (String s; (s = in.readLine()) != null;) { if (s.startsWith("Full thread")) { do { System.out.println(s); s = in.readLine(); } while(s != null && (s.length() == 0 || " \t\"".indexOf(s.charAt(0)) >= 0)); } }
// in src/tools/org/h2/dev/util/Migrate.java
public static void main(String... args) throws Exception { new Migrate().execute(new File(args.length == 1 ? args[0] : "."), true, USER, PASSWORD, false); }
// in src/tools/org/h2/dev/util/Migrate.java
public void execute(File file, boolean recursive, String user, String password, boolean runQuiet) throws Exception { String pathToJavaExe = getJavaExecutablePath(); this.quiet = runQuiet; if (file.isDirectory() && recursive) { for (File f : file.listFiles()) { execute(f, recursive, user, password, runQuiet); } return; } if (!file.getName().endsWith(".data.db")) { return; } println("Migrating " + file.getName()); if (!OLD_H2_FILE.exists()) { download(OLD_H2_FILE.getAbsolutePath(), DOWNLOAD_URL, CHECKSUM); } String url = "jdbc:h2:" + file.getAbsolutePath(); url = url.substring(0, url.length() - ".data.db".length()); exec(new String[] { pathToJavaExe, "-Xmx128m", "-cp", OLD_H2_FILE.getAbsolutePath(), "org.h2.tools.Script", "-script", TEMP_SCRIPT, "-url", url, "-user", user, "-password", password }); file.renameTo(new File(file.getAbsoluteFile() + ".backup")); RunScript.execute(url, user, password, TEMP_SCRIPT, "UTF-8", true); new File(TEMP_SCRIPT).delete(); }
// in src/tools/org/h2/dev/security/SecureKeyStoreBuilder.java
public static void main(String... args) throws Exception { String password = CipherFactory.KEYSTORE_PASSWORD; KeyStore store = CipherFactory.getKeyStore(password); printKeystore(store, password); }
// in src/tools/org/h2/build/indexer/Indexer.java
public static void main(String... args) throws Exception { new Indexer().run(args); }
// in src/tools/org/h2/build/indexer/Indexer.java
private void run(String... args) throws Exception { String dir = "docs"; String destDir = "docs/html"; for (int i = 0; i < args.length; i++) { if (args[i].equals("-dir")) { dir = args[++i]; } else if (args[i].equals("-destDir")) { destDir = args[++i]; } } File file = new File(dir); setNoIndex("index.html", "html/header.html", "html/search.html", "html/frame.html", "html/fragments.html", "html/sourceError.html", "html/source.html", "html/mainWeb.html", "javadoc/index.html", "javadoc/classes.html", "javadoc/allclasses-frame.html", "javadoc/allclasses-noframe.html", "javadoc/constant-values.html", "javadoc/overview-frame.html", "javadoc/overview-summary.html", "javadoc/serialized-form.html"); output = new PrintWriter(new FileWriter(destDir + "/index.js")); readPages("", file, 0); output.println("var pages=new Array();"); output.println("var ref=new Array();"); output.println("var ignored='';"); output.println("function Page(title, file) { this.title=title; this.file=file; }"); output.println("function load() {"); sortWords(); removeOverflowRelations(); sortPages(); listPages(); listWords(); output.println("}"); output.close(); }
// in src/tools/org/h2/build/indexer/Indexer.java
private void readPages(String dir, File file, int level) throws Exception { String name = file.getName(); String fileName = dir.length() > 0 ? dir + "/" + name : level > 0 ? name : ""; if (file.isDirectory()) { for (File f : file.listFiles()) { readPages(fileName, f, level + 1); } return; } String lower = StringUtils.toLowerEnglish(name); if (!lower.endsWith(".html") && !lower.endsWith(".htm")) { return; } if (lower.indexOf("_ja.") >= 0) { return; } if (!noIndex.contains(fileName)) { page = new Page(pages.size(), fileName); pages.add(page); readPage(file); } }
// in src/tools/org/h2/build/indexer/Indexer.java
private void readPage(File file) throws Exception { byte[] data = IOUtils.readBytesAndClose(new FileInputStream(file), 0); String text = new String(data, "UTF-8"); StringTokenizer t = new StringTokenizer(text, "<> \r\n", true); boolean inTag = false; title = false; heading = false; while (t.hasMoreTokens()) { String token = t.nextToken(); if (token.length() == 1) { char c = token.charAt(0); switch (c) { case '<': { if (inTag) { process("???"); } inTag = true; if (!t.hasMoreTokens()) { break; } token = t.nextToken(); if (token.startsWith("/")) { title = false; heading = false; } else if (token.equalsIgnoreCase("title")) { title = true; } else if (token.length() == 2 && Character.toLowerCase(token.charAt(0)) == 'h' && Character.isDigit(token.charAt(1))) { heading = true; } // TODO maybe skip script tags? break; } case '>': { if (!inTag) { process("???"); } inTag = false; break; } case '\r': case '\n': case ' ': break; default: if (!inTag) { process(token); } } } else { if (!inTag) { process(token); } } } if (page.title == null || page.title.trim().length() == 0) { System.out.println("Error: not title found in " + file.getName()); page.title = file.getName(); } page.title = page.title.trim(); }
// in src/tools/org/h2/build/doc/UploadBuild.java
public static void main(String... args) throws Exception { System.setProperty("h2.socketConnectTimeout", "30000"); String password = System.getProperty("h2.ftpPassword"); if (password == null) { return; } FtpClient ftp = FtpClient.open("h2database.com"); ftp.login("h2database", password); ftp.changeWorkingDirectory("/httpdocs"); boolean coverage = new File("coverage/index.html").exists(); boolean coverageFailed; if (coverage) { byte[] data = IOUtils.readBytesAndClose(new FileInputStream("coverage/index.html"), -1); String index = new String(data, "ISO-8859-1"); coverageFailed = index.indexOf("CLASS=\"h\"") >= 0; while (true) { int idx = index.indexOf("<A HREF=\""); if (idx < 0) { break; } int end = index.indexOf('>', idx) + 1; index = index.substring(0, idx) + index.substring(end); idx = index.indexOf("</A>"); index = index.substring(0, idx) + index.substring(idx + "</A>".length()); } index = StringUtils.replaceAll(index, "[all", ""); index = StringUtils.replaceAll(index, "classes]", ""); FileOutputStream out = new FileOutputStream("coverage/overview.html"); out.write(index.getBytes("ISO-8859-1")); out.close(); new File("details").mkdir(); zip("details/coverage_files.zip", "coverage", true); zip("coverage.zip", "details", false); FileUtils.delete("coverage.txt"); FileUtils.delete("details/coverage_files.zip"); FileUtils.delete("details"); if (ftp.exists("/httpdocs", "coverage")) { ftp.removeDirectoryRecursive("/httpdocs/coverage"); } ftp.makeDirectory("/httpdocs/coverage"); } else { coverageFailed = true; } String testOutput; boolean error; if (new File("docs/html/testOutput.html").exists()) { testOutput = IOUtils.readStringAndClose(new FileReader("docs/html/testOutput.html"), -1); error = testOutput.indexOf(OutputCatcher.START_ERROR) >= 0; } else if (new File("log.txt").exists()) { testOutput = IOUtils.readStringAndClose(new FileReader("log.txt"), -1); error = true; } else { testOutput = "No log.txt"; error = true; } if (!ftp.exists("/httpdocs", "automated")) { ftp.makeDirectory("/httpdocs/automated"); } String buildSql; if (ftp.exists("/httpdocs/automated", "history.sql")) { buildSql = new String(ftp.retrieve("/httpdocs/automated/history.sql")); } else { buildSql = "create table item(id identity, title varchar, issued timestamp, desc varchar);\n"; } String ts = new java.sql.Timestamp(System.currentTimeMillis()).toString(); String now = ts.substring(0, 16); int idx = testOutput.indexOf("Statements per second: "); if (idx >= 0) { int end = testOutput.indexOf("<br />", idx); if (end >= 0) { String result = testOutput.substring(idx + "Statements per second: ".length(), end); now += " (" + result + " op/s)"; } } String sql = "insert into item(title, issued, desc) values('Build " + now + (error ? " [FAILED]" : "") + (coverageFailed ? " [COVERAGE]" : "") + "', '" + ts + "', '<a href=\"http://www.h2database.com/html/testOutput.html\">Output</a>" + " - <a href=\"http://www.h2database.com/coverage/overview.html\">Coverage</a>" + " - <a href=\"http://www.h2database.com/automated/h2-latest.jar\">Jar</a>');\n"; buildSql += sql; Connection conn; try { Class.forName("org.h2.Driver"); conn = DriverManager.getConnection("jdbc:h2:mem:"); } catch (Exception e) { Class.forName("org.h2.upgrade.v1_1.Driver"); conn = DriverManager.getConnection("jdbc:h2v1_1:mem:"); } conn.createStatement().execute(buildSql); String newsfeed = IOUtils.readStringAndClose(new FileReader("src/tools/org/h2/build/doc/buildNewsfeed.sql"), -1); ScriptReader r = new ScriptReader(new StringReader(newsfeed)); Statement stat = conn.createStatement(); ResultSet rs = null; while (true) { String s = r.readStatement(); if (s == null) { break; } if (stat.execute(s)) { rs = stat.getResultSet(); } } rs.next(); String content = rs.getString("content"); conn.close(); ftp.store("/httpdocs/automated/history.sql", new ByteArrayInputStream(buildSql.getBytes())); ftp.store("/httpdocs/automated/news.xml", new ByteArrayInputStream(content.getBytes())); ftp.store("/httpdocs/html/testOutput.html", new ByteArrayInputStream(testOutput.getBytes())); String jarFileName = "bin/h2-" + Constants.getVersion() + ".jar"; if (FileUtils.exists(jarFileName)) { ftp.store("/httpdocs/automated/h2-latest.jar", new FileInputStream(jarFileName)); } if (coverage) { ftp.store("/httpdocs/coverage/overview.html", new FileInputStream("coverage/overview.html")); ftp.store("/httpdocs/coverage/coverage.zip", new FileInputStream("coverage.zip")); FileUtils.delete("coverage.zip"); } ftp.close(); }
// in src/tools/org/h2/build/doc/MergeDocs.java
public static void main(String... args) throws Exception { new MergeDocs().run(); }
// in src/tools/org/h2/build/doc/MergeDocs.java
private void run() throws Exception { // the order of pages is important here String[] pages = { "quickstart.html", "installation.html", "tutorial.html", "features.html", "performance.html", "advanced.html", "grammar.html", "functions.html", "datatypes.html", "build.html", "history.html", "faq.html" }; StringBuilder buff = new StringBuilder(); for (String fileName : pages) { String text = getContent(fileName); for (String page : pages) { text = StringUtils.replaceAll(text, page + "#", "#"); } text = disableRailroads(text); text = removeHeaderFooter(fileName, text); buff.append(text); } String finalText = buff.toString(); File output = new File(baseDir, "onePage.html"); PrintWriter writer = new PrintWriter(new FileWriter(output)); writer.println("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /><title>"); writer.println("H2 Documentation"); writer.println("</title><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheetPdf.css\" /></head><body>"); writer.println("<h1>H2 Database Engine</h1>"); writer.println("<p>Version " + Constants.getFullVersion() + "</p>"); writer.println(finalText); writer.println("</body></html>"); writer.close(); }
// in src/tools/org/h2/build/doc/MergeDocs.java
private String getContent(String fileName) throws Exception { File file = new File(baseDir, fileName); int length = (int) file.length(); char[] data = new char[length]; FileReader reader = new FileReader(file); int off = 0; while (length > 0) { int len = reader.read(data, off, length); off += len; length -= len; } reader.close(); String s = new String(data); return s; }
// in src/tools/org/h2/build/doc/WebSite.java
public static void main(String... args) throws Exception { new WebSite().run(); }
// in src/tools/org/h2/build/doc/WebSite.java
private void run() throws Exception { // create the web site deleteRecursive(new File(webDir)); loadFragments(); copy(new File(sourceDir), new File(webDir), true, true); Newsfeed.main(webDir + "/html"); // create the internal documentation copy(new File(sourceDir), new File(sourceDir), true, false); }
// in src/tools/org/h2/build/doc/LinkChecker.java
public static void main(String... args) throws Exception { new LinkChecker().run(args); }
// in src/tools/org/h2/build/doc/LinkChecker.java
private void run(String... args) throws Exception { String dir = "docs"; for (int i = 0; i < args.length; i++) { if ("-dir".equals(args[i])) { dir = args[++i]; } } process(dir); listExternalLinks(); listBadLinks(); }
// in src/tools/org/h2/build/doc/LinkChecker.java
private void listBadLinks() throws Exception { ArrayList<String> errors = new ArrayList<String>(); for (String link : links.keySet()) { if (!link.startsWith("http") && !link.endsWith("h2.pdf") && link.indexOf("_ja.") < 0) { if (targets.get(link) == null) { errors.add(links.get(link) + ": Link missing " + link); } } } for (String link : links.keySet()) { if (!link.startsWith("http")) { targets.remove(link); } } for (String name : targets.keySet()) { if (targets.get(name).equals("id")) { boolean ignore = false; for (String to : IGNORE_MISSING_LINKS_TO) { if (name.indexOf(to) >= 0) { ignore = true; break; } } if (!ignore) { errors.add("No link to " + name); } } } Collections.sort(errors); for (String error : errors) { System.out.println(error); } if (errors.size() > 0) { throw new Exception("Problems where found by the Link Checker"); } }
// in src/tools/org/h2/build/doc/LinkChecker.java
private void process(String path) throws Exception { if (path.endsWith("/CVS") || path.endsWith("/.svn")) { return; } File file = new File(path); if (file.isDirectory()) { for (String n : file.list()) { process(path + "/" + n); } } else { processFile(path); } }
// in src/tools/org/h2/build/doc/LinkChecker.java
private void processFile(String path) throws Exception { targets.put(path, "file"); String lower = StringUtils.toLowerEnglish(path); if (!lower.endsWith(".html") && !lower.endsWith(".htm")) { return; } String fileName = new File(path).getName(); String parent = path.substring(0, path.lastIndexOf('/')); String html = IOUtils.readStringAndClose(new FileReader(path), -1); int idx = -1; while (true) { idx = html.indexOf(" id=\"", idx + 1); if (idx < 0) { break; } int start = idx + " id=\"".length(); int end = html.indexOf("\"", start); if (end < 0) { error(fileName, "Expected \" after id= " + html.substring(idx, idx + 100)); } String ref = html.substring(start, end); if (!ref.startsWith("_")) { targets.put(path + "#" + ref, "id"); } } idx = -1; while (true) { idx = html.indexOf(" href=\"", idx + 1); if (idx < 0) { break; } int start = html.indexOf("\"", idx); if (start < 0) { error(fileName, "Expected \" after href= at " + html.substring(idx, idx + 100)); } int end = html.indexOf("\"", start + 1); if (end < 0) { error(fileName, "Expected \" after href= at " + html.substring(idx, idx + 100)); } String ref = html.substring(start + 1, end); if (ref.startsWith("http:") || ref.startsWith("https:")) { // ok } else if (ref.startsWith("javascript:")) { ref = null; // ok } else if (ref.length() == 0) { ref = null; // ok } else if (ref.startsWith("#")) { ref = path + ref; } else { String p = parent; while (ref.startsWith(".")) { if (ref.startsWith("./")) { ref = ref.substring(2); } else if (ref.startsWith("../")) { ref = ref.substring(3); p = p.substring(0, p.lastIndexOf('/')); } } ref = p + "/" + ref; } if (ref != null) { links.put(ref, path); } } idx = -1; while (true) { idx = html.indexOf("<a ", idx + 1); if (idx < 0) { break; } int equals = html.indexOf("=", idx); if (equals < 0) { error(fileName, "Expected = after <a at " + html.substring(idx, idx + 100)); } String type = html.substring(idx + 2, equals).trim(); int start = html.indexOf("\"", idx); if (start < 0) { error(fileName, "Expected \" after <a at " + html.substring(idx, idx + 100)); } int end = html.indexOf("\"", start + 1); if (end < 0) { error(fileName, "Expected \" after <a at " + html.substring(idx, idx + 100)); } String ref = html.substring(start + 1, end); if (type.equals("href")) { // already checked } else if (type.equals("id")) { targets.put(path + "#" + ref, "id"); } else { error(fileName, "Unsupported <a ?: " + html.substring(idx, idx + 100)); } } }
// in src/tools/org/h2/build/doc/GenerateHelp.java
public static void main(String... args) throws Exception { String in = "src/docsrc/help/help.csv"; String out = "src/main/org/h2/res/help.csv"; Csv csv = new Csv(); csv.setLineCommentCharacter('#'); ResultSet rs = csv.read(in, null, null); SimpleResultSet rs2 = new SimpleResultSet(); ResultSetMetaData meta = rs.getMetaData(); int columnCount = meta.getColumnCount() - 1; for (int i = 0; i < columnCount; i++) { rs2.addColumn(meta.getColumnLabel(1 + i), Types.VARCHAR, 0, 0); } while (rs.next()) { Object[] row = new Object[columnCount]; for (int i = 0; i < columnCount; i++) { String s = rs.getString(1 + i); if (i == 3) { int dot = s.indexOf('.'); if (dot >= 0) { s = s.substring(0, dot + 1); } } row[i] = s; } rs2.addRow(row); } BufferedWriter writer = new BufferedWriter(new FileWriter(out)); writer.write("# Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License,\n" + "# Version 1.0, and under the Eclipse Public License, Version 1.0\n" + "# (http://h2database.com/html/license.html).\n" + "# Initial Developer: H2 Group)\n"); csv = new Csv(); csv.setLineSeparator("\n"); csv.write(writer, rs2); }
// in src/tools/org/h2/build/doc/GenerateDoc.java
public static void main(String... args) throws Exception { new GenerateDoc().run(args); }
// in src/tools/org/h2/build/doc/GenerateDoc.java
private void run(String... args) throws Exception { for (int i = 0; i < args.length; i++) { if (args[i].equals("-in")) { inDir = args[++i]; } else if (args[i].equals("-out")) { outDir = args[++i]; } } Class.forName("org.h2.Driver"); conn = DriverManager.getConnection("jdbc:h2:mem:"); new File(outDir).mkdirs(); new RailroadImages().run(outDir + "/images"); bnf = Bnf.getInstance(null); bnf.linkStatements(); session.put("version", Constants.getVersion()); session.put("versionDate", Constants.BUILD_DATE); session.put("stableVersion", Constants.getVersionStable()); session.put("stableVersionDate", Constants.BUILD_DATE_STABLE); // String help = "SELECT * FROM INFORMATION_SCHEMA.HELP WHERE SECTION"; String help = "SELECT ROWNUM ID, * FROM CSVREAD('" + inHelp + "', NULL, 'lineComment=#') WHERE SECTION "; map("commands", help + "LIKE 'Commands%' ORDER BY ID", true); map("commandsDML", help + "= 'Commands (DML)' ORDER BY ID", false); map("commandsDDL", help + "= 'Commands (DDL)' ORDER BY ID", false); map("commandsOther", help + "= 'Commands (Other)' ORDER BY ID", false); map("otherGrammar", help + "= 'Other Grammar' ORDER BY ID", true); map("functionsAggregate", help + "= 'Functions (Aggregate)' ORDER BY ID", false); map("functionsNumeric", help + "= 'Functions (Numeric)' ORDER BY ID", false); map("functionsString", help + "= 'Functions (String)' ORDER BY ID", false); map("functionsTimeDate", help + "= 'Functions (Time and Date)' ORDER BY ID", false); map("functionsSystem", help + "= 'Functions (System)' ORDER BY ID", false); map("functionsAll", help + "LIKE 'Functions%' ORDER BY SECTION, ID", true); map("dataTypes", help + "LIKE 'Data Types%' ORDER BY SECTION, ID", true); map("informationSchema", "SELECT TABLE_NAME TOPIC, GROUP_CONCAT(COLUMN_NAME " + "ORDER BY ORDINAL_POSITION SEPARATOR ', ') SYNTAX FROM INFORMATION_SCHEMA.COLUMNS " + "WHERE TABLE_SCHEMA='INFORMATION_SCHEMA' GROUP BY TABLE_NAME ORDER BY TABLE_NAME", false); processAll(""); conn.close(); }
// in src/tools/org/h2/build/doc/GenerateDoc.java
private void processAll(String dir) throws Exception { if (dir.endsWith(".svn")) { return; } File[] list = new File(inDir + "/" + dir).listFiles(); for (File file : list) { if (file.isDirectory()) { processAll(dir + file.getName()); } else { process(dir, file.getName()); } } }
// in src/tools/org/h2/build/doc/GenerateDoc.java
private void process(String dir, String fileName) throws Exception { String inFile = inDir + "/" + dir + "/" + fileName; String outFile = outDir + "/" + dir + "/" + fileName; new File(outFile).getParentFile().mkdirs(); FileOutputStream out = new FileOutputStream(outFile); FileInputStream in = new FileInputStream(inFile); byte[] bytes = IOUtils.readBytesAndClose(in, 0); if (fileName.endsWith(".html")) { String page = new String(bytes); page = PageParser.parse(page, session); bytes = page.getBytes(); } out.write(bytes); out.close(); }
// in src/tools/org/h2/build/doc/GenerateDoc.java
private void map(String key, String sql, boolean railroads) throws Exception { ResultSet rs = null; Statement stat = null; try { stat = conn.createStatement(); rs = stat.executeQuery(sql); ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); while (rs.next()) { HashMap<String, String> map = new HashMap<String, String>(); ResultSetMetaData meta = rs.getMetaData(); for (int i = 0; i < meta.getColumnCount(); i++) { String k = StringUtils.toLowerEnglish(meta.getColumnLabel(i + 1)); String value = rs.getString(i + 1); value = value.trim(); map.put(k, PageParser.escapeHtml(value)); } String topic = rs.getString("TOPIC"); String syntax = rs.getString("SYNTAX").trim(); if (railroads) { BnfRailroad r = new BnfRailroad(); String railroad = r.getHtml(bnf, syntax); map.put("railroad", railroad); } BnfSyntax visitor = new BnfSyntax(); String syntaxHtml = visitor.getHtml(bnf, syntax); map.put("syntax", syntaxHtml); // remove newlines in the regular text String text = map.get("text"); if (text != null) { // text is enclosed in <p> .. </p> so this works. text = StringUtils.replaceAll(text, "<br /><br />", "</p><p>"); text = StringUtils.replaceAll(text, "<br />", " "); text = addCode(text); map.put("text", text); } String link = topic.toLowerCase(); link = StringUtils.replaceAll(link, " ", "_"); // link = StringUtils.replaceAll(link, "_", ""); link = StringUtils.replaceAll(link, "@", "_"); map.put("link", StringUtils.urlEncode(link)); list.add(map); } session.put(key, list); int div = 3; int part = (list.size() + div - 1) / div; for (int i = 0, start = 0; i < div; i++, start += part) { List<HashMap<String, String>> listThird = list.subList(start, Math.min(start + part, list.size())); session.put(key + "-" + i, listThird); } } finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(stat); } }
// in src/tools/org/h2/build/doc/XMLChecker.java
public static void main(String... args) throws Exception { new XMLChecker().run(args); }
// in src/tools/org/h2/build/doc/XMLChecker.java
private void run(String... args) throws Exception { String dir = "."; for (int i = 0; i < args.length; i++) { if ("-dir".equals(args[i])) { dir = args[++i]; } } process(dir + "/src"); process(dir + "/docs"); }
// in src/tools/org/h2/build/doc/XMLChecker.java
private void process(String path) throws Exception { if (path.endsWith("/CVS") || path.endsWith("/.svn")) { return; } File file = new File(path); if (file.isDirectory()) { for (String name : file.list()) { process(path + "/" + name); } } else { processFile(path); } }
// in src/tools/org/h2/build/doc/XMLChecker.java
private static void processFile(String fileName) throws Exception { int idx = fileName.lastIndexOf('.'); if (idx < 0) { return; } String suffix = fileName.substring(idx + 1); if (!suffix.equals("html") && !suffix.equals("xml") && !suffix.equals("jsp")) { return; } // System.out.println("Checking file:" + fileName); FileReader reader = new FileReader(fileName); String s = IOUtils.readStringAndClose(reader, -1); Exception last = null; try { checkXML(s, !suffix.equals("xml")); } catch (Exception e) { last = e; System.out.println("ERROR in file " + fileName + " " + e.toString()); } if (last != null) { last.printStackTrace(); } }
// in src/tools/org/h2/build/doc/XMLChecker.java
private static void checkXML(String xml, boolean html) throws Exception { // String lastElement = null; // <li>: replace <li>([^\r]*[^<]*) with <li>$1</li> // use this for html file, for example if <li> is not closed String[] noClose = {}; XMLParser parser = new XMLParser(xml); Stack<Object[]> stack = new Stack<Object[]>(); boolean rootElement = false; while (true) { int event = parser.next(); if (event == XMLParser.END_DOCUMENT) { break; } else if (event == XMLParser.START_ELEMENT) { if (stack.size() == 0) { if (rootElement) { throw new Exception("Second root element at " + parser.getRemaining()); } rootElement = true; } String name = parser.getName(); if (html) { for (String n : noClose) { if (name.equals(n)) { name = null; break; } } } if (name != null) { stack.add(new Object[] { name, parser.getPos() }); } } else if (event == XMLParser.END_ELEMENT) { String name = parser.getName(); if (html) { for (String n : noClose) { if (name.equals(n)) { throw new Exception("Unnecessary closing element " + name + " at " + parser.getRemaining()); } } } while (true) { Object[] pop = stack.pop(); String p = (String) pop[0]; if (p.equals(name)) { break; } String remaining = xml.substring((Integer) pop[1]); if (remaining.length() > 100) { remaining = remaining.substring(0, 100); } throw new Exception("Unclosed element " + p + " at " + remaining); } } else if (event == XMLParser.CHARACTERS) { // lastElement = parser.getText(); } else if (event == XMLParser.DTD) { // ignore } else if (event == XMLParser.COMMENT) { // ignore } else { int eventType = parser.getEventType(); throw new Exception("Unexpected event " + eventType + " at " + parser.getRemaining()); } } if (stack.size() != 0) { throw new Exception("Unclosed root element"); } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
public static void main(String... args) throws Exception { String baseDir = "src/docsrc/textbase"; prepare(baseDir, "src/main/org/h2/res", true); prepare(baseDir, "src/main/org/h2/server/web/res", true); // convert the txt files to properties files PropertiesToUTF8.textUTF8ToProperties("src/docsrc/text/_docs_de.utf8.txt", "src/docsrc/text/_docs_de.properties"); PropertiesToUTF8.textUTF8ToProperties("src/docsrc/text/_docs_ja.utf8.txt", "src/docsrc/text/_docs_ja.properties"); // create the .jsp files and extract the text in the main language extractFromHtml("docs/html", "src/docsrc/text"); // add missing translations and create a new baseline prepare(baseDir, "src/docsrc/text", false); // create the translated documentation buildHtml("src/docsrc/text", "docs/html", "en"); // buildHtml("src/docsrc/text", "docs/html", "de"); // buildHtml("src/docsrc/text", "docs/html", "ja"); // convert the properties files back to utf8 text files, including the // main language (to be used as a template) PropertiesToUTF8.propertiesToTextUTF8("src/docsrc/text/_docs_en.properties", "src/docsrc/text/_docs_en.utf8.txt"); PropertiesToUTF8.propertiesToTextUTF8("src/docsrc/text/_docs_de.properties", "src/docsrc/text/_docs_de.utf8.txt"); PropertiesToUTF8.propertiesToTextUTF8("src/docsrc/text/_docs_ja.properties", "src/docsrc/text/_docs_ja.utf8.txt"); // delete temporary files for (File f : new File("src/docsrc/text").listFiles()) { if (!f.getName().endsWith(".utf8.txt")) { f.delete(); } } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static void extractFromHtml(String dir, String target) throws Exception { for (File f : new File(dir).listFiles()) { String name = f.getName(); if (!name.endsWith(".html")) { continue; } if (exclude(name)) { continue; } // remove '.html' name = name.substring(0, name.length() - 5); if (name.indexOf('_') >= 0) { // ignore translated files continue; } String template = extract(name, f, target); FileWriter writer = new FileWriter(target + "/" + name + ".jsp"); writer.write(template); writer.close(); } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static String extract(String documentName, File f, String target) throws Exception { String xml = IOUtils.readStringAndClose(new InputStreamReader(new FileInputStream(f), "UTF-8"), -1); // the template contains ${} instead of text StringBuilder template = new StringBuilder(xml.length()); int id = 0; SortedProperties prop = new SortedProperties(); XMLParser parser = new XMLParser(xml); StringBuilder buff = new StringBuilder(); Stack<String> stack = new Stack<String>(); String tag = ""; boolean ignoreEnd = false; String nextKey = ""; // for debugging boolean templateIsCopy = false; while (true) { int event = parser.next(); if (event == XMLParser.END_DOCUMENT) { break; } else if (event == XMLParser.CHARACTERS) { String s = parser.getText(); if (s.trim().length() == 0) { if (buff.length() > 0) { buff.append(s); } else { template.append(s); } } else if ("p".equals(tag) || "li".equals(tag) || "a".equals(tag) || "td".equals(tag) || "th".equals(tag) || "h1".equals(tag) || "h2".equals(tag) || "h3".equals(tag) || "h4".equals(tag) || "body".equals(tag) || "b".equals(tag) || "code".equals(tag) || "form".equals(tag) || "span".equals(tag) || "em".equals(tag) || "div".equals(tag) || "label".equals(tag)) { if (buff.length() == 0) { nextKey = documentName + "_" + (1000 + id++) + "_" + tag; template.append(getSpace(s, true)); } else if (templateIsCopy) { buff.append(getSpace(s, true)); } buff.append(s); } else if ("pre".equals(tag) || "title".equals(tag) || "script".equals(tag) || "style".equals(tag)) { // ignore, don't translate template.append(s); } else { System.out.println(f.getName() + " invalid wrapper tag for text: " + tag + " text: " + s); System.out.println(parser.getRemaining()); throw new Exception(); } } else if (event == XMLParser.START_ELEMENT) { stack.add(tag); String name = parser.getName(); if ("code".equals(name) || "a".equals(name) || "b".equals(name) || "span".equals(name)) { // keep tags if wrapped, but not if this is the wrapper if (buff.length() > 0) { buff.append(parser.getToken()); ignoreEnd = false; } else { ignoreEnd = true; template.append(parser.getToken()); } } else if ("p".equals(tag) || "li".equals(tag) || "td".equals(tag) || "th".equals(tag) || "h1".equals(tag) || "h2".equals(tag) || "h3".equals(tag) || "h4".equals(tag) || "body".equals(tag) || "form".equals(tag)) { if (buff.length() > 0) { if (templateIsCopy) { template.append(buff.toString()); } else { template.append("${" + nextKey + "}"); } add(prop, nextKey, buff); } template.append(parser.getToken()); } else { template.append(parser.getToken()); } tag = name; } else if (event == XMLParser.END_ELEMENT) { String name = parser.getName(); if ("code".equals(name) || "a".equals(name) || "b".equals(name) || "span".equals(name) || "em".equals(name)) { if (ignoreEnd) { if (buff.length() > 0) { if (templateIsCopy) { template.append(buff.toString()); } else { template.append("${" + nextKey + "}"); } add(prop, nextKey, buff); } template.append(parser.getToken()); } else { if (buff.length() > 0) { buff.append(parser.getToken()); } } } else { if (buff.length() > 0) { if (templateIsCopy) { template.append(buff.toString()); } else { template.append("${" + nextKey + "}"); } add(prop, nextKey, buff); } template.append(parser.getToken()); } tag = stack.pop(); } else if (event == XMLParser.DTD) { template.append(parser.getToken()); } else if (event == XMLParser.COMMENT) { template.append(parser.getToken()); } else { int eventType = parser.getEventType(); throw new Exception("Unexpected event " + eventType + " at " + parser.getRemaining()); } // if(!xml.startsWith(template.toString())) { // System.out.println(nextKey); // System.out.println(template.substring(template.length()-60) // +";"); // System.out.println(xml.substring(template.length()-60, // template.length())); // System.out.println(template.substring(template.length()-55) // +";"); // System.out.println(xml.substring(template.length()-55, // template.length())); // break; // } } new File(target).mkdirs(); String propFileName = target + "/_docs_" + MAIN_LANGUAGE + ".properties"; Properties old = load(propFileName, false); prop.putAll(old); store(prop, propFileName, false); String t = template.toString(); if (templateIsCopy && !t.equals(xml)) { for (int i = 0; i < Math.min(t.length(), xml.length()); i++) { if (t.charAt(i) != xml.charAt(i)) { int start = Math.max(0, i - 30), end = Math.min(i + 30, xml.length()); t = t.substring(start, end); xml = xml.substring(start, end); } } System.out.println("xml--------------------------------------------------: "); System.out.println(xml); System.out.println("t---------------------------------------------------: "); System.out.println(t); System.exit(1); } return t; }
// in src/tools/org/h2/build/i18n/PropertiesToUTF8.java
public static void main(String... args) throws Exception { convert("bin/org/h2/res"); convert("bin/org/h2/server/web/res"); }
// in src/tools/org/h2/build/i18n/PropertiesToUTF8.java
static void propertiesToTextUTF8(String source, String target) throws Exception { if (!new File(source).exists()) { return; } Properties prop = SortedProperties.loadProperties(source); FileOutputStream out = new FileOutputStream(target); PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, "UTF-8")); // keys is sorted for (Enumeration<Object> en = prop.keys(); en.hasMoreElements();) { String key = (String) en.nextElement(); String value = prop.getProperty(key, null); writer.print("@" + key + "\n"); writer.print(value + "\n\n"); } writer.close(); }
// in src/tools/org/h2/build/i18n/PropertiesToUTF8.java
static void textUTF8ToProperties(String source, String target) throws Exception { if (!new File(source).exists()) { return; } LineNumberReader reader = new LineNumberReader(new InputStreamReader(new FileInputStream(source), "UTF-8")); try { SortedProperties prop = new SortedProperties(); StringBuilder buff = new StringBuilder(); String key = null; boolean found = false; while (true) { String line = reader.readLine(); if (line == null) { break; } line = line.trim(); if (line.length() == 0) { continue; } if (line.startsWith("@")) { if (key != null) { prop.setProperty(key, buff.toString()); buff.setLength(0); } found = true; key = line.substring(1); } else { if (buff.length() > 0) { buff.append(System.getProperty("line.separator")); } buff.append(line); } } if (found) { prop.setProperty(key, buff.toString()); } prop.store(target); } finally { reader.close(); } }
// in src/tools/org/h2/build/i18n/PropertiesToUTF8.java
private static void convert(String source) throws Exception { for (File f : new File(source).listFiles()) { if (!f.getName().endsWith(".properties")) { continue; } FileInputStream in = new FileInputStream(f); InputStreamReader r = new InputStreamReader(in, "UTF-8"); String s = IOUtils.readStringAndClose(r, -1); in.close(); String name = f.getName(); String utf8, html; if (name.startsWith("utf8")) { utf8 = HtmlConverter.convertHtmlToString(s); html = HtmlConverter.convertStringToHtml(utf8); RandomAccessFile out = new RandomAccessFile("_" + name.substring(4), "rw"); out.write(html.getBytes()); out.setLength(out.getFilePointer()); out.close(); } else { new CheckTextFiles().checkOrFixFile(f, false, false); html = s; utf8 = HtmlConverter.convertHtmlToString(html); // s = unescapeHtml(s); utf8 = StringUtils.javaDecode(utf8); FileOutputStream out = new FileOutputStream("_utf8" + f.getName()); OutputStreamWriter w = new OutputStreamWriter(out, "UTF-8"); w.write(utf8); w.close(); out.close(); } String java = StringUtils.javaEncode(utf8); java = StringUtils.replaceAll(java, "\\r", "\r"); java = StringUtils.replaceAll(java, "\\n", "\n"); RandomAccessFile out = new RandomAccessFile("_java." + name, "rw"); out.write(java.getBytes()); out.setLength(out.getFilePointer()); out.close(); } }
// in src/tools/org/h2/build/code/CheckTextFiles.java
public static void main(String... args) throws Exception { new CheckTextFiles().run(); }
// in src/tools/org/h2/build/code/CheckTextFiles.java
private void run() throws Exception { String baseDir = "src"; check(new File(baseDir)); if (hasError) { throw new Exception("Errors found"); } }
// in src/tools/org/h2/build/code/CheckTextFiles.java
private void check(File file) throws Exception { String name = file.getName(); if (file.isDirectory()) { if (name.equals("CVS") || name.equals(".svn")) { return; } for (File f : file.listFiles()) { check(f); } } else { String suffix = ""; int lastDot = name.lastIndexOf('.'); if (lastDot >= 0) { suffix = name.substring(lastDot + 1); } boolean check = false, ignore = false; for (String s : SUFFIX_CHECK) { if (suffix.equals(s)) { check = true; } } // if (name.endsWith(".html") && name.indexOf("_ja") > 0) { // int todoRemoveJapaneseFiles; // // Japanese html files are UTF-8 at this time // check = false; // ignore = true; // } if (name.endsWith(".utf8.txt") || (name.startsWith("_docs_") && name.endsWith(".properties"))) { check = false; ignore = true; } for (String s : SUFFIX_IGNORE) { if (suffix.equals(s)) { ignore = true; } } boolean checkLicense = true; for (String ig : suffixIgnoreLicense) { if (suffix.equals(ig) || name.endsWith(ig)) { checkLicense = false; break; } } if (ignore == check) { throw new RuntimeException("Unknown suffix: " + suffix + " for file: " + file.getAbsolutePath()); } useCRLF = false; for (String s : SUFFIX_CRLF) { if (suffix.equals(s)) { useCRLF = true; break; } } if (check) { checkOrFixFile(file, autoFix, checkLicense); } } }
// in src/tools/org/h2/build/code/CheckTextFiles.java
public void checkOrFixFile(File file, boolean fix, boolean checkLicense) throws Exception { RandomAccessFile in = new RandomAccessFile(file, "r"); byte[] data = new byte[(int) file.length()]; ByteArrayOutputStream out = fix ? new ByteArrayOutputStream() : null; in.readFully(data); in.close(); if (checkLicense) { if (data.length > COPYRIGHT.length() + LICENSE.length()) { // don't check tiny files String text = new String(data); if (text.indexOf(COPYRIGHT) < 0) { fail(file, "copyright is missing", 0); } if (text.indexOf(LICENSE) < 0) { fail(file, "license is missing", 0); } if (text.indexOf("// " + "##") > 0) { fail(file, "unexpected space between // and ##", 0); } if (text.indexOf("/* " + "##") > 0) { fail(file, "unexpected space between /* and ##", 0); } if (text.indexOf("##" + " */") > 0) { fail(file, "unexpected space between ## and */", 0); } } } int line = 1; boolean lastWasWhitespace = false; for (int i = 0; i < data.length; i++) { char ch = (char) (data[i] & 0xff); boolean isWhitespace = Character.isWhitespace(ch); if (ch > 127) { fail(file, "contains character " + (int) ch + " at " + new String(data, i - 10, 20), line); return; } else if (ch < 32) { if (ch == '\n') { if (lastWasWhitespace && !allowTrailingSpaces) { fail(file, "contains trailing white space", line); return; } if (fix) { if (useCRLF) { out.write('\r'); } out.write(ch); } lastWasWhitespace = false; line++; } else if (ch == '\r') { if (!allowCR) { fail(file, "contains CR", line); return; } if (lastWasWhitespace && !allowTrailingSpaces) { fail(file, "contains trailing white space", line); return; } lastWasWhitespace = false; // ok } else if (ch == '\t') { if (fix) { for (int j = 0; j < spacesPerTab; j++) { out.write(' '); } } else { if (!allowTab) { fail(file, "contains TAB", line); return; } } lastWasWhitespace = true; // ok } else { fail(file, "contains character " + (int) ch, line); return; } } else if (isWhitespace) { lastWasWhitespace = true; if (fix) { boolean write = true; for (int j = i + 1; j < data.length; j++) { char ch2 = (char) (data[j] & 0xff); if (ch2 == '\n' || ch2 == '\r') { write = false; lastWasWhitespace = false; ch = ch2; i = j - 1; break; } else if (!Character.isWhitespace(ch2)) { break; } } if (write) { out.write(ch); } } } else { if (fix) { out.write(ch); } lastWasWhitespace = false; } } if (lastWasWhitespace && !allowTrailingSpaces) { fail(file, "contains trailing white space at the very end", line); return; } if (fix) { byte[] changed = out.toByteArray(); if (Utils.compareNotNull(data, changed) != 0) { RandomAccessFile f = new RandomAccessFile(file, "rw"); f.write(changed); f.setLength(changed.length); f.close(); System.out.println("CHANGED: " + file.getName()); } } line = 1; for (int i = 0; i < data.length; i++) { if (data[i] < 32) { line++; for (int j = i + 1; j < data.length; j++) { if (data[j] != 32) { int mod = (j - i - 1) & 3; if (mod != 0 && (mod != 1 || data[j] != '*')) { fail(file, "contains wrong number of heading spaces: " + (j - i - 1), line); } break; } } } } }
// in src/tools/org/h2/build/code/CheckJavadoc.java
public static void main(String... args) throws Exception { new CheckJavadoc().run(); }
// in src/tools/org/h2/build/code/CheckJavadoc.java
private void run() throws Exception { String baseDir = "src"; check(new File(baseDir)); if (errorCount > 0) { throw new Exception(errorCount + " errors found"); } }
// in src/tools/org/h2/build/code/CheckJavadoc.java
private int check(File file) throws Exception { String name = file.getName(); if (file.isDirectory()) { if (name.equals("CVS") || name.equals(".svn")) { return 0; } boolean foundPackageHtml = false, foundJava = false; for (File f : file.listFiles()) { int type = check(f); if (type == 1) { foundJava = true; } else if (type == 2) { foundPackageHtml = true; } } if (foundJava && !foundPackageHtml) { System.out.println("No package.html file, but a Java file found at: " + file.getAbsolutePath()); errorCount++; } } else { if (name.endsWith(".java")) { checkJavadoc(file); return 1; } else if (name.equals("package.html")) { return 2; } } return 0; }
// in src/tools/org/h2/jcr/Railroads.java
public static void main(String... args) throws Exception { new Railroads().process(); }
// in src/tools/org/h2/jcr/Railroads.java
private void process() throws Exception { RailroadImages.main(); bnf = Bnf.getInstance(getReader()); Csv csv = new Csv(); csv.setLineCommentCharacter('#'); ResultSet rs = csv.read(getReader(), null); map("grammar", rs, true); processHtml("jcr-sql2.html"); }
// in src/tools/org/h2/jcr/Railroads.java
private void processHtml(String fileName) throws Exception { String source = "src/tools/org/h2/jcr/"; String target = "docs/html/"; byte[] s = BuildBase.readFile(new File(source + "stylesheet.css")); BuildBase.writeFile(new File(target + "stylesheet.css"), s); String inFile = source + fileName; String outFile = target + fileName; new File(outFile).getParentFile().mkdirs(); FileOutputStream out = new FileOutputStream(outFile); FileInputStream in = new FileInputStream(inFile); byte[] bytes = IOUtils.readBytesAndClose(in, 0); if (fileName.endsWith(".html")) { String page = new String(bytes); page = PageParser.parse(page, session); bytes = page.getBytes(); } out.write(bytes); out.close(); }
// in src/tools/org/h2/jcr/Railroads.java
private void map(String key, ResultSet rs, boolean railroads) throws Exception { ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); while (rs.next()) { HashMap<String, String> map = new HashMap<String, String>(); ResultSetMetaData meta = rs.getMetaData(); for (int i = 0; i < meta.getColumnCount(); i++) { String k = StringUtils.toLowerEnglish(meta.getColumnLabel(i + 1)); String value = rs.getString(i + 1); value = value.trim(); map.put(k, PageParser.escapeHtml(value)); } String topic = rs.getString("TOPIC"); String syntax = rs.getString("SYNTAX").trim(); if (railroads) { BnfRailroad r = new BnfRailroad(); String railroad = r.getHtml(bnf, syntax); map.put("railroad", railroad); } BnfSyntax visitor = new BnfSyntax(); String syntaxHtml = visitor.getHtml(bnf, syntax); map.put("syntax", syntaxHtml); // remove newlines in the regular text String text = map.get("text"); if (text != null) { // text is enclosed in <p> .. </p> so this works. text = StringUtils.replaceAll(text, "<br /><br />", "</p><p>"); text = StringUtils.replaceAll(text, "<br />", " "); map.put("text", text); } String link = topic.toLowerCase(); link = StringUtils.replaceAll(link, " ", "_"); // link = StringUtils.replaceAll(link, "_", ""); link = StringUtils.replaceAll(link, "@", "_"); map.put("link", StringUtils.urlEncode(link)); list.add(map); } session.put(key, list); int div = 3; int part = (list.size() + div - 1) / div; for (int i = 0, start = 0; i < div; i++, start += part) { List<HashMap<String, String>> listThird = list.subList(start, Math.min(start + part, list.size())); session.put(key + "-" + i, listThird); } rs.close(); }
(Lib) AssertionError 11
              
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
synchronized void recycleConnection(PooledConnection pc) { if (activeConnections <= 0) { throw new AssertionError(); } activeConnections--; if (!isDisposed && activeConnections < maxConnections) { recycledConnections.add(pc); } else { closeConnection(pc); } if (activeConnections >= maxConnections - 1) { notifyAll(); } }
// in src/main/org/h2/bnf/Bnf.java
private RuleHead addRule(String topic, String section, Rule rule) { RuleHead head = new RuleHead(section, topic, rule); String key = StringUtils.toLowerEnglish(topic.trim().replace(' ', '_')); if (ruleMap.get(key) != null) { throw new AssertionError("already exists: " + topic); } ruleMap.put(key, head); return head; }
// in src/main/org/h2/bnf/Bnf.java
private Rule parseToken() { Rule r; if ((firstChar >= 'A' && firstChar <= 'Z') || (firstChar >= 'a' && firstChar <= 'z')) { // r = new RuleElement(currentToken+ " syntax:" + syntax); r = new RuleElement(currentToken, currentTopic); } else if (firstChar == '[') { read(); Rule r2 = parseOr(); r = new RuleOptional(r2); if (firstChar != ']') { throw new AssertionError("expected ], got " + currentToken + " syntax:" + syntax); } } else if (firstChar == '{') { read(); r = parseOr(); if (firstChar != '}') { throw new AssertionError("expected }, got " + currentToken + " syntax:" + syntax); } } else if ("@commaDots@".equals(currentToken)) { r = new RuleList(new RuleElement(",", currentTopic), lastRepeat, false); r = new RuleRepeat(r, true); } else if ("@dots@".equals(currentToken)) { r = new RuleRepeat(lastRepeat, false); } else { r = new RuleElement(currentToken, currentTopic); } lastRepeat = r; read(); return r; }
// in src/main/org/h2/bnf/RuleElement.java
public void setLinks(HashMap<String, RuleHead> ruleMap) { if (link != null) { link.setLinks(ruleMap); } if (keyword) { return; } String test = Bnf.getRuleMapKey(name); for (int i = 0; i < test.length(); i++) { String t = test.substring(i); RuleHead r = ruleMap.get(t); if (r != null) { link = r.getRule(); return; } } throw new AssertionError("Unknown " + name + "/" + test); }
// in src/main/org/h2/bnf/RuleFixed.java
public boolean autoComplete(Sentence sentence) { sentence.stopIfRequired(); String query = sentence.getQuery(); String s = query; switch(type) { case YMD: while (s.length() > 0 && "0123456789-".indexOf(s.charAt(0)) >= 0) { s = s.substring(1); } if (s.length() == 0) { sentence.add("2006-01-01", "1", Sentence.KEYWORD); } break; case HMS: while (s.length() > 0 && "0123456789:".indexOf(s.charAt(0)) >= 0) { s = s.substring(1); } if (s.length() == 0) { sentence.add("12:00:00", "1", Sentence.KEYWORD); } break; case NANOS: while (s.length() > 0 && Character.isDigit(s.charAt(0))) { s = s.substring(1); } if (s.length() == 0) { sentence.add("nanoseconds", "0", Sentence.KEYWORD); } break; case ANY_EXCEPT_SINGLE_QUOTE: while (true) { while (s.length() > 0 && s.charAt(0) != '\'') { s = s.substring(1); } if (s.startsWith("''")) { s = s.substring(2); } else { break; } } if (s.length() == 0) { sentence.add("anything", "Hello World", Sentence.KEYWORD); sentence.add("'", "'", Sentence.KEYWORD); } break; case ANY_EXCEPT_2_DOLLAR: while (s.length() > 0 && !s.startsWith("$$")) { s = s.substring(1); } if (s.length() == 0) { sentence.add("anything", "Hello World", Sentence.KEYWORD); sentence.add("$$", "$$", Sentence.KEYWORD); } break; case ANY_EXCEPT_DOUBLE_QUOTE: while (true) { while (s.length() > 0 && s.charAt(0) != '\"') { s = s.substring(1); } if (s.startsWith("\"\"")) { s = s.substring(2); } else { break; } } if (s.length() == 0) { sentence.add("anything", "identifier", Sentence.KEYWORD); sentence.add("\"", "\"", Sentence.KEYWORD); } break; case ANY_WORD: while (s.length() > 0 && !Character.isSpaceChar(s.charAt(0))) { s = s.substring(1); } if (s.length() == 0) { sentence.add("anything", "anything", Sentence.KEYWORD); } break; case HEX_START: if (s.startsWith("0X") || s.startsWith("0x")) { s = s.substring(2); } else if ("0".equals(s)) { sentence.add("0x", "x", Sentence.KEYWORD); } else if (s.length() == 0) { sentence.add("0x", "0x", Sentence.KEYWORD); } break; case CONCAT: if (s.equals("|")) { sentence.add("||", "|", Sentence.KEYWORD); } else if (s.startsWith("||")) { s = s.substring(2); } else if (s.length() == 0) { sentence.add("||", "||", Sentence.KEYWORD); } break; case AZ_UNDERSCORE: if (s.length() > 0 && (Character.isLetter(s.charAt(0)) || s.charAt(0) == '_')) { s = s.substring(1); } if (s.length() == 0) { sentence.add("character", "A", Sentence.KEYWORD); } break; case AF: if (s.length() > 0) { char ch = Character.toUpperCase(s.charAt(0)); if (ch >= 'A' && ch <= 'F') { s = s.substring(1); } } if (s.length() == 0) { sentence.add("hex character", "0A", Sentence.KEYWORD); } break; case DIGIT: if (s.length() > 0 && Character.isDigit(s.charAt(0))) { s = s.substring(1); } if (s.length() == 0) { sentence.add("digit", "1", Sentence.KEYWORD); } break; case OPEN_BRACKET: if (s.length() == 0) { sentence.add("[", "[", Sentence.KEYWORD); } else if (s.charAt(0) == '[') { s = s.substring(1); } break; case CLOSE_BRACKET: if (s.length() == 0) { sentence.add("]", "]", Sentence.KEYWORD); } else if (s.charAt(0) == ']') { s = s.substring(1); } break; // no autocomplete support for comments // (comments are not reachable in the bnf tree) case ANY_UNTIL_EOL: case ANY_UNTIL_END: default: throw new AssertionError("type="+type); } if (!s.equals(query)) { while (s.length() > 0 && Character.isSpaceChar(s.charAt(0))) { s = s.substring(1); } sentence.setQuery(s); return true; } return false; }
// in src/main/org/h2/util/SynchronizedVerifier.java
public static void setDetect(Class<?> clazz, boolean value) { if (value) { DETECT.put(clazz, new AtomicBoolean()); } else { AtomicBoolean b = DETECT.remove(clazz); if (b == null) { throw new AssertionError("Detection was not enabled"); } else if (!b.get()) { throw new AssertionError("No object of this class was tested"); } } enabled = DETECT.size() > 0; }
// in src/main/org/h2/util/SynchronizedVerifier.java
private static void detectConcurrentAccess(Object o) { AtomicBoolean value = DETECT.get(o.getClass()); if (value != null) { value.set(true); if (CURRENT.remove(o) != null) { throw new AssertionError("Concurrent access"); } CURRENT.put(o, o); try { Thread.sleep(1); } catch (InterruptedException e) { // ignore } Object old = CURRENT.remove(o); if (old == null) { throw new AssertionError("Concurrent access"); } } }
// in src/tools/org/h2/build/doc/BnfRailroad.java
static String getHtmlText(int type) { switch(type) { case RuleFixed.YMD: return "2000-01-01"; case RuleFixed.HMS: return "12:00:00"; case RuleFixed.NANOS: return "000000000"; case RuleFixed.ANY_UNTIL_EOL: case RuleFixed.ANY_EXCEPT_SINGLE_QUOTE: case RuleFixed.ANY_EXCEPT_DOUBLE_QUOTE: case RuleFixed.ANY_WORD: case RuleFixed.ANY_EXCEPT_2_DOLLAR: case RuleFixed.ANY_UNTIL_END: { return "anything"; } case RuleFixed.HEX_START: return "0x"; case RuleFixed.CONCAT: return "||"; case RuleFixed.AZ_UNDERSCORE: return "A-Z | _"; case RuleFixed.AF: return "A-F"; case RuleFixed.DIGIT: return "0-9"; case RuleFixed.OPEN_BRACKET: return "["; case RuleFixed.CLOSE_BRACKET: return "]"; default: throw new AssertionError("type="+type); } }
0 0
(Lib) IllegalStateException 8
              
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
private Connection getConnectionNow() throws SQLException { if (isDisposed) { throw new IllegalStateException("Connection pool has been disposed."); } PooledConnection pc; if (!recycledConnections.isEmpty()) { pc = recycledConnections.remove(recycledConnections.size() - 1); } else { pc = dataSource.getPooledConnection(); } Connection conn = pc.getConnection(); activeConnections++; pc.addConnectionEventListener(this); return conn; }
// in src/main/org/h2/tools/SimpleResultSet.java
public void addColumn(String name, int sqlType, int precision, int scale) { if (rows != null && rows.size() > 0) { throw new IllegalStateException("Cannot add a column after adding rows"); } if (name == null) { name = "C" + (columns.size() + 1); } Column column = new Column(); column.name = name; column.sqlType = sqlType; column.precision = precision; column.scale = scale; columns.add(column); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void addRow(Object... row) { if (rows == null) { throw new IllegalStateException("Cannot add a row when using RowSource"); } rows.add(row); }
// in src/main/org/h2/bnf/Sentence.java
void stopIfRequired() { if (System.currentTimeMillis() > stopAt) { throw new IllegalStateException(); } }
// in src/main/org/h2/util/Task.java
public Exception getException() { stop = true; if (thread == null) { throw new IllegalStateException("Thread not started"); } try { thread.join(); } catch (InterruptedException e) { // ignore } if (ex != null) { return ex; } return null; }
// in src/tools/org/h2/jaqu/TableDefinition.java
void merge(Db db, Object obj) { if (primaryKeyColumnNames == null || primaryKeyColumnNames.size() == 0) { throw new IllegalStateException("No primary key columns defined " + "for table " + obj.getClass() + " - no update possible"); } SQLStatement stat = new SQLStatement(db); StatementBuilder buff = new StatementBuilder("MERGE INTO "); buff.append(db.getDialect().getTableName(schemaName, tableName)).append(" ("); buff.resetCount(); for (FieldDefinition field : fields) { buff.appendExceptFirst(", "); buff.append(field.columnName); } buff.append(") KEY("); buff.resetCount(); for (FieldDefinition field : fields) { if (field.isPrimaryKey) { buff.appendExceptFirst(", "); buff.append(field.columnName); } } buff.append(") "); buff.resetCount(); buff.append("VALUES ("); for (FieldDefinition field : fields) { buff.appendExceptFirst(", "); buff.append('?'); Object value = getValue(obj, field); stat.addParameter(value); } buff.append(')'); stat.setSQL(buff.toString()); StatementLogger.merge(stat.getSQL()); stat.executeUpdate(); }
// in src/tools/org/h2/jaqu/TableDefinition.java
void update(Db db, Object obj) { if (primaryKeyColumnNames == null || primaryKeyColumnNames.size() == 0) { throw new IllegalStateException("No primary key columns defined " + "for table " + obj.getClass() + " - no update possible"); } SQLStatement stat = new SQLStatement(db); StatementBuilder buff = new StatementBuilder("UPDATE "); buff.append(db.getDialect().getTableName(schemaName, tableName)).append(" SET "); buff.resetCount(); for (FieldDefinition field : fields) { if (!field.isPrimaryKey) { buff.appendExceptFirst(", "); buff.append(field.columnName); buff.append(" = ?"); Object value = getValue(obj, field); stat.addParameter(value); } } Object alias = ClassUtils.newObject(obj.getClass()); Query<Object> query = Query.from(db, alias); boolean firstCondition = true; for (FieldDefinition field : fields) { if (field.isPrimaryKey) { Object aliasValue = field.getValue(alias); Object value = field.getValue(obj); if (!firstCondition) { query.addConditionToken(ConditionAndOr.AND); } firstCondition = false; query.addConditionToken( new Condition<Object>( aliasValue, value, CompareType.EQUAL)); } } stat.setSQL(buff.toString()); query.appendWhere(stat); StatementLogger.update(stat.getSQL()); stat.executeUpdate(); }
// in src/tools/org/h2/jaqu/TableDefinition.java
void delete(Db db, Object obj) { if (primaryKeyColumnNames == null || primaryKeyColumnNames.size() == 0) { throw new IllegalStateException("No primary key columns defined " + "for table " + obj.getClass() + " - no update possible"); } SQLStatement stat = new SQLStatement(db); StatementBuilder buff = new StatementBuilder("DELETE FROM "); buff.append(db.getDialect().getTableName(schemaName, tableName)); buff.resetCount(); Object alias = ClassUtils.newObject(obj.getClass()); Query<Object> query = Query.from(db, alias); boolean firstCondition = true; for (FieldDefinition field : fields) { if (field.isPrimaryKey) { Object aliasValue = field.getValue(alias); Object value = field.getValue(obj); if (!firstCondition) { query.addConditionToken(ConditionAndOr.AND); } firstCondition = false; query.addConditionToken( new Condition<Object>( aliasValue, value, CompareType.EQUAL)); } } stat.setSQL(buff.toString()); query.appendWhere(stat); StatementLogger.delete(stat.getSQL()); stat.executeUpdate(); }
0 0
(Lib) XAException 5
              
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public int prepare(Xid xid) throws XAException { if (isDebugEnabled()) { debugCode("prepare("+JdbcXid.toString(xid)+");"); } checkOpen(); if (!currentTransaction.equals(xid)) { throw new XAException(XAException.XAER_INVAL); } Statement stat = null; try { stat = physicalConn.createStatement(); stat.execute("PREPARE COMMIT " + JdbcXid.toString(xid)); prepared = true; } catch (SQLException e) { throw convertException(e); } finally { JdbcUtils.closeSilently(stat); } return XA_OK; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void end(Xid xid, int flags) throws XAException { if (isDebugEnabled()) { debugCode("end("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");"); } // TODO transaction end: implement this method if (flags == TMSUSPEND) { return; } if (!currentTransaction.equals(xid)) { throw new XAException(XAException.XAER_OUTSIDE); } prepared = false; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void start(Xid xid, int flags) throws XAException { if (isDebugEnabled()) { debugCode("start("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");"); } if (flags == TMRESUME) { return; } if (flags == TMJOIN) { if (currentTransaction != null && !currentTransaction.equals(xid)) { throw new XAException(XAException.XAER_RMERR); } } else if (currentTransaction != null) { throw new XAException(XAException.XAER_NOTA); } try { physicalConn.setAutoCommit(false); } catch (SQLException e) { throw convertException(e); } currentTransaction = xid; prepared = false; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
private void checkOpen() throws XAException { if (physicalConn == null) { throw new XAException(XAException.XAER_RMERR); } }
0 7
              
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public Xid[] recover(int flag) throws XAException { debugCodeCall("recover", quoteFlags(flag)); checkOpen(); Statement stat = null; try { stat = physicalConn.createStatement(); ResultSet rs = stat.executeQuery("SELECT * FROM INFORMATION_SCHEMA.IN_DOUBT ORDER BY TRANSACTION"); ArrayList<Xid> list = New.arrayList(); while (rs.next()) { String tid = rs.getString("TRANSACTION"); int id = getNextId(XID); Xid xid = new JdbcXid(factory, id, tid); list.add(xid); } rs.close(); Xid[] result = new Xid[list.size()]; list.toArray(result); if (list.size() > 0) { prepared = true; } return result; } catch (SQLException e) { XAException xa = new XAException(XAException.XAER_RMERR); xa.initCause(e); throw xa; } finally { JdbcUtils.closeSilently(stat); } }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public int prepare(Xid xid) throws XAException { if (isDebugEnabled()) { debugCode("prepare("+JdbcXid.toString(xid)+");"); } checkOpen(); if (!currentTransaction.equals(xid)) { throw new XAException(XAException.XAER_INVAL); } Statement stat = null; try { stat = physicalConn.createStatement(); stat.execute("PREPARE COMMIT " + JdbcXid.toString(xid)); prepared = true; } catch (SQLException e) { throw convertException(e); } finally { JdbcUtils.closeSilently(stat); } return XA_OK; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void rollback(Xid xid) throws XAException { if (isDebugEnabled()) { debugCode("rollback("+JdbcXid.toString(xid)+");"); } try { physicalConn.rollback(); physicalConn.setAutoCommit(true); if (prepared) { Statement stat = null; try { stat = physicalConn.createStatement(); stat.execute("ROLLBACK TRANSACTION " + JdbcXid.toString(xid)); } finally { JdbcUtils.closeSilently(stat); } prepared = false; } } catch (SQLException e) { throw convertException(e); } currentTransaction = null; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void end(Xid xid, int flags) throws XAException { if (isDebugEnabled()) { debugCode("end("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");"); } // TODO transaction end: implement this method if (flags == TMSUSPEND) { return; } if (!currentTransaction.equals(xid)) { throw new XAException(XAException.XAER_OUTSIDE); } prepared = false; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void start(Xid xid, int flags) throws XAException { if (isDebugEnabled()) { debugCode("start("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");"); } if (flags == TMRESUME) { return; } if (flags == TMJOIN) { if (currentTransaction != null && !currentTransaction.equals(xid)) { throw new XAException(XAException.XAER_RMERR); } } else if (currentTransaction != null) { throw new XAException(XAException.XAER_NOTA); } try { physicalConn.setAutoCommit(false); } catch (SQLException e) { throw convertException(e); } currentTransaction = xid; prepared = false; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void commit(Xid xid, boolean onePhase) throws XAException { if (isDebugEnabled()) { debugCode("commit("+JdbcXid.toString(xid)+", "+onePhase+");"); } Statement stat = null; try { if (onePhase) { physicalConn.commit(); } else { stat = physicalConn.createStatement(); stat.execute("COMMIT TRANSACTION " + JdbcXid.toString(xid)); prepared = false; } physicalConn.setAutoCommit(true); } catch (SQLException e) { throw convertException(e); } finally { JdbcUtils.closeSilently(stat); } currentTransaction = null; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
private void checkOpen() throws XAException { if (physicalConn == null) { throw new XAException(XAException.XAER_RMERR); } }
(Lib) ArrayIndexOutOfBoundsException 4
              
// in src/main/org/h2/compress/CompressLZF.java
public void expand(byte[] in, int inPos, int inLen, byte[] out, int outPos, int outLen) { // if ((inPos | outPos | outLen) < 0) { if (inPos < 0 || outPos < 0 || outLen < 0) { throw new IllegalArgumentException(); } do { int ctrl = in[inPos++] & 255; if (ctrl < MAX_LITERAL) { // literal run of length = ctrl + 1, ctrl++; // copy to output and move forward this many bytes System.arraycopy(in, inPos, out, outPos, ctrl); outPos += ctrl; inPos += ctrl; } else { // back reference // the highest 3 bits are the match length int len = ctrl >> 5; // if the length is maxed, add the next byte to the length if (len == 7) { len += in[inPos++] & 255; } // minimum back-reference is 3 bytes, // so 2 was subtracted before storing size len += 2; // ctrl is now the offset for a back-reference... // the logical AND operation removes the length bits ctrl = -((ctrl & 0x1f) << 8) - 1; // the next byte augments/increases the offset ctrl -= in[inPos++] & 255; // copy the back-reference bytes from the given // location in output to current position ctrl += outPos; if (outPos + len >= out.length) { // reduce array bounds checking throw new ArrayIndexOutOfBoundsException(); } for (int i = 0; i < len; i++) { out[outPos++] = out[ctrl++]; } } } while (outPos < outLen); }
// in src/main/org/h2/util/IntArray.java
public int get(int index) { if (SysProperties.CHECK) { if (index >= size) { throw new ArrayIndexOutOfBoundsException("i=" + index + " size=" + size); } } return data[index]; }
// in src/main/org/h2/util/IntArray.java
public void remove(int index) { if (SysProperties.CHECK) { if (index >= size) { throw new ArrayIndexOutOfBoundsException("i=" + index + " size=" + size); } } System.arraycopy(data, index + 1, data, index, size - index - 1); size--; }
// in src/main/org/h2/util/IntArray.java
public void removeRange(int fromIndex, int toIndex) { if (SysProperties.CHECK) { if (fromIndex > toIndex || toIndex > size) { throw new ArrayIndexOutOfBoundsException("from=" + fromIndex + " to=" + toIndex + " size=" + size); } } System.arraycopy(data, toIndex, data, fromIndex, size - toIndex); size -= toIndex - fromIndex; }
0 0
(Lib) EOFException 4
              
// in src/main/org/h2/store/PageInputStream.java
private int readBlock(byte[] buff, int off, int len) throws IOException { try { fillBuffer(); if (endOfFile) { return -1; } int l = Math.min(remaining, len); data.read(dataPos, buff, off, l); remaining -= l; dataPos += l; return l; } catch (DbException e) { throw new EOFException(); } }
// in src/main/org/h2/store/fs/FileUtils.java
public static void readFully(FileChannel channel, ByteBuffer dst) throws IOException { do { int r = channel.read(dst); if (r < 0) { throw new EOFException(); } } while (dst.remaining() > 0); }
// in src/main/org/h2/util/IOUtils.java
public static void skipFully(InputStream in, long skip) throws IOException { try { while (skip > 0) { long skipped = in.skip(skip); if (skipped <= 0) { throw new EOFException(); } skip -= skipped; } } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/util/IOUtils.java
public static void skipFully(Reader reader, long skip) throws IOException { try { while (skip > 0) { long skipped = reader.skip(skip); if (skipped <= 0) { throw new EOFException(); } skip -= skipped; } } catch (Exception e) { throw DbException.convertToIOException(e); } }
1
              
// in src/main/org/h2/store/PageInputStream.java
catch (DbException e) { throw new EOFException(); }
0
(Lib) FileNotFoundException 4
              
// in src/main/org/h2/store/fs/FilePathZip.java
public FileChannel open(String mode) throws IOException { ZipFile file = openZipFile(); ZipEntry entry = file.getEntry(getEntryName()); if (entry == null) { throw new FileNotFoundException(name); } return new FileZip(file, entry); }
// in src/main/org/h2/store/fs/FilePathDisk.java
public InputStream newInputStream() throws IOException { if (name.indexOf(':') > 1) { // if the : is in position 1, a windows file access is assumed: C:.. or D: if (name.startsWith(CLASSPATH_PREFIX)) { String fileName = name.substring(CLASSPATH_PREFIX.length()); if (!fileName.startsWith("/")) { fileName = "/" + fileName; } InputStream in = getClass().getResourceAsStream(fileName); if (in == null) { in = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); } if (in == null) { throw new FileNotFoundException("resource " + fileName); } return in; } // otherwise an URL is assumed URL url = new URL(name); InputStream in = url.openStream(); return in; } FileInputStream in = new FileInputStream(name); IOUtils.trace("openFileInputStream", name, in); return in; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public FileChannel open(String mode) throws IOException { String entryName = getEntryName(); if (entryName.length() == 0) { throw new FileNotFoundException(); } ZipInputStream in = openZip(); while (true) { ZipEntry entry = in.getNextEntry(); if (entry == null) { break; } if (entry.getName().equals(entryName)) { return new FileZip2(name, entryName, in, size()); } in.closeEntry(); } in.close(); throw new FileNotFoundException(name); }
0 1
(Lib) SQLClientInfoException 3
              
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setClientInfo(String name, String value) throws SQLClientInfoException { throw new SQLClientInfoException(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setClientInfo(Properties properties) throws SQLClientInfoException { throw new SQLClientInfoException(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Properties getClientInfo() throws SQLClientInfoException { throw new SQLClientInfoException(); }
0 3
              
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setClientInfo(String name, String value) throws SQLClientInfoException { throw new SQLClientInfoException(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setClientInfo(Properties properties) throws SQLClientInfoException { throw new SQLClientInfoException(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Properties getClientInfo() throws SQLClientInfoException { throw new SQLClientInfoException(); }
(Domain) FastEOFException 2
              
// in src/main/org/h2/store/DataReader.java
public byte readByte() throws IOException { int x = in.read(); if (x < 0) { throw new FastEOFException(); } return (byte) x; }
// in src/main/org/h2/store/DataReader.java
public void readFully(byte[] buff, int offset, int len) throws IOException { int got = IOUtils.readFully(in, buff, offset, len); if (got < len) { throw new FastEOFException(); } }
0 0
(Lib) NoSuchMethodException 2
              
// in src/main/org/h2/util/Utils.java
private static Object callMethod( Object instance, Class<?> clazz, String methodName, Object... params) throws Exception { Method best = null; int bestMatch = 0; boolean isStatic = instance == null; for (Method m : clazz.getMethods()) { if (Modifier.isStatic(m.getModifiers()) == isStatic && m.getName().equals(methodName)) { int p = match(m.getParameterTypes(), params); if (p > bestMatch) { bestMatch = p; best = m; } } } if (best == null) { throw new NoSuchMethodException(methodName); } return best.invoke(instance, params); }
// in src/main/org/h2/util/Utils.java
public static Object newInstance(String className, Object... params) throws Exception { Constructor<?> best = null; int bestMatch = 0; for (Constructor<?> c : Class.forName(className).getConstructors()) { int p = match(c.getParameterTypes(), params); if (p > bestMatch) { bestMatch = p; best = c; } } if (best == null) { throw new NoSuchMethodException(className); } return best.newInstance(params); }
0 0
(Lib) ParseException 2
              
// in src/main/org/h2/server/web/PageParser.java
private String parseBlockUntil(String end) throws ParseException { PageParser block = new PageParser(page, settings, pos); block.parseAll(); if (!block.readIf(end)) { throw new ParseException(page, block.pos); } pos = block.pos; return block.result.toString(); }
// in src/main/org/h2/server/web/PageParser.java
private void read(String s) throws ParseException { if (!readIf(s)) { throw new ParseException(s, pos); } }
0 3
              
// in src/main/org/h2/server/web/PageParser.java
private String parseBlockUntil(String end) throws ParseException { PageParser block = new PageParser(page, settings, pos); block.parseAll(); if (!block.readIf(end)) { throw new ParseException(page, block.pos); } pos = block.pos; return block.result.toString(); }
// in src/main/org/h2/server/web/PageParser.java
private String readParam(String name) throws ParseException { read(name); read("="); read("\""); int start = pos; while (page.charAt(pos) != '"') { pos++; } int end = pos; read("\""); String s = page.substring(start, end); return PageParser.parse(s, settings); }
// in src/main/org/h2/server/web/PageParser.java
private void read(String s) throws ParseException { if (!readIf(s)) { throw new ParseException(s, pos); } }
(Lib) DataFormatException 1
              
// in src/main/org/h2/compress/CompressDeflate.java
public void expand(byte[] in, int inPos, int inLen, byte[] out, int outPos, int outLen) { Inflater decompresser = new Inflater(); decompresser.setInput(in, inPos, inLen); decompresser.finished(); try { int len = decompresser.inflate(out, outPos, outLen); if (len != outLen) { throw new DataFormatException(len + " " + outLen); } } catch (DataFormatException e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); } decompresser.end(); }
0 0
(Domain) JdbcBatchUpdateException 1
              
// in src/main/org/h2/jdbc/JdbcStatement.java
public int[] executeBatch() throws SQLException { try { debugCodeCall("executeBatch"); checkClosedForWrite(); try { if (batchCommands == null) { // TODO batch: check what other database do if no commands are set batchCommands = New.arrayList(); } int size = batchCommands.size(); int[] result = new int[size]; boolean error = false; SQLException next = null; for (int i = 0; i < size; i++) { String sql = batchCommands.get(i); try { result[i] = executeUpdateInternal(sql); } catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; } } batchCommands = null; if (error) { throw new JdbcBatchUpdateException(next, result); } return result; } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
0 0
Explicit thrown (throw new...): 265/1845
Explicit thrown ratio: 14.4%
Builder thrown ratio: 81.8%
Variable thrown ratio: 3.8%
Checked Runtime Total
Domain 16 0 16
Lib 43 167 210
Total 59 167

Caught Exceptions Summary

A (Domain) exception is defined in the application. A (Lib) exception is defined in the JDK or in a library. An exception can be caught, and it happens that the catch block contains a throw (e.g. for wrapping a low-level exception). Hovering over a number triggers showing code snippets from the application code.

Type Exception Caught
(directly)
Caught
with Thrown
(Lib) Exception 595
            
// in src/main/org/h2/message/TraceSystem.java
catch (Exception e) { logWritingError(e); }
// in src/main/org/h2/message/TraceSystem.java
catch (Exception e) { logWritingError(e); return false; }
// in src/main/org/h2/message/TraceObject.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/tools/ChangeFileEncryption.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/ChangeFileEncryption.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/CompressTool.java
catch (Exception e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
// in src/main/org/h2/tools/CompressTool.java
catch (Exception e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
// in src/main/org/h2/tools/Backup.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Backup.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Csv.java
catch (Exception e) { close(); throw DbException.convertToIOException(e); }
// in src/main/org/h2/tools/Recover.java
catch (Exception e) { traceError(n, e); }
// in src/main/org/h2/tools/Recover.java
catch (Exception e) { writeError(writer, e); }
// in src/main/org/h2/tools/Recover.java
catch (Exception e) { writeError(writer, e); }
// in src/main/org/h2/tools/Recover.java
catch (Exception e) { writeDataError(writer, "exception " + e, s.getBytes()); continue; }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { result = DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { out.println(e.getMessage()); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { // ignore }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { // ignore and try the next }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw new Exception("Failed to start a browser to open the URL " + url + ": " + e.getMessage()); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { // ignore }
// in src/main/org/h2/tools/RunScript.java
catch (Exception e) { if (continueOnError) { e.printStackTrace(out); } else { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/Console.java
catch (Exception e) { e.printStackTrace(); }
// in src/main/org/h2/tools/Console.java
catch (Exception e) { // ignore }
// in src/main/org/h2/tools/Console.java
catch (Exception e) { return false; }
// in src/main/org/h2/tools/Console.java
catch (Exception e) { out.println(e.getMessage()); }
// in src/main/org/h2/tools/Shell.java
catch (Exception e) { println("Exception: " + e.toString()); e.printStackTrace(err); break; }
// in src/main/org/h2/tools/Shell.java
catch (Exception e) { // ignore, use the default solution }
// in src/main/org/h2/value/ValueTime.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "TIME", s); }
// in src/main/org/h2/value/ValueDate.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "DATE", s); }
// in src/main/org/h2/value/CompareMode.java
catch (Exception e) { // ignore }
// in src/main/org/h2/value/CompareModeIcu4J.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/value/ValueTimestamp.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "TIMESTAMP", s); }
// in src/main/org/h2/upgrade/DbUpgrade.java
catch (Exception e) { if (FileUtils.exists(backupData)) { FileUtils.moveTo(backupData, data); } if (FileUtils.exists(backupIndex)) { FileUtils.moveTo(backupIndex, index); } if (FileUtils.exists(backupLobs)) { FileUtils.moveTo(backupLobs, lobs); } FileUtils.delete(name + ".h2.db"); throw DbException.toSQLException(e); }
// in src/main/org/h2/schema/Schema.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Exception e) { if (onRollback) { // ignore } else { throw DbException.convert(e); } }
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { // failed int errorCode = 0; if (e instanceof SQLException) { errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } e.printStackTrace(System.out); }
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { int errorCode = 0; if (e instanceof DbException) { e = ((DbException) e).getSQLException(); errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } StringBuilder buff = new StringBuilder(); StackTraceElement[] list = e.getStackTrace(); for (int i = 0; i < 10 && i < list.length; i++) { buff.append(list[i].toString()).append('\n'); } String s = buff.toString(); if (!knownErrors.contains(s)) { out.println(writeCount + " code: " + errorCode + " " + e.toString()); e.printStackTrace(System.out); knownErrors.add(s); } else { out.println(writeCount + " code: " + errorCode); } }
// in src/main/org/h2/store/fs/FilePath.java
catch (Exception e) { // ignore - the files may be excluded in purpose }
// in src/main/org/h2/store/fs/FilePathWrapper.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (Exception e) { // workaround for GAE which throws a // java.security.AccessControlException return false; }
// in src/main/org/h2/store/fs/FileUtils.java
catch (Exception e) { return false; }
// in src/main/org/h2/store/WriterThread.java
catch (Exception e) { TraceSystem traceSystem = database.getTraceSystem(); if (traceSystem != null) { traceSystem.getTrace(Trace.DATABASE).error(e, "flush"); } }
// in src/main/org/h2/store/FileStore.java
catch (Exception e) { // ignore }
// in src/main/org/h2/store/FileStore.java
catch (Exception e) { // ignore OverlappingFileLockException return false; }
// in src/main/org/h2/store/FileStore.java
catch (Exception e) { // ignore }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "unlock"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "unlock"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "sleep"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "sleep"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "lock"); serverSocket = null; lockFile(); return; }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "watchdog"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "watchdog"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "watchdog"); }
// in src/main/org/h2/index/RangeIndex.java
catch (Exception e) { // error when converting the value - ignore }
// in src/main/org/h2/index/RangeIndex.java
catch (Exception e) { // error when converting the value - ignore }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/compress/CompressDeflate.java
catch (Exception e) { throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_OPTIONS_1, options); }
// in src/main/org/h2/Driver.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { trace.error(e, "closing session"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { // this method doesn't throw an exception, but it logs it logAndConvert(e); return false; }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/engine/UserAggregate.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Exception e) { trace.error(e, "pending {0}", pending); return false; }
// in src/main/org/h2/engine/Database.java
catch (Exception e) { // ignore (the trace is closed already) }
// in src/main/org/h2/engine/Database.java
catch (Exception e2) { // ignore this (user made) exception }
// in src/main/org/h2/engine/Database.java
catch (Exception e2) { // ignore this (user made) exception }
// in src/main/org/h2/engine/Database.java
catch (Exception e) { // DbException, InterruptedException trace.error(e, "readOnly {0}", readOnly); // ignore }
// in src/main/org/h2/engine/Database.java
catch (Exception e) { // ignore InterruptedException }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (Exception e) { // ignore InterruptedException }
// in src/main/org/h2/engine/Engine.java
catch (Exception e) { database.removeSession(session); throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX"); }
// in src/main/org/h2/engine/Engine.java
catch (Exception e) { throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX"); }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception re) { DbException e = DbException.convert(re); if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (autoServerMode) { String serverKey = ((JdbcSQLException) e.getSQLException()).getSQL(); if (serverKey != null) { backup.setServerKey(serverKey); // OPEN_NEW must be removed now, otherwise // opening a session with AUTO_SERVER fails // if another connection is already open backup.removeProperty("OPEN_NEW", null); connectServer(backup); return this; } } } throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE) { throw e; } // exclusive mode: re-try endlessly try { Thread.sleep(500); } catch (Exception e2) { // ignore } }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception e2) { // ignore }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Session.java
catch (Exception e) { // ignore InterruptedException }
// in src/main/org/h2/engine/Session.java
catch (Exception e) { // ignore break; }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { throw DbException.get(ErrorCode.SYNTAX_ERROR_1, e, source); }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { return false; }
// in src/main/org/h2/util/SortedProperties.java
catch (Exception e) { TraceSystem.traceThrowable(e); return def; }
// in src/main/org/h2/util/SortedProperties.java
catch (Exception e) { TraceSystem.traceThrowable(e); return def; }
// in src/main/org/h2/util/SortedProperties.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { clazz = null; }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/NetUtils.java
catch (Exception e) { // try again return createServerSocketTry(port, ssl); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // ignore }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // ignore }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // ignore }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // ignore }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { try { return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); } }
// in src/main/org/h2/util/Utils.java
catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); }
// in src/main/org/h2/util/TempFileDeleter.java
catch (Exception e) { // TODO log such errors? }
// in src/main/org/h2/util/Task.java
catch (Exception e) { this.ex = e; }
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { // NoSuchAlgorithmException warn("SecureRandom", e); }
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { // NoSuchAlgorithmException warn("SecureRandom", e); cachedSecureRandom = new SecureRandom(); }
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { // nanoTime not found, this is ok (only exists for JDK 1.5 and higher) out.writeUTF(e.toString()); }
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { warn("generateAlternativeSeed", e); }
// in src/main/org/h2/util/JdbcUtils.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/util/DateTimeUtils.java
catch (Exception e) { // ParseException throw DbException.get(ErrorCode.PARSE_ERROR_1, e, date); }
// in src/main/org/h2/util/DateTimeUtils.java
catch (Exception e) { throw DbException.get(ErrorCode.PARSE_ERROR_1, e, format + "/" + locale + "/" + timeZone); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/Profiler.java
catch (Exception e) { // ignore }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { if (!stop) { TraceSystem.traceThrowable(e); } }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { if (traceError) { traceError(e); } return false; }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { // try to connect - so that accept returns }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/server/pg/PgServer.java
catch (Exception e) { if (!stop) { e.printStackTrace(); } }
// in src/main/org/h2/server/pg/PgServer.java
catch (Exception e) { // TODO log exception e.printStackTrace(); }
// in src/main/org/h2/server/pg/PgServer.java
catch (Exception e) { if (traceError) { traceError(e); } return false; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { e.printStackTrace(); stop = true; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); break switchBlock; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); break; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { server.traceError(e); s = null; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Exception e2) { if (!transfer.isClosed()) { server.traceError(e2); } // if writing the error does not work, close the connection stop = true; }
// in src/main/org/h2/server/web/DbStarter.java
catch (Exception e) { e.printStackTrace(); }
// in src/main/org/h2/server/web/DbStarter.java
catch (Exception e) { e.printStackTrace(); }
// in src/main/org/h2/server/web/DbStarter.java
catch (Exception e) { e.printStackTrace(); }
// in src/main/org/h2/server/web/WebThread.java
catch (Exception e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { trace(e.toString()); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("toolResult", getStackTrace(0, e, true)); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("tree", ""); session.put("error", getStackTrace(0, e, isH2)); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("error", getLoginError(e, isH2)); return "login.jsp"; }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("error", getLoginError(e, isH2)); return "login.jsp"; }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { trace(e.toString()); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { rs.addRow("meta." + m.getName(), e.toString()); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { trace(e.toString()); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { if (traceError) { traceError(e); } return false; }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { traceError(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { TraceSystem.traceThrowable(e); return new Properties(); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { traceError(e); }
// in src/main/org/h2/server/web/WebSession.java
catch (Exception e) { // ok we don't have the bnf server.traceError(e); }
// in src/main/org/h2/server/web/WebSession.java
catch (Exception e) { // ignore }
// in src/main/org/h2/server/web/WebSession.java
catch (Exception e) { // ignore }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { // could be SQLException or RuntimeException conn.close(true); conn = null; throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, e, originalTable + "(" + e.toString() + ")"); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { // Some ODBC bridge drivers don't support it: // some combinations of "DataDirect SequeLink(R) for JDBC" // http://www.datadirect.com/index.ssp rs = null; }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { // Oracle throws an exception if the table is not found or is a // SYNONYM rs = null; }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { throw wrapException(sql, e); }
// in src/main/org/h2/table/MetaTable.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (Exception e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (Exception e) { throw convertException(e); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (Exception e) { server.traceError(e); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (Exception e) { server.traceError(e); reply(426, "Failed"); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (Exception e) { server.traceError(e); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
catch (Exception e) { traceError(e); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
catch (Exception e) { // ignore }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (Exception e) { throw DbException.convert(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (Exception e) { error(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (Exception e) { error(e); break; }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { file = null; throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { file = null; throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/doc/UploadBuild.java
catch (Exception e) { Class.forName("org.h2.upgrade.v1_1.Driver"); conn = DriverManager.getConnection("jdbc:h2v1_1:mem:"); }
// in src/tools/org/h2/build/doc/LinkChecker.java
catch (Exception e) { // ignore }
// in src/tools/org/h2/build/doc/XMLChecker.java
catch (Exception e) { last = e; System.out.println("ERROR in file " + fileName + " " + e.toString()); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { sysOut.println("Unknown target: " + target); projectHelp(); return false; }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { System.out.println(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read field " + className + "." + fieldName, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read value " + className + "." + methodName + "()", e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { result = exec("javadoc", args(args)); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { e.printStackTrace(); result = exec("javac", new StringList(array)); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/Build.java
catch (Exception e) { print("NSIS is not available: " + e); }
// in src/tools/org/h2/build/Build.java
catch (Exception e) { e.printStackTrace(); serverSocket = new ServerSocket(0); }
// in src/tools/org/h2/build/Build.java
catch (Exception e) { e.printStackTrace(); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { if (MAKE_ACCESSIBLE) { Constructor[] constructors = clazz.getDeclaredConstructors(); // try 0 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 0) { c.setAccessible(true); try { return clazz.newInstance(); } catch (Exception e2) { // ignore } } } // try 1 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 1) { c.setAccessible(true); try { return (T) c.newInstance(new Object[1]); } catch (Exception e2) { // ignore } } } } throw new RuntimeException("Exception trying to create " + clazz.getName() + ": " + e, e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e2) { // ignore }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e2) { // ignore }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { throw new RuntimeException("Error converting CLOB to String: " + e.toString(), e); }
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { throw new RuntimeException(source.substring(0, current.index) + "[*]" + source.substring(current.index), e); }
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { current = back; forStat.init = readStatement(); forStat.condition = readExpr(); read(";"); do { forStat.updates.add(readExpr()); } while (readIf(",")); }
461
            
// in src/main/org/h2/message/TraceObject.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/tools/ChangeFileEncryption.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/ChangeFileEncryption.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/CompressTool.java
catch (Exception e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
// in src/main/org/h2/tools/CompressTool.java
catch (Exception e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
// in src/main/org/h2/tools/Backup.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Backup.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Csv.java
catch (Exception e) { close(); throw DbException.convertToIOException(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw new Exception("Failed to start a browser to open the URL " + url + ": " + e.getMessage()); }
// in src/main/org/h2/tools/RunScript.java
catch (Exception e) { if (continueOnError) { e.printStackTrace(out); } else { throw DbException.toSQLException(e); } }
// in src/main/org/h2/value/ValueTime.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "TIME", s); }
// in src/main/org/h2/value/ValueDate.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "DATE", s); }
// in src/main/org/h2/value/CompareModeIcu4J.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/value/ValueTimestamp.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "TIMESTAMP", s); }
// in src/main/org/h2/upgrade/DbUpgrade.java
catch (Exception e) { if (FileUtils.exists(backupData)) { FileUtils.moveTo(backupData, data); } if (FileUtils.exists(backupIndex)) { FileUtils.moveTo(backupIndex, index); } if (FileUtils.exists(backupLobs)) { FileUtils.moveTo(backupLobs, lobs); } FileUtils.delete(name + ".h2.db"); throw DbException.toSQLException(e); }
// in src/main/org/h2/schema/Schema.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Exception e) { if (onRollback) { // ignore } else { throw DbException.convert(e); } }
// in src/main/org/h2/store/fs/FilePathWrapper.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/compress/CompressDeflate.java
catch (Exception e) { throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_OPTIONS_1, options); }
// in src/main/org/h2/Driver.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/engine/UserAggregate.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Engine.java
catch (Exception e) { database.removeSession(session); throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX"); }
// in src/main/org/h2/engine/Engine.java
catch (Exception e) { throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX"); }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception re) { DbException e = DbException.convert(re); if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (autoServerMode) { String serverKey = ((JdbcSQLException) e.getSQLException()).getSQL(); if (serverKey != null) { backup.setServerKey(serverKey); // OPEN_NEW must be removed now, otherwise // opening a session with AUTO_SERVER fails // if another connection is already open backup.removeProperty("OPEN_NEW", null); connectServer(backup); return this; } } } throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE) { throw e; } // exclusive mode: re-try endlessly try { Thread.sleep(500); } catch (Exception e2) { // ignore } }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { throw DbException.get(ErrorCode.SYNTAX_ERROR_1, e, source); }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SortedProperties.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { try { return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); } }
// in src/main/org/h2/util/Utils.java
catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); }
// in src/main/org/h2/util/JdbcUtils.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/util/DateTimeUtils.java
catch (Exception e) { // ParseException throw DbException.get(ErrorCode.PARSE_ERROR_1, e, date); }
// in src/main/org/h2/util/DateTimeUtils.java
catch (Exception e) { throw DbException.get(ErrorCode.PARSE_ERROR_1, e, format + "/" + locale + "/" + timeZone); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { // could be SQLException or RuntimeException conn.close(true); conn = null; throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, e, originalTable + "(" + e.toString() + ")"); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { throw wrapException(sql, e); }
// in src/main/org/h2/table/MetaTable.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (Exception e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (Exception e) { throw convertException(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (Exception e) { throw DbException.convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { file = null; throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { file = null; throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read field " + className + "." + fieldName, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read value " + className + "." + methodName + "()", e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { if (MAKE_ACCESSIBLE) { Constructor[] constructors = clazz.getDeclaredConstructors(); // try 0 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 0) { c.setAccessible(true); try { return clazz.newInstance(); } catch (Exception e2) { // ignore } } } // try 1 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 1) { c.setAccessible(true); try { return (T) c.newInstance(new Object[1]); } catch (Exception e2) { // ignore } } } } throw new RuntimeException("Exception trying to create " + clazz.getName() + ": " + e, e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { throw new RuntimeException("Error converting CLOB to String: " + e.toString(), e); }
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { throw new RuntimeException(source.substring(0, current.index) + "[*]" + source.substring(current.index), e); }
(Lib) IOException 156
            
// in src/main/org/h2/jmx/DocumentedMBean.java
catch (IOException e) { // ignore }
// in src/main/org/h2/message/TraceSystem.java
catch (IOException e) { // ignore }
// in src/main/org/h2/message/DbException.java
catch (IOException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/tools/Restore.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/main/org/h2/tools/CompressTool.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/CompressTool.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/ConvertTraceFile.java
catch (IOException e) { throw DbException.convertIOException(e, traceFile); }
// in src/main/org/h2/tools/Backup.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException writing " + outputFileName, e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException reading " + inputFileName, e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { close(); throw e; }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException reading from " + fileName, e); }
// in src/main/org/h2/tools/Recover.java
catch (IOException e) { // ignore }
// in src/main/org/h2/tools/RunScript.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/tools/Console.java
catch (IOException e) { e.printStackTrace(); return null; }
// in src/main/org/h2/tools/Shell.java
catch (IOException e) { println(e.getMessage()); break; }
// in src/main/org/h2/tools/Shell.java
catch (IOException e) { // ignore }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/Transfer.java
catch (IOException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { trace.error(e, "close"); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/expression/Function.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/store/LobStorage.java
catch (IOException e) { if (lobId != -1) { removeLob(lobId); } throw DbException.convertIOException(e, null); }
// in src/main/org/h2/store/PageLog.java
catch (IOException e) { trace.debug("log recovery completed"); }
// in src/main/org/h2/store/FileStoreInputStream.java
catch (IOException e) { throw DbException.convertIOException(e, store.name); }
// in src/main/org/h2/store/fs/FilePathMem.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (IOException e) { if (i > 16 || e.toString().indexOf("user-mapped section open") < 0) { throw e; } }
// in src/main/org/h2/store/fs/FilePathZip.java
catch (IOException e) { return false; }
// in src/main/org/h2/store/fs/FilePathZip.java
catch (IOException e) { return false; }
// in src/main/org/h2/store/fs/FilePathZip.java
catch (IOException e) { return 0; }
// in src/main/org/h2/store/fs/FilePathZip.java
catch (IOException e) { throw DbException.convertIOException(e, "listFiles " + path); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { // 'access denied' is really a concurrent access problem wait(i); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { // ignore }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { return new FileOutputStream(name); } catch (IOException e2) { throw DbException.convertIOException(e, name); } }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e2) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { f = new FileDisk(name, mode); } catch (IOException e2) { throw e; } }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e2) { throw e; }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, "name: " + name + " mode: " + mode); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { // ignore }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { throw getExceptionFatal("Could not save properties " + fileName, e); }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { return; }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { lastException = e; }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { throw getExceptionFatal("IOException", null); }
// in src/main/org/h2/command/dml/RunScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/command/dml/ScriptBase.java
catch (IOException e) { throw DbException.convertIOException(e, file); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, getFileName()); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/command/dml/BackupCommand.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { s.removeServer(e, i--, ++count); }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { session.removeServer(e, i--, ++count); }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { session.removeServer(e, i--, ++count); }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { session.removeServer(e, i--, ++count); }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (IOException e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (IOException e) { throw DbException.convertIOException(e, databaseName); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { removeServer(e, i--, ++count); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { trace.debug(e, "could not cancel statement"); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { removeServer(e, i--, ++count); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { removeServer(e, i--, ++count); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { throw DbException.convertIOException(e, prefix); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { if (len == 1) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, e, e + ": " + s); } switchOffCluster = true; }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { removeServer(e, i--, ++count); }
// in src/main/org/h2/util/ScriptReader.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/util/ScriptReader.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { try { return createSocket("localhost", port, ssl); } catch (IOException e2) { // throw the original exception throw e; } }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e2) { // throw the original exception throw e; }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { throw DbException.convertIOException(e, "port: " + port + " ssl: " + ssl); }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { // ignore }
// in src/main/org/h2/util/Utils.java
catch (IOException e) { // if this happens we have a real problem e.printStackTrace(); }
// in src/main/org/h2/util/MathUtils.java
catch (IOException e) { warn("generateAlternativeSeed", e); return new byte[1]; }
// in src/main/org/h2/util/Tool.java
catch (IOException e) { out.println("Cannot load " + resourceName); }
// in src/main/org/h2/server/TcpServer.java
catch (IOException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/pg/PgServer.java
catch (IOException e) { // TODO log exception e.printStackTrace(); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (IOException e) { throw DbException.convertIOException(e, "Can not read pg_catalog resource"); }
// in src/main/org/h2/server/web/WebThread.java
catch (IOException e) { // ignore }
// in src/main/org/h2/server/web/WebThread.java
catch (IOException e) { // ignore }
// in src/main/org/h2/server/web/WebServer.java
catch (IOException e) { traceError(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (IOException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (IOException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (IOException e) { throw DbException.convertIOException(e, "Tokenizer error"); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (IOException e) { // ignore }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (IOException e) { server.traceError(e); reply(426, "Failed"); }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
catch (IOException e) { e.printStackTrace(); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
catch (IOException e) { traceError(e); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
catch (IOException e) { if (traceError) { traceError(e); } return false; }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
catch (IOException e) { // ignore }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
catch (IOException e) { e.printStackTrace(); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
catch (IOException e) { e.printStackTrace(); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
catch (IOException e) { // ignore }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
catch (IOException e) { // ignore }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { throw DbException.convertIOException(e, "cwd"); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { error(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { error(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { error(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { error(e); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { return false; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { return false; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { return 0; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { throw DbException.convertIOException(e, "listFiles " + path); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { // ignore }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/FileViewer.java
catch (IOException e) { throw DbException.toSQLException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error downloading", e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/build/doc/RailroadImages.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error downloading " + fileURL + " to " + target, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error reading from file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error creating file " + destFile, e); }
// in src/tools/org/h2/build/Build.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/Build.java
catch (IOException e) { e.printStackTrace(); }
// in src/tools/org/h2/jaqu/bytecode/ClassReader.java
catch (IOException e) { throw new RuntimeException("Could not read class bytecode", e); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (IOException io) { throw DbException.convertIOException(io, "could not generate model").getSQLException(); }
// in src/tools/org/h2/java/JavaParser.java
catch (IOException e) { throw new RuntimeException(e); }
97
            
// in src/main/org/h2/tools/Restore.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/main/org/h2/tools/CompressTool.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/CompressTool.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/ConvertTraceFile.java
catch (IOException e) { throw DbException.convertIOException(e, traceFile); }
// in src/main/org/h2/tools/Backup.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException writing " + outputFileName, e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException reading " + inputFileName, e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { close(); throw e; }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException reading from " + fileName, e); }
// in src/main/org/h2/tools/RunScript.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/expression/Function.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/store/LobStorage.java
catch (IOException e) { if (lobId != -1) { removeLob(lobId); } throw DbException.convertIOException(e, null); }
// in src/main/org/h2/store/FileStoreInputStream.java
catch (IOException e) { throw DbException.convertIOException(e, store.name); }
// in src/main/org/h2/store/fs/FilePathMem.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (IOException e) { if (i > 16 || e.toString().indexOf("user-mapped section open") < 0) { throw e; } }
// in src/main/org/h2/store/fs/FilePathZip.java
catch (IOException e) { throw DbException.convertIOException(e, "listFiles " + path); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { return new FileOutputStream(name); } catch (IOException e2) { throw DbException.convertIOException(e, name); } }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e2) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { f = new FileDisk(name, mode); } catch (IOException e2) { throw e; } }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e2) { throw e; }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, "name: " + name + " mode: " + mode); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { throw getExceptionFatal("Could not save properties " + fileName, e); }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { throw getExceptionFatal("IOException", null); }
// in src/main/org/h2/command/dml/RunScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/command/dml/ScriptBase.java
catch (IOException e) { throw DbException.convertIOException(e, file); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, getFileName()); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/command/dml/BackupCommand.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (IOException e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (IOException e) { throw DbException.convertIOException(e, databaseName); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { throw DbException.convertIOException(e, prefix); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { if (len == 1) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, e, e + ": " + s); } switchOffCluster = true; }
// in src/main/org/h2/util/ScriptReader.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/util/ScriptReader.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { try { return createSocket("localhost", port, ssl); } catch (IOException e2) { // throw the original exception throw e; } }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e2) { // throw the original exception throw e; }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { throw DbException.convertIOException(e, "port: " + port + " ssl: " + ssl); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (IOException e) { throw DbException.convertIOException(e, "Can not read pg_catalog resource"); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (IOException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (IOException e) { throw DbException.convertIOException(e, "Tokenizer error"); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { throw DbException.convertIOException(e, "cwd"); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { throw DbException.convertIOException(e, "listFiles " + path); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/FileViewer.java
catch (IOException e) { throw DbException.toSQLException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error downloading", e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/build/doc/RailroadImages.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error downloading " + fileURL + " to " + target, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error reading from file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error creating file " + destFile, e); }
// in src/tools/org/h2/build/Build.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/bytecode/ClassReader.java
catch (IOException e) { throw new RuntimeException("Could not read class bytecode", e); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (IOException io) { throw DbException.convertIOException(io, "could not generate model").getSQLException(); }
// in src/tools/org/h2/java/JavaParser.java
catch (IOException e) { throw new RuntimeException(e); }
(Domain) SQLException 92
            
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { XAException xa = new XAException(XAException.XAER_RMERR); xa.initCause(e); throw xa; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { // ignore }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
catch (SQLException e) { // ignore }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
catch (SQLException e) { if (logWriter != null) { e.printStackTrace(logWriter); } }
// in src/main/org/h2/tools/CreateCluster.java
catch (SQLException e) { if (e.getErrorCode() == ErrorCode.DATABASE_NOT_FOUND_1) { // database does not exists yet - ok exists = false; } else { throw e; } }
// in src/main/org/h2/tools/Server.java
catch (SQLException e) { stopAll(); throw e; }
// in src/main/org/h2/tools/Console.java
catch (SQLException e) { printProblem(e, web); startException = e; }
// in src/main/org/h2/tools/Console.java
catch (SQLException e) { printProblem(e, tcp); if (startException == null) { startException = e; } }
// in src/main/org/h2/tools/Console.java
catch (SQLException e) { printProblem(e, pg); if (startException == null) { startException = e; } }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("SQL Exception: " + e.getMessage()); statement = null; }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("SQL Exception: " + e.getMessage()); e.printStackTrace(err); }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("Error: " + e.toString()); if (listMode) { e.printStackTrace(err); } return; }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/Transfer.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/value/ValueResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/ValueResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/result/LocalResult.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Expression.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/RecoverTester.java
catch (SQLException e) { // ignore }
// in src/main/org/h2/store/Data.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/Data.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/LinkedCursor.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/FunctionCursorResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/FunctionCursorResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/Driver.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/Driver.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/engine/Database.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (SQLException e) { trace.error(e, "close"); }
// in src/main/org/h2/util/JdbcUtils.java
catch (SQLException e) { // ignore }
// in src/main/org/h2/util/JdbcUtils.java
catch (SQLException e) { // ignore }
// in src/main/org/h2/util/JdbcUtils.java
catch (SQLException e) { // ignore }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { if (force) { // ignore } else { if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } } }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { if (i == 1) { throw e; } }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (SQLException e) { sendErrorResponse(e); break; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (SQLException e) { // failed transaction block c = 'E'; }
// in src/main/org/h2/server/web/DbContents.java
catch (SQLException e) { return defaultColumnIndex; }
// in src/main/org/h2/server/web/DbContents.java
catch (SQLException e) { // IS_DEFAULT not found }
// in src/main/org/h2/server/web/WebApp.java
catch (SQLException e) { // SQLite return treeIndex; }
// in src/main/org/h2/server/web/WebApp.java
catch (SQLException e) { map = e.toString(); }
// in src/main/org/h2/server/web/WebSession.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/table/LinkSchema.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/table/FunctionTable.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (SQLException e) { if (retry >= MAX_RETRY) { throw DbException.convert(e); } conn.close(true); connect(); }
// in src/main/org/h2/table/TableLinkConnection.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (SQLException e) { throw convertException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
66
            
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { XAException xa = new XAException(XAException.XAER_RMERR); xa.initCause(e); throw xa; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/tools/CreateCluster.java
catch (SQLException e) { if (e.getErrorCode() == ErrorCode.DATABASE_NOT_FOUND_1) { // database does not exists yet - ok exists = false; } else { throw e; } }
// in src/main/org/h2/tools/Server.java
catch (SQLException e) { stopAll(); throw e; }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/Transfer.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/value/ValueResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/ValueResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/result/LocalResult.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Expression.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/Data.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/Data.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/LinkedCursor.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/FunctionCursorResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/FunctionCursorResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/engine/Database.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { if (force) { // ignore } else { if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } } }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { if (i == 1) { throw e; } }
// in src/main/org/h2/table/LinkSchema.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/table/FunctionTable.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (SQLException e) { if (retry >= MAX_RETRY) { throw DbException.convert(e); } conn.close(true); connect(); }
// in src/main/org/h2/table/TableLinkConnection.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (SQLException e) { throw convertException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
(Domain) DbException 70
            
// in src/main/org/h2/tools/Recover.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (DbException e) { if (!force) { throw e; } }
// in src/main/org/h2/store/PageStreamTrunk.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) { // wrong checksum means end of stream return null; } throw e; }
// in src/main/org/h2/store/PageInputStream.java
catch (DbException e) { throw new EOFException(); }
// in src/main/org/h2/store/FileLister.java
catch (DbException e) { throw DbException.get( ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, message).getSQLException(); }
// in src/main/org/h2/store/RecoverTester.java
catch (DbException e) { SQLException e2 = DbException.toSQLException(e); int errorCode = e2.getErrorCode(); if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } e.printStackTrace(System.out); }
// in src/main/org/h2/store/PageLog.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) { trace.debug("log recovery stopped"); } else { throw e; } }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (DbException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { close(); throw e; }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.IO_EXCEPTION_2) { if (e.getMessage().indexOf("locked") >= 0) { // in Windows, you can't open a locked file // (in other operating systems, you can) // the exact error message is: // "The process cannot access the file because // another process has locked a portion of the file" throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, e, fileName); } } throw e; }
// in src/main/org/h2/store/FileLock.java
catch (DbException e) { // ignore }
// in src/main/org/h2/store/FileLock.java
catch (DbException e2) { // ignore }
// in src/main/org/h2/index/PageDataIndex.java
catch (DbException e) { if (e != fastDuplicateKeyException) { throw e; } if (!retry) { throw getNewDuplicateKeyException(); } if (add == 0) { // in the first re-try add a small random number, // to avoid collisions after a re-start row.setKey((long) (row.getKey() + Math.random() * 10000)); } else { row.setKey(row.getKey() + add); } add++; }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { throw e.addSQL(originalSQL); }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.SYNTAX_ERROR_1) { // now, get the detailed exception p = parse(sql, true); } else { throw e.addSQL(sql); } }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (force) { command.setSelectSQL(select); while (currentTokenType != END) { read(); } } else { throw e; } }
// in src/main/org/h2/command/ddl/CreateTable.java
catch (DbException e) { db.checkPowerOff(); db.removeSchemaObject(session, table); if (!transactional) { session.commit(true); } throw e; }
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
catch (DbException e) { execute("DROP TABLE " + newTable.getName(), true); throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage()); }
// in src/main/org/h2/command/dml/RunScriptCommand.java
catch (DbException e) { throw e.addSQL(sql); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(expr)); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(r)); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // possibly a concurrent merge or insert Index index = (Index) e.getSource(); if (index != null) { // verify the index columns match the key Column[] indexColumns = index.getColumns(); boolean indexMatchesKeys = false; if (indexColumns.length <= keys.length) { for (int i = 0; i < indexColumns.length; i++) { if (indexColumns[i] != keys[i]) { indexMatchesKeys = false; break; } } } if (indexMatchesKeys) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, table.getName()); } } } throw e; }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, x, getSQL(expr)); }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, rowNumber, getSQL(values)); }
// in src/main/org/h2/command/Command.java
catch (DbException e) { start = filterConcurrentUpdate(e, start); }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e.addSQL(sql); database.exceptionThrown(e.getSQLException(), sql); throw e; }
// in src/main/org/h2/command/Command.java
catch (DbException e) { start = filterConcurrentUpdate(e, start); }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); database.checkPowerOff(); if (s.getErrorCode() == ErrorCode.DEADLOCK_1) { session.rollback(); } else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { // there is a serious problem: // the transaction may be applied partially // in this case we need to panic: // close the database callStop = false; database.shutdownImmediately(); throw e; } else { session.rollbackTo(rollback, false); } throw e; }
// in src/main/org/h2/command/CommandRemote.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (DbException e) { // ignore if the connection is broken right now if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { // ignore }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { store.closeSilently(); throw e; }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_READ_ONLY) { throw e; } pageStore = null; while (!beforeWriting()) { // wait until others stopped writing and // until we can write (the file is not yet open - // no need to re-connect) } getPageStore(); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "disconnecting session #{0}", s.getId()); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { // ignore }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { if (SysProperties.CHECK2) { int code = e.getErrorCode(); if (code != ErrorCode.DATABASE_IS_CLOSED && code != ErrorCode.LOCK_TIMEOUT_1 && code != ErrorCode.IO_EXCEPTION_2) { e.printStackTrace(); } } trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { // ignore }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.WRONG_USER_OR_PASSWORD) { validateUserAndPassword(false); } throw e; }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (!ignoreUnknownSetting) { session.close(); throw e; } }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (!ignoreUnknownSetting) { session.close(); throw e; } }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getErrorCode() == ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1) { // it might have been deleted by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getSQLException().getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // it might have been added by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { trans.close(); throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { traceSystem.close(); throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE) { throw e; } // exclusive mode: re-try endlessly try { Thread.sleep(500); } catch (Exception e2) { // ignore } }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { store.closeSilently(); throw e; }
// in src/main/org/h2/engine/MetaRecord.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); db.getTrace(Trace.DATABASE).error(s, sql); if (listener != null) { listener.exceptionThrown(s, sql); // continue startup in this case } else { throw e; } }
// in src/main/org/h2/engine/FunctionAlias.java
catch (DbException e) { if (!force) { throw e; } }
// in src/main/org/h2/engine/FunctionAlias.java
catch (DbException e) { throw e; }
// in src/main/org/h2/server/TcpServer.java
catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, ssl); } else { throw e; } }
// in src/main/org/h2/server/pg/PgServer.java
catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, false); } else { throw e; } }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e) { getSchema().freeUniqueName(indexName); try { index.remove(session); } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; } throw e; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; }
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (!force) { throw e; } Column[] cols = { }; setColumns(cols); linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols), IndexType.createNonUnique(false)); indexes.add(linkedIndex); }
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (retry >= MAX_RETRY) { connectException = e; throw e; } }
// in src/main/org/h2/table/Column.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DATA_CONVERSION_ERROR_1) { String target = (table == null ? "" : table.getName() + ": ") + getCreateSQL(); throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, v.getSQL() + " (" + target + ")"); } throw e; }
// in src/main/org/h2/table/TableView.java
catch (DbException e) { if (!force) { return e; } }
// in src/main/org/h2/table/TableView.java
catch (DbException e) { e.addSQL(getCreateSQL()); createException = e; // if it can't be compiled, then it's a 'zero column table' // this avoids problems when creating the view when opening the // database tables = New.arrayList(); cols = new Column[0]; if (recursive && columnNames != null) { cols = new Column[columnNames.length]; for (int i = 0; i < columnNames.length; i++) { cols[i] = new Column(columnNames[i], Value.STRING); } index.setRecursive(true); createException = null; } }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
57
            
// in src/main/org/h2/tools/Recover.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (DbException e) { if (!force) { throw e; } }
// in src/main/org/h2/store/PageStreamTrunk.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) { // wrong checksum means end of stream return null; } throw e; }
// in src/main/org/h2/store/PageInputStream.java
catch (DbException e) { throw new EOFException(); }
// in src/main/org/h2/store/FileLister.java
catch (DbException e) { throw DbException.get( ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, message).getSQLException(); }
// in src/main/org/h2/store/PageLog.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) { trace.debug("log recovery stopped"); } else { throw e; } }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (DbException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { close(); throw e; }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.IO_EXCEPTION_2) { if (e.getMessage().indexOf("locked") >= 0) { // in Windows, you can't open a locked file // (in other operating systems, you can) // the exact error message is: // "The process cannot access the file because // another process has locked a portion of the file" throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, e, fileName); } } throw e; }
// in src/main/org/h2/index/PageDataIndex.java
catch (DbException e) { if (e != fastDuplicateKeyException) { throw e; } if (!retry) { throw getNewDuplicateKeyException(); } if (add == 0) { // in the first re-try add a small random number, // to avoid collisions after a re-start row.setKey((long) (row.getKey() + Math.random() * 10000)); } else { row.setKey(row.getKey() + add); } add++; }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { throw e.addSQL(originalSQL); }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.SYNTAX_ERROR_1) { // now, get the detailed exception p = parse(sql, true); } else { throw e.addSQL(sql); } }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (force) { command.setSelectSQL(select); while (currentTokenType != END) { read(); } } else { throw e; } }
// in src/main/org/h2/command/ddl/CreateTable.java
catch (DbException e) { db.checkPowerOff(); db.removeSchemaObject(session, table); if (!transactional) { session.commit(true); } throw e; }
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
catch (DbException e) { execute("DROP TABLE " + newTable.getName(), true); throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage()); }
// in src/main/org/h2/command/dml/RunScriptCommand.java
catch (DbException e) { throw e.addSQL(sql); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(expr)); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(r)); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // possibly a concurrent merge or insert Index index = (Index) e.getSource(); if (index != null) { // verify the index columns match the key Column[] indexColumns = index.getColumns(); boolean indexMatchesKeys = false; if (indexColumns.length <= keys.length) { for (int i = 0; i < indexColumns.length; i++) { if (indexColumns[i] != keys[i]) { indexMatchesKeys = false; break; } } } if (indexMatchesKeys) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, table.getName()); } } } throw e; }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, x, getSQL(expr)); }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, rowNumber, getSQL(values)); }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e.addSQL(sql); database.exceptionThrown(e.getSQLException(), sql); throw e; }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); database.checkPowerOff(); if (s.getErrorCode() == ErrorCode.DEADLOCK_1) { session.rollback(); } else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { // there is a serious problem: // the transaction may be applied partially // in this case we need to panic: // close the database callStop = false; database.shutdownImmediately(); throw e; } else { session.rollbackTo(rollback, false); } throw e; }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (DbException e) { // ignore if the connection is broken right now if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { store.closeSilently(); throw e; }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_READ_ONLY) { throw e; } pageStore = null; while (!beforeWriting()) { // wait until others stopped writing and // until we can write (the file is not yet open - // no need to re-connect) } getPageStore(); }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.WRONG_USER_OR_PASSWORD) { validateUserAndPassword(false); } throw e; }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (!ignoreUnknownSetting) { session.close(); throw e; } }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (!ignoreUnknownSetting) { session.close(); throw e; } }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getErrorCode() == ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1) { // it might have been deleted by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getSQLException().getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // it might have been added by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { trans.close(); throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { traceSystem.close(); throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE) { throw e; } // exclusive mode: re-try endlessly try { Thread.sleep(500); } catch (Exception e2) { // ignore } }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { store.closeSilently(); throw e; }
// in src/main/org/h2/engine/MetaRecord.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); db.getTrace(Trace.DATABASE).error(s, sql); if (listener != null) { listener.exceptionThrown(s, sql); // continue startup in this case } else { throw e; } }
// in src/main/org/h2/engine/FunctionAlias.java
catch (DbException e) { if (!force) { throw e; } }
// in src/main/org/h2/engine/FunctionAlias.java
catch (DbException e) { throw e; }
// in src/main/org/h2/server/TcpServer.java
catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, ssl); } else { throw e; } }
// in src/main/org/h2/server/pg/PgServer.java
catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, false); } else { throw e; } }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e) { getSchema().freeUniqueName(indexName); try { index.remove(session); } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; } throw e; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; }
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (!force) { throw e; } Column[] cols = { }; setColumns(cols); linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols), IndexType.createNonUnique(false)); indexes.add(linkedIndex); }
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (retry >= MAX_RETRY) { connectException = e; throw e; } }
// in src/main/org/h2/table/Column.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DATA_CONVERSION_ERROR_1) { String target = (table == null ? "" : table.getName() + ": ") + getCreateSQL(); throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, v.getSQL() + " (" + target + ")"); } throw e; }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
(Lib) Throwable 42
            
// in src/main/org/h2/message/TraceSystem.java
catch (Throwable e) { e = DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, adapterClass); write(ERROR, Trace.DATABASE, adapterClass, e); return; }
// in src/main/org/h2/tools/Recover.java
catch (Throwable e) { // this is usually not a problem, because we try both compressed and // uncompressed }
// in src/main/org/h2/tools/Recover.java
catch (Throwable e) { writeError(writer, e); }
// in src/main/org/h2/tools/Recover.java
catch (Throwable e) { writeDataError(writer, "exception " + e, s.getBytes()); continue; }
// in src/main/org/h2/tools/Recover.java
catch (Throwable e) { writeDataError(writer, "exception " + e, s.getBytes()); continue; }
// in src/main/org/h2/tools/Recover.java
catch (Throwable t) { writeError(writer, t); }
// in src/main/org/h2/tools/Console.java
catch (Throwable t) { // ignore // some systems don't support this method, for example IKVM // however it still works }
// in src/main/org/h2/tools/Console.java
catch (Throwable t) { // ignore }
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { // try again later triggerCallback = null; throw DbException.get(ErrorCode.ERROR_CREATING_TRIGGER_OBJECT_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_EXECUTING_TRIGGER_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (Throwable e) { // useSystemGc is already true }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (Throwable e) { // sometimes this throws a NullPointerException // at java.io.DeleteOnExitHook.add(DeleteOnExitHook.java:33) // we can ignore it }
// in src/main/org/h2/command/Command.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/command/Command.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { if (e instanceof OutOfMemoryError) { e.fillInStackTrace(); } if (traceSystem != null) { if (e instanceof SQLException) { SQLException e2 = (SQLException) e; if (e2.getErrorCode() != ErrorCode.DATABASE_ALREADY_OPEN_1) { // only write if the database is not already in use trace.error(e, "opening {0}", databaseName); } } traceSystem.close(); } closeOpenFilesAndUnlock(false); throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Throwable t) { if (SysProperties.CHECK2) { t.printStackTrace(); } trace.error(t, "close"); }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_SETTING_DATABASE_EVENT_LISTENER_2, e, className, e.toString()); }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (Throwable e) { // ignore }
// in src/main/org/h2/engine/SessionRemote.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.SERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.DESERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/util/MathUtils.java
catch (Throwable e) { // on some system, InetAddress is not supported // on some system, InetAddress.getLocalHost() doesn't work // for some reason (incorrect configuration) }
// in src/main/org/h2/util/Profiler.java
catch (Throwable t) { break; }
// in src/main/org/h2/server/TcpServer.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Throwable e) { sendError(e); stop = true; }
// in src/main/org/h2/server/TcpServerThread.java
catch (Throwable e) { sendError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Throwable e) { server.traceError(e); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { server.traceError(e); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable t) { return s; }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { session.put("result", getStackTrace(0, e, session.getContents().isH2)); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { result = "<br />" + getStackTrace(0, e, session.getContents().isH2); error = formatAsError(e.getMessage()); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { // throwable: including OutOfMemoryError and so on return getStackTrace(id, e, session.getContents().isH2); }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (Throwable t) { server.traceError(t); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
catch (Throwable e) { e.printStackTrace(); }
// in src/tools/org/h2/build/BuildBase.java
catch (Throwable e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/Build.java
catch (Throwable t) { t.printStackTrace(); }
// in src/tools/org/h2/build/Build.java
catch (Throwable t) { t.printStackTrace(); }
// in src/tools/org/h2/jaqu/ModelUtils.java
catch (Throwable t) { }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -annotateSchema value"); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -trimStrings value"); }
18
            
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { // try again later triggerCallback = null; throw DbException.get(ErrorCode.ERROR_CREATING_TRIGGER_OBJECT_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_EXECUTING_TRIGGER_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/command/Command.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/command/Command.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { if (e instanceof OutOfMemoryError) { e.fillInStackTrace(); } if (traceSystem != null) { if (e instanceof SQLException) { SQLException e2 = (SQLException) e; if (e2.getErrorCode() != ErrorCode.DATABASE_ALREADY_OPEN_1) { // only write if the database is not already in use trace.error(e, "opening {0}", databaseName); } } traceSystem.close(); } closeOpenFilesAndUnlock(false); throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_SETTING_DATABASE_EVENT_LISTENER_2, e, className, e.toString()); }
// in src/main/org/h2/engine/SessionRemote.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.SERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.DESERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/server/TcpServer.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Throwable e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -annotateSchema value"); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -trimStrings value"); }
(Lib) InterruptedException 24
            
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/tools/Server.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/tools/Shell.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/tools/Shell.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/store/WriterThread.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/store/FileLock.java
catch (InterruptedException e) { throw getExceptionFatal("Sleep interrupted", e); }
// in src/main/org/h2/store/FileLock.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/command/Command.java
catch (InterruptedException e1) { // ignore }
// in src/main/org/h2/engine/Database.java
catch (InterruptedException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Engine.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/engine/Engine.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/engine/Engine.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/engine/Session.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } }
// in src/main/org/h2/util/NetUtils.java
catch (InterruptedException e2) { // ignore }
// in src/main/org/h2/util/Task.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/util/MathUtils.java
catch (InterruptedException e) { warn("InterruptedException", e); }
// in src/main/org/h2/util/SynchronizedVerifier.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/util/Profiler.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/server/TcpServer.java
catch (InterruptedException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (InterruptedException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/table/RegularTable.java
catch (InterruptedException e) { // ignore }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
catch (InterruptedException e) { // ignore }
1
            
// in src/main/org/h2/store/FileLock.java
catch (InterruptedException e) { throw getExceptionFatal("Sleep interrupted", e); }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } }
(Lib) NumberFormatException 19
            
// in src/main/org/h2/tools/Shell.java
catch (NumberFormatException e) { println("Usage: maxwidth <integer value>"); }
// in src/main/org/h2/value/ValueLob.java
catch (NumberFormatException e) { id = -1; }
// in src/main/org/h2/value/Value.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, getString()); }
// in src/main/org/h2/expression/Function.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s); }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (NumberFormatException e) { // ignore }
// in src/main/org/h2/command/Parser.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, sub); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (NumberFormatException e) { return defaultValue; }
// in src/main/org/h2/engine/SettingsBase.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); }
// in src/main/org/h2/engine/SettingsBase.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); }
// in src/main/org/h2/util/Utils.java
catch (NumberFormatException e) { // ignore }
// in src/main/org/h2/util/Utils.java
catch (NumberFormatException e) { // ignore }
// in src/main/org/h2/util/StringUtils.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/main/org/h2/util/StringUtils.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (NumberFormatException e) { reply(500, "Invalid"); }
// in src/tools/org/h2/build/indexer/HtmlConverter.java
catch (NumberFormatException e) { repl = null; }
// in src/tools/org/h2/build/indexer/HtmlConverter.java
catch (NumberFormatException e) { repl = null; }
// in src/tools/org/h2/jaqu/ModelUtils.java
catch (NumberFormatException ex) { return false; }
// in src/tools/org/h2/java/JavaParser.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/tools/org/h2/java/JavaParser.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
9
            
// in src/main/org/h2/value/Value.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, getString()); }
// in src/main/org/h2/expression/Function.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s); }
// in src/main/org/h2/command/Parser.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, sub); }
// in src/main/org/h2/engine/SettingsBase.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); }
// in src/main/org/h2/engine/SettingsBase.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); }
// in src/main/org/h2/util/StringUtils.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/main/org/h2/util/StringUtils.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/tools/org/h2/java/JavaParser.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/tools/org/h2/java/JavaParser.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
(Lib) RuntimeException 8
            
// in src/main/org/h2/jdbcx/JdbcXid.java
catch (RuntimeException e) { throw DbException.get(ErrorCode.WRONG_XID_FORMAT_1, tid); }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (RuntimeException e) { // this can happen when stopping a web application, // if loading classes is no longer allowed // it would throw an IllegalStateException try { trace.error(e, "could not close the database"); // if this was successful, we ignore the exception // otherwise not } catch (RuntimeException e2) { throw e; } }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (RuntimeException e2) { throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (RuntimeException e) { trace.error(e, "close"); closeError = e; }
// in src/main/org/h2/server/TcpServerThread.java
catch (RuntimeException e) { closeError = e; server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (RuntimeException e) { if (closeError == null) { closeError = e; server.traceError(e); } }
// in src/tools/org/h2/build/BuildBase.java
catch (RuntimeException e) { throw e; }
// in src/tools/org/h2/build/BuildBase.java
catch (RuntimeException e) { println("Could not download using Maven: " + e.toString()); }
3
            
// in src/main/org/h2/jdbcx/JdbcXid.java
catch (RuntimeException e) { throw DbException.get(ErrorCode.WRONG_XID_FORMAT_1, tid); }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (RuntimeException e) { // this can happen when stopping a web application, // if loading classes is no longer allowed // it would throw an IllegalStateException try { trace.error(e, "could not close the database"); // if this was successful, we ignore the exception // otherwise not } catch (RuntimeException e2) { throw e; } }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (RuntimeException e2) { throw e; }
// in src/tools/org/h2/build/BuildBase.java
catch (RuntimeException e) { throw e; }
(Lib) UnknownHostException 7
            
// in src/main/org/h2/store/FileLock.java
catch (UnknownHostException e) { throw getExceptionFatal("Unknown host " + ip, e); }
// in src/main/org/h2/util/NetUtils.java
catch (UnknownHostException e) { // ignore }
// in src/main/org/h2/util/NetUtils.java
catch (UnknownHostException e) { throw DbException.convert(e); }
// in src/main/org/h2/server/TcpServer.java
catch (UnknownHostException e) { traceError(e); return false; }
// in src/main/org/h2/server/pg/PgServer.java
catch (UnknownHostException e) { traceError(e); return false; }
// in src/main/org/h2/server/web/WebThread.java
catch (UnknownHostException e) { server.traceError(e); return false; }
// in src/main/org/h2/server/web/WebServlet.java
catch (UnknownHostException e) { return false; }
2
            
// in src/main/org/h2/store/FileLock.java
catch (UnknownHostException e) { throw getExceptionFatal("Unknown host " + ip, e); }
// in src/main/org/h2/util/NetUtils.java
catch (UnknownHostException e) { throw DbException.convert(e); }
(Lib) NullPointerException 6
            
// in src/main/org/h2/store/fs/FilePathZip.java
catch (NullPointerException e) { // workaround for Android skipUsingRead = true; }
// in src/main/org/h2/store/FileLock.java
catch (NullPointerException e) { // ignore }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (NullPointerException e) { // ignore }
// in src/main/org/h2/server/TcpServer.java
catch (NullPointerException e) { // ignore }
// in src/main/org/h2/server/web/WebApp.java
catch (NullPointerException e) { // ignore // workaround for a JDBC-ODBC bridge problem }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (NullPointerException e) { // workaround for Android skipUsingRead = true; }
0
(Lib) OutOfMemoryError 5
            
// in src/main/org/h2/tools/Recover.java
catch (OutOfMemoryError e) { writeDataError(writer, "out of memory", s.getBytes()); return null; }
// in src/main/org/h2/tools/Recover.java
catch (OutOfMemoryError e) { writeDataError(writer, "out of memory", s.getBytes()); continue; }
// in src/main/org/h2/store/FileLock.java
catch (OutOfMemoryError e) { // ignore }
// in src/main/org/h2/util/Utils.java
catch (OutOfMemoryError e) { Error e2 = new OutOfMemoryError("Requested memory: " + len); e2.initCause(e); throw e2; }
// in src/main/org/h2/server/web/WebApp.java
catch (OutOfMemoryError e2) { server.traceError(e); return e.toString(); }
1
            
// in src/main/org/h2/util/Utils.java
catch (OutOfMemoryError e) { Error e2 = new OutOfMemoryError("Requested memory: " + len); e2.initCause(e); throw e2; }
(Lib) ArrayIndexOutOfBoundsException 4
            
// in src/main/org/h2/tools/Recover.java
catch (ArrayIndexOutOfBoundsException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/PageLog.java
catch (ArrayIndexOutOfBoundsException e) { DbException.convertToIOException(e); }
// in src/main/org/h2/compress/LZFInputStream.java
catch (ArrayIndexOutOfBoundsException e) { DbException.convertToIOException(e); }
// in src/main/org/h2/util/StringUtils.java
catch (ArrayIndexOutOfBoundsException e) { throw DbException.get(ErrorCode.HEX_STRING_WRONG_1, s); }
2
            
// in src/main/org/h2/tools/Recover.java
catch (ArrayIndexOutOfBoundsException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/StringUtils.java
catch (ArrayIndexOutOfBoundsException e) { throw DbException.get(ErrorCode.HEX_STRING_WRONG_1, s); }
(Lib) NoClassDefFoundError 4
            
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (NoClassDefFoundError e) { throw DbException.get(ErrorCode.UNSUPPORTED_JAVA_VERSION); }
// in src/main/org/h2/util/Utils.java
catch (NoClassDefFoundError e) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); }
// in src/main/org/h2/server/web/WebServlet.java
catch (NoClassDefFoundError e) { // Google App Engine does not allow java.net.InetAddress return false; }
// in src/main/org/h2/server/web/WebServer.java
catch (NoClassDefFoundError e) { // Google App Engine does not allow java.net.InetAddress }
2
            
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (NoClassDefFoundError e) { throw DbException.get(ErrorCode.UNSUPPORTED_JAVA_VERSION); }
// in src/main/org/h2/util/Utils.java
catch (NoClassDefFoundError e) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); }
(Lib) SecurityException 4
            
// in src/main/org/h2/engine/Database.java
catch (SecurityException e) { // applets may not do that - ignore // Google App Engine doesn't allow // to instantiate classes that extend Thread }
// in src/main/org/h2/engine/Database.java
catch (SecurityException e) { // applets may not do that - ignore }
// in src/main/org/h2/util/Utils.java
catch (SecurityException se) { return defaultValue; }
// in src/main/org/h2/util/MathUtils.java
catch (SecurityException e) { // workaround for the Google App Engine: don't use a thread runnable.run(); generateAlternativeSeed(); }
0
(Lib) ClassNotFoundException 3
            
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { return super.resolveClass(desc); }
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { try { return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); } }
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { return false; }
1
            
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { try { return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); } }
(Lib) FileNotFoundException 3
            
// in src/main/org/h2/tools/Backup.java
catch (FileNotFoundException e) { // the file could have been deleted in the meantime // ignore this (in this case an empty file is created) }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (FileNotFoundException e) { return false; }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (FileNotFoundException e) { // the file could have been deleted in the meantime // ignore this (in this case an empty file is created) }
0
(Lib) IllegalStateException 3
            
// in src/main/org/h2/bnf/Bnf.java
catch (IllegalStateException e) { // ignore }
// in src/main/org/h2/engine/Database.java
catch (IllegalStateException e) { // shutdown in progress - just don't register the handler // (maybe an application wants to write something into a // database at shutdown time) }
// in src/main/org/h2/engine/Database.java
catch (IllegalStateException e) { // ignore }
0
(Lib) InvocationTargetException 3
            
// in src/main/org/h2/engine/FunctionAlias.java
catch (InvocationTargetException e) { StatementBuilder buff = new StatementBuilder(method.getName()); buff.append('('); for (Object o : params) { buff.appendExceptFirst(", "); buff.append(o == null ? "null" : o.toString()); } buff.append(')'); throw DbException.convertInvocation(e, buff.toString()); }
// in src/main/org/h2/server/web/WebApp.java
catch (InvocationTargetException e) { rs.addRow("meta." + m.getName(), e.getTargetException().toString()); }
// in src/tools/org/h2/build/BuildBase.java
catch (InvocationTargetException e) { throw e.getCause(); }
2
            
// in src/main/org/h2/engine/FunctionAlias.java
catch (InvocationTargetException e) { StatementBuilder buff = new StatementBuilder(method.getName()); buff.append('('); for (Object o : params) { buff.appendExceptFirst(", "); buff.append(o == null ? "null" : o.toString()); } buff.append(')'); throw DbException.convertInvocation(e, buff.toString()); }
// in src/tools/org/h2/build/BuildBase.java
catch (InvocationTargetException e) { throw e.getCause(); }
(Lib) BindException 2
            
// in src/main/org/h2/store/FileLock.java
catch (BindException e) { throw getExceptionFatal("Bind Exception", null); }
// in src/main/org/h2/util/NetUtils.java
catch (BindException be) { throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2, be, "" + port, be.toString()); }
2
            
// in src/main/org/h2/store/FileLock.java
catch (BindException e) { throw getExceptionFatal("Bind Exception", null); }
// in src/main/org/h2/util/NetUtils.java
catch (BindException be) { throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2, be, "" + port, be.toString()); }
(Lib) EOFException 2
            
// in src/main/org/h2/store/DataReader.java
catch (EOFException e) { return i; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (EOFException e) { // more or less normal disconnect }
0
(Lib) Error 2
            
// in src/main/org/h2/util/Utils.java
catch (Error e) { // UnsupportedClassVersionError throw DbException.get(ErrorCode.GENERAL_ERROR_1, e, className); }
// in src/tools/org/h2/build/BuildBase.java
catch (Error e) { throw e; }
2
            
// in src/main/org/h2/util/Utils.java
catch (Error e) { // UnsupportedClassVersionError throw DbException.get(ErrorCode.GENERAL_ERROR_1, e, className); }
// in src/tools/org/h2/build/BuildBase.java
catch (Error e) { throw e; }
(Lib) IllegalArgumentException 2
            
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (IllegalArgumentException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; }
// in src/main/org/h2/util/DateTimeUtils.java
catch (IllegalArgumentException e) { // special case: if the time simply doesn't exist because of // daylight saving time changes, use the lenient version String message = e.toString(); if (message.indexOf("HOUR_OF_DAY") > 0) { if (hour < 0 || hour > 23) { throw e; } return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else if (message.indexOf("DAY_OF_MONTH") > 0) { int maxDay; if (month == 2) { maxDay = new GregorianCalendar().isLeapYear(year) ? 29 : 28; } else { maxDay = 30 + ((month + (month > 7 ? 1 : 0)) & 1); } if (day < 1 || day > maxDay) { throw e; } // DAY_OF_MONTH is thrown for years > 2037 // using the timezone Brasilia and others, // for example for 2042-10-12 00:00:00. hour += 6; return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else { return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } }
3
            
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (IllegalArgumentException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; }
// in src/main/org/h2/util/DateTimeUtils.java
catch (IllegalArgumentException e) { // special case: if the time simply doesn't exist because of // daylight saving time changes, use the lenient version String message = e.toString(); if (message.indexOf("HOUR_OF_DAY") > 0) { if (hour < 0 || hour > 23) { throw e; } return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else if (message.indexOf("DAY_OF_MONTH") > 0) { int maxDay; if (month == 2) { maxDay = new GregorianCalendar().isLeapYear(year) ? 29 : 28; } else { maxDay = 30 + ((month + (month > 7 ? 1 : 0)) & 1); } if (day < 1 || day > maxDay) { throw e; } // DAY_OF_MONTH is thrown for years > 2037 // using the timezone Brasilia and others, // for example for 2042-10-12 00:00:00. hour += 6; return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else { return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } }
(Lib) NoSuchAlgorithmException 2
            
// in src/tools/org/h2/dev/util/Migrate.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
2
            
// in src/tools/org/h2/dev/util/Migrate.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
(Lib) NonWritableChannelException 2
            
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
2
            
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
(Lib) PatternSyntaxException 2
            
// in src/main/org/h2/expression/Function.java
catch (PatternSyntaxException e) { throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, regexp); }
// in src/main/org/h2/expression/CompareLike.java
catch (PatternSyntaxException e) { throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, p); }
2
            
// in src/main/org/h2/expression/Function.java
catch (PatternSyntaxException e) { throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, regexp); }
// in src/main/org/h2/expression/CompareLike.java
catch (PatternSyntaxException e) { throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, p); }
(Lib) AccessControlException 1
            
// in src/main/org/h2/store/WriterThread.java
catch (AccessControlException e) { // // Google App Engine does not allow threads return null; }
0
(Lib) BufferUnderflowException 1
            
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (BufferUnderflowException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; }
1
            
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (BufferUnderflowException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; }
(Lib) CloneNotSupportedException 1
            
// in src/main/org/h2/engine/Engine.java
catch (CloneNotSupportedException e) { throw DbException.convert(e); }
1
            
// in src/main/org/h2/engine/Engine.java
catch (CloneNotSupportedException e) { throw DbException.convert(e); }
(Lib) ConnectException 1
            
// in src/main/org/h2/store/FileLock.java
catch (ConnectException e) { trace.debug(e, "socket not connected to port " + port); }
0
(Lib) DataFormatException 1
            
// in src/main/org/h2/compress/CompressDeflate.java
catch (DataFormatException e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
1
            
// in src/main/org/h2/compress/CompressDeflate.java
catch (DataFormatException e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
(Lib) ParseException 1
            
// in src/main/org/h2/server/web/PageParser.java
catch (ParseException e) { setError(pos); }
0
(Lib) UnsupportedEncodingException 1
            
// in src/tools/org/h2/dev/util/ReaderInputStream.java
catch (UnsupportedEncodingException e) { throw DbException.convert(e); }
1
            
// in src/tools/org/h2/dev/util/ReaderInputStream.java
catch (UnsupportedEncodingException e) { throw DbException.convert(e); }

Exception Recast Summary

There is a common practice of throwing exceptions from within a catch block (e.g. for wrapping a low-level exception). The following table summarizes the usage of this practice in the application. The last column gives the number of times it happens for a pair of exceptions. The graph below the table graphically renders the same information. For a given node, its color represents its origin (blue means library exception, orange means domain exception); the left-most number is the number of times it is thrown, the right-most is the number of times it is caught.

Catch Throw
(Lib) RuntimeException
Unknown
3
                    
// in src/main/org/h2/jdbcx/JdbcXid.java
catch (RuntimeException e) { throw DbException.get(ErrorCode.WRONG_XID_FORMAT_1, tid); }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (RuntimeException e) { // this can happen when stopping a web application, // if loading classes is no longer allowed // it would throw an IllegalStateException try { trace.error(e, "could not close the database"); // if this was successful, we ignore the exception // otherwise not } catch (RuntimeException e2) { throw e; } }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (RuntimeException e2) { throw e; }
// in src/tools/org/h2/build/BuildBase.java
catch (RuntimeException e) { throw e; }
(Domain) DbException
(Lib) EOFException
Unknown
1
                    
// in src/main/org/h2/store/PageInputStream.java
catch (DbException e) { throw new EOFException(); }
56
                    
// in src/main/org/h2/tools/Recover.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (DbException e) { if (!force) { throw e; } }
// in src/main/org/h2/store/PageStreamTrunk.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) { // wrong checksum means end of stream return null; } throw e; }
// in src/main/org/h2/store/FileLister.java
catch (DbException e) { throw DbException.get( ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, message).getSQLException(); }
// in src/main/org/h2/store/PageLog.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) { trace.debug("log recovery stopped"); } else { throw e; } }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (DbException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { close(); throw e; }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.IO_EXCEPTION_2) { if (e.getMessage().indexOf("locked") >= 0) { // in Windows, you can't open a locked file // (in other operating systems, you can) // the exact error message is: // "The process cannot access the file because // another process has locked a portion of the file" throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, e, fileName); } } throw e; }
// in src/main/org/h2/index/PageDataIndex.java
catch (DbException e) { if (e != fastDuplicateKeyException) { throw e; } if (!retry) { throw getNewDuplicateKeyException(); } if (add == 0) { // in the first re-try add a small random number, // to avoid collisions after a re-start row.setKey((long) (row.getKey() + Math.random() * 10000)); } else { row.setKey(row.getKey() + add); } add++; }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { throw e.addSQL(originalSQL); }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.SYNTAX_ERROR_1) { // now, get the detailed exception p = parse(sql, true); } else { throw e.addSQL(sql); } }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (force) { command.setSelectSQL(select); while (currentTokenType != END) { read(); } } else { throw e; } }
// in src/main/org/h2/command/ddl/CreateTable.java
catch (DbException e) { db.checkPowerOff(); db.removeSchemaObject(session, table); if (!transactional) { session.commit(true); } throw e; }
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
catch (DbException e) { execute("DROP TABLE " + newTable.getName(), true); throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage()); }
// in src/main/org/h2/command/dml/RunScriptCommand.java
catch (DbException e) { throw e.addSQL(sql); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(expr)); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(r)); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // possibly a concurrent merge or insert Index index = (Index) e.getSource(); if (index != null) { // verify the index columns match the key Column[] indexColumns = index.getColumns(); boolean indexMatchesKeys = false; if (indexColumns.length <= keys.length) { for (int i = 0; i < indexColumns.length; i++) { if (indexColumns[i] != keys[i]) { indexMatchesKeys = false; break; } } } if (indexMatchesKeys) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, table.getName()); } } } throw e; }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, x, getSQL(expr)); }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, rowNumber, getSQL(values)); }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e.addSQL(sql); database.exceptionThrown(e.getSQLException(), sql); throw e; }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); database.checkPowerOff(); if (s.getErrorCode() == ErrorCode.DEADLOCK_1) { session.rollback(); } else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { // there is a serious problem: // the transaction may be applied partially // in this case we need to panic: // close the database callStop = false; database.shutdownImmediately(); throw e; } else { session.rollbackTo(rollback, false); } throw e; }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (DbException e) { // ignore if the connection is broken right now if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { store.closeSilently(); throw e; }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_READ_ONLY) { throw e; } pageStore = null; while (!beforeWriting()) { // wait until others stopped writing and // until we can write (the file is not yet open - // no need to re-connect) } getPageStore(); }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.WRONG_USER_OR_PASSWORD) { validateUserAndPassword(false); } throw e; }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (!ignoreUnknownSetting) { session.close(); throw e; } }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (!ignoreUnknownSetting) { session.close(); throw e; } }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getErrorCode() == ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1) { // it might have been deleted by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getSQLException().getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // it might have been added by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { trans.close(); throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { traceSystem.close(); throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE) { throw e; } // exclusive mode: re-try endlessly try { Thread.sleep(500); } catch (Exception e2) { // ignore } }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { store.closeSilently(); throw e; }
// in src/main/org/h2/engine/MetaRecord.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); db.getTrace(Trace.DATABASE).error(s, sql); if (listener != null) { listener.exceptionThrown(s, sql); // continue startup in this case } else { throw e; } }
// in src/main/org/h2/engine/FunctionAlias.java
catch (DbException e) { if (!force) { throw e; } }
// in src/main/org/h2/engine/FunctionAlias.java
catch (DbException e) { throw e; }
// in src/main/org/h2/server/TcpServer.java
catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, ssl); } else { throw e; } }
// in src/main/org/h2/server/pg/PgServer.java
catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, false); } else { throw e; } }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e) { getSchema().freeUniqueName(indexName); try { index.remove(session); } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; } throw e; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; }
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (!force) { throw e; } Column[] cols = { }; setColumns(cols); linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols), IndexType.createNonUnique(false)); indexes.add(linkedIndex); }
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (retry >= MAX_RETRY) { connectException = e; throw e; } }
// in src/main/org/h2/table/Column.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DATA_CONVERSION_ERROR_1) { String target = (table == null ? "" : table.getName() + ": ") + getCreateSQL(); throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, v.getSQL() + " (" + target + ")"); } throw e; }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
(Domain) SQLException
(Lib) RuntimeException
Unknown
14
                    
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
52
                    
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { XAException xa = new XAException(XAException.XAER_RMERR); xa.initCause(e); throw xa; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/tools/CreateCluster.java
catch (SQLException e) { if (e.getErrorCode() == ErrorCode.DATABASE_NOT_FOUND_1) { // database does not exists yet - ok exists = false; } else { throw e; } }
// in src/main/org/h2/tools/Server.java
catch (SQLException e) { stopAll(); throw e; }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/Transfer.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/value/ValueResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/ValueResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/result/LocalResult.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Expression.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/Data.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/Data.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/LinkedCursor.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/FunctionCursorResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/FunctionCursorResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/engine/Database.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { if (force) { // ignore } else { if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } } }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { if (i == 1) { throw e; } }
// in src/main/org/h2/table/LinkSchema.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/table/FunctionTable.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (SQLException e) { if (retry >= MAX_RETRY) { throw DbException.convert(e); } conn.close(true); connect(); }
// in src/main/org/h2/table/TableLinkConnection.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (SQLException e) { throw convertException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
(Lib) IllegalArgumentException
Unknown
3
                    
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (IllegalArgumentException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; }
// in src/main/org/h2/util/DateTimeUtils.java
catch (IllegalArgumentException e) { // special case: if the time simply doesn't exist because of // daylight saving time changes, use the lenient version String message = e.toString(); if (message.indexOf("HOUR_OF_DAY") > 0) { if (hour < 0 || hour > 23) { throw e; } return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else if (message.indexOf("DAY_OF_MONTH") > 0) { int maxDay; if (month == 2) { maxDay = new GregorianCalendar().isLeapYear(year) ? 29 : 28; } else { maxDay = 30 + ((month + (month > 7 ? 1 : 0)) & 1); } if (day < 1 || day > maxDay) { throw e; } // DAY_OF_MONTH is thrown for years > 2037 // using the timezone Brasilia and others, // for example for 2042-10-12 00:00:00. hour += 6; return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else { return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } }
(Lib) InterruptedException
Unknown
1
                    
// in src/main/org/h2/store/FileLock.java
catch (InterruptedException e) { throw getExceptionFatal("Sleep interrupted", e); }
(Lib) IOException
(Lib) RuntimeException
Unknown
17
                    
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error downloading", e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/build/doc/RailroadImages.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error downloading " + fileURL + " to " + target, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error reading from file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error creating file " + destFile, e); }
// in src/tools/org/h2/build/Build.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/bytecode/ClassReader.java
catch (IOException e) { throw new RuntimeException("Could not read class bytecode", e); }
// in src/tools/org/h2/java/JavaParser.java
catch (IOException e) { throw new RuntimeException(e); }
80
                    
// in src/main/org/h2/tools/Restore.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/main/org/h2/tools/CompressTool.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/CompressTool.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/ConvertTraceFile.java
catch (IOException e) { throw DbException.convertIOException(e, traceFile); }
// in src/main/org/h2/tools/Backup.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException writing " + outputFileName, e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException reading " + inputFileName, e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { close(); throw e; }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException reading from " + fileName, e); }
// in src/main/org/h2/tools/RunScript.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/expression/Function.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/store/LobStorage.java
catch (IOException e) { if (lobId != -1) { removeLob(lobId); } throw DbException.convertIOException(e, null); }
// in src/main/org/h2/store/FileStoreInputStream.java
catch (IOException e) { throw DbException.convertIOException(e, store.name); }
// in src/main/org/h2/store/fs/FilePathMem.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (IOException e) { if (i > 16 || e.toString().indexOf("user-mapped section open") < 0) { throw e; } }
// in src/main/org/h2/store/fs/FilePathZip.java
catch (IOException e) { throw DbException.convertIOException(e, "listFiles " + path); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { return new FileOutputStream(name); } catch (IOException e2) { throw DbException.convertIOException(e, name); } }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e2) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { f = new FileDisk(name, mode); } catch (IOException e2) { throw e; } }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e2) { throw e; }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, "name: " + name + " mode: " + mode); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { throw getExceptionFatal("Could not save properties " + fileName, e); }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { throw getExceptionFatal("IOException", null); }
// in src/main/org/h2/command/dml/RunScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/command/dml/ScriptBase.java
catch (IOException e) { throw DbException.convertIOException(e, file); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, getFileName()); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/command/dml/BackupCommand.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (IOException e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (IOException e) { throw DbException.convertIOException(e, databaseName); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { throw DbException.convertIOException(e, prefix); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { if (len == 1) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, e, e + ": " + s); } switchOffCluster = true; }
// in src/main/org/h2/util/ScriptReader.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/util/ScriptReader.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { try { return createSocket("localhost", port, ssl); } catch (IOException e2) { // throw the original exception throw e; } }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e2) { // throw the original exception throw e; }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { throw DbException.convertIOException(e, "port: " + port + " ssl: " + ssl); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (IOException e) { throw DbException.convertIOException(e, "Can not read pg_catalog resource"); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (IOException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (IOException e) { throw DbException.convertIOException(e, "Tokenizer error"); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { throw DbException.convertIOException(e, "cwd"); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { throw DbException.convertIOException(e, "listFiles " + path); }
// in src/tools/org/h2/dev/util/FileViewer.java
catch (IOException e) { throw DbException.toSQLException(e); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (IOException io) { throw DbException.convertIOException(io, "could not generate model").getSQLException(); }
(Lib) Throwable
(Lib) RuntimeException
(Domain) SQLException
Unknown
1
                    
// in src/tools/org/h2/build/BuildBase.java
catch (Throwable e) { throw new RuntimeException(e); }
2
                    
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -annotateSchema value"); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -trimStrings value"); }
15
                    
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { // try again later triggerCallback = null; throw DbException.get(ErrorCode.ERROR_CREATING_TRIGGER_OBJECT_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_EXECUTING_TRIGGER_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/command/Command.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/command/Command.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { if (e instanceof OutOfMemoryError) { e.fillInStackTrace(); } if (traceSystem != null) { if (e instanceof SQLException) { SQLException e2 = (SQLException) e; if (e2.getErrorCode() != ErrorCode.DATABASE_ALREADY_OPEN_1) { // only write if the database is not already in use trace.error(e, "opening {0}", databaseName); } } traceSystem.close(); } closeOpenFilesAndUnlock(false); throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_SETTING_DATABASE_EVENT_LISTENER_2, e, className, e.toString()); }
// in src/main/org/h2/engine/SessionRemote.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.SERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.DESERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/server/TcpServer.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
(Lib) Exception
(Lib) Exception
(Lib) RuntimeException
Unknown
1
                    
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw new Exception("Failed to start a browser to open the URL " + url + ": " + e.getMessage()); }
24
                    
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read field " + className + "." + fieldName, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read value " + className + "." + methodName + "()", e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { if (MAKE_ACCESSIBLE) { Constructor[] constructors = clazz.getDeclaredConstructors(); // try 0 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 0) { c.setAccessible(true); try { return clazz.newInstance(); } catch (Exception e2) { // ignore } } } // try 1 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 1) { c.setAccessible(true); try { return (T) c.newInstance(new Object[1]); } catch (Exception e2) { // ignore } } } } throw new RuntimeException("Exception trying to create " + clazz.getName() + ": " + e, e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { throw new RuntimeException("Error converting CLOB to String: " + e.toString(), e); }
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { throw new RuntimeException(source.substring(0, current.index) + "[*]" + source.substring(current.index), e); }
436
                    
// in src/main/org/h2/message/TraceObject.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/tools/ChangeFileEncryption.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/ChangeFileEncryption.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/CompressTool.java
catch (Exception e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
// in src/main/org/h2/tools/CompressTool.java
catch (Exception e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
// in src/main/org/h2/tools/Backup.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Backup.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Csv.java
catch (Exception e) { close(); throw DbException.convertToIOException(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/RunScript.java
catch (Exception e) { if (continueOnError) { e.printStackTrace(out); } else { throw DbException.toSQLException(e); } }
// in src/main/org/h2/value/ValueTime.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "TIME", s); }
// in src/main/org/h2/value/ValueDate.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "DATE", s); }
// in src/main/org/h2/value/CompareModeIcu4J.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/value/ValueTimestamp.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "TIMESTAMP", s); }
// in src/main/org/h2/upgrade/DbUpgrade.java
catch (Exception e) { if (FileUtils.exists(backupData)) { FileUtils.moveTo(backupData, data); } if (FileUtils.exists(backupIndex)) { FileUtils.moveTo(backupIndex, index); } if (FileUtils.exists(backupLobs)) { FileUtils.moveTo(backupLobs, lobs); } FileUtils.delete(name + ".h2.db"); throw DbException.toSQLException(e); }
// in src/main/org/h2/schema/Schema.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Exception e) { if (onRollback) { // ignore } else { throw DbException.convert(e); } }
// in src/main/org/h2/store/fs/FilePathWrapper.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/compress/CompressDeflate.java
catch (Exception e) { throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_OPTIONS_1, options); }
// in src/main/org/h2/Driver.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/engine/UserAggregate.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Engine.java
catch (Exception e) { database.removeSession(session); throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX"); }
// in src/main/org/h2/engine/Engine.java
catch (Exception e) { throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX"); }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception re) { DbException e = DbException.convert(re); if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (autoServerMode) { String serverKey = ((JdbcSQLException) e.getSQLException()).getSQL(); if (serverKey != null) { backup.setServerKey(serverKey); // OPEN_NEW must be removed now, otherwise // opening a session with AUTO_SERVER fails // if another connection is already open backup.removeProperty("OPEN_NEW", null); connectServer(backup); return this; } } } throw e; }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { throw DbException.get(ErrorCode.SYNTAX_ERROR_1, e, source); }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SortedProperties.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/Utils.java
catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); }
// in src/main/org/h2/util/JdbcUtils.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/util/DateTimeUtils.java
catch (Exception e) { // ParseException throw DbException.get(ErrorCode.PARSE_ERROR_1, e, date); }
// in src/main/org/h2/util/DateTimeUtils.java
catch (Exception e) { throw DbException.get(ErrorCode.PARSE_ERROR_1, e, format + "/" + locale + "/" + timeZone); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { // could be SQLException or RuntimeException conn.close(true); conn = null; throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, e, originalTable + "(" + e.toString() + ")"); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { throw wrapException(sql, e); }
// in src/main/org/h2/table/MetaTable.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (Exception e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (Exception e) { throw convertException(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (Exception e) { throw DbException.convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { file = null; throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { file = null; throw convert(e); }
(Lib) ArrayIndexOutOfBoundsException
Unknown
2
                    
// in src/main/org/h2/tools/Recover.java
catch (ArrayIndexOutOfBoundsException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/StringUtils.java
catch (ArrayIndexOutOfBoundsException e) { throw DbException.get(ErrorCode.HEX_STRING_WRONG_1, s); }
(Lib) OutOfMemoryError
Unknown
1
                    
// in src/main/org/h2/util/Utils.java
catch (OutOfMemoryError e) { Error e2 = new OutOfMemoryError("Requested memory: " + len); e2.initCause(e); throw e2; }
(Lib) NumberFormatException
Unknown
9
                    
// in src/main/org/h2/value/Value.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, getString()); }
// in src/main/org/h2/expression/Function.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s); }
// in src/main/org/h2/command/Parser.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, sub); }
// in src/main/org/h2/engine/SettingsBase.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); }
// in src/main/org/h2/engine/SettingsBase.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); }
// in src/main/org/h2/util/StringUtils.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/main/org/h2/util/StringUtils.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/tools/org/h2/java/JavaParser.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/tools/org/h2/java/JavaParser.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
(Lib) PatternSyntaxException
Unknown
2
                    
// in src/main/org/h2/expression/Function.java
catch (PatternSyntaxException e) { throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, regexp); }
// in src/main/org/h2/expression/CompareLike.java
catch (PatternSyntaxException e) { throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, p); }
(Lib) NonWritableChannelException
(Lib) IOException
2
                    
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
(Lib) BufferUnderflowException
Unknown
1
                    
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (BufferUnderflowException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; }
(Lib) UnknownHostException
Unknown
2
                    
// in src/main/org/h2/store/FileLock.java
catch (UnknownHostException e) { throw getExceptionFatal("Unknown host " + ip, e); }
// in src/main/org/h2/util/NetUtils.java
catch (UnknownHostException e) { throw DbException.convert(e); }
(Lib) BindException
Unknown
2
                    
// in src/main/org/h2/store/FileLock.java
catch (BindException e) { throw getExceptionFatal("Bind Exception", null); }
// in src/main/org/h2/util/NetUtils.java
catch (BindException be) { throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2, be, "" + port, be.toString()); }
(Lib) DataFormatException
Unknown
1
                    
// in src/main/org/h2/compress/CompressDeflate.java
catch (DataFormatException e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
(Lib) NoClassDefFoundError
Unknown
2
                    
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (NoClassDefFoundError e) { throw DbException.get(ErrorCode.UNSUPPORTED_JAVA_VERSION); }
// in src/main/org/h2/util/Utils.java
catch (NoClassDefFoundError e) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); }
(Lib) CloneNotSupportedException
Unknown
1
                    
// in src/main/org/h2/engine/Engine.java
catch (CloneNotSupportedException e) { throw DbException.convert(e); }
(Lib) InvocationTargetException
Unknown
2
                    
// in src/main/org/h2/engine/FunctionAlias.java
catch (InvocationTargetException e) { StatementBuilder buff = new StatementBuilder(method.getName()); buff.append('('); for (Object o : params) { buff.appendExceptFirst(", "); buff.append(o == null ? "null" : o.toString()); } buff.append(')'); throw DbException.convertInvocation(e, buff.toString()); }
// in src/tools/org/h2/build/BuildBase.java
catch (InvocationTargetException e) { throw e.getCause(); }
(Lib) ClassNotFoundException
Unknown
1
                    
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { try { return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); } }
(Lib) Error
Unknown
2
                    
// in src/main/org/h2/util/Utils.java
catch (Error e) { // UnsupportedClassVersionError throw DbException.get(ErrorCode.GENERAL_ERROR_1, e, className); }
// in src/tools/org/h2/build/BuildBase.java
catch (Error e) { throw e; }
(Lib) UnsupportedEncodingException
Unknown
1
                    
// in src/tools/org/h2/dev/util/ReaderInputStream.java
catch (UnsupportedEncodingException e) { throw DbException.convert(e); }
(Lib) NoSuchAlgorithmException
(Lib) RuntimeException
2
                    
// in src/tools/org/h2/dev/util/Migrate.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }

Caught / Thrown Exception

Not all exceptions are thrown AND caught in the same project. The following table gives the exceptions types with respect to this. The lower left hand side sell lists all exceptions thrown but not caught (prevalent for libraries), the upper right-hand side lists all exceptions caught but not thrown (usually coming from external dependencies).

Thrown Not Thrown
Caught
Type Name
(Lib) RuntimeException
(Domain) SQLException
(Lib) IllegalArgumentException
(Lib) IllegalStateException
(Lib) IOException
(Lib) Exception
(Lib) FileNotFoundException
(Lib) ArrayIndexOutOfBoundsException
(Lib) EOFException
(Lib) DataFormatException
(Lib) ParseException
Type Name
(Domain) DbException
(Lib) InterruptedException
(Lib) Throwable
(Lib) OutOfMemoryError
(Lib) NumberFormatException
(Lib) PatternSyntaxException
(Lib) NonWritableChannelException
(Lib) BufferUnderflowException
(Lib) NullPointerException
(Lib) AccessControlException
(Lib) UnknownHostException
(Lib) BindException
(Lib) ConnectException
(Lib) NoClassDefFoundError
(Lib) SecurityException
(Lib) CloneNotSupportedException
(Lib) InvocationTargetException
(Lib) ClassNotFoundException
(Lib) Error
(Lib) UnsupportedEncodingException
(Lib) NoSuchAlgorithmException
Not caught
Type Name
(Lib) XAException
(Lib) UnsupportedOperationException
(Lib) AssertionError
(Domain) FastEOFException
(Lib) SQLClientInfoException
(Domain) JdbcBatchUpdateException
(Lib) NoSuchMethodException

Methods called in Catch and Finally Blocks

The following shows the methods that are called inside catch blocks (first column) and finally blocks (second column). For each method, we give the number of times it is called in a catch block (second sub-column), and the total number of calls (third sub-column). If the method name is red, it means that it is only called from catch/finally blocks. Hovering over a number triggers showing code snippets from the application code.

Catch Finally
Method Nbr Nbr total
logAndConvert
363
                  
// in src/main/org/h2/message/TraceObject.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { // this method doesn't throw an exception, but it logs it logAndConvert(e); return false; }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
363
convert 75
                  
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/CompareModeIcu4J.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/value/ValueResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/ValueResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/result/LocalResult.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/schema/Schema.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Exception e) { if (onRollback) { // ignore } else { throw DbException.convert(e); } }
// in src/main/org/h2/schema/TriggerObject.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Expression.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/Data.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/Data.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/fs/FilePathWrapper.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/index/LinkedCursor.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/FunctionCursorResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/FunctionCursorResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/command/Command.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/command/Command.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/UserAggregate.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (IOException e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { if (e instanceof OutOfMemoryError) { e.fillInStackTrace(); } if (traceSystem != null) { if (e instanceof SQLException) { SQLException e2 = (SQLException) e; if (e2.getErrorCode() != ErrorCode.DATABASE_ALREADY_OPEN_1) { // only write if the database is not already in use trace.error(e, "opening {0}", databaseName); } } traceSystem.close(); } closeOpenFilesAndUnlock(false); throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Engine.java
catch (CloneNotSupportedException e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception re) { DbException e = DbException.convert(re); if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (autoServerMode) { String serverKey = ((JdbcSQLException) e.getSQLException()).getSQL(); if (serverKey != null) { backup.setServerKey(serverKey); // OPEN_NEW must be removed now, otherwise // opening a session with AUTO_SERVER fails // if another connection is already open backup.removeProperty("OPEN_NEW", null); connectServer(backup); return this; } } } throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/NetUtils.java
catch (UnknownHostException e) { throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/server/TcpServer.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/table/LinkSchema.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/table/FunctionTable.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { // could be SQLException or RuntimeException conn.close(true); conn = null; throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (SQLException e) { if (retry >= MAX_RETRY) { throw DbException.convert(e); } conn.close(true); connect(); }
// in src/main/org/h2/table/TableLinkConnection.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/table/MetaTable.java
catch (Exception e) { throw DbException.convert(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (Exception e) { throw DbException.convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { file = null; throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { file = null; throw convert(e); }
// in src/tools/org/h2/dev/util/ReaderInputStream.java
catch (UnsupportedEncodingException e) { throw DbException.convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
102
convertIOException
61
                  
// in src/main/org/h2/tools/Restore.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/main/org/h2/tools/CompressTool.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/CompressTool.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/ConvertTraceFile.java
catch (IOException e) { throw DbException.convertIOException(e, traceFile); }
// in src/main/org/h2/tools/Backup.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/RunScript.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/expression/Function.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/store/LobStorage.java
catch (IOException e) { if (lobId != -1) { removeLob(lobId); } throw DbException.convertIOException(e, null); }
// in src/main/org/h2/store/FileStoreInputStream.java
catch (IOException e) { throw DbException.convertIOException(e, store.name); }
// in src/main/org/h2/store/fs/FilePathMem.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathZip.java
catch (IOException e) { throw DbException.convertIOException(e, "listFiles " + path); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { return new FileOutputStream(name); } catch (IOException e2) { throw DbException.convertIOException(e, name); } }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e2) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, "name: " + name + " mode: " + mode); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/command/dml/RunScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/command/dml/ScriptBase.java
catch (IOException e) { throw DbException.convertIOException(e, file); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, getFileName()); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/command/dml/BackupCommand.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/engine/Database.java
catch (IOException e) { throw DbException.convertIOException(e, databaseName); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { throw DbException.convertIOException(e, prefix); }
// in src/main/org/h2/util/ScriptReader.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/util/ScriptReader.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { throw DbException.convertIOException(e, "port: " + port + " ssl: " + ssl); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (IOException e) { throw DbException.convertIOException(e, "Can not read pg_catalog resource"); }
// in src/main/org/h2/fulltext/FullText.java
catch (IOException e) { throw DbException.convertIOException(e, "Tokenizer error"); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { throw DbException.convertIOException(e, "cwd"); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { throw DbException.convertIOException(e, "listFiles " + path); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (IOException io) { throw DbException.convertIOException(io, "could not generate model").getSQLException(); }
61
get 43
                  
// in src/main/org/h2/jdbcx/JdbcXid.java
catch (RuntimeException e) { throw DbException.get(ErrorCode.WRONG_XID_FORMAT_1, tid); }
// in src/main/org/h2/message/TraceSystem.java
catch (Throwable e) { e = DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, adapterClass); write(ERROR, Trace.DATABASE, adapterClass, e); return; }
// in src/main/org/h2/tools/CompressTool.java
catch (Exception e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
// in src/main/org/h2/tools/CompressTool.java
catch (Exception e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
// in src/main/org/h2/value/ValueTime.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "TIME", s); }
// in src/main/org/h2/value/ValueDate.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "DATE", s); }
// in src/main/org/h2/value/ValueTimestamp.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "TIMESTAMP", s); }
// in src/main/org/h2/value/Value.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, getString()); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { // try again later triggerCallback = null; throw DbException.get(ErrorCode.ERROR_CREATING_TRIGGER_OBJECT_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_EXECUTING_TRIGGER_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/expression/Function.java
catch (PatternSyntaxException e) { throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, regexp); }
// in src/main/org/h2/expression/Function.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s); }
// in src/main/org/h2/expression/CompareLike.java
catch (PatternSyntaxException e) { throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, p); }
// in src/main/org/h2/store/FileLister.java
catch (DbException e) { throw DbException.get( ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, message).getSQLException(); }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.IO_EXCEPTION_2) { if (e.getMessage().indexOf("locked") >= 0) { // in Windows, you can't open a locked file // (in other operating systems, you can) // the exact error message is: // "The process cannot access the file because // another process has locked a portion of the file" throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, e, fileName); } } throw e; }
// in src/main/org/h2/compress/CompressDeflate.java
catch (Exception e) { throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_OPTIONS_1, options); }
// in src/main/org/h2/compress/CompressDeflate.java
catch (DataFormatException e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
// in src/main/org/h2/command/Parser.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, sub); }
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
catch (DbException e) { execute("DROP TABLE " + newTable.getName(), true); throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage()); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // possibly a concurrent merge or insert Index index = (Index) e.getSource(); if (index != null) { // verify the index columns match the key Column[] indexColumns = index.getColumns(); boolean indexMatchesKeys = false; if (indexColumns.length <= keys.length) { for (int i = 0; i < indexColumns.length; i++) { if (indexColumns[i] != keys[i]) { indexMatchesKeys = false; break; } } } if (indexMatchesKeys) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, table.getName()); } } } throw e; }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (NoClassDefFoundError e) { throw DbException.get(ErrorCode.UNSUPPORTED_JAVA_VERSION); }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_SETTING_DATABASE_EVENT_LISTENER_2, e, className, e.toString()); }
// in src/main/org/h2/engine/Engine.java
catch (Exception e) { database.removeSession(session); throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX"); }
// in src/main/org/h2/engine/Engine.java
catch (Exception e) { throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX"); }
// in src/main/org/h2/engine/SettingsBase.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); }
// in src/main/org/h2/engine/SettingsBase.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { if (len == 1) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, e, e + ": " + s); } switchOffCluster = true; }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { throw DbException.get(ErrorCode.SYNTAX_ERROR_1, e, source); }
// in src/main/org/h2/util/NetUtils.java
catch (BindException be) { throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2, be, "" + port, be.toString()); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.SERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.DESERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { try { return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); } }
// in src/main/org/h2/util/Utils.java
catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); }
// in src/main/org/h2/util/Utils.java
catch (NoClassDefFoundError e) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); }
// in src/main/org/h2/util/Utils.java
catch (Error e) { // UnsupportedClassVersionError throw DbException.get(ErrorCode.GENERAL_ERROR_1, e, className); }
// in src/main/org/h2/util/DateTimeUtils.java
catch (Exception e) { // ParseException throw DbException.get(ErrorCode.PARSE_ERROR_1, e, date); }
// in src/main/org/h2/util/DateTimeUtils.java
catch (Exception e) { throw DbException.get(ErrorCode.PARSE_ERROR_1, e, format + "/" + locale + "/" + timeZone); }
// in src/main/org/h2/util/StringUtils.java
catch (ArrayIndexOutOfBoundsException e) { throw DbException.get(ErrorCode.HEX_STRING_WRONG_1, s); }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, e, originalTable + "(" + e.toString() + ")"); }
// in src/main/org/h2/table/Column.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DATA_CONVERSION_ERROR_1) { String target = (table == null ? "" : table.getName() + ": ") + getCreateSQL(); throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, v.getSQL() + " (" + target + ")"); } throw e; }
1872
trace 37
                  
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { trace(e.toString()); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { trace(e.toString()); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { trace(e.toString()); }
278
traceError 32
                  
// in src/main/org/h2/tools/Recover.java
catch (Exception e) { traceError(n, e); }
// in src/main/org/h2/server/TcpServer.java
catch (UnknownHostException e) { traceError(e); return false; }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { if (traceError) { traceError(e); } return false; }
// in src/main/org/h2/server/pg/PgServer.java
catch (UnknownHostException e) { traceError(e); return false; }
// in src/main/org/h2/server/pg/PgServer.java
catch (Exception e) { if (traceError) { traceError(e); } return false; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { server.traceError(e); s = null; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Throwable e) { server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (RuntimeException e) { closeError = e; server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (RuntimeException e) { if (closeError == null) { closeError = e; server.traceError(e); } }
// in src/main/org/h2/server/TcpServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Exception e2) { if (!transfer.isClosed()) { server.traceError(e2); } // if writing the error does not work, close the connection stop = true; }
// in src/main/org/h2/server/web/WebThread.java
catch (UnknownHostException e) { server.traceError(e); return false; }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { server.traceError(e); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/web/WebApp.java
catch (OutOfMemoryError e2) { server.traceError(e); return e.toString(); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { if (traceError) { traceError(e); } return false; }
// in src/main/org/h2/server/web/WebServer.java
catch (IOException e) { traceError(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { traceError(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { traceError(e); }
// in src/main/org/h2/server/web/WebSession.java
catch (Exception e) { // ok we don't have the bnf server.traceError(e); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (Throwable t) { server.traceError(t); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (Exception e) { server.traceError(e); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (IOException e) { server.traceError(e); reply(426, "Failed"); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (Exception e) { server.traceError(e); reply(426, "Failed"); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (Exception e) { server.traceError(e); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
catch (Exception e) { traceError(e); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
catch (IOException e) { traceError(e); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
catch (IOException e) { if (traceError) { traceError(e); } return false; }
34
error 30
                  
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { trace.error(e, "close"); }
// in src/main/org/h2/store/WriterThread.java
catch (Exception e) { TraceSystem traceSystem = database.getTraceSystem(); if (traceSystem != null) { traceSystem.getTrace(Trace.DATABASE).error(e, "flush"); } }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { trace.error(e, "close"); }
// in src/main/org/h2/command/CommandRemote.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { trace.error(e, "closing session"); }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { if (e instanceof OutOfMemoryError) { e.fillInStackTrace(); } if (traceSystem != null) { if (e instanceof SQLException) { SQLException e2 = (SQLException) e; if (e2.getErrorCode() != ErrorCode.DATABASE_ALREADY_OPEN_1) { // only write if the database is not already in use trace.error(e, "opening {0}", databaseName); } } traceSystem.close(); } closeOpenFilesAndUnlock(false); throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Exception e) { trace.error(e, "pending {0}", pending); return false; }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "disconnecting session #{0}", s.getId()); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (SQLException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { if (SysProperties.CHECK2) { int code = e.getErrorCode(); if (code != ErrorCode.DATABASE_IS_CLOSED && code != ErrorCode.LOCK_TIMEOUT_1 && code != ErrorCode.IO_EXCEPTION_2) { e.printStackTrace(); } } trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (Throwable t) { if (SysProperties.CHECK2) { t.printStackTrace(); } trace.error(t, "close"); }
// in src/main/org/h2/engine/Database.java
catch (InterruptedException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (Exception e) { // DbException, InterruptedException trace.error(e, "readOnly {0}", readOnly); // ignore }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (RuntimeException e) { // this can happen when stopping a web application, // if loading classes is no longer allowed // it would throw an IllegalStateException try { trace.error(e, "could not close the database"); // if this was successful, we ignore the exception // otherwise not } catch (RuntimeException e2) { throw e; } }
// in src/main/org/h2/engine/SessionRemote.java
catch (RuntimeException e) { trace.error(e, "close"); closeError = e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/MetaRecord.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); db.getTrace(Trace.DATABASE).error(s, sql); if (listener != null) { listener.exceptionThrown(s, sql); // continue startup in this case } else { throw e; } }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e) { getSchema().freeUniqueName(indexName); try { index.remove(session); } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; } throw e; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (Exception e) { error(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (Exception e) { error(e); break; }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { error(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { error(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { error(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { error(e); }
65
printStackTrace 30
                  
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
catch (SQLException e) { if (logWriter != null) { e.printStackTrace(logWriter); } }
// in src/main/org/h2/tools/RunScript.java
catch (Exception e) { if (continueOnError) { e.printStackTrace(out); } else { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/Console.java
catch (Exception e) { e.printStackTrace(); }
// in src/main/org/h2/tools/Console.java
catch (IOException e) { e.printStackTrace(); return null; }
// in src/main/org/h2/tools/Shell.java
catch (Exception e) { println("Exception: " + e.toString()); e.printStackTrace(err); break; }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("SQL Exception: " + e.getMessage()); e.printStackTrace(err); }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("Error: " + e.toString()); if (listMode) { e.printStackTrace(err); } return; }
// in src/main/org/h2/store/RecoverTester.java
catch (DbException e) { SQLException e2 = DbException.toSQLException(e); int errorCode = e2.getErrorCode(); if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } e.printStackTrace(System.out); }
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { // failed int errorCode = 0; if (e instanceof SQLException) { errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } e.printStackTrace(System.out); }
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { int errorCode = 0; if (e instanceof DbException) { e = ((DbException) e).getSQLException(); errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } StringBuilder buff = new StringBuilder(); StackTraceElement[] list = e.getStackTrace(); for (int i = 0; i < 10 && i < list.length; i++) { buff.append(list[i].toString()).append('\n'); } String s = buff.toString(); if (!knownErrors.contains(s)) { out.println(writeCount + " code: " + errorCode + " " + e.toString()); e.printStackTrace(System.out); knownErrors.add(s); } else { out.println(writeCount + " code: " + errorCode); } }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { if (SysProperties.CHECK2) { int code = e.getErrorCode(); if (code != ErrorCode.DATABASE_IS_CLOSED && code != ErrorCode.LOCK_TIMEOUT_1 && code != ErrorCode.IO_EXCEPTION_2) { e.printStackTrace(); } } trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (Throwable t) { if (SysProperties.CHECK2) { t.printStackTrace(); } trace.error(t, "close"); }
// in src/main/org/h2/util/Utils.java
catch (IOException e) { // if this happens we have a real problem e.printStackTrace(); }
// in src/main/org/h2/server/pg/PgServer.java
catch (Exception e) { if (!stop) { e.printStackTrace(); } }
// in src/main/org/h2/server/pg/PgServer.java
catch (IOException e) { // TODO log exception e.printStackTrace(); }
// in src/main/org/h2/server/pg/PgServer.java
catch (Exception e) { // TODO log exception e.printStackTrace(); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { e.printStackTrace(); stop = true; }
// in src/main/org/h2/server/web/DbStarter.java
catch (Exception e) { e.printStackTrace(); }
// in src/main/org/h2/server/web/DbStarter.java
catch (Exception e) { e.printStackTrace(); }
// in src/main/org/h2/server/web/DbStarter.java
catch (Exception e) { e.printStackTrace(); }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
catch (IOException e) { e.printStackTrace(); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
catch (IOException e) { e.printStackTrace(); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
catch (IOException e) { e.printStackTrace(); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
catch (Throwable e) { e.printStackTrace(); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { e.printStackTrace(); result = exec("javac", new StringList(array)); }
// in src/tools/org/h2/build/Build.java
catch (Exception e) { e.printStackTrace(); serverSocket = new ServerSocket(0); }
// in src/tools/org/h2/build/Build.java
catch (Throwable t) { t.printStackTrace(); }
// in src/tools/org/h2/build/Build.java
catch (IOException e) { e.printStackTrace(); }
// in src/tools/org/h2/build/Build.java
catch (Throwable t) { t.printStackTrace(); }
// in src/tools/org/h2/build/Build.java
catch (Exception e) { e.printStackTrace(); }
55
toString 30
                  
// in src/main/org/h2/tools/Shell.java
catch (Exception e) { println("Exception: " + e.toString()); e.printStackTrace(err); break; }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("Error: " + e.toString()); if (listMode) { e.printStackTrace(err); } return; }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { // try again later triggerCallback = null; throw DbException.get(ErrorCode.ERROR_CREATING_TRIGGER_OBJECT_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_EXECUTING_TRIGGER_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { int errorCode = 0; if (e instanceof DbException) { e = ((DbException) e).getSQLException(); errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } StringBuilder buff = new StringBuilder(); StackTraceElement[] list = e.getStackTrace(); for (int i = 0; i < 10 && i < list.length; i++) { buff.append(list[i].toString()).append('\n'); } String s = buff.toString(); if (!knownErrors.contains(s)) { out.println(writeCount + " code: " + errorCode + " " + e.toString()); e.printStackTrace(System.out); knownErrors.add(s); } else { out.println(writeCount + " code: " + errorCode); } }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (IOException e) { if (i > 16 || e.toString().indexOf("user-mapped section open") < 0) { throw e; } }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_SETTING_DATABASE_EVENT_LISTENER_2, e, className, e.toString()); }
// in src/main/org/h2/engine/FunctionAlias.java
catch (InvocationTargetException e) { StatementBuilder buff = new StatementBuilder(method.getName()); buff.append('('); for (Object o : params) { buff.appendExceptFirst(", "); buff.append(o == null ? "null" : o.toString()); } buff.append(')'); throw DbException.convertInvocation(e, buff.toString()); }
// in src/main/org/h2/util/NetUtils.java
catch (BindException be) { throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2, be, "" + port, be.toString()); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.SERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.DESERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { // nanoTime not found, this is ok (only exists for JDK 1.5 and higher) out.writeUTF(e.toString()); }
// in src/main/org/h2/util/DateTimeUtils.java
catch (IllegalArgumentException e) { // special case: if the time simply doesn't exist because of // daylight saving time changes, use the lenient version String message = e.toString(); if (message.indexOf("HOUR_OF_DAY") > 0) { if (hour < 0 || hour > 23) { throw e; } return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else if (message.indexOf("DAY_OF_MONTH") > 0) { int maxDay; if (month == 2) { maxDay = new GregorianCalendar().isLeapYear(year) ? 29 : 28; } else { maxDay = 30 + ((month + (month > 7 ? 1 : 0)) & 1); } if (day < 1 || day > maxDay) { throw e; } // DAY_OF_MONTH is thrown for years > 2037 // using the timezone Brasilia and others, // for example for 2042-10-12 00:00:00. hour += 6; return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else { return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { trace(e.toString()); }
// in src/main/org/h2/server/web/WebApp.java
catch (OutOfMemoryError e2) { server.traceError(e); return e.toString(); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { trace(e.toString()); }
// in src/main/org/h2/server/web/WebApp.java
catch (SQLException e) { map = e.toString(); }
// in src/main/org/h2/server/web/WebApp.java
catch (InvocationTargetException e) { rs.addRow("meta." + m.getName(), e.getTargetException().toString()); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { rs.addRow("meta." + m.getName(), e.toString()); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { trace(e.toString()); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, e, originalTable + "(" + e.toString() + ")"); }
// in src/tools/org/h2/build/doc/XMLChecker.java
catch (Exception e) { last = e; System.out.println("ERROR in file " + fileName + " " + e.toString()); }
// in src/tools/org/h2/build/BuildBase.java
catch (RuntimeException e) { println("Could not download using Maven: " + e.toString()); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { throw new RuntimeException("Error converting CLOB to String: " + e.toString(), e); }
513
convertToIOException
28
                  
// in src/main/org/h2/tools/Csv.java
catch (Exception e) { close(); throw DbException.convertToIOException(e); }
// in src/main/org/h2/tools/Recover.java
catch (ArrayIndexOutOfBoundsException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/value/Transfer.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/PageLog.java
catch (ArrayIndexOutOfBoundsException e) { DbException.convertToIOException(e); }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (DbException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/compress/LZFInputStream.java
catch (ArrayIndexOutOfBoundsException e) { DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/SortedProperties.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
28
getErrorCode 23
                  
// in src/main/org/h2/tools/CreateCluster.java
catch (SQLException e) { if (e.getErrorCode() == ErrorCode.DATABASE_NOT_FOUND_1) { // database does not exists yet - ok exists = false; } else { throw e; } }
// in src/main/org/h2/store/PageStreamTrunk.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) { // wrong checksum means end of stream return null; } throw e; }
// in src/main/org/h2/store/RecoverTester.java
catch (DbException e) { SQLException e2 = DbException.toSQLException(e); int errorCode = e2.getErrorCode(); if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } e.printStackTrace(System.out); }
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { // failed int errorCode = 0; if (e instanceof SQLException) { errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } e.printStackTrace(System.out); }
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { int errorCode = 0; if (e instanceof DbException) { e = ((DbException) e).getSQLException(); errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } StringBuilder buff = new StringBuilder(); StackTraceElement[] list = e.getStackTrace(); for (int i = 0; i < 10 && i < list.length; i++) { buff.append(list[i].toString()).append('\n'); } String s = buff.toString(); if (!knownErrors.contains(s)) { out.println(writeCount + " code: " + errorCode + " " + e.toString()); e.printStackTrace(System.out); knownErrors.add(s); } else { out.println(writeCount + " code: " + errorCode); } }
// in src/main/org/h2/store/PageLog.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) { trace.debug("log recovery stopped"); } else { throw e; } }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.IO_EXCEPTION_2) { if (e.getMessage().indexOf("locked") >= 0) { // in Windows, you can't open a locked file // (in other operating systems, you can) // the exact error message is: // "The process cannot access the file because // another process has locked a portion of the file" throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, e, fileName); } } throw e; }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.SYNTAX_ERROR_1) { // now, get the detailed exception p = parse(sql, true); } else { throw e.addSQL(sql); } }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // possibly a concurrent merge or insert Index index = (Index) e.getSource(); if (index != null) { // verify the index columns match the key Column[] indexColumns = index.getColumns(); boolean indexMatchesKeys = false; if (indexColumns.length <= keys.length) { for (int i = 0; i < indexColumns.length; i++) { if (indexColumns[i] != keys[i]) { indexMatchesKeys = false; break; } } } if (indexMatchesKeys) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, table.getName()); } } } throw e; }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); database.checkPowerOff(); if (s.getErrorCode() == ErrorCode.DEADLOCK_1) { session.rollback(); } else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { // there is a serious problem: // the transaction may be applied partially // in this case we need to panic: // close the database callStop = false; database.shutdownImmediately(); throw e; } else { session.rollbackTo(rollback, false); } throw e; }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (DbException e) { // ignore if the connection is broken right now if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { if (e instanceof OutOfMemoryError) { e.fillInStackTrace(); } if (traceSystem != null) { if (e instanceof SQLException) { SQLException e2 = (SQLException) e; if (e2.getErrorCode() != ErrorCode.DATABASE_ALREADY_OPEN_1) { // only write if the database is not already in use trace.error(e, "opening {0}", databaseName); } } traceSystem.close(); } closeOpenFilesAndUnlock(false); throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_READ_ONLY) { throw e; } pageStore = null; while (!beforeWriting()) { // wait until others stopped writing and // until we can write (the file is not yet open - // no need to re-connect) } getPageStore(); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { if (SysProperties.CHECK2) { int code = e.getErrorCode(); if (code != ErrorCode.DATABASE_IS_CLOSED && code != ErrorCode.LOCK_TIMEOUT_1 && code != ErrorCode.IO_EXCEPTION_2) { e.printStackTrace(); } } trace.error(e, "close"); }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.WRONG_USER_OR_PASSWORD) { validateUserAndPassword(false); } throw e; }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getErrorCode() == ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1) { // it might have been deleted by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getSQLException().getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // it might have been added by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception re) { DbException e = DbException.convert(re); if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (autoServerMode) { String serverKey = ((JdbcSQLException) e.getSQLException()).getSQL(); if (serverKey != null) { backup.setServerKey(serverKey); // OPEN_NEW must be removed now, otherwise // opening a session with AUTO_SERVER fails // if another connection is already open backup.removeProperty("OPEN_NEW", null); connectServer(backup); return this; } } } throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE) { throw e; } // exclusive mode: re-try endlessly try { Thread.sleep(500); } catch (Exception e2) { // ignore } }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { if (force) { // ignore } else { if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } } }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/Column.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DATA_CONVERSION_ERROR_1) { String target = (table == null ? "" : table.getName() + ": ") + getCreateSQL(); throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, v.getSQL() + " (" + target + ")"); } throw e; }
34
traceThrowable 21
                  
// in src/main/org/h2/message/DbException.java
catch (IOException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/value/Transfer.java
catch (IOException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/Driver.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/Driver.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/util/SortedProperties.java
catch (Exception e) { TraceSystem.traceThrowable(e); return def; }
// in src/main/org/h2/util/SortedProperties.java
catch (Exception e) { TraceSystem.traceThrowable(e); return def; }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { if (!stop) { TraceSystem.traceThrowable(e); } }
// in src/main/org/h2/server/TcpServer.java
catch (IOException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/TcpServer.java
catch (InterruptedException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/web/WebThread.java
catch (Exception e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (InterruptedException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (IOException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { TraceSystem.traceThrowable(e); return new Properties(); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/web/WebSession.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
23
toSQLException 20
                  
// in src/main/org/h2/tools/ChangeFileEncryption.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/ChangeFileEncryption.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Backup.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Backup.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Recover.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { result = DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/RunScript.java
catch (Exception e) { if (continueOnError) { e.printStackTrace(out); } else { throw DbException.toSQLException(e); } }
// in src/main/org/h2/upgrade/DbUpgrade.java
catch (Exception e) { if (FileUtils.exists(backupData)) { FileUtils.moveTo(backupData, data); } if (FileUtils.exists(backupIndex)) { FileUtils.moveTo(backupIndex, index); } if (FileUtils.exists(backupLobs)) { FileUtils.moveTo(backupLobs, lobs); } FileUtils.delete(name + ".h2.db"); throw DbException.toSQLException(e); }
// in src/main/org/h2/store/RecoverTester.java
catch (DbException e) { SQLException e2 = DbException.toSQLException(e); int errorCode = e2.getErrorCode(); if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } e.printStackTrace(System.out); }
// in src/main/org/h2/Driver.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/util/JdbcUtils.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (IOException e) { throw DbException.toSQLException(e); }
// in src/tools/org/h2/dev/util/FileViewer.java
catch (IOException e) { throw DbException.toSQLException(e); }
23
println 15
                  
// in src/main/org/h2/tools/Server.java
catch (Exception e) { out.println(e.getMessage()); }
// in src/main/org/h2/tools/Console.java
catch (Exception e) { out.println(e.getMessage()); }
// in src/main/org/h2/tools/Shell.java
catch (NumberFormatException e) { println("Usage: maxwidth <integer value>"); }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("SQL Exception: " + e.getMessage()); statement = null; }
// in src/main/org/h2/tools/Shell.java
catch (IOException e) { println(e.getMessage()); break; }
// in src/main/org/h2/tools/Shell.java
catch (Exception e) { println("Exception: " + e.toString()); e.printStackTrace(err); break; }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("SQL Exception: " + e.getMessage()); e.printStackTrace(err); }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("Error: " + e.toString()); if (listMode) { e.printStackTrace(err); } return; }
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { int errorCode = 0; if (e instanceof DbException) { e = ((DbException) e).getSQLException(); errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } StringBuilder buff = new StringBuilder(); StackTraceElement[] list = e.getStackTrace(); for (int i = 0; i < 10 && i < list.length; i++) { buff.append(list[i].toString()).append('\n'); } String s = buff.toString(); if (!knownErrors.contains(s)) { out.println(writeCount + " code: " + errorCode + " " + e.toString()); e.printStackTrace(System.out); knownErrors.add(s); } else { out.println(writeCount + " code: " + errorCode); } }
// in src/main/org/h2/util/Tool.java
catch (IOException e) { out.println("Cannot load " + resourceName); }
// in src/tools/org/h2/build/doc/XMLChecker.java
catch (Exception e) { last = e; System.out.println("ERROR in file " + fileName + " " + e.toString()); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { sysOut.println("Unknown target: " + target); projectHelp(); return false; }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { System.out.println(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (RuntimeException e) { println("Could not download using Maven: " + e.toString()); }
550
convertException
14
                  
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException writing " + outputFileName, e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException reading " + inputFileName, e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException reading from " + fileName, e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (Exception e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (Exception e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
14
debug 12
                  
// in src/main/org/h2/store/PageLog.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) { trace.debug("log recovery stopped"); } else { throw e; } }
// in src/main/org/h2/store/PageLog.java
catch (IOException e) { trace.debug("log recovery completed"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "unlock"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "unlock"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "sleep"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "sleep"); }
// in src/main/org/h2/store/FileLock.java
catch (ConnectException e) { trace.debug(e, "socket not connected to port " + port); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "lock"); serverSocket = null; lockFile(); return; }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "watchdog"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "watchdog"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "watchdog"); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { trace.debug(e, "could not cancel statement"); }
98
close 10
                  
// in src/main/org/h2/tools/Csv.java
catch (Exception e) { close(); throw DbException.convertToIOException(e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { close(); throw e; }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { close(); throw e; }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { if (e instanceof OutOfMemoryError) { e.fillInStackTrace(); } if (traceSystem != null) { if (e instanceof SQLException) { SQLException e2 = (SQLException) e; if (e2.getErrorCode() != ErrorCode.DATABASE_ALREADY_OPEN_1) { // only write if the database is not already in use trace.error(e, "opening {0}", databaseName); } } traceSystem.close(); } closeOpenFilesAndUnlock(false); throw DbException.convert(e); }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (!ignoreUnknownSetting) { session.close(); throw e; } }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (!ignoreUnknownSetting) { session.close(); throw e; } }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { trans.close(); throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { traceSystem.close(); throw e; }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { // could be SQLException or RuntimeException conn.close(true); conn = null; throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (SQLException e) { if (retry >= MAX_RETRY) { throw DbException.convert(e); } conn.close(true); connect(); }
317
getName 10
                  
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { // try again later triggerCallback = null; throw DbException.get(ErrorCode.ERROR_CREATING_TRIGGER_OBJECT_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_EXECUTING_TRIGGER_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
catch (DbException e) { execute("DROP TABLE " + newTable.getName(), true); throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage()); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // possibly a concurrent merge or insert Index index = (Index) e.getSource(); if (index != null) { // verify the index columns match the key Column[] indexColumns = index.getColumns(); boolean indexMatchesKeys = false; if (indexColumns.length <= keys.length) { for (int i = 0; i < indexColumns.length; i++) { if (indexColumns[i] != keys[i]) { indexMatchesKeys = false; break; } } } if (indexMatchesKeys) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, table.getName()); } } } throw e; }
// in src/main/org/h2/engine/FunctionAlias.java
catch (InvocationTargetException e) { StatementBuilder buff = new StatementBuilder(method.getName()); buff.append('('); for (Object o : params) { buff.appendExceptFirst(", "); buff.append(o == null ? "null" : o.toString()); } buff.append(')'); throw DbException.convertInvocation(e, buff.toString()); }
// in src/main/org/h2/server/web/WebApp.java
catch (InvocationTargetException e) { rs.addRow("meta." + m.getName(), e.getTargetException().toString()); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { rs.addRow("meta." + m.getName(), e.toString()); }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/Column.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DATA_CONVERSION_ERROR_1) { String target = (table == null ? "" : table.getName() + ": ") + getCreateSQL(); throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, v.getSQL() + " (" + target + ")"); } throw e; }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { if (MAKE_ACCESSIBLE) { Constructor[] constructors = clazz.getDeclaredConstructors(); // try 0 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 0) { c.setAccessible(true); try { return clazz.newInstance(); } catch (Exception e2) { // ignore } } } // try 1 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 1) { c.setAccessible(true); try { return (T) c.newInstance(new Object[1]); } catch (Exception e2) { // ignore } } } } throw new RuntimeException("Exception trying to create " + clazz.getName() + ": " + e, e); }
427
getMessage 9
                  
// in src/main/org/h2/tools/Server.java
catch (Exception e) { out.println(e.getMessage()); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw new Exception("Failed to start a browser to open the URL " + url + ": " + e.getMessage()); }
// in src/main/org/h2/tools/Console.java
catch (Exception e) { out.println(e.getMessage()); }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("SQL Exception: " + e.getMessage()); statement = null; }
// in src/main/org/h2/tools/Shell.java
catch (IOException e) { println(e.getMessage()); break; }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("SQL Exception: " + e.getMessage()); e.printStackTrace(err); }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.IO_EXCEPTION_2) { if (e.getMessage().indexOf("locked") >= 0) { // in Windows, you can't open a locked file // (in other operating systems, you can) // the exact error message is: // "The process cannot access the file because // another process has locked a portion of the file" throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, e, fileName); } } throw e; }
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
catch (DbException e) { execute("DROP TABLE " + newTable.getName(), true); throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage()); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { result = "<br />" + getStackTrace(0, e, session.getContents().isH2); error = formatAsError(e.getMessage()); }
21
getSQLException 8
                  
// in src/main/org/h2/store/FileLister.java
catch (DbException e) { throw DbException.get( ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, message).getSQLException(); }
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { int errorCode = 0; if (e instanceof DbException) { e = ((DbException) e).getSQLException(); errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } StringBuilder buff = new StringBuilder(); StackTraceElement[] list = e.getStackTrace(); for (int i = 0; i < 10 && i < list.length; i++) { buff.append(list[i].toString()).append('\n'); } String s = buff.toString(); if (!knownErrors.contains(s)) { out.println(writeCount + " code: " + errorCode + " " + e.toString()); e.printStackTrace(System.out); knownErrors.add(s); } else { out.println(writeCount + " code: " + errorCode); } }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e.addSQL(sql); database.exceptionThrown(e.getSQLException(), sql); throw e; }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); database.checkPowerOff(); if (s.getErrorCode() == ErrorCode.DEADLOCK_1) { session.rollback(); } else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { // there is a serious problem: // the transaction may be applied partially // in this case we need to panic: // close the database callStop = false; database.shutdownImmediately(); throw e; } else { session.rollbackTo(rollback, false); } throw e; }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getSQLException().getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // it might have been added by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception re) { DbException e = DbException.convert(re); if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (autoServerMode) { String serverKey = ((JdbcSQLException) e.getSQLException()).getSQL(); if (serverKey != null) { backup.setServerKey(serverKey); // OPEN_NEW must be removed now, otherwise // opening a session with AUTO_SERVER fails // if another connection is already open backup.removeProperty("OPEN_NEW", null); connectServer(backup); return this; } } } throw e; }
// in src/main/org/h2/engine/MetaRecord.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); db.getTrace(Trace.DATABASE).error(s, sql); if (listener != null) { listener.exceptionThrown(s, sql); // continue startup in this case } else { throw e; } }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (IOException io) { throw DbException.convertIOException(io, "could not generate model").getSQLException(); }
20
removeServer
8
                  
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { s.removeServer(e, i--, ++count); }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { session.removeServer(e, i--, ++count); }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { session.removeServer(e, i--, ++count); }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { session.removeServer(e, i--, ++count); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { removeServer(e, i--, ++count); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { removeServer(e, i--, ++count); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { removeServer(e, i--, ++count); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { removeServer(e, i--, ++count); }
8
sendErrorResponse 8
                  
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); break switchBlock; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); break; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (SQLException e) { sendErrorResponse(e); break; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
14
addSQL 7
                  
// in src/main/org/h2/command/Parser.java
catch (DbException e) { throw e.addSQL(originalSQL); }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.SYNTAX_ERROR_1) { // now, get the detailed exception p = parse(sql, true); } else { throw e.addSQL(sql); } }
// in src/main/org/h2/command/dml/RunScriptCommand.java
catch (DbException e) { throw e.addSQL(sql); }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e.addSQL(sql); database.exceptionThrown(e.getSQLException(), sql); throw e; }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); database.checkPowerOff(); if (s.getErrorCode() == ErrorCode.DEADLOCK_1) { session.rollback(); } else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { // there is a serious problem: // the transaction may be applied partially // in this case we need to panic: // close the database callStop = false; database.shutdownImmediately(); throw e; } else { session.rollbackTo(rollback, false); } throw e; }
// in src/main/org/h2/engine/MetaRecord.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); db.getTrace(Trace.DATABASE).error(s, sql); if (listener != null) { listener.exceptionThrown(s, sql); // continue startup in this case } else { throw e; } }
// in src/main/org/h2/table/TableView.java
catch (DbException e) { e.addSQL(getCreateSQL()); createException = e; // if it can't be compiled, then it's a 'zero column table' // this avoids problems when creating the view when opening the // database tables = New.arrayList(); cols = new Column[0]; if (recursive && columnNames != null) { cols = new Column[columnNames.length]; for (int i = 0; i < columnNames.length; i++) { cols[i] = new Column(columnNames[i], Value.STRING); } index.setRecursive(true); createException = null; } }
10
getSQL 7
                  
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
catch (DbException e) { execute("DROP TABLE " + newTable.getName(), true); throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage()); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(expr)); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(r)); }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, x, getSQL(expr)); }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, rowNumber, getSQL(values)); }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception re) { DbException e = DbException.convert(re); if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (autoServerMode) { String serverKey = ((JdbcSQLException) e.getSQLException()).getSQL(); if (serverKey != null) { backup.setServerKey(serverKey); // OPEN_NEW must be removed now, otherwise // opening a session with AUTO_SERVER fails // if another connection is already open backup.removeProperty("OPEN_NEW", null); connectServer(backup); return this; } } } throw e; }
// in src/main/org/h2/table/Column.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DATA_CONVERSION_ERROR_1) { String target = (table == null ? "" : table.getName() + ": ") + getCreateSQL(); throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, v.getSQL() + " (" + target + ")"); } throw e; }
285
getStackTrace 6
                  
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { int errorCode = 0; if (e instanceof DbException) { e = ((DbException) e).getSQLException(); errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } StringBuilder buff = new StringBuilder(); StackTraceElement[] list = e.getStackTrace(); for (int i = 0; i < 10 && i < list.length; i++) { buff.append(list[i].toString()).append('\n'); } String s = buff.toString(); if (!knownErrors.contains(s)) { out.println(writeCount + " code: " + errorCode + " " + e.toString()); e.printStackTrace(System.out); knownErrors.add(s); } else { out.println(writeCount + " code: " + errorCode); } }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("toolResult", getStackTrace(0, e, true)); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("tree", ""); session.put("error", getStackTrace(0, e, isH2)); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { session.put("result", getStackTrace(0, e, session.getContents().isH2)); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { result = "<br />" + getStackTrace(0, e, session.getContents().isH2); error = formatAsError(e.getMessage()); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { // throwable: including OutOfMemoryError and so on return getStackTrace(id, e, session.getContents().isH2); }
8
put 6
                  
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("toolResult", getStackTrace(0, e, true)); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("tree", ""); session.put("error", getStackTrace(0, e, isH2)); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("error", getLoginError(e, isH2)); return "login.jsp"; }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("error", getLoginError(e, isH2)); return "login.jsp"; }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { session.put("result", getStackTrace(0, e, session.getContents().isH2)); }
389
append 5
                  
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { int errorCode = 0; if (e instanceof DbException) { e = ((DbException) e).getSQLException(); errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } StringBuilder buff = new StringBuilder(); StackTraceElement[] list = e.getStackTrace(); for (int i = 0; i < 10 && i < list.length; i++) { buff.append(list[i].toString()).append('\n'); } String s = buff.toString(); if (!knownErrors.contains(s)) { out.println(writeCount + " code: " + errorCode + " " + e.toString()); e.printStackTrace(System.out); knownErrors.add(s); } else { out.println(writeCount + " code: " + errorCode); } }
// in src/main/org/h2/engine/FunctionAlias.java
catch (InvocationTargetException e) { StatementBuilder buff = new StatementBuilder(method.getName()); buff.append('('); for (Object o : params) { buff.appendExceptFirst(", "); buff.append(o == null ? "null" : o.toString()); } buff.append(')'); throw DbException.convertInvocation(e, buff.toString()); }
1621
getBytes 5
                  
// in src/main/org/h2/tools/Recover.java
catch (Throwable e) { writeDataError(writer, "exception " + e, s.getBytes()); continue; }
// in src/main/org/h2/tools/Recover.java
catch (Throwable e) { writeDataError(writer, "exception " + e, s.getBytes()); continue; }
// in src/main/org/h2/tools/Recover.java
catch (OutOfMemoryError e) { writeDataError(writer, "out of memory", s.getBytes()); return null; }
// in src/main/org/h2/tools/Recover.java
catch (Exception e) { writeDataError(writer, "exception " + e, s.getBytes()); continue; }
// in src/main/org/h2/tools/Recover.java
catch (OutOfMemoryError e) { writeDataError(writer, "out of memory", s.getBytes()); continue; }
149
getExceptionFatal 5
                  
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { throw getExceptionFatal("Could not save properties " + fileName, e); }
// in src/main/org/h2/store/FileLock.java
catch (UnknownHostException e) { throw getExceptionFatal("Unknown host " + ip, e); }
// in src/main/org/h2/store/FileLock.java
catch (BindException e) { throw getExceptionFatal("Bind Exception", null); }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { throw getExceptionFatal("IOException", null); }
// in src/main/org/h2/store/FileLock.java
catch (InterruptedException e) { throw getExceptionFatal("Sleep interrupted", e); }
13
warn 5
                  
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { // NoSuchAlgorithmException warn("SecureRandom", e); }
// in src/main/org/h2/util/MathUtils.java
catch (InterruptedException e) { warn("InterruptedException", e); }
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { // NoSuchAlgorithmException warn("SecureRandom", e); cachedSecureRandom = new SecureRandom(); }
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { warn("generateAlternativeSeed", e); }
// in src/main/org/h2/util/MathUtils.java
catch (IOException e) { warn("generateAlternativeSeed", e); return new byte[1]; }
14
wrapException
5
                  
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { throw wrapException(sql, e); }
5
writeDataError 5
                  
// in src/main/org/h2/tools/Recover.java
catch (Throwable e) { writeDataError(writer, "exception " + e, s.getBytes()); continue; }
// in src/main/org/h2/tools/Recover.java
catch (Throwable e) { writeDataError(writer, "exception " + e, s.getBytes()); continue; }
// in src/main/org/h2/tools/Recover.java
catch (OutOfMemoryError e) { writeDataError(writer, "out of memory", s.getBytes()); return null; }
// in src/main/org/h2/tools/Recover.java
catch (Exception e) { writeDataError(writer, "exception " + e, s.getBytes()); continue; }
// in src/main/org/h2/tools/Recover.java
catch (OutOfMemoryError e) { writeDataError(writer, "out of memory", s.getBytes()); continue; }
9
add 4
                  
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { int errorCode = 0; if (e instanceof DbException) { e = ((DbException) e).getSQLException(); errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } StringBuilder buff = new StringBuilder(); StackTraceElement[] list = e.getStackTrace(); for (int i = 0; i < 10 && i < list.length; i++) { buff.append(list[i].toString()).append('\n'); } String s = buff.toString(); if (!knownErrors.contains(s)) { out.println(writeCount + " code: " + errorCode + " " + e.toString()); e.printStackTrace(System.out); knownErrors.add(s); } else { out.println(writeCount + " code: " + errorCode); } }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (!force) { throw e; } Column[] cols = { }; setColumns(cols); linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols), IndexType.createNonUnique(false)); indexes.add(linkedIndex); }
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { current = back; forStat.init = readStatement(); forStat.condition = readExpr(); read(";"); do { forStat.updates.add(readExpr()); } while (readIf(",")); }
626
getFormatException 4
                  
// in src/main/org/h2/util/StringUtils.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/main/org/h2/util/StringUtils.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/tools/org/h2/java/JavaParser.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/tools/org/h2/java/JavaParser.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
10
indexOf 4
                  
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (IOException e) { if (i > 16 || e.toString().indexOf("user-mapped section open") < 0) { throw e; } }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.IO_EXCEPTION_2) { if (e.getMessage().indexOf("locked") >= 0) { // in Windows, you can't open a locked file // (in other operating systems, you can) // the exact error message is: // "The process cannot access the file because // another process has locked a portion of the file" throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, e, fileName); } } throw e; }
// in src/main/org/h2/util/DateTimeUtils.java
catch (IllegalArgumentException e) { // special case: if the time simply doesn't exist because of // daylight saving time changes, use the lenient version String message = e.toString(); if (message.indexOf("HOUR_OF_DAY") > 0) { if (hour < 0 || hour > 23) { throw e; } return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else if (message.indexOf("DAY_OF_MONTH") > 0) { int maxDay; if (month == 2) { maxDay = new GregorianCalendar().isLeapYear(year) ? 29 : 28; } else { maxDay = 30 + ((month + (month > 7 ? 1 : 0)) & 1); } if (day < 1 || day > maxDay) { throw e; } // DAY_OF_MONTH is thrown for years > 2037 // using the timezone Brasilia and others, // for example for 2042-10-12 00:00:00. hour += 6; return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else { return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } }
199
initCause 4
                  
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { XAException xa = new XAException(XAException.XAER_RMERR); xa.initCause(e); throw xa; }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (IllegalArgumentException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (BufferUnderflowException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; }
// in src/main/org/h2/util/Utils.java
catch (OutOfMemoryError e) { Error e2 = new OutOfMemoryError("Requested memory: " + len); e2.initCause(e); throw e2; }
10
setRow 4
                  
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(expr)); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(r)); }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, x, getSQL(expr)); }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, rowNumber, getSQL(values)); }
5
writeError
4
                  
// in src/main/org/h2/tools/Recover.java
catch (Exception e) { writeError(writer, e); }
// in src/main/org/h2/tools/Recover.java
catch (Throwable e) { writeError(writer, e); }
// in src/main/org/h2/tools/Recover.java
catch (Exception e) { writeError(writer, e); }
// in src/main/org/h2/tools/Recover.java
catch (Throwable t) { writeError(writer, t); }
4
closeFileSilently
3
                  
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
3
exceptionThrown 3
                  
// in src/main/org/h2/command/Command.java
catch (DbException e) { e.addSQL(sql); database.exceptionThrown(e.getSQLException(), sql); throw e; }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); database.checkPowerOff(); if (s.getErrorCode() == ErrorCode.DEADLOCK_1) { session.rollback(); } else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { // there is a serious problem: // the transaction may be applied partially // in this case we need to panic: // close the database callStop = false; database.shutdownImmediately(); throw e; } else { session.rollbackTo(rollback, false); } throw e; }
// in src/main/org/h2/engine/MetaRecord.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); db.getTrace(Trace.DATABASE).error(s, sql); if (listener != null) { listener.exceptionThrown(s, sql); // continue startup in this case } else { throw e; } }
4
exists 3
                  
// in src/main/org/h2/upgrade/DbUpgrade.java
catch (Exception e) { if (FileUtils.exists(backupData)) { FileUtils.moveTo(backupData, data); } if (FileUtils.exists(backupIndex)) { FileUtils.moveTo(backupIndex, index); } if (FileUtils.exists(backupLobs)) { FileUtils.moveTo(backupLobs, lobs); } FileUtils.delete(name + ".h2.db"); throw DbException.toSQLException(e); }
81
getContents 3
                  
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { session.put("result", getStackTrace(0, e, session.getContents().isH2)); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { result = "<br />" + getStackTrace(0, e, session.getContents().isH2); error = formatAsError(e.getMessage()); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { // throwable: including OutOfMemoryError and so on return getStackTrace(id, e, session.getContents().isH2); }
7
getTimeTry 3
                  
// in src/main/org/h2/util/DateTimeUtils.java
catch (IllegalArgumentException e) { // special case: if the time simply doesn't exist because of // daylight saving time changes, use the lenient version String message = e.toString(); if (message.indexOf("HOUR_OF_DAY") > 0) { if (hour < 0 || hour > 23) { throw e; } return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else if (message.indexOf("DAY_OF_MONTH") > 0) { int maxDay; if (month == 2) { maxDay = new GregorianCalendar().isLeapYear(year) ? 29 : 28; } else { maxDay = 30 + ((month + (month > 7 ? 1 : 0)) & 1); } if (day < 1 || day > maxDay) { throw e; } // DAY_OF_MONTH is thrown for years > 2037 // using the timezone Brasilia and others, // for example for 2042-10-12 00:00:00. hour += 6; return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else { return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } }
4
moveTo 3
                  
// in src/main/org/h2/upgrade/DbUpgrade.java
catch (Exception e) { if (FileUtils.exists(backupData)) { FileUtils.moveTo(backupData, data); } if (FileUtils.exists(backupIndex)) { FileUtils.moveTo(backupIndex, index); } if (FileUtils.exists(backupLobs)) { FileUtils.moveTo(backupLobs, lobs); } FileUtils.delete(name + ".h2.db"); throw DbException.toSQLException(e); }
21
printProblem
3
                  
// in src/main/org/h2/tools/Console.java
catch (SQLException e) { printProblem(e, web); startException = e; }
// in src/main/org/h2/tools/Console.java
catch (SQLException e) { printProblem(e, tcp); if (startException == null) { startException = e; } }
// in src/main/org/h2/tools/Console.java
catch (SQLException e) { printProblem(e, pg); if (startException == null) { startException = e; } }
3
reply 3
                  
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (IOException e) { server.traceError(e); reply(426, "Failed"); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (NumberFormatException e) { reply(500, "Invalid"); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (Exception e) { server.traceError(e); reply(426, "Failed"); }
58
addRow 2
                  
// in src/main/org/h2/server/web/WebApp.java
catch (InvocationTargetException e) { rs.addRow("meta." + m.getName(), e.getTargetException().toString()); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { rs.addRow("meta." + m.getName(), e.toString()); }
66
checkPowerOff 2
                  
// in src/main/org/h2/command/ddl/CreateTable.java
catch (DbException e) { db.checkPowerOff(); db.removeSchemaObject(session, table); if (!transactional) { session.commit(true); } throw e; }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); database.checkPowerOff(); if (s.getErrorCode() == ErrorCode.DEADLOCK_1) { session.rollback(); } else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { // there is a serious problem: // the transaction may be applied partially // in this case we need to panic: // close the database callStop = false; database.shutdownImmediately(); throw e; } else { session.rollbackTo(rollback, false); } throw e; }
12
checkRowCount 2
                  
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
4
closeSilently 2
                  
// in src/main/org/h2/engine/Database.java
catch (DbException e) { store.closeSilently(); throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { store.closeSilently(); throw e; }
91
createServerSocket 2
                  
// in src/main/org/h2/server/TcpServer.java
catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, ssl); } else { throw e; } }
// in src/main/org/h2/server/pg/PgServer.java
catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, false); } else { throw e; } }
11
exec 2
                  
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { result = exec("javadoc", args(args)); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { e.printStackTrace(); result = exec("javac", new StringList(array)); }
27
filterConcurrentUpdate
2
                  
// in src/main/org/h2/command/Command.java
catch (DbException e) { start = filterConcurrentUpdate(e, start); }
// in src/main/org/h2/command/Command.java
catch (DbException e) { start = filterConcurrentUpdate(e, start); }
2
forName 2
                  
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { try { return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); } }
// in src/tools/org/h2/build/doc/UploadBuild.java
catch (Exception e) { Class.forName("org.h2.upgrade.v1_1.Driver"); conn = DriverManager.getConnection("jdbc:h2v1_1:mem:"); }
22
freeMemoryAndFinalize
2
                  
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { return new FileOutputStream(name); } catch (IOException e2) { throw DbException.convertIOException(e, name); } }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { f = new FileDisk(name, mode); } catch (IOException e2) { throw e; } }
2
getCreateSQL 2
                  
// in src/main/org/h2/table/Column.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DATA_CONVERSION_ERROR_1) { String target = (table == null ? "" : table.getName() + ": ") + getCreateSQL(); throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, v.getSQL() + " (" + target + ")"); } throw e; }
// in src/main/org/h2/table/TableView.java
catch (DbException e) { e.addSQL(getCreateSQL()); createException = e; // if it can't be compiled, then it's a 'zero column table' // this avoids problems when creating the view when opening the // database tables = New.arrayList(); cols = new Column[0]; if (recursive && columnNames != null) { cols = new Column[columnNames.length]; for (int i = 0; i < columnNames.length; i++) { cols[i] = new Column(columnNames[i], Value.STRING); } index.setRecursive(true); createException = null; } }
53
getDatabase 2
                  
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getErrorCode() == ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1) { // it might have been deleted by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getSQLException().getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // it might have been added by another thread // ignore } else { throw e; } }
184
getKey 2
                  
// in src/main/org/h2/index/PageDataIndex.java
catch (DbException e) { if (e != fastDuplicateKeyException) { throw e; } if (!retry) { throw getNewDuplicateKeyException(); } if (add == 0) { // in the first re-try add a small random number, // to avoid collisions after a re-start row.setKey((long) (row.getKey() + Math.random() * 10000)); } else { row.setKey(row.getKey() + add); } add++; }
73
getLockMode 2
                  
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getErrorCode() == ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1) { // it might have been deleted by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getSQLException().getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // it might have been added by another thread // ignore } else { throw e; } }
9
getLoginError
2
                  
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("error", getLoginError(e, isH2)); return "login.jsp"; }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("error", getLoginError(e, isH2)); return "login.jsp"; }
2
getParameterTypes 2
                  
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { if (MAKE_ACCESSIBLE) { Constructor[] constructors = clazz.getDeclaredConstructors(); // try 0 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 0) { c.setAccessible(true); try { return clazz.newInstance(); } catch (Exception e2) { // ignore } } } // try 1 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 1) { c.setAccessible(true); try { return (T) c.newInstance(new Object[1]); } catch (Exception e2) { // ignore } } } } throw new RuntimeException("Exception trying to create " + clazz.getName() + ": " + e, e); }
10
getTrace 2
                  
// in src/main/org/h2/store/WriterThread.java
catch (Exception e) { TraceSystem traceSystem = database.getTraceSystem(); if (traceSystem != null) { traceSystem.getTrace(Trace.DATABASE).error(e, "flush"); } }
// in src/main/org/h2/engine/MetaRecord.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); db.getTrace(Trace.DATABASE).error(s, sql); if (listener != null) { listener.exceptionThrown(s, sql); // continue startup in this case } else { throw e; } }
43
logWritingError
2
                  
// in src/main/org/h2/message/TraceSystem.java
catch (Exception e) { logWritingError(e); }
// in src/main/org/h2/message/TraceSystem.java
catch (Exception e) { logWritingError(e); return false; }
2
newInstance 2
                  
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { if (MAKE_ACCESSIBLE) { Constructor[] constructors = clazz.getDeclaredConstructors(); // try 0 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 0) { c.setAccessible(true); try { return clazz.newInstance(); } catch (Exception e2) { // ignore } } } // try 1 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 1) { c.setAccessible(true); try { return (T) c.newInstance(new Object[1]); } catch (Exception e2) { // ignore } } } } throw new RuntimeException("Exception trying to create " + clazz.getName() + ": " + e, e); }
41
read 2
                  
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (force) { command.setSelectSQL(select); while (currentTokenType != END) { read(); } } else { throw e; } }
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { current = back; forStat.init = readStatement(); forStat.condition = readExpr(); read(";"); do { forStat.updates.add(readExpr()); } while (readIf(",")); }
461
readExpr 2
                  
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { current = back; forStat.init = readStatement(); forStat.condition = readExpr(); read(";"); do { forStat.updates.add(readExpr()); } while (readIf(",")); }
23
remove 2
                  
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e) { getSchema().freeUniqueName(indexName); try { index.remove(session); } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; } throw e; }
192
sendError 2
                  
// in src/main/org/h2/server/TcpServerThread.java
catch (Throwable e) { sendError(e); stop = true; }
// in src/main/org/h2/server/TcpServerThread.java
catch (Throwable e) { sendError(e); }
3
setAccessible 2
                  
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { if (MAKE_ACCESSIBLE) { Constructor[] constructors = clazz.getDeclaredConstructors(); // try 0 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 0) { c.setAccessible(true); try { return clazz.newInstance(); } catch (Exception e2) { // ignore } } } // try 1 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 1) { c.setAccessible(true); try { return (T) c.newInstance(new Object[1]); } catch (Exception e2) { // ignore } } } } throw new RuntimeException("Exception trying to create " + clazz.getName() + ": " + e, e); }
5
setKey 2
                  
// in src/main/org/h2/index/PageDataIndex.java
catch (DbException e) { if (e != fastDuplicateKeyException) { throw e; } if (!retry) { throw getNewDuplicateKeyException(); } if (add == 0) { // in the first re-try add a small random number, // to avoid collisions after a re-start row.setKey((long) (row.getKey() + Math.random() * 10000)); } else { row.setKey(row.getKey() + add); } add++; }
25
setNextException 2
                  
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; }
3
size 2
                  
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
500
sleep 2
                  
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE) { throw e; } // exclusive mode: re-try endlessly try { Thread.sleep(500); } catch (Exception e2) { // ignore } }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } }
37
substring 2
                  
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { throw new RuntimeException(source.substring(0, current.index) + "[*]" + source.substring(current.index), e); }
432
Column 1
                  
// in src/main/org/h2/table/TableView.java
catch (DbException e) { e.addSQL(getCreateSQL()); createException = e; // if it can't be compiled, then it's a 'zero column table' // this avoids problems when creating the view when opening the // database tables = New.arrayList(); cols = new Column[0]; if (recursive && columnNames != null) { cols = new Column[columnNames.length]; for (int i = 0; i < columnNames.length; i++) { cols[i] = new Column(columnNames[i], Value.STRING); } index.setRecursive(true); createException = null; } }
45
FileDisk 1
                  
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { f = new FileDisk(name, mode); } catch (IOException e2) { throw e; } }
2
FileOutputStream 1
                  
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { return new FileOutputStream(name); } catch (IOException e2) { throw DbException.convertIOException(e, name); } }
13
GregorianCalendar
1
                  
// in src/main/org/h2/util/DateTimeUtils.java
catch (IllegalArgumentException e) { // special case: if the time simply doesn't exist because of // daylight saving time changes, use the lenient version String message = e.toString(); if (message.indexOf("HOUR_OF_DAY") > 0) { if (hour < 0 || hour > 23) { throw e; } return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else if (message.indexOf("DAY_OF_MONTH") > 0) { int maxDay; if (month == 2) { maxDay = new GregorianCalendar().isLeapYear(year) ? 29 : 28; } else { maxDay = 30 + ((month + (month > 7 ? 1 : 0)) & 1); } if (day < 1 || day > maxDay) { throw e; } // DAY_OF_MONTH is thrown for years > 2037 // using the timezone Brasilia and others, // for example for 2042-10-12 00:00:00. hour += 6; return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else { return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } }
1
LinkedIndex 1
                  
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (!force) { throw e; } Column[] cols = { }; setColumns(cols); linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols), IndexType.createNonUnique(false)); indexes.add(linkedIndex); }
3
Properties 1
                  
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { TraceSystem.traceThrowable(e); return new Properties(); }
25
SecureRandom 1
                  
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { // NoSuchAlgorithmException warn("SecureRandom", e); cachedSecureRandom = new SecureRandom(); }
3
ServerSocket 1
                  
// in src/tools/org/h2/build/Build.java
catch (Exception e) { e.printStackTrace(); serverSocket = new ServerSocket(0); }
5
StatementBuilder 1
                  
// in src/main/org/h2/engine/FunctionAlias.java
catch (InvocationTargetException e) { StatementBuilder buff = new StatementBuilder(method.getName()); buff.append('('); for (Object o : params) { buff.appendExceptFirst(", "); buff.append(o == null ? "null" : o.toString()); } buff.append(')'); throw DbException.convertInvocation(e, buff.toString()); }
79
StringBuilder 1
                  
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { int errorCode = 0; if (e instanceof DbException) { e = ((DbException) e).getSQLException(); errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } StringBuilder buff = new StringBuilder(); StackTraceElement[] list = e.getStackTrace(); for (int i = 0; i < 10 && i < list.length; i++) { buff.append(list[i].toString()).append('\n'); } String s = buff.toString(); if (!knownErrors.contains(s)) { out.println(writeCount + " code: " + errorCode + " " + e.toString()); e.printStackTrace(System.out); knownErrors.add(s); } else { out.println(writeCount + " code: " + errorCode); } }
161
StringList 1
                  
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { e.printStackTrace(); result = exec("javac", new StringList(array)); }
6
appendExceptFirst 1
                  
// in src/main/org/h2/engine/FunctionAlias.java
catch (InvocationTargetException e) { StatementBuilder buff = new StatementBuilder(method.getName()); buff.append('('); for (Object o : params) { buff.appendExceptFirst(", "); buff.append(o == null ? "null" : o.toString()); } buff.append(')'); throw DbException.convertInvocation(e, buff.toString()); }
103
args 1
                  
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { result = exec("javadoc", args(args)); }
33
arrayList 1
                  
// in src/main/org/h2/table/TableView.java
catch (DbException e) { e.addSQL(getCreateSQL()); createException = e; // if it can't be compiled, then it's a 'zero column table' // this avoids problems when creating the view when opening the // database tables = New.arrayList(); cols = new Column[0]; if (recursive && columnNames != null) { cols = new Column[columnNames.length]; for (int i = 0; i < columnNames.length; i++) { cols[i] = new Column(columnNames[i], Value.STRING); } index.setRecursive(true); createException = null; } }
238
beforeWriting 1
                  
// in src/main/org/h2/engine/Database.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_READ_ONLY) { throw e; } pageStore = null; while (!beforeWriting()) { // wait until others stopped writing and // until we can write (the file is not yet open - // no need to re-connect) } getPageStore(); }
6
closeOpenFilesAndUnlock 1
                  
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { if (e instanceof OutOfMemoryError) { e.fillInStackTrace(); } if (traceSystem != null) { if (e instanceof SQLException) { SQLException e2 = (SQLException) e; if (e2.getErrorCode() != ErrorCode.DATABASE_ALREADY_OPEN_1) { // only write if the database is not already in use trace.error(e, "opening {0}", databaseName); } } traceSystem.close(); } closeOpenFilesAndUnlock(false); throw DbException.convert(e); }
3
commit 1
                  
// in src/main/org/h2/command/ddl/CreateTable.java
catch (DbException e) { db.checkPowerOff(); db.removeSchemaObject(session, table); if (!transactional) { session.commit(true); } throw e; }
79
connect 1
                  
// in src/main/org/h2/table/TableLink.java
catch (SQLException e) { if (retry >= MAX_RETRY) { throw DbException.convert(e); } conn.close(true); connect(); }
14
connectServer 1
                  
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception re) { DbException e = DbException.convert(re); if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (autoServerMode) { String serverKey = ((JdbcSQLException) e.getSQLException()).getSQL(); if (serverKey != null) { backup.setServerKey(serverKey); // OPEN_NEW must be removed now, otherwise // opening a session with AUTO_SERVER fails // if another connection is already open backup.removeProperty("OPEN_NEW", null); connectServer(backup); return this; } } } throw e; }
2
contains 1
                  
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { int errorCode = 0; if (e instanceof DbException) { e = ((DbException) e).getSQLException(); errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } StringBuilder buff = new StringBuilder(); StackTraceElement[] list = e.getStackTrace(); for (int i = 0; i < 10 && i < list.length; i++) { buff.append(list[i].toString()).append('\n'); } String s = buff.toString(); if (!knownErrors.contains(s)) { out.println(writeCount + " code: " + errorCode + " " + e.toString()); e.printStackTrace(System.out); knownErrors.add(s); } else { out.println(writeCount + " code: " + errorCode); } }
38
convertInvocation 1
                  
// in src/main/org/h2/engine/FunctionAlias.java
catch (InvocationTargetException e) { StatementBuilder buff = new StatementBuilder(method.getName()); buff.append('('); for (Object o : params) { buff.appendExceptFirst(", "); buff.append(o == null ? "null" : o.toString()); } buff.append(')'); throw DbException.convertInvocation(e, buff.toString()); }
2
createNonUnique 1
                  
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (!force) { throw e; } Column[] cols = { }; setColumns(cols); linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols), IndexType.createNonUnique(false)); indexes.add(linkedIndex); }
13
createServerSocketTry 1
                  
// in src/main/org/h2/util/NetUtils.java
catch (Exception e) { // try again return createServerSocketTry(port, ssl); }
2
createSocket 1
                  
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { try { return createSocket("localhost", port, ssl); } catch (IOException e2) { // throw the original exception throw e; } }
10
currentThread 1
                  
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { try { return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); } }
6
currentTimeMillis 1
                  
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } }
92
delete 1
                  
// in src/main/org/h2/upgrade/DbUpgrade.java
catch (Exception e) { if (FileUtils.exists(backupData)) { FileUtils.moveTo(backupData, data); } if (FileUtils.exists(backupIndex)) { FileUtils.moveTo(backupIndex, index); } if (FileUtils.exists(backupLobs)) { FileUtils.moveTo(backupLobs, lobs); } FileUtils.delete(name + ".h2.db"); throw DbException.toSQLException(e); }
71
execute 1
                  
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
catch (DbException e) { execute("DROP TABLE " + newTable.getName(), true); throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage()); }
122
fillInStackTrace
1
                  
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { if (e instanceof OutOfMemoryError) { e.fillInStackTrace(); } if (traceSystem != null) { if (e instanceof SQLException) { SQLException e2 = (SQLException) e; if (e2.getErrorCode() != ErrorCode.DATABASE_ALREADY_OPEN_1) { // only write if the database is not already in use trace.error(e, "opening {0}", databaseName); } } traceSystem.close(); } closeOpenFilesAndUnlock(false); throw DbException.convert(e); }
1
formatAsError 1
                  
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { result = "<br />" + getStackTrace(0, e, session.getContents().isH2); error = formatAsError(e.getMessage()); }
2
freeUniqueName 1
                  
// in src/main/org/h2/table/RegularTable.java
catch (DbException e) { getSchema().freeUniqueName(indexName); try { index.remove(session); } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; } throw e; }
8
generateAlternativeSeed 1
                  
// in src/main/org/h2/util/MathUtils.java
catch (SecurityException e) { // workaround for the Google App Engine: don't use a thread runnable.run(); generateAlternativeSeed(); }
2
getCause 1
                  
// in src/tools/org/h2/build/BuildBase.java
catch (InvocationTargetException e) { throw e.getCause(); }
4
getColumns 1
                  
// in src/main/org/h2/command/dml/Merge.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // possibly a concurrent merge or insert Index index = (Index) e.getSource(); if (index != null) { // verify the index columns match the key Column[] indexColumns = index.getColumns(); boolean indexMatchesKeys = false; if (indexColumns.length <= keys.length) { for (int i = 0; i < indexColumns.length; i++) { if (indexColumns[i] != keys[i]) { indexMatchesKeys = false; break; } } } if (indexMatchesKeys) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, table.getName()); } } } throw e; }
51
getConnection 1
                  
// in src/tools/org/h2/build/doc/UploadBuild.java
catch (Exception e) { Class.forName("org.h2.upgrade.v1_1.Driver"); conn = DriverManager.getConnection("jdbc:h2v1_1:mem:"); }
45
getContextClassLoader 1
                  
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { try { return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); } }
3
getDeclaredConstructors
1
                  
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { if (MAKE_ACCESSIBLE) { Constructor[] constructors = clazz.getDeclaredConstructors(); // try 0 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 0) { c.setAccessible(true); try { return clazz.newInstance(); } catch (Exception e2) { // ignore } } } // try 1 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 1) { c.setAccessible(true); try { return (T) c.newInstance(new Object[1]); } catch (Exception e2) { // ignore } } } } throw new RuntimeException("Exception trying to create " + clazz.getName() + ": " + e, e); }
1
getFileName 1
                  
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, getFileName()); }
25
getId 1
                  
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "disconnecting session #{0}", s.getId()); }
141
getIndexType 1
                  
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
26
getNewDuplicateKeyException
1
                  
// in src/main/org/h2/index/PageDataIndex.java
catch (DbException e) { if (e != fastDuplicateKeyException) { throw e; } if (!retry) { throw getNewDuplicateKeyException(); } if (add == 0) { // in the first re-try add a small random number, // to avoid collisions after a re-start row.setKey((long) (row.getKey() + Math.random() * 10000)); } else { row.setKey(row.getKey() + add); } add++; }
1
getPageStore 1
                  
// in src/main/org/h2/engine/Database.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_READ_ONLY) { throw e; } pageStore = null; while (!beforeWriting()) { // wait until others stopped writing and // until we can write (the file is not yet open - // no need to re-connect) } getPageStore(); }
141
getSchema 1
                  
// in src/main/org/h2/table/RegularTable.java
catch (DbException e) { getSchema().freeUniqueName(indexName); try { index.remove(session); } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; } throw e; }
177
getSource 1
                  
// in src/main/org/h2/command/dml/Merge.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // possibly a concurrent merge or insert Index index = (Index) e.getSource(); if (index != null) { // verify the index columns match the key Column[] indexColumns = index.getColumns(); boolean indexMatchesKeys = false; if (indexColumns.length <= keys.length) { for (int i = 0; i < indexColumns.length; i++) { if (indexColumns[i] != keys[i]) { indexMatchesKeys = false; break; } } } if (indexMatchesKeys) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, table.getName()); } } } throw e; }
4
getString 1
                  
// in src/main/org/h2/value/Value.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, getString()); }
276
getTargetException 1
                  
// in src/main/org/h2/server/web/WebApp.java
catch (InvocationTargetException e) { rs.addRow("meta." + m.getName(), e.getTargetException().toString()); }
3
getTraceSystem 1
                  
// in src/main/org/h2/store/WriterThread.java
catch (Exception e) { TraceSystem traceSystem = database.getTraceSystem(); if (traceSystem != null) { traceSystem.getTrace(Trace.DATABASE).error(e, "flush"); } }
7
isClosed 1
                  
// in src/main/org/h2/server/TcpServerThread.java
catch (Exception e2) { if (!transfer.isClosed()) { server.traceError(e2); } // if writing the error does not work, close the connection stop = true; }
14
isLeapYear
1
                  
// in src/main/org/h2/util/DateTimeUtils.java
catch (IllegalArgumentException e) { // special case: if the time simply doesn't exist because of // daylight saving time changes, use the lenient version String message = e.toString(); if (message.indexOf("HOUR_OF_DAY") > 0) { if (hour < 0 || hour > 23) { throw e; } return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else if (message.indexOf("DAY_OF_MONTH") > 0) { int maxDay; if (month == 2) { maxDay = new GregorianCalendar().isLeapYear(year) ? 29 : 28; } else { maxDay = 30 + ((month + (month > 7 ? 1 : 0)) & 1); } if (day < 1 || day > maxDay) { throw e; } // DAY_OF_MONTH is thrown for years > 2037 // using the timezone Brasilia and others, // for example for 2042-10-12 00:00:00. hour += 6; return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else { return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } }
1
isUncommittedFromOtherSession
1
                  
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
1
isUnique 1
                  
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
10
lockFile 1
                  
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "lock"); serverSocket = null; lockFile(); return; }
5
long 1
                  
// in src/main/org/h2/index/PageDataIndex.java
catch (DbException e) { if (e != fastDuplicateKeyException) { throw e; } if (!retry) { throw getNewDuplicateKeyException(); } if (add == 0) { // in the first re-try add a small random number, // to avoid collisions after a re-start row.setKey((long) (row.getKey() + Math.random() * 10000)); } else { row.setKey(row.getKey() + add); } add++; }
6
min 1
                  
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } }
92
parse 1
                  
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.SYNTAX_ERROR_1) { // now, get the detailed exception p = parse(sql, true); } else { throw e.addSQL(sql); } }
37
print 1
                  
// in src/tools/org/h2/build/Build.java
catch (Exception e) { print("NSIS is not available: " + e); }
61
projectHelp 1
                  
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { sysOut.println("Unknown target: " + target); projectHelp(); return false; }
2
random 1
                  
// in src/main/org/h2/index/PageDataIndex.java
catch (DbException e) { if (e != fastDuplicateKeyException) { throw e; } if (!retry) { throw getNewDuplicateKeyException(); } if (add == 0) { // in the first re-try add a small random number, // to avoid collisions after a re-start row.setKey((long) (row.getKey() + Math.random() * 10000)); } else { row.setKey(row.getKey() + add); } add++; }
9
readIf 1
                  
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { current = back; forStat.init = readStatement(); forStat.condition = readExpr(); read(";"); do { forStat.updates.add(readExpr()); } while (readIf(",")); }
705
readStatement 1
                  
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { current = back; forStat.init = readStatement(); forStat.condition = readExpr(); read(";"); do { forStat.updates.add(readExpr()); } while (readIf(",")); }
22
removeLob 1
                  
// in src/main/org/h2/store/LobStorage.java
catch (IOException e) { if (lobId != -1) { removeLob(lobId); } throw DbException.convertIOException(e, null); }
3
removeProperty 1
                  
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception re) { DbException e = DbException.convert(re); if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (autoServerMode) { String serverKey = ((JdbcSQLException) e.getSQLException()).getSQL(); if (serverKey != null) { backup.setServerKey(serverKey); // OPEN_NEW must be removed now, otherwise // opening a session with AUTO_SERVER fails // if another connection is already open backup.removeProperty("OPEN_NEW", null); connectServer(backup); return this; } } } throw e; }
15
removeSchemaObject 1
                  
// in src/main/org/h2/command/ddl/CreateTable.java
catch (DbException e) { db.checkPowerOff(); db.removeSchemaObject(session, table); if (!transactional) { session.commit(true); } throw e; }
30
removeSession 1
                  
// in src/main/org/h2/engine/Engine.java
catch (Exception e) { database.removeSession(session); throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX"); }
5
resolveClass
1
                  
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { return super.resolveClass(desc); }
1
rollback 1
                  
// in src/main/org/h2/command/Command.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); database.checkPowerOff(); if (s.getErrorCode() == ErrorCode.DEADLOCK_1) { session.rollback(); } else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { // there is a serious problem: // the transaction may be applied partially // in this case we need to panic: // close the database callStop = false; database.shutdownImmediately(); throw e; } else { session.rollbackTo(rollback, false); } throw e; }
12
rollbackTo 1
                  
// in src/main/org/h2/command/Command.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); database.checkPowerOff(); if (s.getErrorCode() == ErrorCode.DEADLOCK_1) { session.rollback(); } else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { // there is a serious problem: // the transaction may be applied partially // in this case we need to panic: // close the database callStop = false; database.shutdownImmediately(); throw e; } else { session.rollbackTo(rollback, false); } throw e; }
3
run 1
                  
// in src/main/org/h2/util/MathUtils.java
catch (SecurityException e) { // workaround for the Google App Engine: don't use a thread runnable.run(); generateAlternativeSeed(); }
14
setColumns 1
                  
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (!force) { throw e; } Column[] cols = { }; setColumns(cols); linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols), IndexType.createNonUnique(false)); indexes.add(linkedIndex); }
19
setError 1
                  
// in src/main/org/h2/server/web/PageParser.java
catch (ParseException e) { setError(pos); }
5
setRecursive
1
                  
// in src/main/org/h2/table/TableView.java
catch (DbException e) { e.addSQL(getCreateSQL()); createException = e; // if it can't be compiled, then it's a 'zero column table' // this avoids problems when creating the view when opening the // database tables = New.arrayList(); cols = new Column[0]; if (recursive && columnNames != null) { cols = new Column[columnNames.length]; for (int i = 0; i < columnNames.length; i++) { cols[i] = new Column(columnNames[i], Value.STRING); } index.setRecursive(true); createException = null; } }
1
setSelectSQL
1
                  
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (force) { command.setSelectSQL(select); while (currentTokenType != END) { read(); } } else { throw e; } }
1
setServerKey
1
                  
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception re) { DbException e = DbException.convert(re); if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (autoServerMode) { String serverKey = ((JdbcSQLException) e.getSQLException()).getSQL(); if (serverKey != null) { backup.setServerKey(serverKey); // OPEN_NEW must be removed now, otherwise // opening a session with AUTO_SERVER fails // if another connection is already open backup.removeProperty("OPEN_NEW", null); connectServer(backup); return this; } } } throw e; }
1
shutdownImmediately 1
                  
// in src/main/org/h2/command/Command.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); database.checkPowerOff(); if (s.getErrorCode() == ErrorCode.DEADLOCK_1) { session.rollback(); } else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { // there is a serious problem: // the transaction may be applied partially // in this case we need to panic: // close the database callStop = false; database.shutdownImmediately(); throw e; } else { session.rollbackTo(rollback, false); } throw e; }
2
stopAll 1
                  
// in src/main/org/h2/tools/Server.java
catch (SQLException e) { stopAll(); throw e; }
2
validateUserAndPassword 1
                  
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.WRONG_USER_OR_PASSWORD) { validateUserAndPassword(false); } throw e; }
2
wait 1
                  
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { // 'access denied' is really a concurrent access problem wait(i); }
10
wrap 1
                  
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (!force) { throw e; } Column[] cols = { }; setColumns(cols); linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols), IndexType.createNonUnique(false)); indexes.add(linkedIndex); }
45
write 1
                  
// in src/main/org/h2/message/TraceSystem.java
catch (Throwable e) { e = DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, adapterClass); write(ERROR, Trace.DATABASE, adapterClass, e); return; }
202
writeUTF 1
                  
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { // nanoTime not found, this is ok (only exists for JDK 1.5 and higher) out.writeUTF(e.toString()); }
3
Method Nbr Nbr total
closeSilently 68
                  
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
finally { JdbcUtils.closeSilently(stat); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
finally { JdbcUtils.closeSilently(stat); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
finally { JdbcUtils.closeSilently(stat); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
finally { JdbcUtils.closeSilently(stat); }
// in src/main/org/h2/tools/Restore.java
finally { IOUtils.closeSilently(in); }
// in src/main/org/h2/tools/Restore.java
finally { IOUtils.closeSilently(o); }
// in src/main/org/h2/tools/Restore.java
finally { IOUtils.closeSilently(in); }
// in src/main/org/h2/tools/Script.java
finally { JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(conn); }
// in src/main/org/h2/tools/Script.java
finally { IOUtils.closeSilently(o); }
// in src/main/org/h2/tools/Script.java
finally { JdbcUtils.closeSilently(conn); }
// in src/main/org/h2/tools/Script.java
finally { JdbcUtils.closeSilently(stat); }
// in src/main/org/h2/tools/Backup.java
finally { IOUtils.closeSilently(in); }
// in src/main/org/h2/tools/Backup.java
finally { IOUtils.closeSilently(fileOut); }
// in src/main/org/h2/tools/Csv.java
finally { close(); JdbcUtils.closeSilently(rs); }
// in src/main/org/h2/tools/CreateCluster.java
finally { IOUtils.closeSilently(scriptOut); }
// in src/main/org/h2/tools/CreateCluster.java
finally { FileUtils.delete(scriptFile); JdbcUtils.closeSilently(statSource); JdbcUtils.closeSilently(statTarget); JdbcUtils.closeSilently(connSource); JdbcUtils.closeSilently(connTarget); }
// in src/main/org/h2/tools/Recover.java
finally { IOUtils.closeSilently(fileOut); IOUtils.closeSilently(in); closeSilently(fileStore); }
// in src/main/org/h2/tools/Recover.java
finally { IOUtils.closeSilently(writer); closeSilently(store); }
// in src/main/org/h2/tools/RunScript.java
finally { IOUtils.closeSilently(in); }
// in src/main/org/h2/tools/RunScript.java
finally { JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(conn); }
// in src/main/org/h2/tools/Shell.java
finally { JdbcUtils.closeSilently(rs); }
// in src/main/org/h2/expression/Function.java
finally { JdbcUtils.closeSilently(rs); }
// in src/main/org/h2/store/RecoverTester.java
finally { IOUtils.closeSilently(out); testing = false; }
// in src/main/org/h2/command/dml/ScriptCommand.java
finally { IOUtils.closeSilently(input); }
// in src/main/org/h2/command/dml/ScriptCommand.java
finally { IOUtils.closeSilently(reader); }
// in src/main/org/h2/util/IOUtils.java
finally { closeSilently(out); }
// in src/main/org/h2/util/IOUtils.java
finally { closeSilently(in); }
// in src/main/org/h2/server/TcpServer.java
finally { JdbcUtils.closeSilently(stat); }
// in src/main/org/h2/server/TcpServer.java
finally { JdbcUtils.closeSilently(prep); JdbcUtils.closeSilently(conn); }
// in src/main/org/h2/server/pg/PgServerThread.java
finally { JdbcUtils.closeSilently(stat); }
// in src/main/org/h2/server/pg/PgServerThread.java
finally { JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(rs); }
// in src/main/org/h2/server/pg/PgServerThread.java
finally { IOUtils.closeSilently(r); }
// in src/main/org/h2/server/web/WebApp.java
finally { JdbcUtils.closeSilently(prep); }
// in src/main/org/h2/server/web/WebApp.java
finally { JdbcUtils.closeSilently(stat); }
// in src/main/org/h2/table/LinkSchema.java
finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(c2); JdbcUtils.closeSilently(stat); }
// in src/main/org/h2/table/TableLink.java
finally { JdbcUtils.closeSilently(stat); }
// in src/tools/org/h2/dev/fs/FileShell.java
finally { IOUtils.closeSilently(in); }
// in src/tools/org/h2/dev/fs/FileShell.java
finally { IOUtils.closeSilently(in); }
// in src/tools/org/h2/dev/fs/FileShell.java
finally { IOUtils.closeSilently(fileOut); }
// in src/tools/org/h2/dev/fs/FileShell.java
finally { IOUtils.closeSilently(o); }
// in src/tools/org/h2/dev/fs/FileShell.java
finally { IOUtils.closeSilently(in); }
// in src/tools/org/h2/build/doc/GenerateDoc.java
finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(stat); }
// in src/tools/org/h2/jaqu/Query.java
finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(s); }
// in src/tools/org/h2/jaqu/Query.java
finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(s); }
// in src/tools/org/h2/jaqu/Query.java
finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(s); }
// in src/tools/org/h2/jaqu/Query.java
finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(s); }
// in src/tools/org/h2/jaqu/TableInspector.java
finally { JdbcUtils.closeSilently(rs); }
// in src/tools/org/h2/jaqu/DbInspector.java
finally { JdbcUtils.closeSilently(rs); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
finally { JdbcUtils.closeSilently(conn); }
// in src/tools/org/h2/jaqu/SQLStatement.java
finally { JdbcUtils.closeSilently(ps); }
// in src/tools/org/h2/jaqu/SQLStatement.java
finally { JdbcUtils.closeSilently(ps); }
91
close 29
                  
// in src/main/org/h2/tools/Csv.java
finally { close(); JdbcUtils.closeSilently(rs); }
// in src/main/org/h2/tools/RunScript.java
finally { conn.close(); }
// in src/main/org/h2/value/ValueLob.java
finally { out.close(); }
// in src/main/org/h2/value/ValueLob.java
finally { out.close(); }
// in src/main/org/h2/value/ValueLobDb.java
finally { out.close(); }
// in src/main/org/h2/value/ValueLobDb.java
finally { out.close(); }
// in src/main/org/h2/expression/Subquery.java
finally { result.close(); }
// in src/main/org/h2/store/fs/FilePathDisk.java
finally { if (r != null) { try { r.close(); } catch (IOException e) { // ignore } } }
// in src/main/org/h2/store/FileLock.java
finally { out.close(); }
// in src/main/org/h2/command/dml/Delete.java
finally { rows.close(); }
// in src/main/org/h2/command/dml/Update.java
finally { rows.close(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
finally { session.close(); }
// in src/main/org/h2/jdbc/JdbcClob.java
finally { reader.close(); }
// in src/main/org/h2/jdbc/JdbcBlob.java
finally { in.close(); }
// in src/main/org/h2/util/SortedProperties.java
finally { if (in != null) { in.close(); } }
// in src/main/org/h2/util/IOUtils.java
finally { in.close(); }
// in src/main/org/h2/util/IOUtils.java
finally { in.close(); }
// in src/main/org/h2/util/IOUtils.java
finally { in.close(); }
// in src/main/org/h2/util/Utils.java
finally { zipIn.close(); }
// in src/main/org/h2/server/pg/PgServerThread.java
finally { server.trace("Disconnect"); close(); }
// in src/main/org/h2/server/TcpServerThread.java
finally { close(); }
// in src/main/org/h2/server/TcpServerThread.java
finally { transfer.close(); trace("Close"); server.remove(this); }
// in src/tools/org/h2/android/H2Statement.java
finally { result.close(); }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
finally { socket.close(); }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
finally { socket.close(); }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
finally { socket.close(); }
// in src/tools/org/h2/dev/fs/FileShell.java
finally { try { f.close(); } catch (IOException e) { error(e); } }
// in src/tools/org/h2/build/i18n/PropertiesToUTF8.java
finally { reader.close(); }
// in src/tools/org/h2/build/code/SwitchSource.java
finally { read.close(); }
317
afterWriting 27
                  
// in src/main/org/h2/command/Command.java
finally { stop(); if (writing) { database.afterWriting(); } }
// in src/main/org/h2/command/Command.java
finally { try { if (callStop) { stop(); } } finally { if (writing) { database.afterWriting(); } } }
// in src/main/org/h2/command/Command.java
finally { if (writing) { database.afterWriting(); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcStatement.java
finally { afterWriting(); }
// in src/main/org/h2/jdbc/JdbcStatement.java
finally { afterWriting(); }
32
incrementChangeCount
8
                  
// in src/main/org/h2/index/PageBtreeIndex.java
finally { store.incrementChangeCount(); }
// in src/main/org/h2/index/PageBtreeIndex.java
finally { store.incrementChangeCount(); }
// in src/main/org/h2/index/PageBtreeIndex.java
finally { store.incrementChangeCount(); }
// in src/main/org/h2/index/PageBtreeIndex.java
finally { store.incrementChangeCount(); }
// in src/main/org/h2/index/PageDataIndex.java
finally { store.incrementChangeCount(); }
// in src/main/org/h2/index/PageDataIndex.java
finally { store.incrementChangeCount(); }
// in src/main/org/h2/index/PageDataIndex.java
finally { store.incrementChangeCount(); }
// in src/main/org/h2/index/PageDataIndex.java
finally { store.incrementChangeCount(); }
8
setExecutingStatement 7
                  
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { setExecutingStatement(null); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { setExecutingStatement(null); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
finally { setExecutingStatement(null); }
// in src/main/org/h2/jdbc/JdbcStatement.java
finally { setExecutingStatement(null); }
// in src/main/org/h2/jdbc/JdbcStatement.java
finally { setExecutingStatement(null); }
// in src/main/org/h2/jdbc/JdbcStatement.java
finally { setExecutingStatement(null); }
// in src/main/org/h2/jdbc/JdbcStatement.java
finally { setExecutingStatement(null); }
15
delete 4
                  
// in src/main/org/h2/tools/CreateCluster.java
finally { FileUtils.delete(scriptFile); JdbcUtils.closeSilently(statSource); JdbcUtils.closeSilently(statTarget); JdbcUtils.closeSilently(connSource); JdbcUtils.closeSilently(connTarget); }
// in src/main/org/h2/upgrade/DbUpgrade.java
finally { if (script != null) { FileUtils.delete(script); } }
// in src/main/org/h2/util/SourceCompiler.java
finally { javaFile.delete(); classFile.delete(); }
71
getSchema 4
                  
// in src/main/org/h2/command/ddl/CreateView.java
finally { sysSession.setCurrentSchema(db.getSchema(Constants.SCHEMA_MAIN)); }
// in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
finally { getSchema().freeUniqueName(constraintName); }
// in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
finally { getSchema().freeUniqueName(indexName); }
// in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
finally { getSchema().freeUniqueName(indexName); }
177
freeUniqueName 3
                  
// in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
finally { getSchema().freeUniqueName(constraintName); }
// in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
finally { getSchema().freeUniqueName(indexName); }
// in src/main/org/h2/command/ddl/AlterTableAddConstraint.java
finally { getSchema().freeUniqueName(indexName); }
8
setScopeIdentity
3
                  
// in src/main/org/h2/schema/TriggerObject.java
finally { session.setScopeIdentity(identity); if (type != Trigger.SELECT) { session.setCommitOrRollbackDisabled(old); } }
// in src/main/org/h2/schema/TriggerObject.java
finally { session.setScopeIdentity(identity); session.setCommitOrRollbackDisabled(oldDisabled); session.setAutoCommit(old); }
// in src/main/org/h2/engine/FunctionAlias.java
finally { session.setScopeIdentity(identity); session.setAutoCommit(old); if (defaultConnection) { Driver.setDefaultConnection(null); } }
3
closeIO
2
                  
// in src/main/org/h2/command/dml/RunScriptCommand.java
finally { closeIO(); }
// in src/main/org/h2/command/dml/ScriptCommand.java
finally { closeIO(); }
2
getTop 2
                  
// in src/main/org/h2/server/web/WebApp.java
finally { prof.stopCollecting(); profOpen = prof.getTop(3); }
// in src/main/org/h2/server/web/WebApp.java
finally { prof.stopCollecting(); profClose = prof.getTop(3); }
3
position 2
                  
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
finally { position(pos + len); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
finally { position(pos + len); }
97
remove 2
                  
// in src/main/org/h2/server/TcpServerThread.java
finally { transfer.close(); trace("Close"); server.remove(this); }
// in src/main/org/h2/server/web/WebThread.java
finally { server.remove(this); }
192
renameSchemaObject 2
                  
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
finally { // always put the source tables back with their proper names try { db.renameSchemaObject(session, newTable, newTableName); } finally { db.renameSchemaObject(session, sourceTable, sourceTableName); } }
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
finally { db.renameSchemaObject(session, sourceTable, sourceTableName); }
8
setAutoCommit 2
                  
// in src/main/org/h2/schema/TriggerObject.java
finally { session.setScopeIdentity(identity); session.setCommitOrRollbackDisabled(oldDisabled); session.setAutoCommit(old); }
// in src/main/org/h2/engine/FunctionAlias.java
finally { session.setScopeIdentity(identity); session.setAutoCommit(old); if (defaultConnection) { Driver.setDefaultConnection(null); } }
18
setCommitOrRollbackDisabled 2
                  
// in src/main/org/h2/schema/TriggerObject.java
finally { session.setScopeIdentity(identity); if (type != Trigger.SELECT) { session.setCommitOrRollbackDisabled(old); } }
// in src/main/org/h2/schema/TriggerObject.java
finally { session.setScopeIdentity(identity); session.setCommitOrRollbackDisabled(oldDisabled); session.setAutoCommit(old); }
4
setErr 2
                  
// in src/main/org/h2/util/SourceCompiler.java
finally { System.setErr(old); }
// in src/tools/org/h2/build/BuildBase.java
finally { System.setErr(old); }
4
stop 2
                  
// in src/main/org/h2/command/Command.java
finally { stop(); if (writing) { database.afterWriting(); } }
// in src/main/org/h2/command/Command.java
finally { try { if (callStop) { stop(); } } finally { if (writing) { database.afterWriting(); } } }
13
stopCollecting 2
                  
// in src/main/org/h2/server/web/WebApp.java
finally { prof.stopCollecting(); profOpen = prof.getTop(3); }
// in src/main/org/h2/server/web/WebApp.java
finally { prof.stopCollecting(); profClose = prof.getTop(3); }
5
trace 2
                  
// in src/main/org/h2/server/pg/PgServerThread.java
finally { server.trace("Disconnect"); close(); }
// in src/main/org/h2/server/TcpServerThread.java
finally { transfer.close(); trace("Close"); server.remove(this); }
278
currentTimeMillis 1
                  
// in src/main/org/h2/util/StringUtils.java
finally { softCacheCreated = System.currentTimeMillis(); }
92
error 1
                  
// in src/tools/org/h2/dev/fs/FileShell.java
finally { try { f.close(); } catch (IOException e) { error(e); } }
65
execute 1
                  
// in src/main/org/h2/tools/CreateCluster.java
finally { // switch back to the regular mode statSource.execute("SET EXCLUSIVE FALSE"); }
122
removeLocalTempTable 1
                  
// in src/main/org/h2/command/Parser.java
finally { session.removeLocalTempTable(recursiveTable); }
3
setBackup 1
                  
// in src/main/org/h2/command/dml/BackupCommand.java
finally { store.setBackup(false); }
2
setCurrentSchema 1
                  
// in src/main/org/h2/command/ddl/CreateView.java
finally { sysSession.setCurrentSchema(db.getSchema(Constants.SCHEMA_MAIN)); }
3
setDefaultConnection 1
                  
// in src/main/org/h2/engine/FunctionAlias.java
finally { session.setScopeIdentity(identity); session.setAutoCommit(old); if (defaultConnection) { Driver.setDefaultConnection(null); } }
2
setOut 1
                  
// in src/tools/org/h2/build/BuildBase.java
finally { System.setOut(old); }
6
setReadOnly 1
                  
// in src/main/org/h2/store/PageStore.java
finally { database.setReadOnly(old); }
12
setSortedInsertMode 1
                  
// in src/main/org/h2/command/dml/Insert.java
finally { if (index != null) { index.setSortedInsertMode(false); } }
7
setUndoLogEnabled 1
                  
// in src/main/org/h2/command/ddl/CreateTable.java
finally { session.setUndoLogEnabled(old); }
3
setWaitForLock 1
                  
// in src/main/org/h2/table/RegularTable.java
finally { session.setWaitForLock(null); }
2

Reference Table

This table concatenates the results of the previous tables.

Checked/Runtime Type Exception Thrown Thrown from Catch Declared Caught directly Caught
with Thrown
Caught
with Thrown Runtime
unknown (Lib) AccessControlException 0 0 0 1
            
// in src/main/org/h2/store/WriterThread.java
catch (AccessControlException e) { // // Google App Engine does not allow threads return null; }
0 0
unknown (Lib) ArrayIndexOutOfBoundsException 4
            
// in src/main/org/h2/compress/CompressLZF.java
public void expand(byte[] in, int inPos, int inLen, byte[] out, int outPos, int outLen) { // if ((inPos | outPos | outLen) < 0) { if (inPos < 0 || outPos < 0 || outLen < 0) { throw new IllegalArgumentException(); } do { int ctrl = in[inPos++] & 255; if (ctrl < MAX_LITERAL) { // literal run of length = ctrl + 1, ctrl++; // copy to output and move forward this many bytes System.arraycopy(in, inPos, out, outPos, ctrl); outPos += ctrl; inPos += ctrl; } else { // back reference // the highest 3 bits are the match length int len = ctrl >> 5; // if the length is maxed, add the next byte to the length if (len == 7) { len += in[inPos++] & 255; } // minimum back-reference is 3 bytes, // so 2 was subtracted before storing size len += 2; // ctrl is now the offset for a back-reference... // the logical AND operation removes the length bits ctrl = -((ctrl & 0x1f) << 8) - 1; // the next byte augments/increases the offset ctrl -= in[inPos++] & 255; // copy the back-reference bytes from the given // location in output to current position ctrl += outPos; if (outPos + len >= out.length) { // reduce array bounds checking throw new ArrayIndexOutOfBoundsException(); } for (int i = 0; i < len; i++) { out[outPos++] = out[ctrl++]; } } } while (outPos < outLen); }
// in src/main/org/h2/util/IntArray.java
public int get(int index) { if (SysProperties.CHECK) { if (index >= size) { throw new ArrayIndexOutOfBoundsException("i=" + index + " size=" + size); } } return data[index]; }
// in src/main/org/h2/util/IntArray.java
public void remove(int index) { if (SysProperties.CHECK) { if (index >= size) { throw new ArrayIndexOutOfBoundsException("i=" + index + " size=" + size); } } System.arraycopy(data, index + 1, data, index, size - index - 1); size--; }
// in src/main/org/h2/util/IntArray.java
public void removeRange(int fromIndex, int toIndex) { if (SysProperties.CHECK) { if (fromIndex > toIndex || toIndex > size) { throw new ArrayIndexOutOfBoundsException("from=" + fromIndex + " to=" + toIndex + " size=" + size); } } System.arraycopy(data, toIndex, data, fromIndex, size - toIndex); size -= toIndex - fromIndex; }
0 0 4
            
// in src/main/org/h2/tools/Recover.java
catch (ArrayIndexOutOfBoundsException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/PageLog.java
catch (ArrayIndexOutOfBoundsException e) { DbException.convertToIOException(e); }
// in src/main/org/h2/compress/LZFInputStream.java
catch (ArrayIndexOutOfBoundsException e) { DbException.convertToIOException(e); }
// in src/main/org/h2/util/StringUtils.java
catch (ArrayIndexOutOfBoundsException e) { throw DbException.get(ErrorCode.HEX_STRING_WRONG_1, s); }
2
            
// in src/main/org/h2/tools/Recover.java
catch (ArrayIndexOutOfBoundsException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/StringUtils.java
catch (ArrayIndexOutOfBoundsException e) { throw DbException.get(ErrorCode.HEX_STRING_WRONG_1, s); }
0
unknown (Lib) AssertionError 11
            
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
synchronized void recycleConnection(PooledConnection pc) { if (activeConnections <= 0) { throw new AssertionError(); } activeConnections--; if (!isDisposed && activeConnections < maxConnections) { recycledConnections.add(pc); } else { closeConnection(pc); } if (activeConnections >= maxConnections - 1) { notifyAll(); } }
// in src/main/org/h2/bnf/Bnf.java
private RuleHead addRule(String topic, String section, Rule rule) { RuleHead head = new RuleHead(section, topic, rule); String key = StringUtils.toLowerEnglish(topic.trim().replace(' ', '_')); if (ruleMap.get(key) != null) { throw new AssertionError("already exists: " + topic); } ruleMap.put(key, head); return head; }
// in src/main/org/h2/bnf/Bnf.java
private Rule parseToken() { Rule r; if ((firstChar >= 'A' && firstChar <= 'Z') || (firstChar >= 'a' && firstChar <= 'z')) { // r = new RuleElement(currentToken+ " syntax:" + syntax); r = new RuleElement(currentToken, currentTopic); } else if (firstChar == '[') { read(); Rule r2 = parseOr(); r = new RuleOptional(r2); if (firstChar != ']') { throw new AssertionError("expected ], got " + currentToken + " syntax:" + syntax); } } else if (firstChar == '{') { read(); r = parseOr(); if (firstChar != '}') { throw new AssertionError("expected }, got " + currentToken + " syntax:" + syntax); } } else if ("@commaDots@".equals(currentToken)) { r = new RuleList(new RuleElement(",", currentTopic), lastRepeat, false); r = new RuleRepeat(r, true); } else if ("@dots@".equals(currentToken)) { r = new RuleRepeat(lastRepeat, false); } else { r = new RuleElement(currentToken, currentTopic); } lastRepeat = r; read(); return r; }
// in src/main/org/h2/bnf/RuleElement.java
public void setLinks(HashMap<String, RuleHead> ruleMap) { if (link != null) { link.setLinks(ruleMap); } if (keyword) { return; } String test = Bnf.getRuleMapKey(name); for (int i = 0; i < test.length(); i++) { String t = test.substring(i); RuleHead r = ruleMap.get(t); if (r != null) { link = r.getRule(); return; } } throw new AssertionError("Unknown " + name + "/" + test); }
// in src/main/org/h2/bnf/RuleFixed.java
public boolean autoComplete(Sentence sentence) { sentence.stopIfRequired(); String query = sentence.getQuery(); String s = query; switch(type) { case YMD: while (s.length() > 0 && "0123456789-".indexOf(s.charAt(0)) >= 0) { s = s.substring(1); } if (s.length() == 0) { sentence.add("2006-01-01", "1", Sentence.KEYWORD); } break; case HMS: while (s.length() > 0 && "0123456789:".indexOf(s.charAt(0)) >= 0) { s = s.substring(1); } if (s.length() == 0) { sentence.add("12:00:00", "1", Sentence.KEYWORD); } break; case NANOS: while (s.length() > 0 && Character.isDigit(s.charAt(0))) { s = s.substring(1); } if (s.length() == 0) { sentence.add("nanoseconds", "0", Sentence.KEYWORD); } break; case ANY_EXCEPT_SINGLE_QUOTE: while (true) { while (s.length() > 0 && s.charAt(0) != '\'') { s = s.substring(1); } if (s.startsWith("''")) { s = s.substring(2); } else { break; } } if (s.length() == 0) { sentence.add("anything", "Hello World", Sentence.KEYWORD); sentence.add("'", "'", Sentence.KEYWORD); } break; case ANY_EXCEPT_2_DOLLAR: while (s.length() > 0 && !s.startsWith("$$")) { s = s.substring(1); } if (s.length() == 0) { sentence.add("anything", "Hello World", Sentence.KEYWORD); sentence.add("$$", "$$", Sentence.KEYWORD); } break; case ANY_EXCEPT_DOUBLE_QUOTE: while (true) { while (s.length() > 0 && s.charAt(0) != '\"') { s = s.substring(1); } if (s.startsWith("\"\"")) { s = s.substring(2); } else { break; } } if (s.length() == 0) { sentence.add("anything", "identifier", Sentence.KEYWORD); sentence.add("\"", "\"", Sentence.KEYWORD); } break; case ANY_WORD: while (s.length() > 0 && !Character.isSpaceChar(s.charAt(0))) { s = s.substring(1); } if (s.length() == 0) { sentence.add("anything", "anything", Sentence.KEYWORD); } break; case HEX_START: if (s.startsWith("0X") || s.startsWith("0x")) { s = s.substring(2); } else if ("0".equals(s)) { sentence.add("0x", "x", Sentence.KEYWORD); } else if (s.length() == 0) { sentence.add("0x", "0x", Sentence.KEYWORD); } break; case CONCAT: if (s.equals("|")) { sentence.add("||", "|", Sentence.KEYWORD); } else if (s.startsWith("||")) { s = s.substring(2); } else if (s.length() == 0) { sentence.add("||", "||", Sentence.KEYWORD); } break; case AZ_UNDERSCORE: if (s.length() > 0 && (Character.isLetter(s.charAt(0)) || s.charAt(0) == '_')) { s = s.substring(1); } if (s.length() == 0) { sentence.add("character", "A", Sentence.KEYWORD); } break; case AF: if (s.length() > 0) { char ch = Character.toUpperCase(s.charAt(0)); if (ch >= 'A' && ch <= 'F') { s = s.substring(1); } } if (s.length() == 0) { sentence.add("hex character", "0A", Sentence.KEYWORD); } break; case DIGIT: if (s.length() > 0 && Character.isDigit(s.charAt(0))) { s = s.substring(1); } if (s.length() == 0) { sentence.add("digit", "1", Sentence.KEYWORD); } break; case OPEN_BRACKET: if (s.length() == 0) { sentence.add("[", "[", Sentence.KEYWORD); } else if (s.charAt(0) == '[') { s = s.substring(1); } break; case CLOSE_BRACKET: if (s.length() == 0) { sentence.add("]", "]", Sentence.KEYWORD); } else if (s.charAt(0) == ']') { s = s.substring(1); } break; // no autocomplete support for comments // (comments are not reachable in the bnf tree) case ANY_UNTIL_EOL: case ANY_UNTIL_END: default: throw new AssertionError("type="+type); } if (!s.equals(query)) { while (s.length() > 0 && Character.isSpaceChar(s.charAt(0))) { s = s.substring(1); } sentence.setQuery(s); return true; } return false; }
// in src/main/org/h2/util/SynchronizedVerifier.java
public static void setDetect(Class<?> clazz, boolean value) { if (value) { DETECT.put(clazz, new AtomicBoolean()); } else { AtomicBoolean b = DETECT.remove(clazz); if (b == null) { throw new AssertionError("Detection was not enabled"); } else if (!b.get()) { throw new AssertionError("No object of this class was tested"); } } enabled = DETECT.size() > 0; }
// in src/main/org/h2/util/SynchronizedVerifier.java
private static void detectConcurrentAccess(Object o) { AtomicBoolean value = DETECT.get(o.getClass()); if (value != null) { value.set(true); if (CURRENT.remove(o) != null) { throw new AssertionError("Concurrent access"); } CURRENT.put(o, o); try { Thread.sleep(1); } catch (InterruptedException e) { // ignore } Object old = CURRENT.remove(o); if (old == null) { throw new AssertionError("Concurrent access"); } } }
// in src/tools/org/h2/build/doc/BnfRailroad.java
static String getHtmlText(int type) { switch(type) { case RuleFixed.YMD: return "2000-01-01"; case RuleFixed.HMS: return "12:00:00"; case RuleFixed.NANOS: return "000000000"; case RuleFixed.ANY_UNTIL_EOL: case RuleFixed.ANY_EXCEPT_SINGLE_QUOTE: case RuleFixed.ANY_EXCEPT_DOUBLE_QUOTE: case RuleFixed.ANY_WORD: case RuleFixed.ANY_EXCEPT_2_DOLLAR: case RuleFixed.ANY_UNTIL_END: { return "anything"; } case RuleFixed.HEX_START: return "0x"; case RuleFixed.CONCAT: return "||"; case RuleFixed.AZ_UNDERSCORE: return "A-Z | _"; case RuleFixed.AF: return "A-F"; case RuleFixed.DIGIT: return "0-9"; case RuleFixed.OPEN_BRACKET: return "["; case RuleFixed.CLOSE_BRACKET: return "]"; default: throw new AssertionError("type="+type); } }
0 0 0 0 0
unknown (Lib) BindException 0 0 0 2
            
// in src/main/org/h2/store/FileLock.java
catch (BindException e) { throw getExceptionFatal("Bind Exception", null); }
// in src/main/org/h2/util/NetUtils.java
catch (BindException be) { throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2, be, "" + port, be.toString()); }
2
            
// in src/main/org/h2/store/FileLock.java
catch (BindException e) { throw getExceptionFatal("Bind Exception", null); }
// in src/main/org/h2/util/NetUtils.java
catch (BindException be) { throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2, be, "" + port, be.toString()); }
0
unknown (Lib) BufferUnderflowException 0 0 0 1
            
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (BufferUnderflowException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; }
1
            
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (BufferUnderflowException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; }
0
unknown (Lib) ClassNotFoundException 0 0 5
            
// in src/main/org/h2/jdbcx/JdbcDataSource.java
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { initFactory(); in.defaultReadObject(); }
// in src/main/org/h2/util/SourceCompiler.java
public Class<?> getClass(String packageAndClassName) throws ClassNotFoundException { Class<?> compiledClass = compiled.get(packageAndClassName); if (compiledClass != null) { return compiledClass; } ClassLoader classLoader = new ClassLoader(getClass().getClassLoader()) { public Class<?> findClass(String name) throws ClassNotFoundException { Class<?> classInstance = compiled.get(name); if (classInstance == null) { String source = sources.get(name); String packageName = null; int idx = name.lastIndexOf('.'); String className; if (idx >= 0) { packageName = name.substring(0, idx); className = name.substring(idx + 1); } else { className = name; } byte[] data = javacCompile(packageName, className, source); if (data == null) { classInstance = findSystemClass(name); } else { classInstance = defineClass(name, data, 0, data.length); compiled.put(name, classInstance); } } return classInstance; } }; return classLoader.loadClass(packageAndClassName); }
// in src/main/org/h2/util/SourceCompiler.java
public Class<?> findClass(String name) throws ClassNotFoundException { Class<?> classInstance = compiled.get(name); if (classInstance == null) { String source = sources.get(name); String packageName = null; int idx = name.lastIndexOf('.'); String className; if (idx >= 0) { packageName = name.substring(0, idx); className = name.substring(idx + 1); } else { className = name; } byte[] data = javacCompile(packageName, className, source); if (data == null) { classInstance = findSystemClass(name); } else { classInstance = defineClass(name, data, 0, data.length); compiled.put(name, classInstance); } } return classInstance; }
// in src/main/org/h2/util/SourceCompiler.java
public Method getMethod(String className) throws ClassNotFoundException { Class<?> clazz = getClass(className); Method[] methods = clazz.getDeclaredMethods(); for (Method m : methods) { int modifiers = m.getModifiers(); if (Modifier.isPublic(modifiers)) { if (Modifier.isStatic(modifiers)) { return m; } } } return null; }
// in src/main/org/h2/util/Utils.java
public static Object deserialize(byte[] data) { try { ByteArrayInputStream in = new ByteArrayInputStream(data); ObjectInputStream is; if (SysProperties.USE_THREAD_CONTEXT_CLASS_LOADER) { final ClassLoader loader = Thread.currentThread().getContextClassLoader(); is = new ObjectInputStream(in) { protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { try { return Class.forName(desc.getName(), true, loader); } catch (ClassNotFoundException e) { return super.resolveClass(desc); } } }; } else { is = new ObjectInputStream(in); } return is.readObject(); } catch (Throwable e) { throw DbException.get(ErrorCode.DESERIALIZATION_FAILED_1, e, e.toString()); } }
// in src/main/org/h2/util/Utils.java
protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { try { return Class.forName(desc.getName(), true, loader); } catch (ClassNotFoundException e) { return super.resolveClass(desc); } }
3
            
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { return super.resolveClass(desc); }
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { try { return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); } }
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { return false; }
1
            
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { try { return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); } }
0
unknown (Lib) CloneNotSupportedException 0 0 1
            
// in src/main/org/h2/engine/ConnectionInfo.java
public Object clone() throws CloneNotSupportedException { ConnectionInfo clone = (ConnectionInfo) super.clone(); clone.prop = (Properties) prop.clone(); clone.filePasswordHash = Utils.cloneByteArray(filePasswordHash); clone.userPasswordHash = Utils.cloneByteArray(userPasswordHash); return clone; }
1
            
// in src/main/org/h2/engine/Engine.java
catch (CloneNotSupportedException e) { throw DbException.convert(e); }
1
            
// in src/main/org/h2/engine/Engine.java
catch (CloneNotSupportedException e) { throw DbException.convert(e); }
0
unknown (Lib) ConnectException 0 0 0 1
            
// in src/main/org/h2/store/FileLock.java
catch (ConnectException e) { trace.debug(e, "socket not connected to port " + port); }
0 0
unknown (Lib) DataFormatException 1
            
// in src/main/org/h2/compress/CompressDeflate.java
public void expand(byte[] in, int inPos, int inLen, byte[] out, int outPos, int outLen) { Inflater decompresser = new Inflater(); decompresser.setInput(in, inPos, inLen); decompresser.finished(); try { int len = decompresser.inflate(out, outPos, outLen); if (len != outLen) { throw new DataFormatException(len + " " + outLen); } } catch (DataFormatException e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); } decompresser.end(); }
0 0 1
            
// in src/main/org/h2/compress/CompressDeflate.java
catch (DataFormatException e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
1
            
// in src/main/org/h2/compress/CompressDeflate.java
catch (DataFormatException e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
0
runtime (Domain) DbException
public class DbException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private static final Properties MESSAGES = new Properties();

    private Object source;

    static {
        try {
            byte[] messages = Utils.getResource("/org/h2/res/_messages_en.prop");
            if (messages != null) {
                MESSAGES.load(new ByteArrayInputStream(messages));
            }
            String language = Locale.getDefault().getLanguage();
            if (!"en".equals(language)) {
                byte[] translations = Utils.getResource("/org/h2/res/_messages_" + language + ".prop");
                // message: translated message + english
                // (otherwise certain applications don't work)
                if (translations != null) {
                    Properties p = SortedProperties.fromLines(new String(translations, "UTF-8"));
                    for (Entry<Object, Object> e : p.entrySet()) {
                        String key = (String) e.getKey();
                        String translation = (String) e.getValue();
                        if (translation != null && !translation.startsWith("#")) {
                            String original = MESSAGES.getProperty(key);
                            String message = translation + "\n" + original;
                            MESSAGES.put(key, message);
                        }
                    }
                }
            }
        }
0 0 0 70
            
// in src/main/org/h2/tools/Recover.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (DbException e) { if (!force) { throw e; } }
// in src/main/org/h2/store/PageStreamTrunk.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) { // wrong checksum means end of stream return null; } throw e; }
// in src/main/org/h2/store/PageInputStream.java
catch (DbException e) { throw new EOFException(); }
// in src/main/org/h2/store/FileLister.java
catch (DbException e) { throw DbException.get( ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, message).getSQLException(); }
// in src/main/org/h2/store/RecoverTester.java
catch (DbException e) { SQLException e2 = DbException.toSQLException(e); int errorCode = e2.getErrorCode(); if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } e.printStackTrace(System.out); }
// in src/main/org/h2/store/PageLog.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) { trace.debug("log recovery stopped"); } else { throw e; } }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (DbException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { close(); throw e; }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.IO_EXCEPTION_2) { if (e.getMessage().indexOf("locked") >= 0) { // in Windows, you can't open a locked file // (in other operating systems, you can) // the exact error message is: // "The process cannot access the file because // another process has locked a portion of the file" throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, e, fileName); } } throw e; }
// in src/main/org/h2/store/FileLock.java
catch (DbException e) { // ignore }
// in src/main/org/h2/store/FileLock.java
catch (DbException e2) { // ignore }
// in src/main/org/h2/index/PageDataIndex.java
catch (DbException e) { if (e != fastDuplicateKeyException) { throw e; } if (!retry) { throw getNewDuplicateKeyException(); } if (add == 0) { // in the first re-try add a small random number, // to avoid collisions after a re-start row.setKey((long) (row.getKey() + Math.random() * 10000)); } else { row.setKey(row.getKey() + add); } add++; }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { throw e.addSQL(originalSQL); }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.SYNTAX_ERROR_1) { // now, get the detailed exception p = parse(sql, true); } else { throw e.addSQL(sql); } }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (force) { command.setSelectSQL(select); while (currentTokenType != END) { read(); } } else { throw e; } }
// in src/main/org/h2/command/ddl/CreateTable.java
catch (DbException e) { db.checkPowerOff(); db.removeSchemaObject(session, table); if (!transactional) { session.commit(true); } throw e; }
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
catch (DbException e) { execute("DROP TABLE " + newTable.getName(), true); throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage()); }
// in src/main/org/h2/command/dml/RunScriptCommand.java
catch (DbException e) { throw e.addSQL(sql); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(expr)); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(r)); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // possibly a concurrent merge or insert Index index = (Index) e.getSource(); if (index != null) { // verify the index columns match the key Column[] indexColumns = index.getColumns(); boolean indexMatchesKeys = false; if (indexColumns.length <= keys.length) { for (int i = 0; i < indexColumns.length; i++) { if (indexColumns[i] != keys[i]) { indexMatchesKeys = false; break; } } } if (indexMatchesKeys) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, table.getName()); } } } throw e; }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, x, getSQL(expr)); }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, rowNumber, getSQL(values)); }
// in src/main/org/h2/command/Command.java
catch (DbException e) { start = filterConcurrentUpdate(e, start); }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e.addSQL(sql); database.exceptionThrown(e.getSQLException(), sql); throw e; }
// in src/main/org/h2/command/Command.java
catch (DbException e) { start = filterConcurrentUpdate(e, start); }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); database.checkPowerOff(); if (s.getErrorCode() == ErrorCode.DEADLOCK_1) { session.rollback(); } else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { // there is a serious problem: // the transaction may be applied partially // in this case we need to panic: // close the database callStop = false; database.shutdownImmediately(); throw e; } else { session.rollbackTo(rollback, false); } throw e; }
// in src/main/org/h2/command/CommandRemote.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (DbException e) { // ignore if the connection is broken right now if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { // ignore }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { store.closeSilently(); throw e; }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_READ_ONLY) { throw e; } pageStore = null; while (!beforeWriting()) { // wait until others stopped writing and // until we can write (the file is not yet open - // no need to re-connect) } getPageStore(); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "disconnecting session #{0}", s.getId()); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { // ignore }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { if (SysProperties.CHECK2) { int code = e.getErrorCode(); if (code != ErrorCode.DATABASE_IS_CLOSED && code != ErrorCode.LOCK_TIMEOUT_1 && code != ErrorCode.IO_EXCEPTION_2) { e.printStackTrace(); } } trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { // ignore }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.WRONG_USER_OR_PASSWORD) { validateUserAndPassword(false); } throw e; }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (!ignoreUnknownSetting) { session.close(); throw e; } }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (!ignoreUnknownSetting) { session.close(); throw e; } }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getErrorCode() == ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1) { // it might have been deleted by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getSQLException().getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // it might have been added by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { trans.close(); throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { traceSystem.close(); throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE) { throw e; } // exclusive mode: re-try endlessly try { Thread.sleep(500); } catch (Exception e2) { // ignore } }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { store.closeSilently(); throw e; }
// in src/main/org/h2/engine/MetaRecord.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); db.getTrace(Trace.DATABASE).error(s, sql); if (listener != null) { listener.exceptionThrown(s, sql); // continue startup in this case } else { throw e; } }
// in src/main/org/h2/engine/FunctionAlias.java
catch (DbException e) { if (!force) { throw e; } }
// in src/main/org/h2/engine/FunctionAlias.java
catch (DbException e) { throw e; }
// in src/main/org/h2/server/TcpServer.java
catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, ssl); } else { throw e; } }
// in src/main/org/h2/server/pg/PgServer.java
catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, false); } else { throw e; } }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e) { getSchema().freeUniqueName(indexName); try { index.remove(session); } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; } throw e; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; }
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (!force) { throw e; } Column[] cols = { }; setColumns(cols); linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols), IndexType.createNonUnique(false)); indexes.add(linkedIndex); }
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (retry >= MAX_RETRY) { connectException = e; throw e; } }
// in src/main/org/h2/table/Column.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DATA_CONVERSION_ERROR_1) { String target = (table == null ? "" : table.getName() + ": ") + getCreateSQL(); throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, v.getSQL() + " (" + target + ")"); } throw e; }
// in src/main/org/h2/table/TableView.java
catch (DbException e) { if (!force) { return e; } }
// in src/main/org/h2/table/TableView.java
catch (DbException e) { e.addSQL(getCreateSQL()); createException = e; // if it can't be compiled, then it's a 'zero column table' // this avoids problems when creating the view when opening the // database tables = New.arrayList(); cols = new Column[0]; if (recursive && columnNames != null) { cols = new Column[columnNames.length]; for (int i = 0; i < columnNames.length; i++) { cols[i] = new Column(columnNames[i], Value.STRING); } index.setRecursive(true); createException = null; } }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
57
            
// in src/main/org/h2/tools/Recover.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (DbException e) { if (!force) { throw e; } }
// in src/main/org/h2/store/PageStreamTrunk.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) { // wrong checksum means end of stream return null; } throw e; }
// in src/main/org/h2/store/PageInputStream.java
catch (DbException e) { throw new EOFException(); }
// in src/main/org/h2/store/FileLister.java
catch (DbException e) { throw DbException.get( ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, message).getSQLException(); }
// in src/main/org/h2/store/PageLog.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) { trace.debug("log recovery stopped"); } else { throw e; } }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (DbException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { close(); throw e; }
// in src/main/org/h2/store/PageStore.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.IO_EXCEPTION_2) { if (e.getMessage().indexOf("locked") >= 0) { // in Windows, you can't open a locked file // (in other operating systems, you can) // the exact error message is: // "The process cannot access the file because // another process has locked a portion of the file" throw DbException.get(ErrorCode.DATABASE_ALREADY_OPEN_1, e, fileName); } } throw e; }
// in src/main/org/h2/index/PageDataIndex.java
catch (DbException e) { if (e != fastDuplicateKeyException) { throw e; } if (!retry) { throw getNewDuplicateKeyException(); } if (add == 0) { // in the first re-try add a small random number, // to avoid collisions after a re-start row.setKey((long) (row.getKey() + Math.random() * 10000)); } else { row.setKey(row.getKey() + add); } add++; }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { throw e.addSQL(originalSQL); }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.SYNTAX_ERROR_1) { // now, get the detailed exception p = parse(sql, true); } else { throw e.addSQL(sql); } }
// in src/main/org/h2/command/Parser.java
catch (DbException e) { if (force) { command.setSelectSQL(select); while (currentTokenType != END) { read(); } } else { throw e; } }
// in src/main/org/h2/command/ddl/CreateTable.java
catch (DbException e) { db.checkPowerOff(); db.removeSchemaObject(session, table); if (!transactional) { session.commit(true); } throw e; }
// in src/main/org/h2/command/ddl/AlterTableAlterColumn.java
catch (DbException e) { execute("DROP TABLE " + newTable.getName(), true); throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage()); }
// in src/main/org/h2/command/dml/RunScriptCommand.java
catch (DbException e) { throw e.addSQL(sql); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(expr)); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException ex) { throw setRow(ex, count, getSQL(r)); }
// in src/main/org/h2/command/dml/Merge.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // possibly a concurrent merge or insert Index index = (Index) e.getSource(); if (index != null) { // verify the index columns match the key Column[] indexColumns = index.getColumns(); boolean indexMatchesKeys = false; if (indexColumns.length <= keys.length) { for (int i = 0; i < indexColumns.length; i++) { if (indexColumns[i] != keys[i]) { indexMatchesKeys = false; break; } } } if (indexMatchesKeys) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, table.getName()); } } } throw e; }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, x, getSQL(expr)); }
// in src/main/org/h2/command/dml/Insert.java
catch (DbException ex) { throw setRow(ex, rowNumber, getSQL(values)); }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e.addSQL(sql); database.exceptionThrown(e.getSQLException(), sql); throw e; }
// in src/main/org/h2/command/Command.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); database.checkPowerOff(); if (s.getErrorCode() == ErrorCode.DEADLOCK_1) { session.rollback(); } else if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { // there is a serious problem: // the transaction may be applied partially // in this case we need to panic: // close the database callStop = false; database.shutdownImmediately(); throw e; } else { session.rollbackTo(rollback, false); } throw e; }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (DbException e) { // ignore if the connection is broken right now if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { store.closeSilently(); throw e; }
// in src/main/org/h2/engine/Database.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_READ_ONLY) { throw e; } pageStore = null; while (!beforeWriting()) { // wait until others stopped writing and // until we can write (the file is not yet open - // no need to re-connect) } getPageStore(); }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.WRONG_USER_OR_PASSWORD) { validateUserAndPassword(false); } throw e; }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (!ignoreUnknownSetting) { session.close(); throw e; } }
// in src/main/org/h2/engine/Engine.java
catch (DbException e) { if (!ignoreUnknownSetting) { session.close(); throw e; } }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getErrorCode() == ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1) { // it might have been deleted by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/UndoLogRecord.java
catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getSQLException().getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { // it might have been added by another thread // ignore } else { throw e; } }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { trans.close(); throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { traceSystem.close(); throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE) { throw e; } // exclusive mode: re-try endlessly try { Thread.sleep(500); } catch (Exception e2) { // ignore } }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { store.closeSilently(); throw e; }
// in src/main/org/h2/engine/MetaRecord.java
catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); db.getTrace(Trace.DATABASE).error(s, sql); if (listener != null) { listener.exceptionThrown(s, sql); // continue startup in this case } else { throw e; } }
// in src/main/org/h2/engine/FunctionAlias.java
catch (DbException e) { if (!force) { throw e; } }
// in src/main/org/h2/engine/FunctionAlias.java
catch (DbException e) { throw e; }
// in src/main/org/h2/server/TcpServer.java
catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, ssl); } else { throw e; } }
// in src/main/org/h2/server/pg/PgServer.java
catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, false); } else { throw e; } }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e) { getSchema().freeUniqueName(indexName); try { index.remove(session); } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; } throw e; }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means // there is something wrong with the database trace.error(e2, "could not remove index"); throw e2; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
// in src/main/org/h2/table/RegularTable.java
catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; }
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (!force) { throw e; } Column[] cols = { }; setColumns(cols); linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols), IndexType.createNonUnique(false)); indexes.add(linkedIndex); }
// in src/main/org/h2/table/TableLink.java
catch (DbException e) { if (retry >= MAX_RETRY) { connectException = e; throw e; } }
// in src/main/org/h2/table/Column.java
catch (DbException e) { if (e.getErrorCode() == ErrorCode.DATA_CONVERSION_ERROR_1) { String target = (table == null ? "" : table.getName() + ": ") + getCreateSQL(); throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, v.getSQL() + " (" + target + ")"); } throw e; }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (DbException e) { throw DbException.toSQLException(e); }
0
unknown (Lib) EOFException 4
            
// in src/main/org/h2/store/PageInputStream.java
private int readBlock(byte[] buff, int off, int len) throws IOException { try { fillBuffer(); if (endOfFile) { return -1; } int l = Math.min(remaining, len); data.read(dataPos, buff, off, l); remaining -= l; dataPos += l; return l; } catch (DbException e) { throw new EOFException(); } }
// in src/main/org/h2/store/fs/FileUtils.java
public static void readFully(FileChannel channel, ByteBuffer dst) throws IOException { do { int r = channel.read(dst); if (r < 0) { throw new EOFException(); } } while (dst.remaining() > 0); }
// in src/main/org/h2/util/IOUtils.java
public static void skipFully(InputStream in, long skip) throws IOException { try { while (skip > 0) { long skipped = in.skip(skip); if (skipped <= 0) { throw new EOFException(); } skip -= skipped; } } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/util/IOUtils.java
public static void skipFully(Reader reader, long skip) throws IOException { try { while (skip > 0) { long skipped = reader.skip(skip); if (skipped <= 0) { throw new EOFException(); } skip -= skipped; } } catch (Exception e) { throw DbException.convertToIOException(e); } }
1
            
// in src/main/org/h2/store/PageInputStream.java
catch (DbException e) { throw new EOFException(); }
0 2
            
// in src/main/org/h2/store/DataReader.java
catch (EOFException e) { return i; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (EOFException e) { // more or less normal disconnect }
0 0
runtime (Lib) Error 0 0 0 2
            
// in src/main/org/h2/util/Utils.java
catch (Error e) { // UnsupportedClassVersionError throw DbException.get(ErrorCode.GENERAL_ERROR_1, e, className); }
// in src/tools/org/h2/build/BuildBase.java
catch (Error e) { throw e; }
2
            
// in src/main/org/h2/util/Utils.java
catch (Error e) { // UnsupportedClassVersionError throw DbException.get(ErrorCode.GENERAL_ERROR_1, e, className); }
// in src/tools/org/h2/build/BuildBase.java
catch (Error e) { throw e; }
0
checked (Lib) Exception 12
            
// in src/main/org/h2/tools/Server.java
public static void openBrowser(String url) throws Exception { try { String osName = StringUtils.toLowerEnglish(Utils.getProperty("os.name", "linux")); Runtime rt = Runtime.getRuntime(); String browser = Utils.getProperty(SysProperties.H2_BROWSER, null); if (browser != null) { if (browser.startsWith("call:")) { browser = browser.substring("call:".length()); Utils.callStaticMethod(browser, url); } else if (browser.indexOf("%url") >= 0) { String[] args = StringUtils.arraySplit(browser, ',', false); for (int i = 0; i < args.length; i++) { args[i] = StringUtils.replaceAll(args[i], "%url", url); } rt.exec(args); } else if (osName.indexOf("windows") >= 0) { rt.exec(new String[] { "cmd.exe", "/C", browser, url }); } else { rt.exec(new String[] { browser, url }); } return; } try { Class<?> desktopClass = Class.forName("java.awt.Desktop"); // Desktop.isDesktopSupported() Boolean supported = (Boolean) desktopClass. getMethod("isDesktopSupported"). invoke(null, new Object[0]); URI uri = new URI(url); if (supported) { // Desktop.getDesktop(); Object desktop = desktopClass.getMethod("getDesktop"). invoke(null, new Object[0]); // desktop.browse(uri); desktopClass.getMethod("browse", URI.class). invoke(desktop, uri); return; } } catch (Exception e) { // ignore } if (osName.indexOf("windows") >= 0) { rt.exec(new String[] { "rundll32", "url.dll,FileProtocolHandler", url }); } else if (osName.indexOf("mac") >= 0 || osName.indexOf("darwin") >= 0) { // Mac OS: to open a page with Safari, use "open -a Safari" Runtime.getRuntime().exec(new String[] { "open", url }); } else { String[] browsers = { "google-chrome", "firefox", "mozilla-firefox", "mozilla", "konqueror", "netscape", "opera", "midori" }; boolean ok = false; for (String b : browsers) { try { rt.exec(new String[] { b, url }); ok = true; break; } catch (Exception e) { // ignore and try the next } } if (!ok) { // No success in detection. throw new Exception("Browser detection failed and system property " + SysProperties.H2_BROWSER + " not set"); } } } catch (Exception e) { throw new Exception("Failed to start a browser to open the URL " + url + ": " + e.getMessage()); } }
// in src/tools/org/h2/build/doc/LinkChecker.java
private void listBadLinks() throws Exception { ArrayList<String> errors = new ArrayList<String>(); for (String link : links.keySet()) { if (!link.startsWith("http") && !link.endsWith("h2.pdf") && link.indexOf("_ja.") < 0) { if (targets.get(link) == null) { errors.add(links.get(link) + ": Link missing " + link); } } } for (String link : links.keySet()) { if (!link.startsWith("http")) { targets.remove(link); } } for (String name : targets.keySet()) { if (targets.get(name).equals("id")) { boolean ignore = false; for (String to : IGNORE_MISSING_LINKS_TO) { if (name.indexOf(to) >= 0) { ignore = true; break; } } if (!ignore) { errors.add("No link to " + name); } } } Collections.sort(errors); for (String error : errors) { System.out.println(error); } if (errors.size() > 0) { throw new Exception("Problems where found by the Link Checker"); } }
// in src/tools/org/h2/build/doc/XMLChecker.java
private static void checkXML(String xml, boolean html) throws Exception { // String lastElement = null; // <li>: replace <li>([^\r]*[^<]*) with <li>$1</li> // use this for html file, for example if <li> is not closed String[] noClose = {}; XMLParser parser = new XMLParser(xml); Stack<Object[]> stack = new Stack<Object[]>(); boolean rootElement = false; while (true) { int event = parser.next(); if (event == XMLParser.END_DOCUMENT) { break; } else if (event == XMLParser.START_ELEMENT) { if (stack.size() == 0) { if (rootElement) { throw new Exception("Second root element at " + parser.getRemaining()); } rootElement = true; } String name = parser.getName(); if (html) { for (String n : noClose) { if (name.equals(n)) { name = null; break; } } } if (name != null) { stack.add(new Object[] { name, parser.getPos() }); } } else if (event == XMLParser.END_ELEMENT) { String name = parser.getName(); if (html) { for (String n : noClose) { if (name.equals(n)) { throw new Exception("Unnecessary closing element " + name + " at " + parser.getRemaining()); } } } while (true) { Object[] pop = stack.pop(); String p = (String) pop[0]; if (p.equals(name)) { break; } String remaining = xml.substring((Integer) pop[1]); if (remaining.length() > 100) { remaining = remaining.substring(0, 100); } throw new Exception("Unclosed element " + p + " at " + remaining); } } else if (event == XMLParser.CHARACTERS) { // lastElement = parser.getText(); } else if (event == XMLParser.DTD) { // ignore } else if (event == XMLParser.COMMENT) { // ignore } else { int eventType = parser.getEventType(); throw new Exception("Unexpected event " + eventType + " at " + parser.getRemaining()); } } if (stack.size() != 0) { throw new Exception("Unclosed root element"); } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static String extract(String documentName, File f, String target) throws Exception { String xml = IOUtils.readStringAndClose(new InputStreamReader(new FileInputStream(f), "UTF-8"), -1); // the template contains ${} instead of text StringBuilder template = new StringBuilder(xml.length()); int id = 0; SortedProperties prop = new SortedProperties(); XMLParser parser = new XMLParser(xml); StringBuilder buff = new StringBuilder(); Stack<String> stack = new Stack<String>(); String tag = ""; boolean ignoreEnd = false; String nextKey = ""; // for debugging boolean templateIsCopy = false; while (true) { int event = parser.next(); if (event == XMLParser.END_DOCUMENT) { break; } else if (event == XMLParser.CHARACTERS) { String s = parser.getText(); if (s.trim().length() == 0) { if (buff.length() > 0) { buff.append(s); } else { template.append(s); } } else if ("p".equals(tag) || "li".equals(tag) || "a".equals(tag) || "td".equals(tag) || "th".equals(tag) || "h1".equals(tag) || "h2".equals(tag) || "h3".equals(tag) || "h4".equals(tag) || "body".equals(tag) || "b".equals(tag) || "code".equals(tag) || "form".equals(tag) || "span".equals(tag) || "em".equals(tag) || "div".equals(tag) || "label".equals(tag)) { if (buff.length() == 0) { nextKey = documentName + "_" + (1000 + id++) + "_" + tag; template.append(getSpace(s, true)); } else if (templateIsCopy) { buff.append(getSpace(s, true)); } buff.append(s); } else if ("pre".equals(tag) || "title".equals(tag) || "script".equals(tag) || "style".equals(tag)) { // ignore, don't translate template.append(s); } else { System.out.println(f.getName() + " invalid wrapper tag for text: " + tag + " text: " + s); System.out.println(parser.getRemaining()); throw new Exception(); } } else if (event == XMLParser.START_ELEMENT) { stack.add(tag); String name = parser.getName(); if ("code".equals(name) || "a".equals(name) || "b".equals(name) || "span".equals(name)) { // keep tags if wrapped, but not if this is the wrapper if (buff.length() > 0) { buff.append(parser.getToken()); ignoreEnd = false; } else { ignoreEnd = true; template.append(parser.getToken()); } } else if ("p".equals(tag) || "li".equals(tag) || "td".equals(tag) || "th".equals(tag) || "h1".equals(tag) || "h2".equals(tag) || "h3".equals(tag) || "h4".equals(tag) || "body".equals(tag) || "form".equals(tag)) { if (buff.length() > 0) { if (templateIsCopy) { template.append(buff.toString()); } else { template.append("${" + nextKey + "}"); } add(prop, nextKey, buff); } template.append(parser.getToken()); } else { template.append(parser.getToken()); } tag = name; } else if (event == XMLParser.END_ELEMENT) { String name = parser.getName(); if ("code".equals(name) || "a".equals(name) || "b".equals(name) || "span".equals(name) || "em".equals(name)) { if (ignoreEnd) { if (buff.length() > 0) { if (templateIsCopy) { template.append(buff.toString()); } else { template.append("${" + nextKey + "}"); } add(prop, nextKey, buff); } template.append(parser.getToken()); } else { if (buff.length() > 0) { buff.append(parser.getToken()); } } } else { if (buff.length() > 0) { if (templateIsCopy) { template.append(buff.toString()); } else { template.append("${" + nextKey + "}"); } add(prop, nextKey, buff); } template.append(parser.getToken()); } tag = stack.pop(); } else if (event == XMLParser.DTD) { template.append(parser.getToken()); } else if (event == XMLParser.COMMENT) { template.append(parser.getToken()); } else { int eventType = parser.getEventType(); throw new Exception("Unexpected event " + eventType + " at " + parser.getRemaining()); } // if(!xml.startsWith(template.toString())) { // System.out.println(nextKey); // System.out.println(template.substring(template.length()-60) // +";"); // System.out.println(xml.substring(template.length()-60, // template.length())); // System.out.println(template.substring(template.length()-55) // +";"); // System.out.println(xml.substring(template.length()-55, // template.length())); // break; // } } new File(target).mkdirs(); String propFileName = target + "/_docs_" + MAIN_LANGUAGE + ".properties"; Properties old = load(propFileName, false); prop.putAll(old); store(prop, propFileName, false); String t = template.toString(); if (templateIsCopy && !t.equals(xml)) { for (int i = 0; i < Math.min(t.length(), xml.length()); i++) { if (t.charAt(i) != xml.charAt(i)) { int start = Math.max(0, i - 30), end = Math.min(i + 30, xml.length()); t = t.substring(start, end); xml = xml.substring(start, end); } } System.out.println("xml--------------------------------------------------: "); System.out.println(xml); System.out.println("t---------------------------------------------------: "); System.out.println(t); System.exit(1); } return t; }
// in src/tools/org/h2/build/code/CheckTextFiles.java
private void run() throws Exception { String baseDir = "src"; check(new File(baseDir)); if (hasError) { throw new Exception("Errors found"); } }
// in src/tools/org/h2/build/code/CheckJavadoc.java
private void run() throws Exception { String baseDir = "src"; check(new File(baseDir)); if (errorCount > 0) { throw new Exception(errorCount + " errors found"); } }
1
            
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw new Exception("Failed to start a browser to open the URL " + url + ": " + e.getMessage()); }
60
            
// in src/main/org/h2/jmx/DatabaseInfo.java
public static void unregisterMBean(String name) throws Exception { ObjectName mbeanObjectName = MBEANS.remove(name); if (mbeanObjectName != null) { MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); mbeanServer.unregisterMBean(mbeanObjectName); } }
// in src/main/org/h2/tools/Server.java
public static void openBrowser(String url) throws Exception { try { String osName = StringUtils.toLowerEnglish(Utils.getProperty("os.name", "linux")); Runtime rt = Runtime.getRuntime(); String browser = Utils.getProperty(SysProperties.H2_BROWSER, null); if (browser != null) { if (browser.startsWith("call:")) { browser = browser.substring("call:".length()); Utils.callStaticMethod(browser, url); } else if (browser.indexOf("%url") >= 0) { String[] args = StringUtils.arraySplit(browser, ',', false); for (int i = 0; i < args.length; i++) { args[i] = StringUtils.replaceAll(args[i], "%url", url); } rt.exec(args); } else if (osName.indexOf("windows") >= 0) { rt.exec(new String[] { "cmd.exe", "/C", browser, url }); } else { rt.exec(new String[] { browser, url }); } return; } try { Class<?> desktopClass = Class.forName("java.awt.Desktop"); // Desktop.isDesktopSupported() Boolean supported = (Boolean) desktopClass. getMethod("isDesktopSupported"). invoke(null, new Object[0]); URI uri = new URI(url); if (supported) { // Desktop.getDesktop(); Object desktop = desktopClass.getMethod("getDesktop"). invoke(null, new Object[0]); // desktop.browse(uri); desktopClass.getMethod("browse", URI.class). invoke(desktop, uri); return; } } catch (Exception e) { // ignore } if (osName.indexOf("windows") >= 0) { rt.exec(new String[] { "rundll32", "url.dll,FileProtocolHandler", url }); } else if (osName.indexOf("mac") >= 0 || osName.indexOf("darwin") >= 0) { // Mac OS: to open a page with Safari, use "open -a Safari" Runtime.getRuntime().exec(new String[] { "open", url }); } else { String[] browsers = { "google-chrome", "firefox", "mozilla-firefox", "mozilla", "konqueror", "netscape", "opera", "midori" }; boolean ok = false; for (String b : browsers) { try { rt.exec(new String[] { b, url }); ok = true; break; } catch (Exception e) { // ignore and try the next } } if (!ok) { // No success in detection. throw new Exception("Browser detection failed and system property " + SysProperties.H2_BROWSER + " not set"); } } } catch (Exception e) { throw new Exception("Failed to start a browser to open the URL " + url + ": " + e.getMessage()); } }
// in src/main/org/h2/util/Utils.java
public static Object callStaticMethod(String classAndMethod, Object... params) throws Exception { int lastDot = classAndMethod.lastIndexOf('.'); String className = classAndMethod.substring(0, lastDot); String methodName = classAndMethod.substring(lastDot + 1); return callMethod(null, Class.forName(className), methodName, params); }
// in src/main/org/h2/util/Utils.java
public static Object callMethod( Object instance, String methodName, Object... params) throws Exception { return callMethod(instance, instance.getClass(), methodName, params); }
// in src/main/org/h2/util/Utils.java
private static Object callMethod( Object instance, Class<?> clazz, String methodName, Object... params) throws Exception { Method best = null; int bestMatch = 0; boolean isStatic = instance == null; for (Method m : clazz.getMethods()) { if (Modifier.isStatic(m.getModifiers()) == isStatic && m.getName().equals(methodName)) { int p = match(m.getParameterTypes(), params); if (p > bestMatch) { bestMatch = p; best = m; } } } if (best == null) { throw new NoSuchMethodException(methodName); } return best.invoke(instance, params); }
// in src/main/org/h2/util/Utils.java
public static Object newInstance(String className, Object... params) throws Exception { Constructor<?> best = null; int bestMatch = 0; for (Constructor<?> c : Class.forName(className).getConstructors()) { int p = match(c.getParameterTypes(), params); if (p > bestMatch) { bestMatch = p; best = c; } } if (best == null) { throw new NoSuchMethodException(className); } return best.newInstance(params); }
// in src/main/org/h2/util/Utils.java
public static Object getStaticField(String classAndField) throws Exception { int lastDot = classAndField.lastIndexOf('.'); String className = classAndField.substring(0, lastDot); String fieldName = classAndField.substring(lastDot + 1); return Class.forName(className).getField(fieldName).get(null); }
// in src/main/org/h2/util/Utils.java
public static Object getField(Object instance, String fieldName) throws Exception { return instance.getClass().getField(fieldName).get(instance); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendDataRow(ResultSet rs) throws Exception { int columns = rs.getMetaData().getColumnCount(); String[] values = new String[columns]; for (int i = 0; i < columns; i++) { values[i] = rs.getString(i + 1); } startMessage('D'); writeShort(columns); for (String s : values) { if (s == null) { writeInt(-1); } else { // TODO write Binary data byte[] d2 = s.getBytes(getEncoding()); writeInt(d2.length); write(d2); } } sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendRowDescription(ResultSetMetaData meta) throws Exception { if (meta == null) { sendNoData(); } else { int columns = meta.getColumnCount(); int[] types = new int[columns]; int[] precision = new int[columns]; String[] names = new String[columns]; for (int i = 0; i < columns; i++) { String name = meta.getColumnName(i + 1); names[i] = name; int type = meta.getColumnType(i + 1); type = PgServer.convertType(type); // the ODBC client needs the column pg_catalog.pg_index // to be of type 'int2vector' // if (name.equalsIgnoreCase("indkey") && // "pg_index".equalsIgnoreCase(meta.getTableName(i + 1))) { // type = PgServer.PG_TYPE_INT2VECTOR; // } precision[i] = meta.getColumnDisplaySize(i + 1); server.checkType(type); types[i] = type; } startMessage('T'); writeShort(columns); for (int i = 0; i < columns; i++) { writeString(StringUtils.toLowerEnglish(names[i])); // object ID writeInt(0); // attribute number of the column writeShort(0); // data type writeInt(types[i]); // pg_type.typlen writeShort(getTypeSize(types[i], precision[i])); // pg_attribute.atttypmod writeInt(-1); // text writeShort(0); } sendMessage(); } }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
public static void main(String... args) throws Exception { new PgTcpRedirect().loop(args); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
private void loop(String... args) throws Exception { // MySQL protocol: // http://www.redferni.uklinux.net/mysql/MySQL-Protocol.html // PostgreSQL protocol: // http://developer.postgresql.org/pgdocs/postgres/protocol.html // int portServer = 9083, portClient = 9084; // int portServer = 3306, portClient = 3307; // H2 PgServer // int portServer = 5435, portClient = 5433; // PostgreSQL int portServer = 5432, portClient = 5433; for (int i = 0; i < args.length; i++) { if ("-client".equals(args[i])) { portClient = Integer.parseInt(args[++i]); } else if ("-server".equals(args[i])) { portServer = Integer.parseInt(args[++i]); } } ServerSocket listener = new ServerSocket(portClient); while (true) { Socket client = listener.accept(); Socket server = new Socket("localhost", portServer); TcpRedirectThread c = new TcpRedirectThread(client, server, true); TcpRedirectThread s = new TcpRedirectThread(server, client, false); new Thread(c).start(); new Thread(s).start(); } }
// in src/tools/org/h2/dev/util/ThreadDumpFilter.java
public static void main(String... a) throws Exception { LineNumberReader in = new LineNumberReader(new InputStreamReader(System.in)); for (String s; (s = in.readLine()) != null;) { if (s.startsWith("Full thread")) { do { System.out.println(s); s = in.readLine(); } while(s != null && (s.length() == 0 || " \t\"".indexOf(s.charAt(0)) >= 0)); } }
// in src/tools/org/h2/dev/util/Migrate.java
public static void main(String... args) throws Exception { new Migrate().execute(new File(args.length == 1 ? args[0] : "."), true, USER, PASSWORD, false); }
// in src/tools/org/h2/dev/util/Migrate.java
public void execute(File file, boolean recursive, String user, String password, boolean runQuiet) throws Exception { String pathToJavaExe = getJavaExecutablePath(); this.quiet = runQuiet; if (file.isDirectory() && recursive) { for (File f : file.listFiles()) { execute(f, recursive, user, password, runQuiet); } return; } if (!file.getName().endsWith(".data.db")) { return; } println("Migrating " + file.getName()); if (!OLD_H2_FILE.exists()) { download(OLD_H2_FILE.getAbsolutePath(), DOWNLOAD_URL, CHECKSUM); } String url = "jdbc:h2:" + file.getAbsolutePath(); url = url.substring(0, url.length() - ".data.db".length()); exec(new String[] { pathToJavaExe, "-Xmx128m", "-cp", OLD_H2_FILE.getAbsolutePath(), "org.h2.tools.Script", "-script", TEMP_SCRIPT, "-url", url, "-user", user, "-password", password }); file.renameTo(new File(file.getAbsoluteFile() + ".backup")); RunScript.execute(url, user, password, TEMP_SCRIPT, "UTF-8", true); new File(TEMP_SCRIPT).delete(); }
// in src/tools/org/h2/dev/security/SecureKeyStoreBuilder.java
public static void main(String... args) throws Exception { String password = CipherFactory.KEYSTORE_PASSWORD; KeyStore store = CipherFactory.getKeyStore(password); printKeystore(store, password); }
// in src/tools/org/h2/build/indexer/Indexer.java
public static void main(String... args) throws Exception { new Indexer().run(args); }
// in src/tools/org/h2/build/indexer/Indexer.java
private void run(String... args) throws Exception { String dir = "docs"; String destDir = "docs/html"; for (int i = 0; i < args.length; i++) { if (args[i].equals("-dir")) { dir = args[++i]; } else if (args[i].equals("-destDir")) { destDir = args[++i]; } } File file = new File(dir); setNoIndex("index.html", "html/header.html", "html/search.html", "html/frame.html", "html/fragments.html", "html/sourceError.html", "html/source.html", "html/mainWeb.html", "javadoc/index.html", "javadoc/classes.html", "javadoc/allclasses-frame.html", "javadoc/allclasses-noframe.html", "javadoc/constant-values.html", "javadoc/overview-frame.html", "javadoc/overview-summary.html", "javadoc/serialized-form.html"); output = new PrintWriter(new FileWriter(destDir + "/index.js")); readPages("", file, 0); output.println("var pages=new Array();"); output.println("var ref=new Array();"); output.println("var ignored='';"); output.println("function Page(title, file) { this.title=title; this.file=file; }"); output.println("function load() {"); sortWords(); removeOverflowRelations(); sortPages(); listPages(); listWords(); output.println("}"); output.close(); }
// in src/tools/org/h2/build/indexer/Indexer.java
private void readPages(String dir, File file, int level) throws Exception { String name = file.getName(); String fileName = dir.length() > 0 ? dir + "/" + name : level > 0 ? name : ""; if (file.isDirectory()) { for (File f : file.listFiles()) { readPages(fileName, f, level + 1); } return; } String lower = StringUtils.toLowerEnglish(name); if (!lower.endsWith(".html") && !lower.endsWith(".htm")) { return; } if (lower.indexOf("_ja.") >= 0) { return; } if (!noIndex.contains(fileName)) { page = new Page(pages.size(), fileName); pages.add(page); readPage(file); } }
// in src/tools/org/h2/build/indexer/Indexer.java
private void readPage(File file) throws Exception { byte[] data = IOUtils.readBytesAndClose(new FileInputStream(file), 0); String text = new String(data, "UTF-8"); StringTokenizer t = new StringTokenizer(text, "<> \r\n", true); boolean inTag = false; title = false; heading = false; while (t.hasMoreTokens()) { String token = t.nextToken(); if (token.length() == 1) { char c = token.charAt(0); switch (c) { case '<': { if (inTag) { process("???"); } inTag = true; if (!t.hasMoreTokens()) { break; } token = t.nextToken(); if (token.startsWith("/")) { title = false; heading = false; } else if (token.equalsIgnoreCase("title")) { title = true; } else if (token.length() == 2 && Character.toLowerCase(token.charAt(0)) == 'h' && Character.isDigit(token.charAt(1))) { heading = true; } // TODO maybe skip script tags? break; } case '>': { if (!inTag) { process("???"); } inTag = false; break; } case '\r': case '\n': case ' ': break; default: if (!inTag) { process(token); } } } else { if (!inTag) { process(token); } } } if (page.title == null || page.title.trim().length() == 0) { System.out.println("Error: not title found in " + file.getName()); page.title = file.getName(); } page.title = page.title.trim(); }
// in src/tools/org/h2/build/doc/UploadBuild.java
public static void main(String... args) throws Exception { System.setProperty("h2.socketConnectTimeout", "30000"); String password = System.getProperty("h2.ftpPassword"); if (password == null) { return; } FtpClient ftp = FtpClient.open("h2database.com"); ftp.login("h2database", password); ftp.changeWorkingDirectory("/httpdocs"); boolean coverage = new File("coverage/index.html").exists(); boolean coverageFailed; if (coverage) { byte[] data = IOUtils.readBytesAndClose(new FileInputStream("coverage/index.html"), -1); String index = new String(data, "ISO-8859-1"); coverageFailed = index.indexOf("CLASS=\"h\"") >= 0; while (true) { int idx = index.indexOf("<A HREF=\""); if (idx < 0) { break; } int end = index.indexOf('>', idx) + 1; index = index.substring(0, idx) + index.substring(end); idx = index.indexOf("</A>"); index = index.substring(0, idx) + index.substring(idx + "</A>".length()); } index = StringUtils.replaceAll(index, "[all", ""); index = StringUtils.replaceAll(index, "classes]", ""); FileOutputStream out = new FileOutputStream("coverage/overview.html"); out.write(index.getBytes("ISO-8859-1")); out.close(); new File("details").mkdir(); zip("details/coverage_files.zip", "coverage", true); zip("coverage.zip", "details", false); FileUtils.delete("coverage.txt"); FileUtils.delete("details/coverage_files.zip"); FileUtils.delete("details"); if (ftp.exists("/httpdocs", "coverage")) { ftp.removeDirectoryRecursive("/httpdocs/coverage"); } ftp.makeDirectory("/httpdocs/coverage"); } else { coverageFailed = true; } String testOutput; boolean error; if (new File("docs/html/testOutput.html").exists()) { testOutput = IOUtils.readStringAndClose(new FileReader("docs/html/testOutput.html"), -1); error = testOutput.indexOf(OutputCatcher.START_ERROR) >= 0; } else if (new File("log.txt").exists()) { testOutput = IOUtils.readStringAndClose(new FileReader("log.txt"), -1); error = true; } else { testOutput = "No log.txt"; error = true; } if (!ftp.exists("/httpdocs", "automated")) { ftp.makeDirectory("/httpdocs/automated"); } String buildSql; if (ftp.exists("/httpdocs/automated", "history.sql")) { buildSql = new String(ftp.retrieve("/httpdocs/automated/history.sql")); } else { buildSql = "create table item(id identity, title varchar, issued timestamp, desc varchar);\n"; } String ts = new java.sql.Timestamp(System.currentTimeMillis()).toString(); String now = ts.substring(0, 16); int idx = testOutput.indexOf("Statements per second: "); if (idx >= 0) { int end = testOutput.indexOf("<br />", idx); if (end >= 0) { String result = testOutput.substring(idx + "Statements per second: ".length(), end); now += " (" + result + " op/s)"; } } String sql = "insert into item(title, issued, desc) values('Build " + now + (error ? " [FAILED]" : "") + (coverageFailed ? " [COVERAGE]" : "") + "', '" + ts + "', '<a href=\"http://www.h2database.com/html/testOutput.html\">Output</a>" + " - <a href=\"http://www.h2database.com/coverage/overview.html\">Coverage</a>" + " - <a href=\"http://www.h2database.com/automated/h2-latest.jar\">Jar</a>');\n"; buildSql += sql; Connection conn; try { Class.forName("org.h2.Driver"); conn = DriverManager.getConnection("jdbc:h2:mem:"); } catch (Exception e) { Class.forName("org.h2.upgrade.v1_1.Driver"); conn = DriverManager.getConnection("jdbc:h2v1_1:mem:"); } conn.createStatement().execute(buildSql); String newsfeed = IOUtils.readStringAndClose(new FileReader("src/tools/org/h2/build/doc/buildNewsfeed.sql"), -1); ScriptReader r = new ScriptReader(new StringReader(newsfeed)); Statement stat = conn.createStatement(); ResultSet rs = null; while (true) { String s = r.readStatement(); if (s == null) { break; } if (stat.execute(s)) { rs = stat.getResultSet(); } } rs.next(); String content = rs.getString("content"); conn.close(); ftp.store("/httpdocs/automated/history.sql", new ByteArrayInputStream(buildSql.getBytes())); ftp.store("/httpdocs/automated/news.xml", new ByteArrayInputStream(content.getBytes())); ftp.store("/httpdocs/html/testOutput.html", new ByteArrayInputStream(testOutput.getBytes())); String jarFileName = "bin/h2-" + Constants.getVersion() + ".jar"; if (FileUtils.exists(jarFileName)) { ftp.store("/httpdocs/automated/h2-latest.jar", new FileInputStream(jarFileName)); } if (coverage) { ftp.store("/httpdocs/coverage/overview.html", new FileInputStream("coverage/overview.html")); ftp.store("/httpdocs/coverage/coverage.zip", new FileInputStream("coverage.zip")); FileUtils.delete("coverage.zip"); } ftp.close(); }
// in src/tools/org/h2/build/doc/MergeDocs.java
public static void main(String... args) throws Exception { new MergeDocs().run(); }
// in src/tools/org/h2/build/doc/MergeDocs.java
private void run() throws Exception { // the order of pages is important here String[] pages = { "quickstart.html", "installation.html", "tutorial.html", "features.html", "performance.html", "advanced.html", "grammar.html", "functions.html", "datatypes.html", "build.html", "history.html", "faq.html" }; StringBuilder buff = new StringBuilder(); for (String fileName : pages) { String text = getContent(fileName); for (String page : pages) { text = StringUtils.replaceAll(text, page + "#", "#"); } text = disableRailroads(text); text = removeHeaderFooter(fileName, text); buff.append(text); } String finalText = buff.toString(); File output = new File(baseDir, "onePage.html"); PrintWriter writer = new PrintWriter(new FileWriter(output)); writer.println("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /><title>"); writer.println("H2 Documentation"); writer.println("</title><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheetPdf.css\" /></head><body>"); writer.println("<h1>H2 Database Engine</h1>"); writer.println("<p>Version " + Constants.getFullVersion() + "</p>"); writer.println(finalText); writer.println("</body></html>"); writer.close(); }
// in src/tools/org/h2/build/doc/MergeDocs.java
private String getContent(String fileName) throws Exception { File file = new File(baseDir, fileName); int length = (int) file.length(); char[] data = new char[length]; FileReader reader = new FileReader(file); int off = 0; while (length > 0) { int len = reader.read(data, off, length); off += len; length -= len; } reader.close(); String s = new String(data); return s; }
// in src/tools/org/h2/build/doc/WebSite.java
public static void main(String... args) throws Exception { new WebSite().run(); }
// in src/tools/org/h2/build/doc/WebSite.java
private void run() throws Exception { // create the web site deleteRecursive(new File(webDir)); loadFragments(); copy(new File(sourceDir), new File(webDir), true, true); Newsfeed.main(webDir + "/html"); // create the internal documentation copy(new File(sourceDir), new File(sourceDir), true, false); }
// in src/tools/org/h2/build/doc/LinkChecker.java
public static void main(String... args) throws Exception { new LinkChecker().run(args); }
// in src/tools/org/h2/build/doc/LinkChecker.java
private void run(String... args) throws Exception { String dir = "docs"; for (int i = 0; i < args.length; i++) { if ("-dir".equals(args[i])) { dir = args[++i]; } } process(dir); listExternalLinks(); listBadLinks(); }
// in src/tools/org/h2/build/doc/LinkChecker.java
private void listBadLinks() throws Exception { ArrayList<String> errors = new ArrayList<String>(); for (String link : links.keySet()) { if (!link.startsWith("http") && !link.endsWith("h2.pdf") && link.indexOf("_ja.") < 0) { if (targets.get(link) == null) { errors.add(links.get(link) + ": Link missing " + link); } } } for (String link : links.keySet()) { if (!link.startsWith("http")) { targets.remove(link); } } for (String name : targets.keySet()) { if (targets.get(name).equals("id")) { boolean ignore = false; for (String to : IGNORE_MISSING_LINKS_TO) { if (name.indexOf(to) >= 0) { ignore = true; break; } } if (!ignore) { errors.add("No link to " + name); } } } Collections.sort(errors); for (String error : errors) { System.out.println(error); } if (errors.size() > 0) { throw new Exception("Problems where found by the Link Checker"); } }
// in src/tools/org/h2/build/doc/LinkChecker.java
private void process(String path) throws Exception { if (path.endsWith("/CVS") || path.endsWith("/.svn")) { return; } File file = new File(path); if (file.isDirectory()) { for (String n : file.list()) { process(path + "/" + n); } } else { processFile(path); } }
// in src/tools/org/h2/build/doc/LinkChecker.java
private void processFile(String path) throws Exception { targets.put(path, "file"); String lower = StringUtils.toLowerEnglish(path); if (!lower.endsWith(".html") && !lower.endsWith(".htm")) { return; } String fileName = new File(path).getName(); String parent = path.substring(0, path.lastIndexOf('/')); String html = IOUtils.readStringAndClose(new FileReader(path), -1); int idx = -1; while (true) { idx = html.indexOf(" id=\"", idx + 1); if (idx < 0) { break; } int start = idx + " id=\"".length(); int end = html.indexOf("\"", start); if (end < 0) { error(fileName, "Expected \" after id= " + html.substring(idx, idx + 100)); } String ref = html.substring(start, end); if (!ref.startsWith("_")) { targets.put(path + "#" + ref, "id"); } } idx = -1; while (true) { idx = html.indexOf(" href=\"", idx + 1); if (idx < 0) { break; } int start = html.indexOf("\"", idx); if (start < 0) { error(fileName, "Expected \" after href= at " + html.substring(idx, idx + 100)); } int end = html.indexOf("\"", start + 1); if (end < 0) { error(fileName, "Expected \" after href= at " + html.substring(idx, idx + 100)); } String ref = html.substring(start + 1, end); if (ref.startsWith("http:") || ref.startsWith("https:")) { // ok } else if (ref.startsWith("javascript:")) { ref = null; // ok } else if (ref.length() == 0) { ref = null; // ok } else if (ref.startsWith("#")) { ref = path + ref; } else { String p = parent; while (ref.startsWith(".")) { if (ref.startsWith("./")) { ref = ref.substring(2); } else if (ref.startsWith("../")) { ref = ref.substring(3); p = p.substring(0, p.lastIndexOf('/')); } } ref = p + "/" + ref; } if (ref != null) { links.put(ref, path); } } idx = -1; while (true) { idx = html.indexOf("<a ", idx + 1); if (idx < 0) { break; } int equals = html.indexOf("=", idx); if (equals < 0) { error(fileName, "Expected = after <a at " + html.substring(idx, idx + 100)); } String type = html.substring(idx + 2, equals).trim(); int start = html.indexOf("\"", idx); if (start < 0) { error(fileName, "Expected \" after <a at " + html.substring(idx, idx + 100)); } int end = html.indexOf("\"", start + 1); if (end < 0) { error(fileName, "Expected \" after <a at " + html.substring(idx, idx + 100)); } String ref = html.substring(start + 1, end); if (type.equals("href")) { // already checked } else if (type.equals("id")) { targets.put(path + "#" + ref, "id"); } else { error(fileName, "Unsupported <a ?: " + html.substring(idx, idx + 100)); } } }
// in src/tools/org/h2/build/doc/GenerateHelp.java
public static void main(String... args) throws Exception { String in = "src/docsrc/help/help.csv"; String out = "src/main/org/h2/res/help.csv"; Csv csv = new Csv(); csv.setLineCommentCharacter('#'); ResultSet rs = csv.read(in, null, null); SimpleResultSet rs2 = new SimpleResultSet(); ResultSetMetaData meta = rs.getMetaData(); int columnCount = meta.getColumnCount() - 1; for (int i = 0; i < columnCount; i++) { rs2.addColumn(meta.getColumnLabel(1 + i), Types.VARCHAR, 0, 0); } while (rs.next()) { Object[] row = new Object[columnCount]; for (int i = 0; i < columnCount; i++) { String s = rs.getString(1 + i); if (i == 3) { int dot = s.indexOf('.'); if (dot >= 0) { s = s.substring(0, dot + 1); } } row[i] = s; } rs2.addRow(row); } BufferedWriter writer = new BufferedWriter(new FileWriter(out)); writer.write("# Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License,\n" + "# Version 1.0, and under the Eclipse Public License, Version 1.0\n" + "# (http://h2database.com/html/license.html).\n" + "# Initial Developer: H2 Group)\n"); csv = new Csv(); csv.setLineSeparator("\n"); csv.write(writer, rs2); }
// in src/tools/org/h2/build/doc/GenerateDoc.java
public static void main(String... args) throws Exception { new GenerateDoc().run(args); }
// in src/tools/org/h2/build/doc/GenerateDoc.java
private void run(String... args) throws Exception { for (int i = 0; i < args.length; i++) { if (args[i].equals("-in")) { inDir = args[++i]; } else if (args[i].equals("-out")) { outDir = args[++i]; } } Class.forName("org.h2.Driver"); conn = DriverManager.getConnection("jdbc:h2:mem:"); new File(outDir).mkdirs(); new RailroadImages().run(outDir + "/images"); bnf = Bnf.getInstance(null); bnf.linkStatements(); session.put("version", Constants.getVersion()); session.put("versionDate", Constants.BUILD_DATE); session.put("stableVersion", Constants.getVersionStable()); session.put("stableVersionDate", Constants.BUILD_DATE_STABLE); // String help = "SELECT * FROM INFORMATION_SCHEMA.HELP WHERE SECTION"; String help = "SELECT ROWNUM ID, * FROM CSVREAD('" + inHelp + "', NULL, 'lineComment=#') WHERE SECTION "; map("commands", help + "LIKE 'Commands%' ORDER BY ID", true); map("commandsDML", help + "= 'Commands (DML)' ORDER BY ID", false); map("commandsDDL", help + "= 'Commands (DDL)' ORDER BY ID", false); map("commandsOther", help + "= 'Commands (Other)' ORDER BY ID", false); map("otherGrammar", help + "= 'Other Grammar' ORDER BY ID", true); map("functionsAggregate", help + "= 'Functions (Aggregate)' ORDER BY ID", false); map("functionsNumeric", help + "= 'Functions (Numeric)' ORDER BY ID", false); map("functionsString", help + "= 'Functions (String)' ORDER BY ID", false); map("functionsTimeDate", help + "= 'Functions (Time and Date)' ORDER BY ID", false); map("functionsSystem", help + "= 'Functions (System)' ORDER BY ID", false); map("functionsAll", help + "LIKE 'Functions%' ORDER BY SECTION, ID", true); map("dataTypes", help + "LIKE 'Data Types%' ORDER BY SECTION, ID", true); map("informationSchema", "SELECT TABLE_NAME TOPIC, GROUP_CONCAT(COLUMN_NAME " + "ORDER BY ORDINAL_POSITION SEPARATOR ', ') SYNTAX FROM INFORMATION_SCHEMA.COLUMNS " + "WHERE TABLE_SCHEMA='INFORMATION_SCHEMA' GROUP BY TABLE_NAME ORDER BY TABLE_NAME", false); processAll(""); conn.close(); }
// in src/tools/org/h2/build/doc/GenerateDoc.java
private void processAll(String dir) throws Exception { if (dir.endsWith(".svn")) { return; } File[] list = new File(inDir + "/" + dir).listFiles(); for (File file : list) { if (file.isDirectory()) { processAll(dir + file.getName()); } else { process(dir, file.getName()); } } }
// in src/tools/org/h2/build/doc/GenerateDoc.java
private void process(String dir, String fileName) throws Exception { String inFile = inDir + "/" + dir + "/" + fileName; String outFile = outDir + "/" + dir + "/" + fileName; new File(outFile).getParentFile().mkdirs(); FileOutputStream out = new FileOutputStream(outFile); FileInputStream in = new FileInputStream(inFile); byte[] bytes = IOUtils.readBytesAndClose(in, 0); if (fileName.endsWith(".html")) { String page = new String(bytes); page = PageParser.parse(page, session); bytes = page.getBytes(); } out.write(bytes); out.close(); }
// in src/tools/org/h2/build/doc/GenerateDoc.java
private void map(String key, String sql, boolean railroads) throws Exception { ResultSet rs = null; Statement stat = null; try { stat = conn.createStatement(); rs = stat.executeQuery(sql); ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); while (rs.next()) { HashMap<String, String> map = new HashMap<String, String>(); ResultSetMetaData meta = rs.getMetaData(); for (int i = 0; i < meta.getColumnCount(); i++) { String k = StringUtils.toLowerEnglish(meta.getColumnLabel(i + 1)); String value = rs.getString(i + 1); value = value.trim(); map.put(k, PageParser.escapeHtml(value)); } String topic = rs.getString("TOPIC"); String syntax = rs.getString("SYNTAX").trim(); if (railroads) { BnfRailroad r = new BnfRailroad(); String railroad = r.getHtml(bnf, syntax); map.put("railroad", railroad); } BnfSyntax visitor = new BnfSyntax(); String syntaxHtml = visitor.getHtml(bnf, syntax); map.put("syntax", syntaxHtml); // remove newlines in the regular text String text = map.get("text"); if (text != null) { // text is enclosed in <p> .. </p> so this works. text = StringUtils.replaceAll(text, "<br /><br />", "</p><p>"); text = StringUtils.replaceAll(text, "<br />", " "); text = addCode(text); map.put("text", text); } String link = topic.toLowerCase(); link = StringUtils.replaceAll(link, " ", "_"); // link = StringUtils.replaceAll(link, "_", ""); link = StringUtils.replaceAll(link, "@", "_"); map.put("link", StringUtils.urlEncode(link)); list.add(map); } session.put(key, list); int div = 3; int part = (list.size() + div - 1) / div; for (int i = 0, start = 0; i < div; i++, start += part) { List<HashMap<String, String>> listThird = list.subList(start, Math.min(start + part, list.size())); session.put(key + "-" + i, listThird); } } finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(stat); } }
// in src/tools/org/h2/build/doc/XMLChecker.java
public static void main(String... args) throws Exception { new XMLChecker().run(args); }
// in src/tools/org/h2/build/doc/XMLChecker.java
private void run(String... args) throws Exception { String dir = "."; for (int i = 0; i < args.length; i++) { if ("-dir".equals(args[i])) { dir = args[++i]; } } process(dir + "/src"); process(dir + "/docs"); }
// in src/tools/org/h2/build/doc/XMLChecker.java
private void process(String path) throws Exception { if (path.endsWith("/CVS") || path.endsWith("/.svn")) { return; } File file = new File(path); if (file.isDirectory()) { for (String name : file.list()) { process(path + "/" + name); } } else { processFile(path); } }
// in src/tools/org/h2/build/doc/XMLChecker.java
private static void processFile(String fileName) throws Exception { int idx = fileName.lastIndexOf('.'); if (idx < 0) { return; } String suffix = fileName.substring(idx + 1); if (!suffix.equals("html") && !suffix.equals("xml") && !suffix.equals("jsp")) { return; } // System.out.println("Checking file:" + fileName); FileReader reader = new FileReader(fileName); String s = IOUtils.readStringAndClose(reader, -1); Exception last = null; try { checkXML(s, !suffix.equals("xml")); } catch (Exception e) { last = e; System.out.println("ERROR in file " + fileName + " " + e.toString()); } if (last != null) { last.printStackTrace(); } }
// in src/tools/org/h2/build/doc/XMLChecker.java
private static void checkXML(String xml, boolean html) throws Exception { // String lastElement = null; // <li>: replace <li>([^\r]*[^<]*) with <li>$1</li> // use this for html file, for example if <li> is not closed String[] noClose = {}; XMLParser parser = new XMLParser(xml); Stack<Object[]> stack = new Stack<Object[]>(); boolean rootElement = false; while (true) { int event = parser.next(); if (event == XMLParser.END_DOCUMENT) { break; } else if (event == XMLParser.START_ELEMENT) { if (stack.size() == 0) { if (rootElement) { throw new Exception("Second root element at " + parser.getRemaining()); } rootElement = true; } String name = parser.getName(); if (html) { for (String n : noClose) { if (name.equals(n)) { name = null; break; } } } if (name != null) { stack.add(new Object[] { name, parser.getPos() }); } } else if (event == XMLParser.END_ELEMENT) { String name = parser.getName(); if (html) { for (String n : noClose) { if (name.equals(n)) { throw new Exception("Unnecessary closing element " + name + " at " + parser.getRemaining()); } } } while (true) { Object[] pop = stack.pop(); String p = (String) pop[0]; if (p.equals(name)) { break; } String remaining = xml.substring((Integer) pop[1]); if (remaining.length() > 100) { remaining = remaining.substring(0, 100); } throw new Exception("Unclosed element " + p + " at " + remaining); } } else if (event == XMLParser.CHARACTERS) { // lastElement = parser.getText(); } else if (event == XMLParser.DTD) { // ignore } else if (event == XMLParser.COMMENT) { // ignore } else { int eventType = parser.getEventType(); throw new Exception("Unexpected event " + eventType + " at " + parser.getRemaining()); } } if (stack.size() != 0) { throw new Exception("Unclosed root element"); } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
public static void main(String... args) throws Exception { String baseDir = "src/docsrc/textbase"; prepare(baseDir, "src/main/org/h2/res", true); prepare(baseDir, "src/main/org/h2/server/web/res", true); // convert the txt files to properties files PropertiesToUTF8.textUTF8ToProperties("src/docsrc/text/_docs_de.utf8.txt", "src/docsrc/text/_docs_de.properties"); PropertiesToUTF8.textUTF8ToProperties("src/docsrc/text/_docs_ja.utf8.txt", "src/docsrc/text/_docs_ja.properties"); // create the .jsp files and extract the text in the main language extractFromHtml("docs/html", "src/docsrc/text"); // add missing translations and create a new baseline prepare(baseDir, "src/docsrc/text", false); // create the translated documentation buildHtml("src/docsrc/text", "docs/html", "en"); // buildHtml("src/docsrc/text", "docs/html", "de"); // buildHtml("src/docsrc/text", "docs/html", "ja"); // convert the properties files back to utf8 text files, including the // main language (to be used as a template) PropertiesToUTF8.propertiesToTextUTF8("src/docsrc/text/_docs_en.properties", "src/docsrc/text/_docs_en.utf8.txt"); PropertiesToUTF8.propertiesToTextUTF8("src/docsrc/text/_docs_de.properties", "src/docsrc/text/_docs_de.utf8.txt"); PropertiesToUTF8.propertiesToTextUTF8("src/docsrc/text/_docs_ja.properties", "src/docsrc/text/_docs_ja.utf8.txt"); // delete temporary files for (File f : new File("src/docsrc/text").listFiles()) { if (!f.getName().endsWith(".utf8.txt")) { f.delete(); } } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static void extractFromHtml(String dir, String target) throws Exception { for (File f : new File(dir).listFiles()) { String name = f.getName(); if (!name.endsWith(".html")) { continue; } if (exclude(name)) { continue; } // remove '.html' name = name.substring(0, name.length() - 5); if (name.indexOf('_') >= 0) { // ignore translated files continue; } String template = extract(name, f, target); FileWriter writer = new FileWriter(target + "/" + name + ".jsp"); writer.write(template); writer.close(); } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static String extract(String documentName, File f, String target) throws Exception { String xml = IOUtils.readStringAndClose(new InputStreamReader(new FileInputStream(f), "UTF-8"), -1); // the template contains ${} instead of text StringBuilder template = new StringBuilder(xml.length()); int id = 0; SortedProperties prop = new SortedProperties(); XMLParser parser = new XMLParser(xml); StringBuilder buff = new StringBuilder(); Stack<String> stack = new Stack<String>(); String tag = ""; boolean ignoreEnd = false; String nextKey = ""; // for debugging boolean templateIsCopy = false; while (true) { int event = parser.next(); if (event == XMLParser.END_DOCUMENT) { break; } else if (event == XMLParser.CHARACTERS) { String s = parser.getText(); if (s.trim().length() == 0) { if (buff.length() > 0) { buff.append(s); } else { template.append(s); } } else if ("p".equals(tag) || "li".equals(tag) || "a".equals(tag) || "td".equals(tag) || "th".equals(tag) || "h1".equals(tag) || "h2".equals(tag) || "h3".equals(tag) || "h4".equals(tag) || "body".equals(tag) || "b".equals(tag) || "code".equals(tag) || "form".equals(tag) || "span".equals(tag) || "em".equals(tag) || "div".equals(tag) || "label".equals(tag)) { if (buff.length() == 0) { nextKey = documentName + "_" + (1000 + id++) + "_" + tag; template.append(getSpace(s, true)); } else if (templateIsCopy) { buff.append(getSpace(s, true)); } buff.append(s); } else if ("pre".equals(tag) || "title".equals(tag) || "script".equals(tag) || "style".equals(tag)) { // ignore, don't translate template.append(s); } else { System.out.println(f.getName() + " invalid wrapper tag for text: " + tag + " text: " + s); System.out.println(parser.getRemaining()); throw new Exception(); } } else if (event == XMLParser.START_ELEMENT) { stack.add(tag); String name = parser.getName(); if ("code".equals(name) || "a".equals(name) || "b".equals(name) || "span".equals(name)) { // keep tags if wrapped, but not if this is the wrapper if (buff.length() > 0) { buff.append(parser.getToken()); ignoreEnd = false; } else { ignoreEnd = true; template.append(parser.getToken()); } } else if ("p".equals(tag) || "li".equals(tag) || "td".equals(tag) || "th".equals(tag) || "h1".equals(tag) || "h2".equals(tag) || "h3".equals(tag) || "h4".equals(tag) || "body".equals(tag) || "form".equals(tag)) { if (buff.length() > 0) { if (templateIsCopy) { template.append(buff.toString()); } else { template.append("${" + nextKey + "}"); } add(prop, nextKey, buff); } template.append(parser.getToken()); } else { template.append(parser.getToken()); } tag = name; } else if (event == XMLParser.END_ELEMENT) { String name = parser.getName(); if ("code".equals(name) || "a".equals(name) || "b".equals(name) || "span".equals(name) || "em".equals(name)) { if (ignoreEnd) { if (buff.length() > 0) { if (templateIsCopy) { template.append(buff.toString()); } else { template.append("${" + nextKey + "}"); } add(prop, nextKey, buff); } template.append(parser.getToken()); } else { if (buff.length() > 0) { buff.append(parser.getToken()); } } } else { if (buff.length() > 0) { if (templateIsCopy) { template.append(buff.toString()); } else { template.append("${" + nextKey + "}"); } add(prop, nextKey, buff); } template.append(parser.getToken()); } tag = stack.pop(); } else if (event == XMLParser.DTD) { template.append(parser.getToken()); } else if (event == XMLParser.COMMENT) { template.append(parser.getToken()); } else { int eventType = parser.getEventType(); throw new Exception("Unexpected event " + eventType + " at " + parser.getRemaining()); } // if(!xml.startsWith(template.toString())) { // System.out.println(nextKey); // System.out.println(template.substring(template.length()-60) // +";"); // System.out.println(xml.substring(template.length()-60, // template.length())); // System.out.println(template.substring(template.length()-55) // +";"); // System.out.println(xml.substring(template.length()-55, // template.length())); // break; // } } new File(target).mkdirs(); String propFileName = target + "/_docs_" + MAIN_LANGUAGE + ".properties"; Properties old = load(propFileName, false); prop.putAll(old); store(prop, propFileName, false); String t = template.toString(); if (templateIsCopy && !t.equals(xml)) { for (int i = 0; i < Math.min(t.length(), xml.length()); i++) { if (t.charAt(i) != xml.charAt(i)) { int start = Math.max(0, i - 30), end = Math.min(i + 30, xml.length()); t = t.substring(start, end); xml = xml.substring(start, end); } } System.out.println("xml--------------------------------------------------: "); System.out.println(xml); System.out.println("t---------------------------------------------------: "); System.out.println(t); System.exit(1); } return t; }
// in src/tools/org/h2/build/i18n/PropertiesToUTF8.java
public static void main(String... args) throws Exception { convert("bin/org/h2/res"); convert("bin/org/h2/server/web/res"); }
// in src/tools/org/h2/build/i18n/PropertiesToUTF8.java
static void propertiesToTextUTF8(String source, String target) throws Exception { if (!new File(source).exists()) { return; } Properties prop = SortedProperties.loadProperties(source); FileOutputStream out = new FileOutputStream(target); PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, "UTF-8")); // keys is sorted for (Enumeration<Object> en = prop.keys(); en.hasMoreElements();) { String key = (String) en.nextElement(); String value = prop.getProperty(key, null); writer.print("@" + key + "\n"); writer.print(value + "\n\n"); } writer.close(); }
// in src/tools/org/h2/build/i18n/PropertiesToUTF8.java
static void textUTF8ToProperties(String source, String target) throws Exception { if (!new File(source).exists()) { return; } LineNumberReader reader = new LineNumberReader(new InputStreamReader(new FileInputStream(source), "UTF-8")); try { SortedProperties prop = new SortedProperties(); StringBuilder buff = new StringBuilder(); String key = null; boolean found = false; while (true) { String line = reader.readLine(); if (line == null) { break; } line = line.trim(); if (line.length() == 0) { continue; } if (line.startsWith("@")) { if (key != null) { prop.setProperty(key, buff.toString()); buff.setLength(0); } found = true; key = line.substring(1); } else { if (buff.length() > 0) { buff.append(System.getProperty("line.separator")); } buff.append(line); } } if (found) { prop.setProperty(key, buff.toString()); } prop.store(target); } finally { reader.close(); } }
// in src/tools/org/h2/build/i18n/PropertiesToUTF8.java
private static void convert(String source) throws Exception { for (File f : new File(source).listFiles()) { if (!f.getName().endsWith(".properties")) { continue; } FileInputStream in = new FileInputStream(f); InputStreamReader r = new InputStreamReader(in, "UTF-8"); String s = IOUtils.readStringAndClose(r, -1); in.close(); String name = f.getName(); String utf8, html; if (name.startsWith("utf8")) { utf8 = HtmlConverter.convertHtmlToString(s); html = HtmlConverter.convertStringToHtml(utf8); RandomAccessFile out = new RandomAccessFile("_" + name.substring(4), "rw"); out.write(html.getBytes()); out.setLength(out.getFilePointer()); out.close(); } else { new CheckTextFiles().checkOrFixFile(f, false, false); html = s; utf8 = HtmlConverter.convertHtmlToString(html); // s = unescapeHtml(s); utf8 = StringUtils.javaDecode(utf8); FileOutputStream out = new FileOutputStream("_utf8" + f.getName()); OutputStreamWriter w = new OutputStreamWriter(out, "UTF-8"); w.write(utf8); w.close(); out.close(); } String java = StringUtils.javaEncode(utf8); java = StringUtils.replaceAll(java, "\\r", "\r"); java = StringUtils.replaceAll(java, "\\n", "\n"); RandomAccessFile out = new RandomAccessFile("_java." + name, "rw"); out.write(java.getBytes()); out.setLength(out.getFilePointer()); out.close(); } }
// in src/tools/org/h2/build/code/CheckTextFiles.java
public static void main(String... args) throws Exception { new CheckTextFiles().run(); }
// in src/tools/org/h2/build/code/CheckTextFiles.java
private void run() throws Exception { String baseDir = "src"; check(new File(baseDir)); if (hasError) { throw new Exception("Errors found"); } }
// in src/tools/org/h2/build/code/CheckTextFiles.java
private void check(File file) throws Exception { String name = file.getName(); if (file.isDirectory()) { if (name.equals("CVS") || name.equals(".svn")) { return; } for (File f : file.listFiles()) { check(f); } } else { String suffix = ""; int lastDot = name.lastIndexOf('.'); if (lastDot >= 0) { suffix = name.substring(lastDot + 1); } boolean check = false, ignore = false; for (String s : SUFFIX_CHECK) { if (suffix.equals(s)) { check = true; } } // if (name.endsWith(".html") && name.indexOf("_ja") > 0) { // int todoRemoveJapaneseFiles; // // Japanese html files are UTF-8 at this time // check = false; // ignore = true; // } if (name.endsWith(".utf8.txt") || (name.startsWith("_docs_") && name.endsWith(".properties"))) { check = false; ignore = true; } for (String s : SUFFIX_IGNORE) { if (suffix.equals(s)) { ignore = true; } } boolean checkLicense = true; for (String ig : suffixIgnoreLicense) { if (suffix.equals(ig) || name.endsWith(ig)) { checkLicense = false; break; } } if (ignore == check) { throw new RuntimeException("Unknown suffix: " + suffix + " for file: " + file.getAbsolutePath()); } useCRLF = false; for (String s : SUFFIX_CRLF) { if (suffix.equals(s)) { useCRLF = true; break; } } if (check) { checkOrFixFile(file, autoFix, checkLicense); } } }
// in src/tools/org/h2/build/code/CheckTextFiles.java
public void checkOrFixFile(File file, boolean fix, boolean checkLicense) throws Exception { RandomAccessFile in = new RandomAccessFile(file, "r"); byte[] data = new byte[(int) file.length()]; ByteArrayOutputStream out = fix ? new ByteArrayOutputStream() : null; in.readFully(data); in.close(); if (checkLicense) { if (data.length > COPYRIGHT.length() + LICENSE.length()) { // don't check tiny files String text = new String(data); if (text.indexOf(COPYRIGHT) < 0) { fail(file, "copyright is missing", 0); } if (text.indexOf(LICENSE) < 0) { fail(file, "license is missing", 0); } if (text.indexOf("// " + "##") > 0) { fail(file, "unexpected space between // and ##", 0); } if (text.indexOf("/* " + "##") > 0) { fail(file, "unexpected space between /* and ##", 0); } if (text.indexOf("##" + " */") > 0) { fail(file, "unexpected space between ## and */", 0); } } } int line = 1; boolean lastWasWhitespace = false; for (int i = 0; i < data.length; i++) { char ch = (char) (data[i] & 0xff); boolean isWhitespace = Character.isWhitespace(ch); if (ch > 127) { fail(file, "contains character " + (int) ch + " at " + new String(data, i - 10, 20), line); return; } else if (ch < 32) { if (ch == '\n') { if (lastWasWhitespace && !allowTrailingSpaces) { fail(file, "contains trailing white space", line); return; } if (fix) { if (useCRLF) { out.write('\r'); } out.write(ch); } lastWasWhitespace = false; line++; } else if (ch == '\r') { if (!allowCR) { fail(file, "contains CR", line); return; } if (lastWasWhitespace && !allowTrailingSpaces) { fail(file, "contains trailing white space", line); return; } lastWasWhitespace = false; // ok } else if (ch == '\t') { if (fix) { for (int j = 0; j < spacesPerTab; j++) { out.write(' '); } } else { if (!allowTab) { fail(file, "contains TAB", line); return; } } lastWasWhitespace = true; // ok } else { fail(file, "contains character " + (int) ch, line); return; } } else if (isWhitespace) { lastWasWhitespace = true; if (fix) { boolean write = true; for (int j = i + 1; j < data.length; j++) { char ch2 = (char) (data[j] & 0xff); if (ch2 == '\n' || ch2 == '\r') { write = false; lastWasWhitespace = false; ch = ch2; i = j - 1; break; } else if (!Character.isWhitespace(ch2)) { break; } } if (write) { out.write(ch); } } } else { if (fix) { out.write(ch); } lastWasWhitespace = false; } } if (lastWasWhitespace && !allowTrailingSpaces) { fail(file, "contains trailing white space at the very end", line); return; } if (fix) { byte[] changed = out.toByteArray(); if (Utils.compareNotNull(data, changed) != 0) { RandomAccessFile f = new RandomAccessFile(file, "rw"); f.write(changed); f.setLength(changed.length); f.close(); System.out.println("CHANGED: " + file.getName()); } } line = 1; for (int i = 0; i < data.length; i++) { if (data[i] < 32) { line++; for (int j = i + 1; j < data.length; j++) { if (data[j] != 32) { int mod = (j - i - 1) & 3; if (mod != 0 && (mod != 1 || data[j] != '*')) { fail(file, "contains wrong number of heading spaces: " + (j - i - 1), line); } break; } } } } }
// in src/tools/org/h2/build/code/CheckJavadoc.java
public static void main(String... args) throws Exception { new CheckJavadoc().run(); }
// in src/tools/org/h2/build/code/CheckJavadoc.java
private void run() throws Exception { String baseDir = "src"; check(new File(baseDir)); if (errorCount > 0) { throw new Exception(errorCount + " errors found"); } }
// in src/tools/org/h2/build/code/CheckJavadoc.java
private int check(File file) throws Exception { String name = file.getName(); if (file.isDirectory()) { if (name.equals("CVS") || name.equals(".svn")) { return 0; } boolean foundPackageHtml = false, foundJava = false; for (File f : file.listFiles()) { int type = check(f); if (type == 1) { foundJava = true; } else if (type == 2) { foundPackageHtml = true; } } if (foundJava && !foundPackageHtml) { System.out.println("No package.html file, but a Java file found at: " + file.getAbsolutePath()); errorCount++; } } else { if (name.endsWith(".java")) { checkJavadoc(file); return 1; } else if (name.equals("package.html")) { return 2; } } return 0; }
// in src/tools/org/h2/jcr/Railroads.java
public static void main(String... args) throws Exception { new Railroads().process(); }
// in src/tools/org/h2/jcr/Railroads.java
private void process() throws Exception { RailroadImages.main(); bnf = Bnf.getInstance(getReader()); Csv csv = new Csv(); csv.setLineCommentCharacter('#'); ResultSet rs = csv.read(getReader(), null); map("grammar", rs, true); processHtml("jcr-sql2.html"); }
// in src/tools/org/h2/jcr/Railroads.java
private void processHtml(String fileName) throws Exception { String source = "src/tools/org/h2/jcr/"; String target = "docs/html/"; byte[] s = BuildBase.readFile(new File(source + "stylesheet.css")); BuildBase.writeFile(new File(target + "stylesheet.css"), s); String inFile = source + fileName; String outFile = target + fileName; new File(outFile).getParentFile().mkdirs(); FileOutputStream out = new FileOutputStream(outFile); FileInputStream in = new FileInputStream(inFile); byte[] bytes = IOUtils.readBytesAndClose(in, 0); if (fileName.endsWith(".html")) { String page = new String(bytes); page = PageParser.parse(page, session); bytes = page.getBytes(); } out.write(bytes); out.close(); }
// in src/tools/org/h2/jcr/Railroads.java
private void map(String key, ResultSet rs, boolean railroads) throws Exception { ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); while (rs.next()) { HashMap<String, String> map = new HashMap<String, String>(); ResultSetMetaData meta = rs.getMetaData(); for (int i = 0; i < meta.getColumnCount(); i++) { String k = StringUtils.toLowerEnglish(meta.getColumnLabel(i + 1)); String value = rs.getString(i + 1); value = value.trim(); map.put(k, PageParser.escapeHtml(value)); } String topic = rs.getString("TOPIC"); String syntax = rs.getString("SYNTAX").trim(); if (railroads) { BnfRailroad r = new BnfRailroad(); String railroad = r.getHtml(bnf, syntax); map.put("railroad", railroad); } BnfSyntax visitor = new BnfSyntax(); String syntaxHtml = visitor.getHtml(bnf, syntax); map.put("syntax", syntaxHtml); // remove newlines in the regular text String text = map.get("text"); if (text != null) { // text is enclosed in <p> .. </p> so this works. text = StringUtils.replaceAll(text, "<br /><br />", "</p><p>"); text = StringUtils.replaceAll(text, "<br />", " "); map.put("text", text); } String link = topic.toLowerCase(); link = StringUtils.replaceAll(link, " ", "_"); // link = StringUtils.replaceAll(link, "_", ""); link = StringUtils.replaceAll(link, "@", "_"); map.put("link", StringUtils.urlEncode(link)); list.add(map); } session.put(key, list); int div = 3; int part = (list.size() + div - 1) / div; for (int i = 0, start = 0; i < div; i++, start += part) { List<HashMap<String, String>> listThird = list.subList(start, Math.min(start + part, list.size())); session.put(key + "-" + i, listThird); } rs.close(); }
595
            
// in src/main/org/h2/message/TraceSystem.java
catch (Exception e) { logWritingError(e); }
// in src/main/org/h2/message/TraceSystem.java
catch (Exception e) { logWritingError(e); return false; }
// in src/main/org/h2/message/TraceObject.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/tools/ChangeFileEncryption.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/ChangeFileEncryption.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/CompressTool.java
catch (Exception e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
// in src/main/org/h2/tools/CompressTool.java
catch (Exception e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
// in src/main/org/h2/tools/Backup.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Backup.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Csv.java
catch (Exception e) { close(); throw DbException.convertToIOException(e); }
// in src/main/org/h2/tools/Recover.java
catch (Exception e) { traceError(n, e); }
// in src/main/org/h2/tools/Recover.java
catch (Exception e) { writeError(writer, e); }
// in src/main/org/h2/tools/Recover.java
catch (Exception e) { writeError(writer, e); }
// in src/main/org/h2/tools/Recover.java
catch (Exception e) { writeDataError(writer, "exception " + e, s.getBytes()); continue; }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { result = DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { out.println(e.getMessage()); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { // ignore }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { // ignore and try the next }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw new Exception("Failed to start a browser to open the URL " + url + ": " + e.getMessage()); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { // ignore }
// in src/main/org/h2/tools/RunScript.java
catch (Exception e) { if (continueOnError) { e.printStackTrace(out); } else { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/Console.java
catch (Exception e) { e.printStackTrace(); }
// in src/main/org/h2/tools/Console.java
catch (Exception e) { // ignore }
// in src/main/org/h2/tools/Console.java
catch (Exception e) { return false; }
// in src/main/org/h2/tools/Console.java
catch (Exception e) { out.println(e.getMessage()); }
// in src/main/org/h2/tools/Shell.java
catch (Exception e) { println("Exception: " + e.toString()); e.printStackTrace(err); break; }
// in src/main/org/h2/tools/Shell.java
catch (Exception e) { // ignore, use the default solution }
// in src/main/org/h2/value/ValueTime.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "TIME", s); }
// in src/main/org/h2/value/ValueDate.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "DATE", s); }
// in src/main/org/h2/value/CompareMode.java
catch (Exception e) { // ignore }
// in src/main/org/h2/value/CompareModeIcu4J.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/value/ValueTimestamp.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "TIMESTAMP", s); }
// in src/main/org/h2/upgrade/DbUpgrade.java
catch (Exception e) { if (FileUtils.exists(backupData)) { FileUtils.moveTo(backupData, data); } if (FileUtils.exists(backupIndex)) { FileUtils.moveTo(backupIndex, index); } if (FileUtils.exists(backupLobs)) { FileUtils.moveTo(backupLobs, lobs); } FileUtils.delete(name + ".h2.db"); throw DbException.toSQLException(e); }
// in src/main/org/h2/schema/Schema.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Exception e) { if (onRollback) { // ignore } else { throw DbException.convert(e); } }
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { // failed int errorCode = 0; if (e instanceof SQLException) { errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } e.printStackTrace(System.out); }
// in src/main/org/h2/store/RecoverTester.java
catch (Exception e) { int errorCode = 0; if (e instanceof DbException) { e = ((DbException) e).getSQLException(); errorCode = ((SQLException) e).getErrorCode(); } if (errorCode == ErrorCode.WRONG_USER_OR_PASSWORD) { return; } else if (errorCode == ErrorCode.FILE_ENCRYPTION_ERROR_1) { return; } StringBuilder buff = new StringBuilder(); StackTraceElement[] list = e.getStackTrace(); for (int i = 0; i < 10 && i < list.length; i++) { buff.append(list[i].toString()).append('\n'); } String s = buff.toString(); if (!knownErrors.contains(s)) { out.println(writeCount + " code: " + errorCode + " " + e.toString()); e.printStackTrace(System.out); knownErrors.add(s); } else { out.println(writeCount + " code: " + errorCode); } }
// in src/main/org/h2/store/fs/FilePath.java
catch (Exception e) { // ignore - the files may be excluded in purpose }
// in src/main/org/h2/store/fs/FilePathWrapper.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (Exception e) { // workaround for GAE which throws a // java.security.AccessControlException return false; }
// in src/main/org/h2/store/fs/FileUtils.java
catch (Exception e) { return false; }
// in src/main/org/h2/store/WriterThread.java
catch (Exception e) { TraceSystem traceSystem = database.getTraceSystem(); if (traceSystem != null) { traceSystem.getTrace(Trace.DATABASE).error(e, "flush"); } }
// in src/main/org/h2/store/FileStore.java
catch (Exception e) { // ignore }
// in src/main/org/h2/store/FileStore.java
catch (Exception e) { // ignore OverlappingFileLockException return false; }
// in src/main/org/h2/store/FileStore.java
catch (Exception e) { // ignore }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "unlock"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "unlock"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "sleep"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "sleep"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "lock"); serverSocket = null; lockFile(); return; }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "watchdog"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "watchdog"); }
// in src/main/org/h2/store/FileLock.java
catch (Exception e) { trace.debug(e, "watchdog"); }
// in src/main/org/h2/index/RangeIndex.java
catch (Exception e) { // error when converting the value - ignore }
// in src/main/org/h2/index/RangeIndex.java
catch (Exception e) { // error when converting the value - ignore }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/compress/CompressDeflate.java
catch (Exception e) { throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_OPTIONS_1, options); }
// in src/main/org/h2/Driver.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { trace.error(e, "closing session"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { // this method doesn't throw an exception, but it logs it logAndConvert(e); return false; }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/engine/UserAggregate.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Exception e) { trace.error(e, "pending {0}", pending); return false; }
// in src/main/org/h2/engine/Database.java
catch (Exception e) { // ignore (the trace is closed already) }
// in src/main/org/h2/engine/Database.java
catch (Exception e2) { // ignore this (user made) exception }
// in src/main/org/h2/engine/Database.java
catch (Exception e2) { // ignore this (user made) exception }
// in src/main/org/h2/engine/Database.java
catch (Exception e) { // DbException, InterruptedException trace.error(e, "readOnly {0}", readOnly); // ignore }
// in src/main/org/h2/engine/Database.java
catch (Exception e) { // ignore InterruptedException }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (Exception e) { // ignore InterruptedException }
// in src/main/org/h2/engine/Engine.java
catch (Exception e) { database.removeSession(session); throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX"); }
// in src/main/org/h2/engine/Engine.java
catch (Exception e) { throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX"); }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception re) { DbException e = DbException.convert(re); if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (autoServerMode) { String serverKey = ((JdbcSQLException) e.getSQLException()).getSQL(); if (serverKey != null) { backup.setServerKey(serverKey); // OPEN_NEW must be removed now, otherwise // opening a session with AUTO_SERVER fails // if another connection is already open backup.removeProperty("OPEN_NEW", null); connectServer(backup); return this; } } } throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE) { throw e; } // exclusive mode: re-try endlessly try { Thread.sleep(500); } catch (Exception e2) { // ignore } }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception e2) { // ignore }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Session.java
catch (Exception e) { // ignore InterruptedException }
// in src/main/org/h2/engine/Session.java
catch (Exception e) { // ignore break; }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { throw DbException.get(ErrorCode.SYNTAX_ERROR_1, e, source); }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { return false; }
// in src/main/org/h2/util/SortedProperties.java
catch (Exception e) { TraceSystem.traceThrowable(e); return def; }
// in src/main/org/h2/util/SortedProperties.java
catch (Exception e) { TraceSystem.traceThrowable(e); return def; }
// in src/main/org/h2/util/SortedProperties.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { clazz = null; }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/NetUtils.java
catch (Exception e) { // try again return createServerSocketTry(port, ssl); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // ignore }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // ignore }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // ignore }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // ignore }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { try { return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); } }
// in src/main/org/h2/util/Utils.java
catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); }
// in src/main/org/h2/util/TempFileDeleter.java
catch (Exception e) { // TODO log such errors? }
// in src/main/org/h2/util/Task.java
catch (Exception e) { this.ex = e; }
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { // NoSuchAlgorithmException warn("SecureRandom", e); }
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { // NoSuchAlgorithmException warn("SecureRandom", e); cachedSecureRandom = new SecureRandom(); }
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { // nanoTime not found, this is ok (only exists for JDK 1.5 and higher) out.writeUTF(e.toString()); }
// in src/main/org/h2/util/MathUtils.java
catch (Exception e) { warn("generateAlternativeSeed", e); }
// in src/main/org/h2/util/JdbcUtils.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/util/DateTimeUtils.java
catch (Exception e) { // ParseException throw DbException.get(ErrorCode.PARSE_ERROR_1, e, date); }
// in src/main/org/h2/util/DateTimeUtils.java
catch (Exception e) { throw DbException.get(ErrorCode.PARSE_ERROR_1, e, format + "/" + locale + "/" + timeZone); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/Profiler.java
catch (Exception e) { // ignore }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { if (!stop) { TraceSystem.traceThrowable(e); } }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { if (traceError) { traceError(e); } return false; }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { // try to connect - so that accept returns }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/server/pg/PgServer.java
catch (Exception e) { if (!stop) { e.printStackTrace(); } }
// in src/main/org/h2/server/pg/PgServer.java
catch (Exception e) { // TODO log exception e.printStackTrace(); }
// in src/main/org/h2/server/pg/PgServer.java
catch (Exception e) { if (traceError) { traceError(e); } return false; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { e.printStackTrace(); stop = true; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); break switchBlock; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); break; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { server.traceError(e); s = null; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { sendErrorResponse(e); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Exception e2) { if (!transfer.isClosed()) { server.traceError(e2); } // if writing the error does not work, close the connection stop = true; }
// in src/main/org/h2/server/web/DbStarter.java
catch (Exception e) { e.printStackTrace(); }
// in src/main/org/h2/server/web/DbStarter.java
catch (Exception e) { e.printStackTrace(); }
// in src/main/org/h2/server/web/DbStarter.java
catch (Exception e) { e.printStackTrace(); }
// in src/main/org/h2/server/web/WebThread.java
catch (Exception e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { trace(e.toString()); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("toolResult", getStackTrace(0, e, true)); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { server.traceError(e); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("tree", ""); session.put("error", getStackTrace(0, e, isH2)); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("error", getLoginError(e, isH2)); return "login.jsp"; }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { session.put("error", getLoginError(e, isH2)); return "login.jsp"; }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { trace(e.toString()); }
// in src/main/org/h2/server/web/WebApp.java
catch (Exception e) { rs.addRow("meta." + m.getName(), e.toString()); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { trace(e.toString()); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { if (traceError) { traceError(e); } return false; }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { traceError(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { TraceSystem.traceThrowable(e); return new Properties(); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (Exception e) { traceError(e); }
// in src/main/org/h2/server/web/WebSession.java
catch (Exception e) { // ok we don't have the bnf server.traceError(e); }
// in src/main/org/h2/server/web/WebSession.java
catch (Exception e) { // ignore }
// in src/main/org/h2/server/web/WebSession.java
catch (Exception e) { // ignore }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { // could be SQLException or RuntimeException conn.close(true); conn = null; throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, e, originalTable + "(" + e.toString() + ")"); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { // Some ODBC bridge drivers don't support it: // some combinations of "DataDirect SequeLink(R) for JDBC" // http://www.datadirect.com/index.ssp rs = null; }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { // Oracle throws an exception if the table is not found or is a // SYNONYM rs = null; }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { throw wrapException(sql, e); }
// in src/main/org/h2/table/MetaTable.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (Exception e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (Exception e) { throw convertException(e); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (Exception e) { server.traceError(e); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (Exception e) { server.traceError(e); reply(426, "Failed"); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (Exception e) { server.traceError(e); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
catch (Exception e) { traceError(e); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
catch (Exception e) { // ignore }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (Exception e) { throw DbException.convert(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (Exception e) { error(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (Exception e) { error(e); break; }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { file = null; throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { file = null; throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/doc/UploadBuild.java
catch (Exception e) { Class.forName("org.h2.upgrade.v1_1.Driver"); conn = DriverManager.getConnection("jdbc:h2v1_1:mem:"); }
// in src/tools/org/h2/build/doc/LinkChecker.java
catch (Exception e) { // ignore }
// in src/tools/org/h2/build/doc/XMLChecker.java
catch (Exception e) { last = e; System.out.println("ERROR in file " + fileName + " " + e.toString()); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { sysOut.println("Unknown target: " + target); projectHelp(); return false; }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { System.out.println(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read field " + className + "." + fieldName, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read value " + className + "." + methodName + "()", e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { result = exec("javadoc", args(args)); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { e.printStackTrace(); result = exec("javac", new StringList(array)); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/Build.java
catch (Exception e) { print("NSIS is not available: " + e); }
// in src/tools/org/h2/build/Build.java
catch (Exception e) { e.printStackTrace(); serverSocket = new ServerSocket(0); }
// in src/tools/org/h2/build/Build.java
catch (Exception e) { e.printStackTrace(); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { if (MAKE_ACCESSIBLE) { Constructor[] constructors = clazz.getDeclaredConstructors(); // try 0 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 0) { c.setAccessible(true); try { return clazz.newInstance(); } catch (Exception e2) { // ignore } } } // try 1 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 1) { c.setAccessible(true); try { return (T) c.newInstance(new Object[1]); } catch (Exception e2) { // ignore } } } } throw new RuntimeException("Exception trying to create " + clazz.getName() + ": " + e, e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e2) { // ignore }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e2) { // ignore }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { throw new RuntimeException("Error converting CLOB to String: " + e.toString(), e); }
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { throw new RuntimeException(source.substring(0, current.index) + "[*]" + source.substring(current.index), e); }
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { current = back; forStat.init = readStatement(); forStat.condition = readExpr(); read(";"); do { forStat.updates.add(readExpr()); } while (readIf(",")); }
461
            
// in src/main/org/h2/message/TraceObject.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/tools/ChangeFileEncryption.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/ChangeFileEncryption.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/CompressTool.java
catch (Exception e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
// in src/main/org/h2/tools/CompressTool.java
catch (Exception e) { throw DbException.get(ErrorCode.COMPRESSION_ERROR, e); }
// in src/main/org/h2/tools/Backup.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Backup.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Csv.java
catch (Exception e) { close(); throw DbException.convertToIOException(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/tools/Server.java
catch (Exception e) { throw new Exception("Failed to start a browser to open the URL " + url + ": " + e.getMessage()); }
// in src/main/org/h2/tools/RunScript.java
catch (Exception e) { if (continueOnError) { e.printStackTrace(out); } else { throw DbException.toSQLException(e); } }
// in src/main/org/h2/value/ValueTime.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "TIME", s); }
// in src/main/org/h2/value/ValueDate.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "DATE", s); }
// in src/main/org/h2/value/CompareModeIcu4J.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/value/ValueTimestamp.java
catch (Exception e) { throw DbException.get(ErrorCode.INVALID_DATETIME_CONSTANT_2, e, "TIMESTAMP", s); }
// in src/main/org/h2/upgrade/DbUpgrade.java
catch (Exception e) { if (FileUtils.exists(backupData)) { FileUtils.moveTo(backupData, data); } if (FileUtils.exists(backupIndex)) { FileUtils.moveTo(backupIndex, index); } if (FileUtils.exists(backupLobs)) { FileUtils.moveTo(backupLobs, lobs); } FileUtils.delete(name + ".h2.db"); throw DbException.toSQLException(e); }
// in src/main/org/h2/schema/Schema.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Exception e) { if (onRollback) { // ignore } else { throw DbException.convert(e); } }
// in src/main/org/h2/store/fs/FilePathWrapper.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/index/LinkedIndex.java
catch (Exception e) { throw TableLink.wrapException(sql, e); }
// in src/main/org/h2/compress/CompressDeflate.java
catch (Exception e) { throw DbException.get(ErrorCode.UNSUPPORTED_COMPRESSION_OPTIONS_1, options); }
// in src/main/org/h2/Driver.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcClob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcArray.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcBlob.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/jdbc/JdbcStatement.java
catch (Exception e) { throw logAndConvert(e); }
// in src/main/org/h2/engine/UserAggregate.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Engine.java
catch (Exception e) { database.removeSession(session); throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX"); }
// in src/main/org/h2/engine/Engine.java
catch (Exception e) { throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, e, "JMX"); }
// in src/main/org/h2/engine/SessionRemote.java
catch (Exception re) { DbException e = DbException.convert(re); if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (autoServerMode) { String serverKey = ((JdbcSQLException) e.getSQLException()).getSQL(); if (serverKey != null) { backup.setServerKey(serverKey); // OPEN_NEW must be removed now, otherwise // opening a session with AUTO_SERVER fails // if another connection is already open backup.removeProperty("OPEN_NEW", null); connectServer(backup); return this; } } } throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE) { throw e; } // exclusive mode: re-try endlessly try { Thread.sleep(500); } catch (Exception e2) { // ignore } }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { throw DbException.get(ErrorCode.SYNTAX_ERROR_1, e, source); }
// in src/main/org/h2/engine/FunctionAlias.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SortedProperties.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/SourceCompiler.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/IOUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/Utils.java
catch (ClassNotFoundException e) { try { return Class.forName(className, true, Thread.currentThread().getContextClassLoader()); } catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); } }
// in src/main/org/h2/util/Utils.java
catch (Exception e2) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); }
// in src/main/org/h2/util/JdbcUtils.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/util/DateTimeUtils.java
catch (Exception e) { // ParseException throw DbException.get(ErrorCode.PARSE_ERROR_1, e, date); }
// in src/main/org/h2/util/DateTimeUtils.java
catch (Exception e) { throw DbException.get(ErrorCode.PARSE_ERROR_1, e, format + "/" + locale + "/" + timeZone); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/util/StringUtils.java
catch (Exception e) { // UnsupportedEncodingException throw DbException.convert(e); }
// in src/main/org/h2/server/TcpServer.java
catch (Exception e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { // could be SQLException or RuntimeException conn.close(true); conn = null; throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, e, originalTable + "(" + e.toString() + ")"); }
// in src/main/org/h2/table/TableLink.java
catch (Exception e) { throw wrapException(sql, e); }
// in src/main/org/h2/table/MetaTable.java
catch (Exception e) { throw DbException.convert(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/security/CipherFactory.java
catch (Exception e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (Exception e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (Exception e) { throw convertException(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (Exception e) { throw DbException.convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { file = null; throw convert(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { file = null; throw convert(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read field " + className + "." + fieldName, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read value " + className + "." + methodName + "()", e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { if (MAKE_ACCESSIBLE) { Constructor[] constructors = clazz.getDeclaredConstructors(); // try 0 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 0) { c.setAccessible(true); try { return clazz.newInstance(); } catch (Exception e2) { // ignore } } } // try 1 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 1) { c.setAccessible(true); try { return (T) c.newInstance(new Object[1]); } catch (Exception e2) { // ignore } } } } throw new RuntimeException("Exception trying to create " + clazz.getName() + ": " + e, e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { throw new RuntimeException("Error converting CLOB to String: " + e.toString(), e); }
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { throw new RuntimeException(source.substring(0, current.index) + "[*]" + source.substring(current.index), e); }
24
unknown (Domain) FastEOFException
static class FastEOFException extends EOFException {

        private static final long serialVersionUID = 1L;

        public synchronized Throwable fillInStackTrace() {
            return null;
        }

    }
2
            
// in src/main/org/h2/store/DataReader.java
public byte readByte() throws IOException { int x = in.read(); if (x < 0) { throw new FastEOFException(); } return (byte) x; }
// in src/main/org/h2/store/DataReader.java
public void readFully(byte[] buff, int offset, int len) throws IOException { int got = IOUtils.readFully(in, buff, offset, len); if (got < len) { throw new FastEOFException(); } }
0 0 0 0 0
unknown (Lib) FileNotFoundException 4
            
// in src/main/org/h2/store/fs/FilePathZip.java
public FileChannel open(String mode) throws IOException { ZipFile file = openZipFile(); ZipEntry entry = file.getEntry(getEntryName()); if (entry == null) { throw new FileNotFoundException(name); } return new FileZip(file, entry); }
// in src/main/org/h2/store/fs/FilePathDisk.java
public InputStream newInputStream() throws IOException { if (name.indexOf(':') > 1) { // if the : is in position 1, a windows file access is assumed: C:.. or D: if (name.startsWith(CLASSPATH_PREFIX)) { String fileName = name.substring(CLASSPATH_PREFIX.length()); if (!fileName.startsWith("/")) { fileName = "/" + fileName; } InputStream in = getClass().getResourceAsStream(fileName); if (in == null) { in = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); } if (in == null) { throw new FileNotFoundException("resource " + fileName); } return in; } // otherwise an URL is assumed URL url = new URL(name); InputStream in = url.openStream(); return in; } FileInputStream in = new FileInputStream(name); IOUtils.trace("openFileInputStream", name, in); return in; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public FileChannel open(String mode) throws IOException { String entryName = getEntryName(); if (entryName.length() == 0) { throw new FileNotFoundException(); } ZipInputStream in = openZip(); while (true) { ZipEntry entry = in.getNextEntry(); if (entry == null) { break; } if (entry.getName().equals(entryName)) { return new FileZip2(name, entryName, in, size()); } in.closeEntry(); } in.close(); throw new FileNotFoundException(name); }
0 1 3
            
// in src/main/org/h2/tools/Backup.java
catch (FileNotFoundException e) { // the file could have been deleted in the meantime // ignore this (in this case an empty file is created) }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (FileNotFoundException e) { return false; }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (FileNotFoundException e) { // the file could have been deleted in the meantime // ignore this (in this case an empty file is created) }
0 0
checked (Domain) H2AbortException
public class H2AbortException extends H2Exception {

    private static final long serialVersionUID = 1L;

    H2AbortException() {
        super();
    }

    H2AbortException(String error) {
        super(error);
    }
}
0 0 0 0 0 0
checked (Domain) H2ConstraintException
public class H2ConstraintException extends H2Exception {

    private static final long serialVersionUID = 1L;

    H2ConstraintException() {
        super();
    }

    H2ConstraintException(String error) {
        super(error);
    }
}
0 0 0 0 0 0
checked (Domain) H2DatabaseCorruptException
public class H2DatabaseCorruptException extends H2Exception {
    private static final long serialVersionUID = 1L;

    H2DatabaseCorruptException() {
        super();
    }

    H2DatabaseCorruptException(String error) {
        super(error);
    }
}
0 0 0 0 0 0
checked (Domain) H2DiskIOException
public class H2DiskIOException extends H2Exception {
    private static final long serialVersionUID = 1L;

    H2DiskIOException() {
        super();
    }

    H2DiskIOException(String error) {
        super(error);
    }
}
0 0 0 0 0 0
checked (Domain) H2DoneException
public class H2DoneException extends H2Exception {
    private static final long serialVersionUID = 1L;

    H2DoneException() {
        super();
    }

    H2DoneException(String error) {
        super(error);
    }
}
0 0 0 0 0 0
checked (Domain) H2Exception
public class H2Exception extends SQLException {
    private static final long serialVersionUID = 1L;

    public H2Exception() {
        super();
    }

    public H2Exception(String error) {
        super(error);
    }
}
0 0 0 0 0 0
checked (Domain) H2FullException
public class H2FullException extends H2Exception {
    private static final long serialVersionUID = 1L;

    H2FullException() {
        super();
    }

    H2FullException(String error) {
        super(error);
    }
}
0 0 0 0 0 0
checked (Domain) H2MisuseException
public class H2MisuseException extends H2Exception {
    private static final long serialVersionUID = 1L;

    H2MisuseException() {
        super();
    }

    H2MisuseException(String error) {
        super(error);
    }
}
0 0 0 0 0 0
checked (Lib) IOException 31
            
// in src/main/org/h2/tools/Restore.java
private static String getOriginalDbName(String fileName, String db) throws IOException { InputStream in = null; try { in = FileUtils.newInputStream(fileName); ZipInputStream zipIn = new ZipInputStream(in); String originalDbName = null; boolean multiple = false; while (true) { ZipEntry entry = zipIn.getNextEntry(); if (entry == null) { break; } String entryName = entry.getName(); zipIn.closeEntry(); String name = getDatabaseNameFromFileName(entryName); if (name != null) { if (db.equals(name)) { originalDbName = name; // we found the correct database break; } else if (originalDbName == null) { originalDbName = name; // we found a database, but maybe another one } else { // we have found multiple databases, but not the correct // one multiple = true; } } } zipIn.close(); if (multiple && !db.equals(originalDbName)) { throw new IOException("Multiple databases found, but not " + db); } return originalDbName; } finally { IOUtils.closeSilently(in); } }
// in src/main/org/h2/tools/Restore.java
public static void execute(String zipFileName, String directory, String db, boolean quiet) { InputStream in = null; try { if (!FileUtils.exists(zipFileName)) { throw new IOException("File not found: " + zipFileName); } String originalDbName = null; int originalDbLen = 0; if (db != null) { originalDbName = getOriginalDbName(zipFileName, db); if (originalDbName == null) { throw new IOException("No database named " + db + " found"); } if (originalDbName.startsWith(SysProperties.FILE_SEPARATOR)) { originalDbName = originalDbName.substring(1); } originalDbLen = originalDbName.length(); } in = FileUtils.newInputStream(zipFileName); ZipInputStream zipIn = new ZipInputStream(in); while (true) { ZipEntry entry = zipIn.getNextEntry(); if (entry == null) { break; } String fileName = entry.getName(); // restoring windows backups on linux and vice versa fileName = fileName.replace('\\', SysProperties.FILE_SEPARATOR.charAt(0)); fileName = fileName.replace('/', SysProperties.FILE_SEPARATOR.charAt(0)); if (fileName.startsWith(SysProperties.FILE_SEPARATOR)) { fileName = fileName.substring(1); } boolean copy = false; if (db == null) { copy = true; } else if (fileName.startsWith(originalDbName + ".")) { fileName = db + fileName.substring(originalDbLen); copy = true; } if (copy) { OutputStream o = null; try { o = FileUtils.newOutputStream(directory + SysProperties.FILE_SEPARATOR + fileName, false); IOUtils.copy(zipIn, o); o.close(); } finally { IOUtils.closeSilently(o); } } zipIn.closeEntry(); } zipIn.closeEntry(); zipIn.close(); } catch (IOException e) { throw DbException.convertIOException(e, zipFileName); } finally { IOUtils.closeSilently(in); } }
// in src/main/org/h2/tools/Shell.java
private String readLine() throws IOException { String line = reader.readLine(); if (line == null) { throw new IOException("Aborted"); } return line; }
// in src/main/org/h2/store/fs/FilePathNio.java
public FileChannel truncate(long newLength) throws IOException { try { channel.truncate(newLength); if (channel.position() > newLength) { // looks like a bug in this FileChannel implementation, as the // documentation says the position needs to be changed channel.position(newLength); } return this; } catch (NonWritableChannelException e) { throw new IOException("read only"); } }
// in src/main/org/h2/store/fs/FilePathNio.java
public int write(ByteBuffer src) throws IOException { try { return channel.write(src); } catch (NonWritableChannelException e) { throw new IOException("read only"); } }
// in src/main/org/h2/store/fs/FilePathMem.java
void touch(boolean openReadOnly) throws IOException { if (isReadOnly || openReadOnly) { throw new IOException("Read only"); } lastModified = System.currentTimeMillis(); }
// in src/main/org/h2/store/fs/FilePathSplit.java
private void closeAndThrow(int id, FileChannel[] array, FileChannel o, long maxLength) throws IOException { String message = "Expected file length: " + maxLength + " got: " + o.size() + " for " + getName(id); for (FileChannel f : array) { f.close(); } throw new IOException(message); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
private void unMap() throws IOException { if (mapped == null) { return; } // first write all data mapped.force(); // need to dispose old direct buffer, see bug // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038 boolean useSystemGc = true; if (SysProperties.NIO_CLEANER_HACK) { try { Method cleanerMethod = mapped.getClass().getMethod("cleaner"); cleanerMethod.setAccessible(true); Object cleaner = cleanerMethod.invoke(mapped); if (cleaner != null) { Method clearMethod = cleaner.getClass().getMethod("clean"); clearMethod.invoke(cleaner); } useSystemGc = false; } catch (Throwable e) { // useSystemGc is already true } finally { mapped = null; } } if (useSystemGc) { WeakReference<MappedByteBuffer> bufferWeakRef = new WeakReference<MappedByteBuffer>(mapped); mapped = null; long start = System.currentTimeMillis(); while (bufferWeakRef.get() != null) { if (System.currentTimeMillis() - start > GC_TIMEOUT_MS) { throw new IOException("Timeout (" + GC_TIMEOUT_MS + " ms) reached while trying to GC mapped buffer"); } System.gc(); Thread.yield(); } } }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
private void reMap() throws IOException { int oldPos = 0; if (mapped != null) { oldPos = pos; unMap(); } fileLength = file.length(); checkFileSizeLimit(fileLength); // maps new MappedByteBuffer; the old one is disposed during GC mapped = file.getChannel().map(mode, 0, fileLength); int limit = mapped.limit(); int capacity = mapped.capacity(); if (limit < fileLength || capacity < fileLength) { throw new IOException("Unable to map: length=" + limit + " capacity=" + capacity + " length=" + fileLength); } if (SysProperties.NIO_LOAD_MAPPED) { mapped.load(); } this.pos = Math.min(oldPos, (int) fileLength); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
private static void checkFileSizeLimit(long length) throws IOException { if (length > Integer.MAX_VALUE) { throw new IOException("File over 2GB is not supported yet when using this file system"); } }
// in src/main/org/h2/store/fs/FilePathZip.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { if (!inTempDir) { throw new IOException("File system is read-only"); } return new FilePathDisk().getPath(name).createTempFile(suffix, deleteOnExit, true); }
// in src/main/org/h2/store/fs/FilePathZip.java
public FileChannel truncate(long newLength) throws IOException { throw new IOException("File is read-only"); }
// in src/main/org/h2/store/fs/FilePathZip.java
public int write(ByteBuffer src) throws IOException { throw new IOException("File is read-only"); }
// in src/main/org/h2/server/web/WebThread.java
private String readHeaderLine() throws IOException { StringBuilder buff = new StringBuilder(); while (true) { headerBytes++; int c = input.read(); if (c == -1) { throw new IOException("Unexpected EOF"); } else if (c == '\r') { headerBytes++; if (input.read() == '\n') { return buff.length() > 0 ? buff.toString() : null; } } else if (c == '\n') { return buff.length() > 0 ? buff.toString() : null; } else { buff.append((char) c); } } }
// in src/tools/org/h2/dev/ftp/FtpClient.java
private void readCode(int optional, int expected) throws IOException { readLine(); if (code == optional) { readLine(); } if (code != expected) { throw new IOException("Expected: " + expected + " got: " + code + " " + message); } }
// in src/tools/org/h2/dev/fs/FileShell.java
private void end(String[] list, int index) throws IOException { if (list.length != index) { throw new IOException("End of command expected, got: " + list[index]); } }
// in src/tools/org/h2/dev/fs/FileShell.java
private int readFileList(String[] list, int i, ArrayList<String> target, boolean recursive) throws IOException { while (i < list.length) { String c = list[i++]; if (";".equals(c)) { break; } c = getFile(c); if (!FileUtils.exists(c)) { throw new IOException("File not found: " + c); } if (recursive) { addFilesRecursive(c, target); } else { target.add(c); } } return i; }
// in src/tools/org/h2/dev/fs/FileShell.java
private String readLine() throws IOException { String line = reader.readLine(); if (line == null) { throw new IOException("Aborted"); } return line; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { if (!inTempDir) { throw new IOException("File system is read-only"); } return new FilePathDisk().getPath(name).createTempFile(suffix, deleteOnExit, true); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public FileChannel truncate(long newLength) throws IOException { throw new IOException("File is read-only"); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public int write(ByteBuffer src) throws IOException { throw new IOException("File is read-only"); }
// in src/tools/org/h2/build/doc/SpellChecker.java
private void run(String dictionaryFileName, String dir) throws IOException { process(new File(dictionaryFileName)); process(new File(dir)); if (printDictionary) { System.out.println("USED WORDS"); String[] list = new String[used.size()]; used.toArray(list); Arrays.sort(list); StringBuilder buff = new StringBuilder(); for (String s : list) { if (buff.length() > 0) { if (buff.length() + s.length() > 80) { System.out.println(buff.toString()); buff.setLength(0); } else { buff.append(' '); } } buff.append(s); } System.out.println(buff.toString()); } if (unknown.size() > 0) { System.out.println(); System.out.println("UNKNOWN WORDS"); for (String s : unknown.keySet()) { // int count = unknown.get(s); System.out.print(s + " "); errorCount++; } System.out.println(); System.out.println(); } if (errorCount > 0) { throw new IOException(errorCount + " error found"); } }
// in src/tools/org/h2/build/doc/SpellChecker.java
private void process(File file) throws IOException { String name = file.getName(); if (name.endsWith(".svn") || name.endsWith(".DS_Store")) { return; } if (name.startsWith("_") && name.indexOf("_en") < 0) { return; } if (file.isDirectory()) { for (File f : file.listFiles()) { process(f); } } else { String fileName = file.getAbsolutePath(); int idx = fileName.lastIndexOf('.'); String suffix; if (idx < 0) { suffix = ""; } else { suffix = fileName.substring(idx + 1); } for (String s : IGNORE) { if (s.equals(suffix)) { return; } } for (String ignoreFile : IGNORE_FILES) { if (fileName.endsWith(ignoreFile)) { return; } } boolean ok = false; for (String s : SUFFIX) { if (s.equals(suffix)) { ok = true; break; } } if (!ok) { throw new IOException("Unsupported suffix: " + suffix + " for file: " + fileName); } String text = new String(BuildBase.readFile(file)); if (fileName.endsWith("dictionary.txt")) { addToDictionary = true; } else { addToDictionary = false; } scan(fileName, text); } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static void buildHtml(String templateDir, String targetDir, String language) throws IOException { File[] list = new File(templateDir).listFiles(); new File(targetDir).mkdirs(); // load the main 'translation' String propName = templateDir + "/_docs_" + MAIN_LANGUAGE + ".properties"; Properties prop = load(propName, false); propName = templateDir + "/_docs_" + language + ".properties"; if (!(new File(propName)).exists()) { throw new IOException("Translation not found: " + propName); } Properties transProp = load(propName, false); for (Object k : transProp.keySet()) { String key = (String) k; String t = transProp.getProperty(key); // overload with translations, but not the ones starting with # if (t.startsWith("##")) { prop.put(key, t.substring(2)); } else if (!t.startsWith("#")) { prop.put(key, t); } } ArrayList <String>fileNames = new ArrayList<String>(); for (File f : list) { String name = f.getName(); if (!name.endsWith(".jsp")) { continue; } // remove '.jsp' name = name.substring(0, name.length() - 4); fileNames.add(name); } for (File f : list) { String name = f.getName(); if (!name.endsWith(".jsp")) { continue; } // remove '.jsp' name = name.substring(0, name.length() - 4); String template = IOUtils.readStringAndClose(new FileReader(templateDir + "/" + name + ".jsp"), -1); HashMap<String, Object> map = New.hashMap(); for (Object k : prop.keySet()) { map.put(k.toString(), prop.get(k)); } String html = PageParser.parse(template, map); html = StringUtils.replaceAll(html, "lang=\"" + MAIN_LANGUAGE + "\"", "lang=\"" + language + "\""); for (String n : fileNames) { if ("frame".equals(n)) { // don't translate 'frame.html' to 'frame_ja.html', // otherwise we can't switch back to English continue; } html = StringUtils.replaceAll(html, n + ".html\"", n + "_" + language + ".html\""); } html = StringUtils.replaceAll(html, "_" + MAIN_LANGUAGE + ".html\"", ".html\""); String target; if (language.equals(MAIN_LANGUAGE)) { target = targetDir + "/" + name + ".html"; } else { target = targetDir + "/" + name + "_" + language + ".html"; } OutputStream out = new FileOutputStream(target); OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8"); writer.write(html); writer.close(); } }
// in src/tools/org/h2/build/doclet/Doclet.java
private boolean startDoc(RootDoc root) throws IOException { ClassDoc[] classes = root.classes(); String[][] options = root.options(); for (String[] op : options) { if (op[0].equals("destdir")) { destDir = op[1]; } } for (ClassDoc clazz : classes) { processClass(clazz); } if (errorCount > 0) { throw new IOException("FAILED: " + errorCount + " errors found"); } return true; }
// in src/tools/org/h2/build/code/SwitchSource.java
private void processFile(File f) throws IOException { RandomAccessFile read = new RandomAccessFile(f, "r"); byte[] buffer; try { long len = read.length(); if (len >= Integer.MAX_VALUE) { throw new IOException("Files bigger than Integer.MAX_VALUE are not supported"); } buffer = new byte[(int) len]; read.readFully(buffer); } finally { read.close(); } boolean found = false; // check for ## without creating a string for (int i = 0; i < buffer.length - 1; i++) { if (buffer[i] == '#' && buffer[i + 1] == '#') { found = true; break; } } if (!found) { return; } String source = new String(buffer); String target = source; for (String x : enable) { target = replaceAll(target, "/*## " + x + " ##", "//## " + x + " ##"); } for (String x : disable) { target = replaceAll(target, "//## " + x + " ##", "/*## " + x + " ##"); } if (!source.equals(target)) { String name = f.getPath(); File fileNew = new File(name + ".new"); FileWriter write = new FileWriter(fileNew); write.write(target); write.close(); File fileBack = new File(name + ".bak"); fileBack.delete(); f.renameTo(fileBack); File fileCopy = new File(name); if (!fileNew.renameTo(fileCopy)) { throw new IOException("Could not rename " + fileNew.getAbsolutePath() + " to " + name); } if (!fileBack.delete()) { throw new IOException("Could not delete " + fileBack.getAbsolutePath()); } // System.out.println(name); } }
2
            
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
409
            
// in src/main/org/h2/jdbcx/JdbcDataSource.java
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { initFactory(); in.defaultReadObject(); }
// in src/main/org/h2/tools/Restore.java
private static String getOriginalDbName(String fileName, String db) throws IOException { InputStream in = null; try { in = FileUtils.newInputStream(fileName); ZipInputStream zipIn = new ZipInputStream(in); String originalDbName = null; boolean multiple = false; while (true) { ZipEntry entry = zipIn.getNextEntry(); if (entry == null) { break; } String entryName = entry.getName(); zipIn.closeEntry(); String name = getDatabaseNameFromFileName(entryName); if (name != null) { if (db.equals(name)) { originalDbName = name; // we found the correct database break; } else if (originalDbName == null) { originalDbName = name; // we found a database, but maybe another one } else { // we have found multiple databases, but not the correct // one multiple = true; } } } zipIn.close(); if (multiple && !db.equals(originalDbName)) { throw new IOException("Multiple databases found, but not " + db); } return originalDbName; } finally { IOUtils.closeSilently(in); } }
// in src/main/org/h2/tools/ConvertTraceFile.java
private void convertFile(String traceFileName, String javaClassName, String script) throws IOException { LineNumberReader reader = new LineNumberReader(IOUtils.getBufferedReader( FileUtils.newInputStream(traceFileName))); PrintWriter javaWriter = new PrintWriter(IOUtils.getBufferedWriter( FileUtils.newOutputStream(javaClassName + ".java", false))); PrintWriter scriptWriter = new PrintWriter(IOUtils.getBufferedWriter( FileUtils.newOutputStream(script, false))); javaWriter.println("import java.io.*;"); javaWriter.println("import java.sql.*;"); javaWriter.println("import java.math.*;"); javaWriter.println("import java.util.Calendar;"); String cn = javaClassName.replace('\\', '/'); int idx = cn.lastIndexOf('/'); if (idx > 0) { cn = cn.substring(idx + 1); } javaWriter.println("public class " + cn + " {"); javaWriter.println(" public static void main(String... args) throws Exception {"); javaWriter.println(" Class.forName(\"org.h2.Driver\");"); while (true) { String line = reader.readLine(); if (line == null) { break; } if (line.startsWith("/**/")) { line = " " + line.substring(4); javaWriter.println(line); } else if (line.startsWith("/*SQL")) { int end = line.indexOf("*/"); String sql = line.substring(end + "*/".length()); sql = StringUtils.javaDecode(sql); line = line.substring("/*SQL".length(), end); if (line.length() > 0) { String statement = sql; int count = 0; long time = 0; line = line.trim(); if (line.length() > 0) { StringTokenizer tk = new StringTokenizer(line, " :"); while (tk.hasMoreElements()) { String token = tk.nextToken(); if ("l".equals(token)) { int len = Integer.parseInt(tk.nextToken()); statement = sql.substring(0, len) + ";"; } else if ("#".equals(token)) { count = Integer.parseInt(tk.nextToken()); } else if ("t".equals(token)) { time = Long.parseLong(tk.nextToken()); } } } addToStats(statement, count, time); } scriptWriter.println(sql); } } javaWriter.println(" }"); javaWriter.println('}'); reader.close(); javaWriter.close(); if (stats.size() > 0) { scriptWriter.println("-----------------------------------------"); scriptWriter.println("-- SQL Statement Statistics"); scriptWriter.println("-- time: total time in milliseconds (accumulated)"); scriptWriter.println("-- count: how many times the statement ran"); scriptWriter.println("-- result: total update count or row count"); scriptWriter.println("-----------------------------------------"); scriptWriter.println("-- self accu time count result sql"); int accumTime = 0; ArrayList<Stat> list = New.arrayList(stats.values()); Collections.sort(list); if (timeTotal == 0) { timeTotal = 1; } for (Stat stat : list) { accumTime += stat.time; StringBuilder buff = new StringBuilder(100); buff.append("-- "). append(padNumberLeft(100 * stat.time / timeTotal, 3)). append("% "). append(padNumberLeft(100 * accumTime / timeTotal, 3)). append('%'). append(padNumberLeft(stat.time, 8)). append(padNumberLeft(stat.executeCount, 8)). append(padNumberLeft(stat.resultCount, 8)). append(' '). append(removeNewlines(stat.sql)); scriptWriter.println(buff.toString()); } } scriptWriter.close(); }
// in src/main/org/h2/tools/Csv.java
public ResultSet read(Reader reader, String[] colNames) throws IOException { init(null, null); this.input = reader; return readResultSet(colNames); }
// in src/main/org/h2/tools/Csv.java
private ResultSet readResultSet(String[] colNames) throws IOException { this.columnNames = colNames; initRead(); SimpleResultSet result = new SimpleResultSet(this); makeColumnNamesUnique(); for (String columnName : columnNames) { result.addColumn(columnName, Types.VARCHAR, Integer.MAX_VALUE, 0); } return result; }
// in src/main/org/h2/tools/Csv.java
private void initWrite() throws IOException { if (output == null) { try { OutputStream out = FileUtils.newOutputStream(fileName, false); out = new BufferedOutputStream(out, Constants.IO_BUFFER_SIZE); output = new BufferedWriter(new OutputStreamWriter(out, characterSet)); } catch (Exception e) { close(); throw DbException.convertToIOException(e); } } }
// in src/main/org/h2/tools/Csv.java
private void writeRow(String[] values) throws IOException { for (int i = 0; i < values.length; i++) { if (i > 0) { if (fieldSeparatorWrite != null) { output.write(fieldSeparatorWrite); } } String s = values[i]; if (s != null) { if (escapeCharacter != 0) { if (fieldDelimiter != 0) { output.write(fieldDelimiter); } output.write(escape(s)); if (fieldDelimiter != 0) { output.write(fieldDelimiter); } } else { output.write(s); } } else if (nullString != null && nullString.length() > 0) { output.write(nullString); } } if (rowSeparatorWrite != null) { output.write(rowSeparatorWrite); } output.write(lineSeparator); }
// in src/main/org/h2/tools/Csv.java
private void initRead() throws IOException { if (input == null) { try { InputStream in = FileUtils.newInputStream(fileName); in = new BufferedInputStream(in, Constants.IO_BUFFER_SIZE); input = new InputStreamReader(in, characterSet); } catch (IOException e) { close(); throw e; } } if (!input.markSupported()) { input = new BufferedReader(input); } input.mark(1); int bom = input.read(); if (bom != 0xfeff) { // Microsoft Excel compatibility // ignore pseudo-BOM input.reset(); } inputBuffer = new char[Constants.IO_BUFFER_SIZE * 2]; if (columnNames == null) { readHeader(); } }
// in src/main/org/h2/tools/Csv.java
private void readHeader() throws IOException { ArrayList<String> list = New.arrayList(); while (true) { String v = readValue(); if (v == null) { if (endOfLine) { if (endOfFile || list.size() > 0) { break; } } else { v = "COLUMN" + list.size(); list.add(v); } } else { if (v.length() == 0) { v = "COLUMN" + list.size(); } else if (!caseSensitiveColumnNames && isSimpleColumnName(v)) { v = v.toUpperCase(); } list.add(v); if (endOfLine) { break; } } } columnNames = new String[list.size()]; list.toArray(columnNames); }
// in src/main/org/h2/tools/Csv.java
private int readChar() throws IOException { if (inputBufferPos >= inputBufferEnd) { return readBuffer(); } return inputBuffer[inputBufferPos++]; }
// in src/main/org/h2/tools/Csv.java
private int readBuffer() throws IOException { if (endOfFile) { return -1; } int keep; if (inputBufferStart >= 0) { keep = inputBufferPos - inputBufferStart; if (keep > 0) { char[] src = inputBuffer; if (keep + Constants.IO_BUFFER_SIZE > src.length) { inputBuffer = new char[src.length * 2]; } System.arraycopy(src, inputBufferStart, inputBuffer, 0, keep); } inputBufferStart = 0; } else { keep = 0; } inputBufferPos = keep; int len = input.read(inputBuffer, keep, Constants.IO_BUFFER_SIZE); if (len == -1) { // ensure bufferPos > bufferEnd // even after pushBack inputBufferEnd = -1024; endOfFile = true; // ensure the right number of characters are read // in case the input buffer is still used inputBufferPos++; return -1; } inputBufferEnd = keep + len; return inputBuffer[inputBufferPos++]; }
// in src/main/org/h2/tools/Csv.java
private String readValue() throws IOException { endOfLine = false; inputBufferStart = inputBufferPos; while (true) { int ch = readChar(); if (ch == fieldDelimiter) { // delimited value boolean containsEscape = false; inputBufferStart = inputBufferPos; int sep; while (true) { ch = readChar(); if (ch == fieldDelimiter) { ch = readChar(); if (ch != fieldDelimiter) { sep = 2; break; } containsEscape = true; } else if (ch == escapeCharacter) { ch = readChar(); if (ch < 0) { sep = 1; break; } containsEscape = true; } else if (ch < 0) { sep = 1; break; } } String s = new String(inputBuffer, inputBufferStart, inputBufferPos - inputBufferStart - sep); if (containsEscape) { s = unEscape(s); } inputBufferStart = -1; while (true) { if (ch == fieldSeparatorRead) { break; } else if (ch == '\n' || ch < 0 || ch == '\r') { endOfLine = true; break; } else if (ch == ' ' || ch == '\t') { // ignore } else { pushBack(); break; } ch = readChar(); } return s; } else if (ch == '\n' || ch < 0 || ch == '\r') { endOfLine = true; return null; } else if (ch == fieldSeparatorRead) { // null return null; } else if (ch <= ' ') { // ignore spaces continue; } else if (lineComment != 0 && ch == lineComment) { // comment until end of line inputBufferStart = -1; while (true) { ch = readChar(); if (ch == '\n' || ch < 0 || ch == '\r') { break; } } endOfLine = true; return null; } else { // un-delimited value while (true) { ch = readChar(); if (ch == fieldSeparatorRead) { break; } else if (ch == '\n' || ch < 0 || ch == '\r') { endOfLine = true; break; } } String s = new String(inputBuffer, inputBufferStart, inputBufferPos - inputBufferStart - 1); if (!preserveWhitespace) { s = s.trim(); } inputBufferStart = -1; // check un-delimited value for nullString return readNull(s); } } }
// in src/main/org/h2/tools/Recover.java
public static Reader readClob(String fileName) throws IOException { return new BufferedReader(new InputStreamReader(readBlob(fileName), "UTF-8")); }
// in src/main/org/h2/tools/Recover.java
public static InputStream readBlob(String fileName) throws IOException { return new BufferedInputStream(FileUtils.newInputStream(fileName)); }
// in src/main/org/h2/tools/Recover.java
private void dumpPageLogStream(PrintWriter writer, int logKey, int logFirstTrunkPage, int logFirstDataPage, long pageCount) throws IOException { Data s = Data.create(this, pageSize); DataReader in = new DataReader( new PageInputStream(writer, this, store, logKey, logFirstTrunkPage, logFirstDataPage, pageSize) ); writer.println("---- Transaction log ----"); CompressLZF compress = new CompressLZF(); while (true) { int x = in.readByte(); if (x < 0) { break; } if (x == PageLog.NOOP) { // ignore } else if (x == PageLog.UNDO) { int pageId = in.readVarInt(); int size = in.readVarInt(); byte[] data = new byte[pageSize]; if (size == 0) { in.readFully(data, 0, pageSize); } else if (size == 1) { // empty } else { byte[] compressBuffer = new byte[size]; in.readFully(compressBuffer, 0, size); try { compress.expand(compressBuffer, 0, size, data, 0, pageSize); } catch (ArrayIndexOutOfBoundsException e) { throw DbException.convertToIOException(e); } } String typeName = ""; int type = data[0]; boolean last = (type & Page.FLAG_LAST) != 0; type &= ~Page.FLAG_LAST; switch (type) { case Page.TYPE_EMPTY: typeName = "empty"; break; case Page.TYPE_DATA_LEAF: typeName = "data leaf " + (last ? "(last)" : ""); break; case Page.TYPE_DATA_NODE: typeName = "data node " + (last ? "(last)" : ""); break; case Page.TYPE_DATA_OVERFLOW: typeName = "data overflow " + (last ? "(last)" : ""); break; case Page.TYPE_BTREE_LEAF: typeName = "b-tree leaf " + (last ? "(last)" : ""); break; case Page.TYPE_BTREE_NODE: typeName = "b-tree node " + (last ? "(last)" : ""); break; case Page.TYPE_FREE_LIST: typeName = "free list " + (last ? "(last)" : ""); break; case Page.TYPE_STREAM_TRUNK: typeName = "log trunk"; break; case Page.TYPE_STREAM_DATA: typeName = "log data"; break; default: typeName = "ERROR: unknown type " + type; break; } writer.println("-- undo page " + pageId + " " + typeName); if (trace) { Data d = Data.create(null, data); dumpPage(writer, d, pageId, pageCount); } } else if (x == PageLog.ADD) { int sessionId = in.readVarInt(); setStorage(in.readVarInt()); Row row = PageLog.readRow(in, s); writer.println("-- session " + sessionId + " table " + storageId + " + " + row.toString()); if (transactionLog) { if (storageId == 0 && row.getColumnCount() >= 4) { int tableId = (int) row.getKey(); String sql = row.getValue(3).getString(); String name = extractTableOrViewName(sql); if (row.getValue(2).getInt() == DbObject.TABLE_OR_VIEW) { tableMap.put(tableId, name); } writer.println(sql + ";"); } else { String tableName = tableMap.get(storageId); if (tableName != null) { StatementBuilder buff = new StatementBuilder(); buff.append("INSERT INTO ").append(tableName).append(" VALUES("); for (int i = 0; i < row.getColumnCount(); i++) { buff.appendExceptFirst(", "); buff.append(row.getValue(i).getSQL()); } buff.append(");"); writer.println(buff.toString()); } } } } else if (x == PageLog.REMOVE) { int sessionId = in.readVarInt(); setStorage(in.readVarInt()); long key = in.readVarLong(); writer.println("-- session " + sessionId + " table " + storageId + " - " + key); if (transactionLog) { if (storageId == 0) { int tableId = (int) key; String tableName = tableMap.get(tableId); if (tableName != null) { writer.println("DROP TABLE IF EXISTS " + tableName + ";"); } } else { String tableName = tableMap.get(storageId); if (tableName != null) { String sql = "DELETE FROM " + tableName + " WHERE _ROWID_ = " + key + ";"; writer.println(sql); } } } } else if (x == PageLog.TRUNCATE) { int sessionId = in.readVarInt(); setStorage(in.readVarInt()); writer.println("-- session " + sessionId + " table " + storageId + " truncate"); if (transactionLog) { writer.println("TRUNCATE TABLE " + storageId); } } else if (x == PageLog.COMMIT) { int sessionId = in.readVarInt(); writer.println("-- commit " + sessionId); } else if (x == PageLog.ROLLBACK) { int sessionId = in.readVarInt(); writer.println("-- rollback " + sessionId); } else if (x == PageLog.PREPARE_COMMIT) { int sessionId = in.readVarInt(); String transaction = in.readString(); writer.println("-- prepare commit " + sessionId + " " + transaction); } else if (x == PageLog.NOOP) { // nothing to do } else if (x == PageLog.CHECKPOINT) { writer.println("-- checkpoint"); } else if (x == PageLog.FREE_LOG) { int size = in.readVarInt(); StringBuilder buff = new StringBuilder("-- free"); for (int i = 0; i < size; i++) { buff.append(' ').append(in.readVarInt()); } writer.println(buff); } else { writer.println("-- ERROR: unknown operation " + x); break; } } }
// in src/main/org/h2/tools/RunScript.java
private void process(Connection conn, String fileName, boolean continueOnError, String charsetName) throws SQLException, IOException { InputStream in = FileUtils.newInputStream(fileName); String path = FileUtils.getParent(fileName); try { in = new BufferedInputStream(in, Constants.IO_BUFFER_SIZE); Reader reader = new InputStreamReader(in, charsetName); process(conn, continueOnError, path, reader, charsetName); } finally { IOUtils.closeSilently(in); } }
// in src/main/org/h2/tools/RunScript.java
private void process(Connection conn, boolean continueOnError, String path, Reader reader, String charsetName) throws SQLException, IOException { Statement stat = conn.createStatement(); ScriptReader r = new ScriptReader(reader); while (true) { String sql = r.readStatement(); if (sql == null) { break; } String trim = sql.trim(); if (trim.length() == 0) { continue; } if (trim.startsWith("@") && StringUtils.toUpperEnglish(trim).startsWith("@INCLUDE")) { sql = trim; sql = sql.substring("@INCLUDE".length()).trim(); if (!FileUtils.isAbsolute(sql)) { sql = path + SysProperties.FILE_SEPARATOR + sql; } process(conn, sql, continueOnError, charsetName); } else { try { if (showResults && !trim.startsWith("-->")) { out.print(sql + ";"); } if (showResults || checkResults) { boolean query = stat.execute(sql); if (query) { ResultSet rs = stat.getResultSet(); int columns = rs.getMetaData().getColumnCount(); StringBuilder buff = new StringBuilder(); while (rs.next()) { buff.append("\n-->"); for (int i = 0; i < columns; i++) { String s = rs.getString(i + 1); if (s != null) { s = StringUtils.replaceAll(s, "\r\n", "\n"); s = StringUtils.replaceAll(s, "\n", "\n--> "); s = StringUtils.replaceAll(s, "\r", "\r--> "); } buff.append(' ').append(s); } } buff.append("\n;"); String result = buff.toString(); if (showResults) { out.print(result); } if (checkResults) { String expected = r.readStatement() + ";"; expected = StringUtils.replaceAll(expected, "\r\n", "\n"); expected = StringUtils.replaceAll(expected, "\r", "\n"); if (!expected.equals(result)) { expected = StringUtils.replaceAll(expected, " ", "+"); result = StringUtils.replaceAll(result, " ", "+"); throw new SQLException("Unexpected output for:\n" + sql.trim() + "\nGot:\n" + result + "\nExpected:\n" + expected); } } } } else { stat.execute(sql); } } catch (Exception e) { if (continueOnError) { e.printStackTrace(out); } else { throw DbException.toSQLException(e); } } } } }
// in src/main/org/h2/tools/Shell.java
private void connect() throws IOException, SQLException { String url = "jdbc:h2:~/test"; String user = "sa"; String driver = null; try { Properties prop; if ("null".equals(serverPropertiesDir)) { prop = new Properties(); } else { prop = SortedProperties.loadProperties(serverPropertiesDir + "/" + Constants.SERVER_PROPERTIES_NAME); } String data = null; boolean found = false; for (int i = 0;; i++) { String d = prop.getProperty(String.valueOf(i)); if (d == null) { break; } found = true; data = d; } if (found) { ConnectionInfo info = new ConnectionInfo(data); url = info.url; user = info.user; driver = info.driver; } } catch (IOException e) { // ignore } println("[Enter] " + url); print("URL "); url = readLine(url).trim(); if (driver == null) { driver = JdbcUtils.getDriver(url); } if (driver != null) { println("[Enter] " + driver); } print("Driver "); driver = readLine(driver).trim(); println("[Enter] " + user); print("User "); user = readLine(user); println("[Enter] Hide"); print("Password "); String password = readLine(); if (password.length() == 0) { password = readPassword(); } conn = JdbcUtils.getConnection(driver, url, user, password); stat = conn.createStatement(); println("Connected"); }
// in src/main/org/h2/tools/Shell.java
private String readPassword() throws IOException { try { Object console = Utils.callStaticMethod("java.lang.System.console"); print("Password "); char[] password = (char[]) Utils.callMethod(console, "readPassword"); return password == null ? null : new String(password); } catch (Exception e) { // ignore, use the default solution } Thread passwordHider = new Thread(this, "Password hider"); stopHide = false; passwordHider.start(); print("Password > "); String p = readLine(); stopHide = true; try { passwordHider.join(); } catch (InterruptedException e) { // ignore } print("\b\b"); return p; }
// in src/main/org/h2/tools/Shell.java
private String readLine(String defaultValue) throws IOException { String s = readLine(); return s.length() == 0 ? defaultValue : s; }
// in src/main/org/h2/tools/Shell.java
private String readLine() throws IOException { String line = reader.readLine(); if (line == null) { throw new IOException("Aborted"); } return line; }
// in src/main/org/h2/value/Transfer.java
public synchronized void init() throws IOException { if (socket != null) { in = new DataInputStream(new BufferedInputStream(socket.getInputStream(), Transfer.BUFFER_SIZE)); out = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), Transfer.BUFFER_SIZE)); } }
// in src/main/org/h2/value/Transfer.java
public void flush() throws IOException { out.flush(); }
// in src/main/org/h2/value/Transfer.java
public Transfer writeBoolean(boolean x) throws IOException { out.writeByte((byte) (x ? 1 : 0)); return this; }
// in src/main/org/h2/value/Transfer.java
public boolean readBoolean() throws IOException { return in.readByte() == 1; }
// in src/main/org/h2/value/Transfer.java
private Transfer writeByte(byte x) throws IOException { out.writeByte(x); return this; }
// in src/main/org/h2/value/Transfer.java
private byte readByte() throws IOException { return in.readByte(); }
// in src/main/org/h2/value/Transfer.java
public Transfer writeInt(int x) throws IOException { out.writeInt(x); return this; }
// in src/main/org/h2/value/Transfer.java
public int readInt() throws IOException { return in.readInt(); }
// in src/main/org/h2/value/Transfer.java
public Transfer writeLong(long x) throws IOException { out.writeLong(x); return this; }
// in src/main/org/h2/value/Transfer.java
public long readLong() throws IOException { return in.readLong(); }
// in src/main/org/h2/value/Transfer.java
private Transfer writeDouble(double i) throws IOException { out.writeDouble(i); return this; }
// in src/main/org/h2/value/Transfer.java
private Transfer writeFloat(float i) throws IOException { out.writeFloat(i); return this; }
// in src/main/org/h2/value/Transfer.java
private double readDouble() throws IOException { return in.readDouble(); }
// in src/main/org/h2/value/Transfer.java
private float readFloat() throws IOException { return in.readFloat(); }
// in src/main/org/h2/value/Transfer.java
public Transfer writeString(String s) throws IOException { if (s == null) { out.writeInt(-1); } else { int len = s.length(); out.writeInt(len); for (int i = 0; i < len; i++) { out.writeChar(s.charAt(i)); } } return this; }
// in src/main/org/h2/value/Transfer.java
public String readString() throws IOException { int len = in.readInt(); if (len == -1) { return null; } StringBuilder buff = new StringBuilder(len); for (int i = 0; i < len; i++) { buff.append(in.readChar()); } String s = buff.toString(); s = StringUtils.cache(s); return s; }
// in src/main/org/h2/value/Transfer.java
public Transfer writeBytes(byte[] data) throws IOException { if (data == null) { writeInt(-1); } else { writeInt(data.length); out.write(data); } return this; }
// in src/main/org/h2/value/Transfer.java
public Transfer writeBytes(byte[] buff, int off, int len) throws IOException { out.write(buff, off, len); return this; }
// in src/main/org/h2/value/Transfer.java
public byte[] readBytes() throws IOException { int len = readInt(); if (len == -1) { return null; } byte[] b = Utils.newBytes(len); in.readFully(b); return b; }
// in src/main/org/h2/value/Transfer.java
public void readBytes(byte[] buff, int off, int len) throws IOException { in.readFully(buff, off, len); }
// in src/main/org/h2/value/Transfer.java
public void writeValue(Value v) throws IOException { int type = v.getType(); writeInt(type); switch (type) { case Value.NULL: break; case Value.BYTES: case Value.JAVA_OBJECT: writeBytes(v.getBytesNoCopy()); break; case Value.UUID: { ValueUuid uuid = (ValueUuid) v; writeLong(uuid.getHigh()); writeLong(uuid.getLow()); break; } case Value.BOOLEAN: writeBoolean(v.getBoolean().booleanValue()); break; case Value.BYTE: writeByte(v.getByte()); break; case Value.TIME: if (version >= Constants.TCP_PROTOCOL_VERSION_9) { writeLong(((ValueTime) v).getNanos()); } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) { writeLong(DateTimeUtils.getTimeLocalWithoutDst(v.getTime())); } else { writeLong(v.getTime().getTime()); } break; case Value.DATE: if (version >= Constants.TCP_PROTOCOL_VERSION_9) { writeLong(((ValueDate) v).getDateValue()); } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) { writeLong(DateTimeUtils.getTimeLocalWithoutDst(v.getDate())); } else { writeLong(v.getDate().getTime()); } break; case Value.TIMESTAMP: { if (version >= Constants.TCP_PROTOCOL_VERSION_9) { ValueTimestamp ts = (ValueTimestamp) v; writeLong(ts.getDateValue()); writeLong(ts.getNanos()); } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) { Timestamp ts = v.getTimestamp(); writeLong(DateTimeUtils.getTimeLocalWithoutDst(ts)); writeInt(ts.getNanos()); } else { Timestamp ts = v.getTimestamp(); writeLong(ts.getTime()); writeInt(ts.getNanos()); } break; } case Value.DECIMAL: writeString(v.getString()); break; case Value.DOUBLE: writeDouble(v.getDouble()); break; case Value.FLOAT: writeFloat(v.getFloat()); break; case Value.INT: writeInt(v.getInt()); break; case Value.LONG: writeLong(v.getLong()); break; case Value.SHORT: writeInt(v.getShort()); break; case Value.STRING: case Value.STRING_IGNORECASE: case Value.STRING_FIXED: writeString(v.getString()); break; case Value.BLOB: { if (version >= Constants.TCP_PROTOCOL_VERSION_11) { if (v instanceof ValueLobDb) { ValueLobDb lob = (ValueLobDb) v; if (lob.isStored()) { writeLong(-1); writeInt(lob.getTableId()); writeLong(lob.getLobId()); writeLong(lob.getPrecision()); break; } } } long length = v.getPrecision(); if (length < 0) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "length=" + length); } writeLong(length); long written = IOUtils.copyAndCloseInput(v.getInputStream(), out); if (written != length) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "length:" + length + " written:" + written); } writeInt(LOB_MAGIC); break; } case Value.CLOB: { if (version >= Constants.TCP_PROTOCOL_VERSION_11) { if (v instanceof ValueLobDb) { ValueLobDb lob = (ValueLobDb) v; if (lob.isStored()) { writeLong(-1); writeInt(lob.getTableId()); writeLong(lob.getLobId()); writeLong(lob.getPrecision()); break; } } } long length = v.getPrecision(); if (length < 0) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "length=" + length); } writeLong(length); Reader reader = v.getReader(); Data.copyString(reader, out); writeInt(LOB_MAGIC); break; } case Value.ARRAY: { ValueArray va = (ValueArray) v; Value[] list = va.getList(); int len = list.length; Class<?> componentType = va.getComponentType(); if (componentType == Object.class) { writeInt(len); } else { writeInt(-(len + 1)); writeString(componentType.getName()); } for (Value value : list) { writeValue(value); } break; } case Value.RESULT_SET: { try { ResultSet rs = ((ValueResultSet) v).getResultSet(); rs.beforeFirst(); ResultSetMetaData meta = rs.getMetaData(); int columnCount = meta.getColumnCount(); writeInt(columnCount); for (int i = 0; i < columnCount; i++) { writeString(meta.getColumnName(i + 1)); writeInt(meta.getColumnType(i + 1)); writeInt(meta.getPrecision(i + 1)); writeInt(meta.getScale(i + 1)); } while (rs.next()) { writeBoolean(true); for (int i = 0; i < columnCount; i++) { int t = DataType.convertSQLTypeToValueType(meta.getColumnType(i + 1)); Value val = DataType.readValue(session, rs, i + 1, t); writeValue(val); } } writeBoolean(false); rs.beforeFirst(); } catch (SQLException e) { throw DbException.convertToIOException(e); } break; } default: throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "type=" + type); } }
// in src/main/org/h2/value/Transfer.java
public Value readValue() throws IOException { int type = readInt(); switch(type) { case Value.NULL: return ValueNull.INSTANCE; case Value.BYTES: return ValueBytes.getNoCopy(readBytes()); case Value.UUID: return ValueUuid.get(readLong(), readLong()); case Value.JAVA_OBJECT: return ValueJavaObject.getNoCopy(readBytes()); case Value.BOOLEAN: return ValueBoolean.get(readBoolean()); case Value.BYTE: return ValueByte.get(readByte()); case Value.DATE: if (version >= Constants.TCP_PROTOCOL_VERSION_9) { return ValueDate.fromDateValue(readLong()); } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) { return ValueDate.get(new Date(DateTimeUtils.getTimeUTCWithoutDst(readLong()))); } return ValueDate.get(new Date(readLong())); case Value.TIME: if (version >= Constants.TCP_PROTOCOL_VERSION_9) { return ValueTime.fromNanos(readLong()); } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) { return ValueTime.get(new Time(DateTimeUtils.getTimeUTCWithoutDst(readLong()))); } return ValueTime.get(new Time(readLong())); case Value.TIMESTAMP: { if (version >= Constants.TCP_PROTOCOL_VERSION_9) { return ValueTimestamp.fromDateValueAndNanos(readLong(), readLong()); } else if (version >= Constants.TCP_PROTOCOL_VERSION_7) { Timestamp ts = new Timestamp(DateTimeUtils.getTimeUTCWithoutDst(readLong())); ts.setNanos(readInt()); return ValueTimestamp.get(ts); } Timestamp ts = new Timestamp(readLong()); ts.setNanos(readInt()); return ValueTimestamp.get(ts); } case Value.DECIMAL: return ValueDecimal.get(new BigDecimal(readString())); case Value.DOUBLE: return ValueDouble.get(readDouble()); case Value.FLOAT: return ValueFloat.get(readFloat()); case Value.INT: return ValueInt.get(readInt()); case Value.LONG: return ValueLong.get(readLong()); case Value.SHORT: return ValueShort.get((short) readInt()); case Value.STRING: return ValueString.get(readString()); case Value.STRING_IGNORECASE: return ValueStringIgnoreCase.get(readString()); case Value.STRING_FIXED: return ValueStringFixed.get(readString()); case Value.BLOB: { long length = readLong(); if (version >= Constants.TCP_PROTOCOL_VERSION_11) { if (length == -1) { int tableId = readInt(); long id = readLong(); long precision = readLong(); return ValueLobDb.create(Value.BLOB, session.getDataHandler().getLobStorage(), tableId, id, precision); } int len = (int) length; byte[] small = new byte[len]; IOUtils.readFully(in, small, 0, len); int magic = readInt(); if (magic != LOB_MAGIC) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic); } return ValueLobDb.createSmallLob(Value.BLOB, small, length); } Value v = session.getDataHandler().getLobStorage().createBlob(in, length); int magic = readInt(); if (magic != LOB_MAGIC) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic); } return v; } case Value.CLOB: { long length = readLong(); if (version >= Constants.TCP_PROTOCOL_VERSION_11) { if (length == -1) { int tableId = readInt(); long id = readLong(); long precision = readLong(); return ValueLobDb.create(Value.CLOB, session.getDataHandler().getLobStorage(), tableId, id, precision); } DataReader reader = new DataReader(in); int len = (int) length; char[] buff = new char[len]; IOUtils.readFully(reader, buff, len); int magic = readInt(); if (magic != LOB_MAGIC) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic); } byte[] small = new String(buff).getBytes("UTF-8"); return ValueLobDb.createSmallLob(Value.CLOB, small, length); } Value v = session.getDataHandler().getLobStorage().createClob(new DataReader(in), length); int magic = readInt(); if (magic != LOB_MAGIC) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "magic=" + magic); } return v; } case Value.ARRAY: { int len = readInt(); Class<?> componentType = Object.class; if (len < 0) { len = -(len + 1); componentType = Utils.loadUserClass(readString()); } Value[] list = new Value[len]; for (int i = 0; i < len; i++) { list[i] = readValue(); } return ValueArray.get(componentType, list); } case Value.RESULT_SET: { SimpleResultSet rs = new SimpleResultSet(); int columns = readInt(); for (int i = 0; i < columns; i++) { rs.addColumn(readString(), readInt(), readInt(), readInt()); } while (true) { if (!readBoolean()) { break; } Object[] o = new Object[columns]; for (int i = 0; i < columns; i++) { o[i] = readValue().getObject(); } rs.addRow(o); } return ValueResultSet.get(rs); } default: throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "type=" + type); } }
// in src/main/org/h2/value/Transfer.java
public Transfer openNewConnection() throws IOException { InetAddress address = socket.getInetAddress(); int port = socket.getPort(); Socket s2 = NetUtils.createSocket(address, port, ssl); Transfer trans = new Transfer(null); trans.setSocket(s2); trans.setSSL(ssl); return trans; }
// in src/main/org/h2/result/ResultColumn.java
public static void writeColumn(Transfer out, ResultInterface result, int i) throws IOException { out.writeString(result.getAlias(i)); out.writeString(result.getSchemaName(i)); out.writeString(result.getTableName(i)); out.writeString(result.getColumnName(i)); out.writeInt(result.getColumnType(i)); out.writeLong(result.getColumnPrecision(i)); out.writeInt(result.getColumnScale(i)); out.writeInt(result.getDisplaySize(i)); out.writeBoolean(result.isAutoIncrement(i)); out.writeInt(result.getNullable(i)); }
// in src/main/org/h2/expression/ParameterRemote.java
public void readMetaData(Transfer transfer) throws IOException { dataType = transfer.readInt(); precision = transfer.readLong(); scale = transfer.readInt(); nullable = transfer.readInt(); }
// in src/main/org/h2/expression/ParameterRemote.java
public static void writeMetaData(Transfer transfer, ParameterInterface p) throws IOException { transfer.writeInt(p.getType()); transfer.writeLong(p.getPrecision()); transfer.writeInt(p.getScale()); transfer.writeInt(p.getNullable()); }
// in src/main/org/h2/store/PageInputStream.java
public int read() throws IOException { int len = read(buffer); return len < 0 ? -1 : (buffer[0] & 255); }
// in src/main/org/h2/store/PageInputStream.java
public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
// in src/main/org/h2/store/PageInputStream.java
public int read(byte[] b, int off, int len) throws IOException { if (len == 0) { return 0; } int read = 0; while (len > 0) { int r = readBlock(b, off, len); if (r < 0) { break; } read += r; off += r; len -= r; } return read == 0 ? -1 : read; }
// in src/main/org/h2/store/PageInputStream.java
private int readBlock(byte[] buff, int off, int len) throws IOException { try { fillBuffer(); if (endOfFile) { return -1; } int l = Math.min(remaining, len); data.read(dataPos, buff, off, l); remaining -= l; dataPos += l; return l; } catch (DbException e) { throw new EOFException(); } }
// in src/main/org/h2/store/LobStorage.java
public int read() throws IOException { byte[] buff = new byte[1]; int len = read(buff, 0, 1); return len < 0 ? len : (buff[0] & 255); }
// in src/main/org/h2/store/LobStorage.java
public int read(byte[] buff) throws IOException { return read(buff, 0, buff.length); }
// in src/main/org/h2/store/LobStorage.java
public int read(byte[] buff, int off, int length) throws IOException { if (length == 0) { return 0; } length = (int) Math.min(length, remainingBytes); if (length == 0) { return -1; } length = handler.readLob(lob, pos, buff, off, length); remainingBytes -= length; if (length == 0) { return -1; } pos += length; return length; }
// in src/main/org/h2/store/LobStorage.java
public int read() throws IOException { fillBuffer(); if (remainingBytes <= 0) { return -1; } remainingBytes--; return buffer[pos++] & 255; }
// in src/main/org/h2/store/LobStorage.java
public long skip(long n) throws IOException { long remaining = n; remaining -= skipSmall(remaining); if (remaining > BLOCK_LENGTH) { long toPos = length - remainingBytes + remaining; try { long[] seqPos = skipBuffer(lob, toPos); if (seqPos == null) { remaining -= super.skip(remaining); return n - remaining; } seq = (int) seqPos[0]; long p = seqPos[1]; remainingBytes = length - p; remaining = toPos - p; } catch (SQLException e) { throw DbException.convertToIOException(e); } pos = 0; buffer = null; } fillBuffer(); remaining -= skipSmall(remaining); remaining -= super.skip(remaining); return n - remaining; }
// in src/main/org/h2/store/LobStorage.java
public int read(byte[] buff) throws IOException { return readFully(buff, 0, buff.length); }
// in src/main/org/h2/store/LobStorage.java
public int read(byte[] buff, int off, int length) throws IOException { return readFully(buff, off, length); }
// in src/main/org/h2/store/LobStorage.java
private int readFully(byte[] buff, int off, int length) throws IOException { if (length == 0) { return 0; } int read = 0; while (length > 0) { fillBuffer(); if (remainingBytes <= 0) { break; } int len = (int) Math.min(length, remainingBytes); len = Math.min(len, buffer.length - pos); System.arraycopy(buffer, pos, buff, off, len); pos += len; read += len; remainingBytes -= len; off += len; length -= len; } return read == 0 ? -1 : read; }
// in src/main/org/h2/store/LobStorage.java
private void fillBuffer() throws IOException { if (buffer != null && pos < buffer.length) { return; } if (remainingBytes <= 0) { return; } try { buffer = readBlock(lob, seq++); pos = 0; } catch (SQLException e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/store/LobStorage.java
public InputStream getInputStream(long lobId, long byteCount) throws IOException { init(); if (conn == null) { if (byteCount < 0) { byteCount = Long.MAX_VALUE; } return new BufferedInputStream(new RemoteInputStream(handler, lobId, byteCount)); } if (byteCount == -1) { synchronized (handler) { try { String sql = "SELECT BYTE_COUNT FROM " + LOBS + " WHERE ID = ?"; PreparedStatement prep = prepare(sql); prep.setLong(1, lobId); ResultSet rs = prep.executeQuery(); if (!rs.next()) { throw DbException.get(ErrorCode.IO_EXCEPTION_1, "Missing lob: "+ lobId).getSQLException(); } byteCount = rs.getLong(1); reuse(sql, prep); } catch (SQLException e) { throw DbException.convertToIOException(e); } } } return new LobInputStream(lobId, byteCount); }
// in src/main/org/h2/store/LobStorage.java
public int read(byte[] buff, int offset, int len) throws IOException { if (buffer == null) { return -1; } if (pos >= buffer.length) { fillBuffer(); if (buffer == null) { return -1; } } len = Math.min(len, buffer.length - pos); System.arraycopy(buffer, pos, buff, offset, len); pos += len; return len; }
// in src/main/org/h2/store/LobStorage.java
public int read() throws IOException { if (buffer == null) { return -1; } if (pos >= buffer.length) { fillBuffer(); if (buffer == null) { return -1; } } return buffer[pos++]; }
// in src/main/org/h2/store/LobStorage.java
private void fillBuffer() throws IOException { int len = (int) Math.min(charBuffer.length, remaining); if (len > 0) { len = reader.read(charBuffer, 0, len); } else { len = -1; } if (len < 0) { buffer = null; } else { buffer = StringUtils.utf8Encode(new String(charBuffer, 0, len)); length += len; remaining -= len; } pos = 0; }
// in src/main/org/h2/store/LobStorage.java
public void close() throws IOException { reader.close(); }
// in src/main/org/h2/store/PageLog.java
public static Row readRow(DataReader in, Data data) throws IOException { long key = in.readVarLong(); int len = in.readVarInt(); data.reset(); data.checkCapacity(len); in.readFully(data.getBytes(), 0, len); int columnCount = data.readVarInt(); Value[] values = new Value[columnCount]; for (int i = 0; i < columnCount; i++) { values[i] = data.readValue(); } Row row = new Row(values, Row.MEMORY_CALCULATE); row.setKey(key); return row; }
// in src/main/org/h2/store/DataReader.java
public byte readByte() throws IOException { int x = in.read(); if (x < 0) { throw new FastEOFException(); } return (byte) x; }
// in src/main/org/h2/store/DataReader.java
public int readVarInt() throws IOException { int b = readByte(); if (b >= 0) { return b; } int x = b & 0x7f; b = readByte(); if (b >= 0) { return x | (b << 7); } x |= (b & 0x7f) << 7; b = readByte(); if (b >= 0) { return x | (b << 14); } x |= (b & 0x7f) << 14; b = readByte(); if (b >= 0) { return x | b << 21; } return x | ((b & 0x7f) << 21) | (readByte() << 28); }
// in src/main/org/h2/store/DataReader.java
public long readVarLong() throws IOException { long x = readByte(); if (x >= 0) { return x; } x &= 0x7f; for (int s = 7;; s += 7) { long b = readByte(); x |= (b & 0x7f) << s; if (b >= 0) { return x; } } }
// in src/main/org/h2/store/DataReader.java
public void readFully(byte[] buff, int offset, int len) throws IOException { int got = IOUtils.readFully(in, buff, offset, len); if (got < len) { throw new FastEOFException(); } }
// in src/main/org/h2/store/DataReader.java
public String readString() throws IOException { int len = readVarInt(); return readString(len); }
// in src/main/org/h2/store/DataReader.java
private String readString(int len) throws IOException { char[] chars = new char[len]; for (int i = 0; i < len; i++) { chars[i] = readChar(); } return new String(chars); }
// in src/main/org/h2/store/DataReader.java
private char readChar() throws IOException { int x = readByte() & 0xff; if (x < 0x80) { return (char) x; } else if (x >= 0xe0) { return (char) (((x & 0xf) << 12) + ((readByte() & 0x3f) << 6) + (readByte() & 0x3f)); } else { return (char) (((x & 0x1f) << 6) + (readByte() & 0x3f)); } }
// in src/main/org/h2/store/DataReader.java
public void close() throws IOException { // ignore }
// in src/main/org/h2/store/DataReader.java
public int read(char[] buff, int off, int len) throws IOException { int i = 0; try { for (; i < len; i++) { buff[i] = readChar(); } return len; } catch (EOFException e) { return i; } }
// in src/main/org/h2/store/FileStoreInputStream.java
public int read(byte[] buff) throws IOException { return read(buff, 0, buff.length); }
// in src/main/org/h2/store/FileStoreInputStream.java
public int read(byte[] b, int off, int len) throws IOException { if (len == 0) { return 0; } int read = 0; while (len > 0) { int r = readBlock(b, off, len); if (r < 0) { break; } read += r; off += r; len -= r; } return read == 0 ? -1 : read; }
// in src/main/org/h2/store/FileStoreInputStream.java
private int readBlock(byte[] buff, int off, int len) throws IOException { fillBuffer(); if (endOfFile) { return -1; } int l = Math.min(remainingInBuffer, len); page.read(buff, off, l); remainingInBuffer -= l; return l; }
// in src/main/org/h2/store/FileStoreInputStream.java
private void fillBuffer() throws IOException { if (remainingInBuffer > 0 || endOfFile) { return; } page.reset(); store.openFile(); if (store.length() == store.getFilePointer()) { close(); return; } store.readFully(page.getBytes(), 0, Constants.FILE_BLOCK_SIZE); page.reset(); remainingInBuffer = readInt(); if (remainingInBuffer < 0) { close(); return; } page.checkCapacity(remainingInBuffer); // get the length to read if (compress != null) { page.checkCapacity(Data.LENGTH_INT); readInt(); } page.setPos(page.length() + remainingInBuffer); page.fillAligned(); int len = page.length() - Constants.FILE_BLOCK_SIZE; page.reset(); readInt(); store.readFully(page.getBytes(), Constants.FILE_BLOCK_SIZE, len); page.reset(); readInt(); if (compress != null) { int uncompressed = readInt(); byte[] buff = Utils.newBytes(remainingInBuffer); page.read(buff, 0, remainingInBuffer); page.reset(); page.checkCapacity(uncompressed); CompressTool.expand(buff, page.getBytes(), 0); remainingInBuffer = uncompressed; } if (alwaysClose) { store.closeFile(); } }
// in src/main/org/h2/store/FileStoreInputStream.java
public int read() throws IOException { fillBuffer(); if (endOfFile) { return -1; } int i = page.readByte() & 0xff; remainingInBuffer--; return i; }
// in src/main/org/h2/store/Data.java
public static void copyString(Reader source, OutputStream target) throws IOException { char[] buff = new char[Constants.IO_BUFFER_SIZE]; Data d = new Data(null, new byte[3 * Constants.IO_BUFFER_SIZE]); while (true) { int l = source.read(buff); if (l < 0) { break; } d.writeStringWithoutLength(buff, l); target.write(d.data, 0, d.pos); d.reset(); } }
// in src/main/org/h2/store/fs/FileChannelInputStream.java
public int read() throws IOException { if (channel.position() >= channel.size()) { return -1; } FileUtils.readFully(channel, ByteBuffer.wrap(buffer)); return buffer[0] & 0xff; }
// in src/main/org/h2/store/fs/FileChannelInputStream.java
public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
// in src/main/org/h2/store/fs/FileChannelInputStream.java
public int read(byte[] b, int off, int len) throws IOException { if (channel.position() + len < channel.size()) { FileUtils.readFully(channel, ByteBuffer.wrap(b, off, len)); return len; } return super.read(b, off, len); }
// in src/main/org/h2/store/fs/FileChannelInputStream.java
public void close() throws IOException { channel.close(); }
// in src/main/org/h2/store/fs/FilePath.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { while (true) { FilePath p = getPath(name + getNextTempFileNamePart(false) + suffix); if (p.exists() || !p.createFile()) { // in theory, the random number could collide getNextTempFileNamePart(true); continue; } p.open("rw").close(); return p; } }
// in src/main/org/h2/store/fs/FilePathWrapper.java
public InputStream newInputStream() throws IOException { return base.newInputStream(); }
// in src/main/org/h2/store/fs/FilePathWrapper.java
public FileChannel open(String mode) throws IOException { return base.open(mode); }
// in src/main/org/h2/store/fs/FilePathWrapper.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { return wrap(base.createTempFile(suffix, deleteOnExit, inTempDir)); }
// in src/main/org/h2/store/fs/FilePathNio.java
public FileChannel open(String mode) throws IOException { return new FileNio(name.substring(getScheme().length() + 1), mode); }
// in src/main/org/h2/store/fs/FilePathNio.java
public void implCloseChannel() throws IOException { channel.close(); }
// in src/main/org/h2/store/fs/FilePathNio.java
public long position() throws IOException { return channel.position(); }
// in src/main/org/h2/store/fs/FilePathNio.java
public long size() throws IOException { return channel.size(); }
// in src/main/org/h2/store/fs/FilePathNio.java
public int read(ByteBuffer dst) throws IOException { return channel.read(dst); }
// in src/main/org/h2/store/fs/FilePathNio.java
public FileChannel position(long pos) throws IOException { channel.position(pos); return this; }
// in src/main/org/h2/store/fs/FilePathNio.java
public FileChannel truncate(long newLength) throws IOException { try { channel.truncate(newLength); if (channel.position() > newLength) { // looks like a bug in this FileChannel implementation, as the // documentation says the position needs to be changed channel.position(newLength); } return this; } catch (NonWritableChannelException e) { throw new IOException("read only"); } }
// in src/main/org/h2/store/fs/FilePathNio.java
public void force(boolean metaData) throws IOException { channel.force(metaData); }
// in src/main/org/h2/store/fs/FilePathNio.java
public int write(ByteBuffer src) throws IOException { try { return channel.write(src); } catch (NonWritableChannelException e) { throw new IOException("read only"); } }
// in src/main/org/h2/store/fs/FilePathNio.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return channel.tryLock(); }
// in src/main/org/h2/store/fs/FilePathMem.java
public FileChannel truncate(long newLength) throws IOException { if (newLength < size()) { data.touch(readOnly); pos = Math.min(pos, newLength); data.truncate(newLength); } return this; }
// in src/main/org/h2/store/fs/FilePathMem.java
public int write(ByteBuffer src) throws IOException { int len = src.remaining(); if (len == 0) { return 0; } data.touch(readOnly); pos = data.readWrite(pos, src.array(), src.position(), len, true); src.position(src.position() + len); return len; }
// in src/main/org/h2/store/fs/FilePathMem.java
public int read(ByteBuffer dst) throws IOException { int len = dst.remaining(); if (len == 0) { return 0; } long newPos = data.readWrite(pos, dst.array(), dst.position(), len, false); len = (int) (newPos - pos); if (len <= 0) { return -1; } dst.position(dst.position() + len); pos = newPos; return len; }
// in src/main/org/h2/store/fs/FilePathMem.java
public void implCloseChannel() throws IOException { pos = 0; }
// in src/main/org/h2/store/fs/FilePathMem.java
public void force(boolean metaData) throws IOException { // do nothing }
// in src/main/org/h2/store/fs/FilePathMem.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return null; }
// in src/main/org/h2/store/fs/FilePathMem.java
void touch(boolean openReadOnly) throws IOException { if (isReadOnly || openReadOnly) { throw new IOException("Read only"); } lastModified = System.currentTimeMillis(); }
// in src/main/org/h2/store/fs/FileChannelOutputStream.java
public void write(int b) throws IOException { buffer[0] = (byte) b; FileUtils.writeFully(channel, ByteBuffer.wrap(buffer)); }
// in src/main/org/h2/store/fs/FileChannelOutputStream.java
public void write(byte[] b) throws IOException { FileUtils.writeFully(channel, ByteBuffer.wrap(b)); }
// in src/main/org/h2/store/fs/FileChannelOutputStream.java
public void write(byte[] b, int off, int len) throws IOException { FileUtils.writeFully(channel, ByteBuffer.wrap(b, off, len)); }
// in src/main/org/h2/store/fs/FileChannelOutputStream.java
public void close() throws IOException { channel.close(); }
// in src/main/org/h2/store/fs/FilePathSplit.java
public InputStream newInputStream() throws IOException { InputStream input = getBase().newInputStream(); for (int i = 1;; i++) { FilePath f = getBase(i); if (f.exists()) { InputStream i2 = f.newInputStream(); input = new SequenceInputStream(input, i2); } else { break; } } return input; }
// in src/main/org/h2/store/fs/FilePathSplit.java
public FileChannel open(String mode) throws IOException { ArrayList<FileChannel> list = New.arrayList(); list.add(getBase().open(mode)); for (int i = 1;; i++) { FilePath f = getBase(i); if (f.exists()) { list.add(f.open(mode)); } else { break; } } FileChannel[] array = new FileChannel[list.size()]; list.toArray(array); long maxLength = array[0].size(); long length = maxLength; if (array.length == 1) { long defaultMaxLength = getDefaultMaxLength(); if (maxLength < defaultMaxLength) { maxLength = defaultMaxLength; } } else { if (maxLength == 0) { closeAndThrow(0, array, array[0], maxLength); } for (int i = 1; i < array.length - 1; i++) { FileChannel c = array[i]; long l = c.size(); length += l; if (l != maxLength) { closeAndThrow(i, array, c, maxLength); } } FileChannel c = array[array.length - 1]; long l = c.size(); length += l; if (l > maxLength) { closeAndThrow(array.length - 1, array, c, maxLength); } } return new FileSplit(this, mode, array, length, maxLength); }
// in src/main/org/h2/store/fs/FilePathSplit.java
private void closeAndThrow(int id, FileChannel[] array, FileChannel o, long maxLength) throws IOException { String message = "Expected file length: " + maxLength + " got: " + o.size() + " for " + getName(id); for (FileChannel f : array) { f.close(); } throw new IOException(message); }
// in src/main/org/h2/store/fs/FilePathSplit.java
public void implCloseChannel() throws IOException { for (FileChannel c : list) { c.close(); } }
// in src/main/org/h2/store/fs/FilePathSplit.java
public int read(ByteBuffer dst) throws IOException { int len = dst.remaining(); if (len == 0) { return 0; } len = (int) Math.min(len, length - filePointer); if (len <= 0) { return -1; } long offset = filePointer % maxLength; len = (int) Math.min(len, maxLength - offset); FileChannel channel = getFileChannel(); channel.position(offset); len = channel.read(dst); filePointer += len; return len; }
// in src/main/org/h2/store/fs/FilePathSplit.java
private FileChannel getFileChannel() throws IOException { int id = (int) (filePointer / maxLength); while (id >= list.length) { int i = list.length; FileChannel[] newList = new FileChannel[i + 1]; System.arraycopy(list, 0, newList, 0, i); FilePath f = file.getBase(i); newList[i] = f.open(mode); list = newList; } return list[id]; }
// in src/main/org/h2/store/fs/FilePathSplit.java
public FileChannel truncate(long newLength) throws IOException { if (newLength >= length) { return this; } filePointer = Math.min(filePointer, newLength); int newFileCount = 1 + (int) (newLength / maxLength); if (newFileCount < list.length) { // delete some of the files FileChannel[] newList = new FileChannel[newFileCount]; // delete backwards, so that truncating is somewhat transactional for (int i = list.length - 1; i >= newFileCount; i--) { // verify the file is writable list[i].truncate(0); list[i].close(); try { file.getBase(i).delete(); } catch (DbException e) { throw DbException.convertToIOException(e); } } System.arraycopy(list, 0, newList, 0, newList.length); list = newList; } long size = newLength - maxLength * (newFileCount - 1); list[list.length - 1].truncate(size); this.length = newLength; return this; }
// in src/main/org/h2/store/fs/FilePathSplit.java
public void force(boolean metaData) throws IOException { for (FileChannel c : list) { c.force(metaData); } }
// in src/main/org/h2/store/fs/FilePathSplit.java
public int write(ByteBuffer src) throws IOException { if (filePointer >= length && filePointer > maxLength) { // may need to extend and create files long oldFilePointer = filePointer; long x = length - (length % maxLength) + maxLength; for (; x < filePointer; x += maxLength) { if (x > length) { // expand the file size position(x - 1); write(ByteBuffer.wrap(new byte[1])); } filePointer = oldFilePointer; } } long offset = filePointer % maxLength; int len = src.remaining(); FileChannel channel = getFileChannel(); channel.position(offset); int l = (int) Math.min(len, maxLength - offset); if (l == len) { l = channel.write(src); } else { int oldLimit = src.limit(); src.limit(src.position() + l); l = channel.write(src); src.limit(oldLimit); } filePointer += l; length = Math.max(length, filePointer); return l; }
// in src/main/org/h2/store/fs/FilePathSplit.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return list[0].tryLock(); }
// in src/main/org/h2/store/fs/FilePathRec.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { log(Recorder.CREATE_TEMP_FILE, unwrap(name) + ":" + suffix + ":" + deleteOnExit + ":" + inTempDir); return super.createTempFile(suffix, deleteOnExit, inTempDir); }
// in src/main/org/h2/store/fs/FilePathRec.java
public FileChannel open(String mode) throws IOException { return new FileRec(this, super.open(mode), name); }
// in src/main/org/h2/store/fs/FilePathRec.java
public void implCloseChannel() throws IOException { channel.close(); }
// in src/main/org/h2/store/fs/FilePathRec.java
public long position() throws IOException { return channel.position(); }
// in src/main/org/h2/store/fs/FilePathRec.java
public long size() throws IOException { return channel.size(); }
// in src/main/org/h2/store/fs/FilePathRec.java
public int read(ByteBuffer dst) throws IOException { return channel.read(dst); }
// in src/main/org/h2/store/fs/FilePathRec.java
public FileChannel position(long pos) throws IOException { channel.position(pos); return this; }
// in src/main/org/h2/store/fs/FilePathRec.java
public FileChannel truncate(long newLength) throws IOException { rec.log(Recorder.TRUNCATE, name, null, newLength); channel.truncate(newLength); return this; }
// in src/main/org/h2/store/fs/FilePathRec.java
public void force(boolean metaData) throws IOException { channel.force(metaData); }
// in src/main/org/h2/store/fs/FilePathRec.java
public int write(ByteBuffer src) throws IOException { byte[] buff = src.array(); int len = src.remaining(); if (src.position() != 0 || len != buff.length) { byte[] b = new byte[len]; System.arraycopy(buff, src.position(), b, 0, len); buff = b; } int result = channel.write(src); rec.log(Recorder.WRITE, name, buff, channel.position()); return result; }
// in src/main/org/h2/store/fs/FilePathRec.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return channel.tryLock(); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public FileChannel open(String mode) throws IOException { return new FileNioMapped(name.substring(getScheme().length() + 1), mode); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
private void unMap() throws IOException { if (mapped == null) { return; } // first write all data mapped.force(); // need to dispose old direct buffer, see bug // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038 boolean useSystemGc = true; if (SysProperties.NIO_CLEANER_HACK) { try { Method cleanerMethod = mapped.getClass().getMethod("cleaner"); cleanerMethod.setAccessible(true); Object cleaner = cleanerMethod.invoke(mapped); if (cleaner != null) { Method clearMethod = cleaner.getClass().getMethod("clean"); clearMethod.invoke(cleaner); } useSystemGc = false; } catch (Throwable e) { // useSystemGc is already true } finally { mapped = null; } } if (useSystemGc) { WeakReference<MappedByteBuffer> bufferWeakRef = new WeakReference<MappedByteBuffer>(mapped); mapped = null; long start = System.currentTimeMillis(); while (bufferWeakRef.get() != null) { if (System.currentTimeMillis() - start > GC_TIMEOUT_MS) { throw new IOException("Timeout (" + GC_TIMEOUT_MS + " ms) reached while trying to GC mapped buffer"); } System.gc(); Thread.yield(); } } }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
private void reMap() throws IOException { int oldPos = 0; if (mapped != null) { oldPos = pos; unMap(); } fileLength = file.length(); checkFileSizeLimit(fileLength); // maps new MappedByteBuffer; the old one is disposed during GC mapped = file.getChannel().map(mode, 0, fileLength); int limit = mapped.limit(); int capacity = mapped.capacity(); if (limit < fileLength || capacity < fileLength) { throw new IOException("Unable to map: length=" + limit + " capacity=" + capacity + " length=" + fileLength); } if (SysProperties.NIO_LOAD_MAPPED) { mapped.load(); } this.pos = Math.min(oldPos, (int) fileLength); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
private static void checkFileSizeLimit(long length) throws IOException { if (length > Integer.MAX_VALUE) { throw new IOException("File over 2GB is not supported yet when using this file system"); } }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public void implCloseChannel() throws IOException { if (file != null) { unMap(); file.close(); file = null; } }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public synchronized long size() throws IOException { return fileLength; }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public synchronized int read(ByteBuffer dst) throws IOException { try { int len = dst.remaining(); if (len == 0) { return 0; } len = (int) Math.min(len, fileLength - pos); if (len <= 0) { return -1; } mapped.position(pos); mapped.get(dst.array(), dst.position(), len); dst.position(dst.position() + len); pos += len; return len; } catch (IllegalArgumentException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; } catch (BufferUnderflowException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; } }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public FileChannel position(long pos) throws IOException { checkFileSizeLimit(pos); this.pos = (int) pos; return this; }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public synchronized FileChannel truncate(long newLength) throws IOException { if (newLength < size()) { setFileLength(newLength); } return this; }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public synchronized void setFileLength(long newLength) throws IOException { checkFileSizeLimit(newLength); int oldPos = pos; unMap(); for (int i = 0;; i++) { try { file.setLength(newLength); break; } catch (IOException e) { if (i > 16 || e.toString().indexOf("user-mapped section open") < 0) { throw e; } } System.gc(); } reMap(); pos = (int) Math.min(newLength, oldPos); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public void force(boolean metaData) throws IOException { mapped.force(); file.getFD().sync(); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public synchronized int write(ByteBuffer src) throws IOException { int len = src.remaining(); // check if need to expand file if (mapped.capacity() < pos + len) { setFileLength(pos + len); } mapped.position(pos); mapped.put(src); pos += len; return len; }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return file.getChannel().tryLock(); }
// in src/main/org/h2/store/fs/FilePathZip.java
public InputStream newInputStream() throws IOException { return new FileChannelInputStream(open("r")); }
// in src/main/org/h2/store/fs/FilePathZip.java
public FileChannel open(String mode) throws IOException { ZipFile file = openZipFile(); ZipEntry entry = file.getEntry(getEntryName()); if (entry == null) { throw new FileNotFoundException(name); } return new FileZip(file, entry); }
// in src/main/org/h2/store/fs/FilePathZip.java
private ZipFile openZipFile() throws IOException { String fileName = translateFileName(name); return new ZipFile(fileName); }
// in src/main/org/h2/store/fs/FilePathZip.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { if (!inTempDir) { throw new IOException("File system is read-only"); } return new FilePathDisk().getPath(name).createTempFile(suffix, deleteOnExit, true); }
// in src/main/org/h2/store/fs/FilePathZip.java
public int read(ByteBuffer dst) throws IOException { seek(); int len = in.read(dst.array(), dst.position(), dst.remaining()); if (len > 0) { dst.position(dst.position() + len); pos += len; inPos += len; } return len; }
// in src/main/org/h2/store/fs/FilePathZip.java
private void seek() throws IOException { if (inPos > pos) { if (in != null) { in.close(); } in = null; } if (in == null) { in = file.getInputStream(entry); inPos = 0; } if (inPos < pos) { long skip = pos - inPos; if (!skipUsingRead) { try { IOUtils.skipFully(in, skip); } catch (NullPointerException e) { // workaround for Android skipUsingRead = true; } } if (skipUsingRead) { while (skip > 0) { int s = (int) Math.min(SKIP_BUFFER.length, skip); s = in.read(SKIP_BUFFER, 0, s); skip -= s; } } inPos = pos; } }
// in src/main/org/h2/store/fs/FilePathZip.java
public FileChannel truncate(long newLength) throws IOException { throw new IOException("File is read-only"); }
// in src/main/org/h2/store/fs/FilePathZip.java
public void force(boolean metaData) throws IOException { // nothing to do }
// in src/main/org/h2/store/fs/FilePathZip.java
public int write(ByteBuffer src) throws IOException { throw new IOException("File is read-only"); }
// in src/main/org/h2/store/fs/FilePathZip.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return null; }
// in src/main/org/h2/store/fs/FilePathDisk.java
public InputStream newInputStream() throws IOException { if (name.indexOf(':') > 1) { // if the : is in position 1, a windows file access is assumed: C:.. or D: if (name.startsWith(CLASSPATH_PREFIX)) { String fileName = name.substring(CLASSPATH_PREFIX.length()); if (!fileName.startsWith("/")) { fileName = "/" + fileName; } InputStream in = getClass().getResourceAsStream(fileName); if (in == null) { in = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); } if (in == null) { throw new FileNotFoundException("resource " + fileName); } return in; } // otherwise an URL is assumed URL url = new URL(name); InputStream in = url.openStream(); return in; } FileInputStream in = new FileInputStream(name); IOUtils.trace("openFileInputStream", name, in); return in; }
// in src/main/org/h2/store/fs/FilePathDisk.java
public FileChannel open(String mode) throws IOException { FileDisk f; try { f = new FileDisk(name, mode); IOUtils.trace("open", name, f); } catch (IOException e) { freeMemoryAndFinalize(); try { f = new FileDisk(name, mode); } catch (IOException e2) { throw e; } } return f; }
// in src/main/org/h2/store/fs/FilePathDisk.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { String fileName = name + "."; String prefix = new File(fileName).getName(); File dir; if (inTempDir) { dir = new File(Utils.getProperty("java.io.tmpdir", ".")); } else { dir = new File(fileName).getAbsoluteFile().getParentFile(); } FileUtils.createDirectories(dir.getAbsolutePath()); while (true) { File f = new File(dir, prefix + getNextTempFileNamePart(false) + suffix); if (f.exists() || !f.createNewFile()) { // in theory, the random number could collide getNextTempFileNamePart(true); continue; } if (deleteOnExit) { try { f.deleteOnExit(); } catch (Throwable e) { // sometimes this throws a NullPointerException // at java.io.DeleteOnExitHook.add(DeleteOnExitHook.java:33) // we can ignore it } } return get(f.getCanonicalPath()); } }
// in src/main/org/h2/store/fs/FilePathDisk.java
public void force(boolean metaData) throws IOException { String m = SysProperties.SYNC_METHOD; if ("".equals(m)) { // do nothing } else if ("sync".equals(m)) { file.getFD().sync(); } else if ("force".equals(m)) { file.getChannel().force(true); } else if ("forceFalse".equals(m)) { file.getChannel().force(false); } else { file.getFD().sync(); } }
// in src/main/org/h2/store/fs/FilePathDisk.java
public FileChannel truncate(long newLength) throws IOException { if (newLength < file.length()) { // some implementations actually only support truncate file.setLength(newLength); } return this; }
// in src/main/org/h2/store/fs/FilePathDisk.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return file.getChannel().tryLock(); }
// in src/main/org/h2/store/fs/FilePathDisk.java
public void implCloseChannel() throws IOException { file.close(); }
// in src/main/org/h2/store/fs/FilePathDisk.java
public long position() throws IOException { return file.getFilePointer(); }
// in src/main/org/h2/store/fs/FilePathDisk.java
public long size() throws IOException { return file.length(); }
// in src/main/org/h2/store/fs/FilePathDisk.java
public int read(ByteBuffer dst) throws IOException { int len = file.read(dst.array(), dst.position(), dst.remaining()); if (len > 0) { dst.position(dst.position() + len); } return len; }
// in src/main/org/h2/store/fs/FilePathDisk.java
public FileChannel position(long pos) throws IOException { file.seek(pos); return this; }
// in src/main/org/h2/store/fs/FilePathDisk.java
public int write(ByteBuffer src) throws IOException { int len = src.remaining(); file.write(src.array(), src.position(), len); src.position(src.position() + len); return len; }
// in src/main/org/h2/store/fs/FileBase.java
public void force(boolean metaData) throws IOException { // ignore }
// in src/main/org/h2/store/fs/FileBase.java
public FileLock lock(long position, long size, boolean shared) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public MappedByteBuffer map(MapMode mode, long position, long size) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public int read(ByteBuffer dst, long position) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long transferFrom(ReadableByteChannel src, long position, long count) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long transferTo(long position, long count, WritableByteChannel target) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public FileLock tryLock(long position, long size, boolean shared) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public int write(ByteBuffer src, long position) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
protected void implCloseChannel() throws IOException { // ignore }
// in src/main/org/h2/store/fs/FileUtils.java
public static FileChannel open(String fileName, String mode) throws IOException { return FilePath.get(fileName).open(mode); }
// in src/main/org/h2/store/fs/FileUtils.java
public static InputStream newInputStream(String fileName) throws IOException { return FilePath.get(fileName).newInputStream(); }
// in src/main/org/h2/store/fs/FileUtils.java
public static void copy(String original, String copy) throws IOException { InputStream in = newInputStream(original); OutputStream out = newOutputStream(copy, false); IOUtils.copyAndClose(in, out); }
// in src/main/org/h2/store/fs/FileUtils.java
public static String createTempFile(String prefix, String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { return FilePath.get(prefix).createTempFile(suffix, deleteOnExit, inTempDir).toString(); }
// in src/main/org/h2/store/fs/FileUtils.java
public static void readFully(FileChannel channel, ByteBuffer dst) throws IOException { do { int r = channel.read(dst); if (r < 0) { throw new EOFException(); } } while (dst.remaining() > 0); }
// in src/main/org/h2/store/fs/FileUtils.java
public static void writeFully(FileChannel channel, ByteBuffer src) throws IOException { do { channel.write(src); } while (src.remaining() > 0); }
// in src/main/org/h2/store/PageStore.java
public synchronized int copyDirect(int pageId, OutputStream out) throws IOException { byte[] buffer = new byte[pageSize]; if (pageId >= pageCount) { return -1; } file.seek((long) pageId << pageSizeShift); file.readFullyDirect(buffer, 0, pageSize); readCount++; out.write(buffer, 0, pageSize); return pageId + 1; }
// in src/main/org/h2/store/FileStore.java
public void closeFile() throws IOException { file.close(); file = null; }
// in src/main/org/h2/store/FileStore.java
public void openFile() throws IOException { if (file == null) { file = FileUtils.open(name, mode); file.position(filePos); } }
// in src/main/org/h2/compress/LZFOutputStream.java
public void write(int b) throws IOException { if (pos >= buffer.length) { flush(); } buffer[pos++] = (byte) b; }
// in src/main/org/h2/compress/LZFOutputStream.java
private void compressAndWrite(byte[] buff, int len) throws IOException { if (len > 0) { ensureOutput(len); int compressed = compress.compress(buff, len, outBuffer, 0); if (compressed > len) { writeInt(-len); out.write(buff, 0, len); } else { writeInt(compressed); writeInt(len); out.write(outBuffer, 0, compressed); } } }
// in src/main/org/h2/compress/LZFOutputStream.java
private void writeInt(int x) throws IOException { out.write((byte) (x >> 24)); out.write((byte) (x >> 16)); out.write((byte) (x >> 8)); out.write((byte) x); }
// in src/main/org/h2/compress/LZFOutputStream.java
public void write(byte[] buff, int off, int len) throws IOException { while (len > 0) { int copy = Math.min(buffer.length - pos, len); System.arraycopy(buff, off, buffer, pos, copy); pos += copy; if (pos >= buffer.length) { flush(); } off += copy; len -= copy; } }
// in src/main/org/h2/compress/LZFOutputStream.java
public void flush() throws IOException { compressAndWrite(buffer, pos); pos = 0; }
// in src/main/org/h2/compress/LZFOutputStream.java
public void close() throws IOException { flush(); out.close(); }
// in src/main/org/h2/compress/LZFInputStream.java
private void fillBuffer() throws IOException { if (buffer != null && pos < bufferLength) { return; } int len = readInt(); if (decompress == null) { // EOF this.bufferLength = 0; } else if (len < 0) { len = -len; buffer = ensureSize(buffer, len); readFully(buffer, len); this.bufferLength = len; } else { inBuffer = ensureSize(inBuffer, len); int size = readInt(); readFully(inBuffer, len); buffer = ensureSize(buffer, size); try { decompress.expand(inBuffer, 0, len, buffer, 0, size); } catch (ArrayIndexOutOfBoundsException e) { DbException.convertToIOException(e); } this.bufferLength = size; } pos = 0; }
// in src/main/org/h2/compress/LZFInputStream.java
private void readFully(byte[] buff, int len) throws IOException { int off = 0; while (len > 0) { int l = in.read(buff, off, len); len -= l; off += l; } }
// in src/main/org/h2/compress/LZFInputStream.java
private int readInt() throws IOException { int x = in.read(); if (x < 0) { decompress = null; return 0; } x = (x << 24) + (in.read() << 16) + (in.read() << 8) + in.read(); return x; }
// in src/main/org/h2/compress/LZFInputStream.java
public int read() throws IOException { fillBuffer(); if (pos >= bufferLength) { return -1; } return buffer[pos++] & 255; }
// in src/main/org/h2/compress/LZFInputStream.java
public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
// in src/main/org/h2/compress/LZFInputStream.java
public int read(byte[] b, int off, int len) throws IOException { if (len == 0) { return 0; } int read = 0; while (len > 0) { int r = readBlock(b, off, len); if (r < 0) { break; } read += r; off += r; len -= r; } return read == 0 ? -1 : read; }
// in src/main/org/h2/compress/LZFInputStream.java
private int readBlock(byte[] b, int off, int len) throws IOException { fillBuffer(); if (pos >= bufferLength) { return -1; } int max = Math.min(len, bufferLength - pos); max = Math.min(max, b.length - off); System.arraycopy(buffer, pos, b, off, max); pos += max; return max; }
// in src/main/org/h2/compress/LZFInputStream.java
public void close() throws IOException { in.close(); }
// in src/main/org/h2/command/dml/ScriptCommand.java
private int writeLobStream(Value v) throws IOException { if (!tempLobTableCreated) { add("CREATE TABLE IF NOT EXISTS SYSTEM_LOB_STREAM" + "(ID INT NOT NULL, PART INT NOT NULL, CDATA VARCHAR, BDATA BINARY)", true); add("CREATE PRIMARY KEY SYSTEM_LOB_STREAM_PRIMARY_KEY " + "ON SYSTEM_LOB_STREAM(ID, PART)", true); add("CREATE ALIAS IF NOT EXISTS " + "SYSTEM_COMBINE_CLOB FOR \"" + this.getClass().getName() + ".combineClob\"", true); add("CREATE ALIAS IF NOT EXISTS " + "SYSTEM_COMBINE_BLOB FOR \"" + this.getClass().getName() + ".combineBlob\"", true); tempLobTableCreated = true; } int id = nextLobId++; switch (v.getType()) { case Value.BLOB: { byte[] bytes = new byte[lobBlockSize]; InputStream input = v.getInputStream(); try { for (int i = 0;; i++) { StringBuilder buff = new StringBuilder(lobBlockSize * 2); buff.append("INSERT INTO SYSTEM_LOB_STREAM VALUES(" + id + ", " + i + ", NULL, '"); int len = IOUtils.readFully(input, bytes, 0, lobBlockSize); if (len <= 0) { break; } buff.append(StringUtils.convertBytesToHex(bytes, len)).append("')"); String sql = buff.toString(); add(sql, true); } } finally { IOUtils.closeSilently(input); } break; } case Value.CLOB: { char[] chars = new char[lobBlockSize]; Reader reader = v.getReader(); try { for (int i = 0;; i++) { StringBuilder buff = new StringBuilder(lobBlockSize * 2); buff.append("INSERT INTO SYSTEM_LOB_STREAM VALUES(" + id + ", " + i + ", "); int len = IOUtils.readFully(reader, chars, lobBlockSize); if (len < 0) { break; } buff.append(StringUtils.quoteStringSQL(new String(chars, 0, len))). append(", NULL)"); String sql = buff.toString(); add(sql, true); } } finally { IOUtils.closeSilently(reader); } break; } default: DbException.throwInternalError("type:" + v.getType()); } return id; }
// in src/main/org/h2/command/dml/ScriptCommand.java
public static InputStream combineBlob(Connection conn, int id) throws SQLException { if (id < 0) { return null; } final ResultSet rs = getLobStream(conn, "BDATA", id); return new InputStream() { private InputStream current; private boolean closed; public int read() throws IOException { while (true) { try { if (current == null) { if (closed) { return -1; } if (!rs.next()) { close(); return -1; } current = rs.getBinaryStream(1); current = new BufferedInputStream(current); } int x = current.read(); if (x >= 0) { return x; } current = null; } catch (SQLException e) { throw DbException.convertToIOException(e); } } } public void close() throws IOException { if (closed) { return; } closed = true; try { rs.close(); } catch (SQLException e) { throw DbException.convertToIOException(e); } } }; }
// in src/main/org/h2/command/dml/ScriptCommand.java
public int read() throws IOException { while (true) { try { if (current == null) { if (closed) { return -1; } if (!rs.next()) { close(); return -1; } current = rs.getBinaryStream(1); current = new BufferedInputStream(current); } int x = current.read(); if (x >= 0) { return x; } current = null; } catch (SQLException e) { throw DbException.convertToIOException(e); } } }
// in src/main/org/h2/command/dml/ScriptCommand.java
public void close() throws IOException { if (closed) { return; } closed = true; try { rs.close(); } catch (SQLException e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/command/dml/ScriptCommand.java
public static Reader combineClob(Connection conn, int id) throws SQLException { if (id < 0) { return null; } final ResultSet rs = getLobStream(conn, "CDATA", id); return new Reader() { private Reader current; private boolean closed; public int read() throws IOException { while (true) { try { if (current == null) { if (closed) { return -1; } if (!rs.next()) { close(); return -1; } current = rs.getCharacterStream(1); current = new BufferedReader(current); } int x = current.read(); if (x >= 0) { return x; } current = null; } catch (SQLException e) { throw DbException.convertToIOException(e); } } } public void close() throws IOException { if (closed) { return; } closed = true; try { rs.close(); } catch (SQLException e) { throw DbException.convertToIOException(e); } } public int read(char[] buffer, int off, int len) throws IOException { if (len == 0) { return 0; } int c = read(); if (c == -1) { return -1; } buffer[off] = (char) c; int i = 1; for (; i < len; i++) { c = read(); if (c == -1) { break; } buffer[off + i] = (char) c; } return i; } }; }
// in src/main/org/h2/command/dml/ScriptCommand.java
public int read() throws IOException { while (true) { try { if (current == null) { if (closed) { return -1; } if (!rs.next()) { close(); return -1; } current = rs.getCharacterStream(1); current = new BufferedReader(current); } int x = current.read(); if (x >= 0) { return x; } current = null; } catch (SQLException e) { throw DbException.convertToIOException(e); } } }
// in src/main/org/h2/command/dml/ScriptCommand.java
public void close() throws IOException { if (closed) { return; } closed = true; try { rs.close(); } catch (SQLException e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/command/dml/ScriptCommand.java
public int read(char[] buffer, int off, int len) throws IOException { if (len == 0) { return 0; } int c = read(); if (c == -1) { return -1; } buffer[off] = (char) c; int i = 1; for (; i < len; i++) { c = read(); if (c == -1) { break; } buffer[off + i] = (char) c; } return i; }
// in src/main/org/h2/command/dml/ScriptCommand.java
private void add(String s, boolean insert) throws IOException { if (s == null) { return; } s += ";"; if (out != null) { byte[] buff = s.getBytes(charset); int len = MathUtils.roundUpInt(buff.length + lineSeparator.length, Constants.FILE_BLOCK_SIZE); buffer = Utils.copy(buff, buffer); if (len > buffer.length) { buffer = new byte[len]; } System.arraycopy(buff, 0, buffer, 0, buff.length); for (int i = buff.length; i < len - lineSeparator.length; i++) { buffer[i] = ' '; } for (int j = 0, i = len - lineSeparator.length; i < len; i++, j++) { buffer[i] = lineSeparator[j]; } out.write(buffer, 0, len); if (!insert) { Value[] row = { ValueString.get(s) }; result.addRow(row); } } else { Value[] row = { ValueString.get(s) }; result.addRow(row); } }
// in src/main/org/h2/command/dml/BackupCommand.java
private void backupPageStore(ZipOutputStream out, String fileName, PageStore store) throws IOException { Database db = session.getDatabase(); fileName = FileUtils.getName(fileName); out.putNextEntry(new ZipEntry(fileName)); int pos = 0; try { store.setBackup(true); while (true) { pos = store.copyDirect(pos, out); if (pos < 0) { break; } int max = store.getPageCount(); db.setProgress(DatabaseEventListener.STATE_BACKUP_FILE, fileName, pos, max); } } finally { store.setBackup(false); } out.closeEntry(); }
// in src/main/org/h2/command/dml/BackupCommand.java
private static void backupFile(ZipOutputStream out, String base, String fn) throws IOException { String f = FileUtils.toRealPath(fn); base = FileUtils.toRealPath(base); if (!f.startsWith(base)) { DbException.throwInternalError(f + " does not start with " + base); } f = f.substring(base.length()); f = correctFileName(f); out.putNextEntry(new ZipEntry(f)); InputStream in = FileUtils.newInputStream(fn); IOUtils.copyAndCloseInput(in, out); out.closeEntry(); }
// in src/main/org/h2/command/CommandRemote.java
private void sendParameters(Transfer transfer) throws IOException { int len = parameters.size(); transfer.writeInt(len); for (ParameterInterface p : parameters) { transfer.writeValue(p.getParamValue()); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public Writer setCharacterStream(long pos) throws SQLException { try { if (isDebugEnabled()) { debugCodeCall("setCharacterStream(" + pos + ");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } if (value.getPrecision() != 0) { throw DbException.getInvalidValueException("length", value.getPrecision()); } final JdbcConnection c = conn; // PipedReader / PipedWriter are a lot slower // than PipedInputStream / PipedOutputStream // (Sun/Oracle Java 1.6.0_20) final PipedInputStream in = new PipedInputStream(); final Task task = new Task() { public void call() { value = c.createClob(IOUtils.getReader(in), -1); } }; PipedOutputStream out = new PipedOutputStream(in) { public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } } }; task.execute(); return IOUtils.getBufferedWriter(out); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public OutputStream setBinaryStream(long pos) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBinaryStream("+pos+");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } if (value.getPrecision() != 0) { throw DbException.getInvalidValueException("length", value.getPrecision()); } final JdbcConnection c = conn; final PipedInputStream in = new PipedInputStream(); final Task task = new Task() { public void call() { value = c.createBlob(in, -1); } }; PipedOutputStream out = new PipedOutputStream(in) { public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } } }; task.execute(); return new BufferedOutputStream(out); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/bnf/Bnf.java
public static Bnf getInstance(Reader csv) throws SQLException, IOException { Bnf bnf = new Bnf(); if (csv == null) { byte[] data = Utils.getResource("/org/h2/res/help.csv"); csv = new InputStreamReader(new ByteArrayInputStream(data)); } bnf.parse(csv); return bnf; }
// in src/main/org/h2/bnf/Bnf.java
private void parse(Reader reader) throws SQLException, IOException { Rule functions = null; statements = New.arrayList(); Csv csv = new Csv(); csv.setLineCommentCharacter('#'); ResultSet rs = csv.read(reader, null); while (rs.next()) { String section = rs.getString("SECTION").trim(); if (section.startsWith("System")) { continue; } String topic = rs.getString("TOPIC"); syntax = rs.getString("SYNTAX").trim(); currentTopic = section; tokens = tokenize(); index = 0; Rule rule = parseRule(); if (section.startsWith("Command")) { rule = new RuleList(rule, new RuleElement(";\n\n", currentTopic), false); } RuleHead head = addRule(topic, section, rule); if (section.startsWith("Function")) { if (functions == null) { functions = rule; } else { functions = new RuleList(rule, functions, true); } } else if (section.startsWith("Commands")) { statements.add(head); } } addRule("@func@", "Function", functions); addFixedRule("@ymd@", RuleFixed.YMD); addFixedRule("@hms@", RuleFixed.HMS); addFixedRule("@nanos@", RuleFixed.NANOS); addFixedRule("anything_except_single_quote", RuleFixed.ANY_EXCEPT_SINGLE_QUOTE); addFixedRule("anything_except_double_quote", RuleFixed.ANY_EXCEPT_DOUBLE_QUOTE); addFixedRule("anything_until_end_of_line", RuleFixed.ANY_UNTIL_EOL); addFixedRule("anything_until_end_comment", RuleFixed.ANY_UNTIL_END); addFixedRule("anything_except_two_dollar_signs", RuleFixed.ANY_EXCEPT_2_DOLLAR); addFixedRule("anything", RuleFixed.ANY_WORD); addFixedRule("@hex_start@", RuleFixed.HEX_START); addFixedRule("@concat@", RuleFixed.CONCAT); addFixedRule("@az_@", RuleFixed.AZ_UNDERSCORE); addFixedRule("@af@", RuleFixed.AF); addFixedRule("@digit@", RuleFixed.DIGIT); addFixedRule("@open_bracket@", RuleFixed.OPEN_BRACKET); addFixedRule("@close_bracket@", RuleFixed.CLOSE_BRACKET); }
// in src/main/org/h2/engine/SessionRemote.java
private Transfer initTransfer(ConnectionInfo ci, String db, String server) throws IOException { Socket socket = NetUtils.createSocket(server, Constants.DEFAULT_TCP_PORT, ci.isSSL()); Transfer trans = new Transfer(this); trans.setSocket(socket); trans.setSSL(ci.isSSL()); trans.init(); trans.writeInt(Constants.TCP_PROTOCOL_VERSION_6); trans.writeInt(Constants.TCP_PROTOCOL_VERSION_11); trans.writeString(db); trans.writeString(ci.getOriginalURL()); trans.writeString(ci.getUserName()); trans.writeBytes(ci.getUserPasswordHash()); trans.writeBytes(ci.getFilePasswordHash()); String[] keys = ci.getKeys(); trans.writeInt(keys.length); for (String key : keys) { trans.writeString(key).writeString(ci.getProperty(key)); } try { done(trans); clientVersion = trans.readInt(); trans.setVersion(clientVersion); trans.writeInt(SessionRemote.SESSION_SET_ID); trans.writeString(sessionId); done(trans); } catch (DbException e) { trans.close(); throw e; } autoCommit = true; return trans; }
// in src/main/org/h2/engine/SessionRemote.java
public void done(Transfer transfer) throws IOException { transfer.flush(); int status = transfer.readInt(); if (status == STATUS_ERROR) { String sqlstate = transfer.readString(); String message = transfer.readString(); String sql = transfer.readString(); int errorCode = transfer.readInt(); String stackTrace = transfer.readString(); JdbcSQLException s = new JdbcSQLException(message, sql, sqlstate, errorCode, null, stackTrace); if (errorCode == ErrorCode.CONNECTION_BROKEN_1) { // allow re-connect IOException e = new IOException(s.toString()); e.initCause(s); throw e; } throw DbException.convert(s); } else if (status == STATUS_CLOSED) { transferList = null; } else if (status == STATUS_OK_STATE_CHANGED) { sessionStateChanged = true; } else if (status == STATUS_OK) { // ok } else { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "unexpected status " + status); } }
// in src/main/org/h2/util/SortedProperties.java
public static synchronized SortedProperties loadProperties(String fileName) throws IOException { SortedProperties prop = new SortedProperties(); if (FileUtils.exists(fileName)) { InputStream in = null; try { in = FileUtils.newInputStream(fileName); prop.load(in); } finally { if (in != null) { in.close(); } } } return prop; }
// in src/main/org/h2/util/SortedProperties.java
public synchronized void store(String fileName) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); store(out, null); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); InputStreamReader reader = new InputStreamReader(in, "ISO8859-1"); LineNumberReader r = new LineNumberReader(reader); Writer w; try { w = new OutputStreamWriter(FileUtils.newOutputStream(fileName, false)); } catch (Exception e) { throw DbException.convertToIOException(e); } PrintWriter writer = new PrintWriter(new BufferedWriter(w)); while (true) { String line = r.readLine(); if (line == null) { break; } if (!line.startsWith("#")) { writer.print(line + "\n"); } } writer.close(); }
// in src/main/org/h2/util/ScriptReader.java
private String readStatementLoop() throws IOException { bufferStart = bufferPos; int c = read(); while (true) { if (c < 0) { endOfFile = true; if (bufferPos - 1 == bufferStart) { return null; } break; } else if (c == ';') { break; } switch (c) { case '$': { c = read(); if (c == '$' && (bufferPos - bufferStart < 3 || buffer[bufferPos - 3] <= ' ')) { // dollar quoted string while (true) { c = read(); if (c < 0) { break; } if (c == '$') { c = read(); if (c < 0) { break; } if (c == '$') { break; } } } c = read(); } break; } case '\'': while (true) { c = read(); if (c < 0) { break; } if (c == '\'') { break; } } c = read(); break; case '"': while (true) { c = read(); if (c < 0) { break; } if (c == '\"') { break; } } c = read(); break; case '/': { c = read(); if (c == '*') { // block comment startRemark(false); while (true) { c = read(); if (c < 0) { break; } if (c == '*') { c = read(); if (c < 0) { clearRemark(); break; } if (c == '/') { endRemark(); break; } } } c = read(); } else if (c == '/') { // single line comment startRemark(false); while (true) { c = read(); if (c < 0) { clearRemark(); break; } if (c == '\r' || c == '\n') { endRemark(); break; } } c = read(); } break; } case '-': { c = read(); if (c == '-') { // single line comment startRemark(false); while (true) { c = read(); if (c < 0) { clearRemark(); break; } if (c == '\r' || c == '\n') { endRemark(); break; } } c = read(); } break; } default: { c = read(); } } } return new String(buffer, bufferStart, bufferPos - 1 - bufferStart); }
// in src/main/org/h2/util/ScriptReader.java
private int read() throws IOException { if (bufferPos >= bufferEnd) { return readBuffer(); } return buffer[bufferPos++]; }
// in src/main/org/h2/util/ScriptReader.java
private int readBuffer() throws IOException { if (endOfFile) { return -1; } int keep = bufferPos - bufferStart; if (keep > 0) { char[] src = buffer; if (keep + Constants.IO_BUFFER_SIZE > src.length) { buffer = new char[src.length * 2]; } System.arraycopy(src, bufferStart, buffer, 0, keep); } remarkStart -= bufferStart; bufferStart = 0; bufferPos = keep; int len = reader.read(buffer, keep, Constants.IO_BUFFER_SIZE); if (len == -1) { // ensure bufferPos > bufferEnd bufferEnd = -1024; endOfFile = true; // ensure the right number of characters are read // in case the input buffer is still used bufferPos++; return -1; } bufferEnd = keep + len; return buffer[bufferPos++]; }
// in src/main/org/h2/util/SourceCompiler.java
private static void copyInThread(final InputStream in, final OutputStream out) { new Task() { public void call() throws IOException { IOUtils.copy(in, out); } }.execute(); }
// in src/main/org/h2/util/SourceCompiler.java
public void call() throws IOException { IOUtils.copy(in, out); }
// in src/main/org/h2/util/NetUtils.java
public static Socket createLoopbackSocket(int port, boolean ssl) throws IOException { InetAddress address = getBindAddress(); if (address == null) { address = InetAddress.getLocalHost(); } try { return createSocket(getHostAddress(address), port, ssl); } catch (IOException e) { try { return createSocket("localhost", port, ssl); } catch (IOException e2) { // throw the original exception throw e; } } }
// in src/main/org/h2/util/NetUtils.java
public static Socket createSocket(String server, int defaultPort, boolean ssl) throws IOException { int port = defaultPort; // IPv6: RFC 2732 format is '[a:b:c:d:e:f:g:h]' or // '[a:b:c:d:e:f:g:h]:port' // RFC 2396 format is 'a.b.c.d' or 'a.b.c.d:port' or 'hostname' or // 'hostname:port' int startIndex = server.startsWith("[") ? server.indexOf(']') : 0; int idx = server.indexOf(':', startIndex); if (idx >= 0) { port = Integer.decode(server.substring(idx + 1)); server = server.substring(0, idx); } InetAddress address = InetAddress.getByName(server); return createSocket(address, port, ssl); }
// in src/main/org/h2/util/NetUtils.java
public static Socket createSocket(InetAddress address, int port, boolean ssl) throws IOException { long start = System.currentTimeMillis(); for (int i = 0;; i++) { try { if (ssl) { return CipherFactory.createSocket(address, port); } Socket socket = new Socket(); socket.connect(new InetSocketAddress(address, port), SysProperties.SOCKET_CONNECT_TIMEOUT); return socket; } catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } } } }
// in src/main/org/h2/util/IOUtils.java
public static void skipFully(InputStream in, long skip) throws IOException { try { while (skip > 0) { long skipped = in.skip(skip); if (skipped <= 0) { throw new EOFException(); } skip -= skipped; } } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/util/IOUtils.java
public static void skipFully(Reader reader, long skip) throws IOException { try { while (skip > 0) { long skipped = reader.skip(skip); if (skipped <= 0) { throw new EOFException(); } skip -= skipped; } } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/util/IOUtils.java
public static long copyAndClose(InputStream in, OutputStream out) throws IOException { try { long len = copyAndCloseInput(in, out); out.close(); return len; } catch (Exception e) { throw DbException.convertToIOException(e); } finally { closeSilently(out); } }
// in src/main/org/h2/util/IOUtils.java
public static long copyAndCloseInput(InputStream in, OutputStream out) throws IOException { try { return copy(in, out); } catch (Exception e) { throw DbException.convertToIOException(e); } finally { closeSilently(in); } }
// in src/main/org/h2/util/IOUtils.java
public static long copy(InputStream in, OutputStream out) throws IOException { return copy(in, out, Long.MAX_VALUE); }
// in src/main/org/h2/util/IOUtils.java
public static long copy(InputStream in, OutputStream out, long length) throws IOException { try { long copied = 0; int len = (int) Math.min(length, Constants.IO_BUFFER_SIZE); byte[] buffer = new byte[len]; while (length > 0) { len = in.read(buffer, 0, len); if (len < 0) { break; } if (out != null) { out.write(buffer, 0, len); } copied += len; length -= len; len = (int) Math.min(length, Constants.IO_BUFFER_SIZE); } return copied; } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/util/IOUtils.java
public static long copyAndCloseInput(Reader in, Writer out, long length) throws IOException { try { long copied = 0; int len = (int) Math.min(length, Constants.IO_BUFFER_SIZE); char[] buffer = new char[len]; while (length > 0) { len = in.read(buffer, 0, len); if (len < 0) { break; } if (out != null) { out.write(buffer, 0, len); } length -= len; len = (int) Math.min(length, Constants.IO_BUFFER_SIZE); copied += len; } return copied; } catch (Exception e) { throw DbException.convertToIOException(e); } finally { in.close(); } }
// in src/main/org/h2/util/IOUtils.java
public static byte[] readBytesAndClose(InputStream in, int length) throws IOException { try { if (length <= 0) { length = Integer.MAX_VALUE; } int block = Math.min(Constants.IO_BUFFER_SIZE, length); ByteArrayOutputStream out = new ByteArrayOutputStream(block); copy(in, out, length); return out.toByteArray(); } catch (Exception e) { throw DbException.convertToIOException(e); } finally { in.close(); } }
// in src/main/org/h2/util/IOUtils.java
public static String readStringAndClose(Reader in, int length) throws IOException { try { if (length <= 0) { length = Integer.MAX_VALUE; } int block = Math.min(Constants.IO_BUFFER_SIZE, length); StringWriter out = new StringWriter(block); copyAndCloseInput(in, out, length); return out.toString(); } finally { in.close(); } }
// in src/main/org/h2/util/IOUtils.java
public static int readFully(InputStream in, byte[] buffer, int off, int max) throws IOException { try { int len = Math.min(max, buffer.length); int result = 0; while (len > 0) { int l = in.read(buffer, off, len); if (l < 0) { break; } result += l; off += l; len -= l; } return result; } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/util/IOUtils.java
public static int readFully(Reader in, char[] buffer, int max) throws IOException { try { int off = 0, len = Math.min(max, buffer.length); if (len == 0) { return 0; } while (true) { int l = len - off; if (l <= 0) { break; } l = in.read(buffer, off, l); if (l < 0) { break; } off += l; } return off <= 0 ? -1 : off; } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/util/Utils.java
public static Object deserialize(byte[] data) { try { ByteArrayInputStream in = new ByteArrayInputStream(data); ObjectInputStream is; if (SysProperties.USE_THREAD_CONTEXT_CLASS_LOADER) { final ClassLoader loader = Thread.currentThread().getContextClassLoader(); is = new ObjectInputStream(in) { protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { try { return Class.forName(desc.getName(), true, loader); } catch (ClassNotFoundException e) { return super.resolveClass(desc); } } }; } else { is = new ObjectInputStream(in); } return is.readObject(); } catch (Throwable e) { throw DbException.get(ErrorCode.DESERIALIZATION_FAILED_1, e, e.toString()); } }
// in src/main/org/h2/util/Utils.java
protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { try { return Class.forName(desc.getName(), true, loader); } catch (ClassNotFoundException e) { return super.resolveClass(desc); } }
// in src/main/org/h2/util/Utils.java
public static byte[] getResource(String name) throws IOException { byte[] data = RESOURCES.get(name); if (data == null) { data = loadResource(name); RESOURCES.put(name, data); } return data == null ? EMPTY_BYTES : data; }
// in src/main/org/h2/util/Utils.java
private static byte[] loadResource(String name) throws IOException { InputStream in = Utils.class.getResourceAsStream("data.zip"); if (in == null) { in = Utils.class.getResourceAsStream(name); if (in == null) { return null; } return IOUtils.readBytesAndClose(in, 0); } ZipInputStream zipIn = new ZipInputStream(in); try { while (true) { ZipEntry entry = zipIn.getNextEntry(); if (entry == null) { break; } String entryName = entry.getName(); if (!entryName.startsWith("/")) { entryName = "/" + entryName; } if (entryName.equals(name)) { ByteArrayOutputStream out = new ByteArrayOutputStream(); IOUtils.copy(zipIn, out); zipIn.closeEntry(); return out.toByteArray(); } zipIn.closeEntry(); } } catch (IOException e) { // if this happens we have a real problem e.printStackTrace(); } finally { zipIn.close(); } return null; }
// in src/main/org/h2/util/AutoCloseInputStream.java
private int autoClose(int x) throws IOException { if (x < 0) { close(); } return x; }
// in src/main/org/h2/util/AutoCloseInputStream.java
public void close() throws IOException { if (!closed) { in.close(); closed = true; } }
// in src/main/org/h2/util/AutoCloseInputStream.java
public int read(byte[] b, int off, int len) throws IOException { return closed ? -1 : autoClose(in.read(b, off, len)); }
// in src/main/org/h2/util/AutoCloseInputStream.java
public int read(byte[] b) throws IOException { return closed ? -1 : autoClose(in.read(b)); }
// in src/main/org/h2/util/AutoCloseInputStream.java
public int read() throws IOException { return closed ? -1 : autoClose(in.read()); }
// in src/main/org/h2/server/pg/PgServerThread.java
private String readString() throws IOException { ByteArrayOutputStream buff = new ByteArrayOutputStream(); while (true) { int x = dataIn.read(); if (x <= 0) { break; } buff.write(x); } return new String(buff.toByteArray(), getEncoding()); }
// in src/main/org/h2/server/pg/PgServerThread.java
private int readInt() throws IOException { return dataIn.readInt(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private int readShort() throws IOException { return dataIn.readShort(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private byte readByte() throws IOException { return dataIn.readByte(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void readFully(byte[] buff) throws IOException { dataIn.readFully(buff); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void process() throws IOException { int x; if (initDone) { x = dataInRaw.read(); if (x < 0) { stop = true; return; } } else { x = 0; } int len = dataInRaw.readInt(); len -= 4; byte[] data = Utils.newBytes(len); dataInRaw.readFully(data, 0, len); dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len)); switchBlock: switch (x) { case 0: server.trace("Init"); int version = readInt(); if (version == 80877102) { server.trace("CancelRequest (not supported)"); server.trace(" pid: " + readInt()); server.trace(" key: " + readInt()); } else if (version == 80877103) { server.trace("SSLRequest"); out.write('N'); } else { server.trace("StartupMessage"); server.trace(" version " + version + " (" + (version >> 16) + "." + (version & 0xff) + ")"); while (true) { String param = readString(); if (param.length() == 0) { break; } String value = readString(); if ("user".equals(param)) { this.userName = value; } else if ("database".equals(param)) { this.databaseName = value; } else if ("client_encoding".equals(param)) { // UTF8 clientEncoding = value; } else if ("DateStyle".equals(param)) { dateStyle = value; } // extra_float_digits 2 // geqo on (Genetic Query Optimization) server.trace(" param " + param + "=" + value); } sendAuthenticationCleartextPassword(); initDone = true; } break; case 'p': { server.trace("PasswordMessage"); String password = readString(); try { Properties info = new Properties(); info.put("MODE", "PostgreSQL"); info.put("USER", userName); info.put("PASSWORD", password); String url = "jdbc:h2:" + databaseName; ConnectionInfo ci = new ConnectionInfo(url, info); String baseDir = server.getBaseDir(); if (baseDir == null) { baseDir = SysProperties.getBaseDir(); } if (baseDir != null) { ci.setBaseDir(baseDir); } if (server.getIfExists()) { ci.setProperty("IFEXISTS", "TRUE"); } conn = new JdbcConnection(ci, false); // can not do this because when called inside // DriverManager.getConnection, a deadlock occurs // conn = DriverManager.getConnection(url, userName, password); initDb(); sendAuthenticationOk(); } catch (Exception e) { e.printStackTrace(); stop = true; } break; } case 'P': { server.trace("Parse"); Prepared p = new Prepared(); p.name = readString(); p.sql = getSQL(readString()); int count = readShort(); p.paramType = new int[count]; for (int i = 0; i < count; i++) { int type = readInt(); server.checkType(type); p.paramType[i] = type; } try { p.prep = (JdbcPreparedStatement) conn.prepareStatement(p.sql); prepared.put(p.name, p); sendParseComplete(); } catch (Exception e) { sendErrorResponse(e); } break; } case 'B': { server.trace("Bind"); Portal portal = new Portal(); portal.name = readString(); String prepName = readString(); Prepared prep = prepared.get(prepName); if (prep == null) { sendErrorResponse("Prepared not found"); break; } portal.prep = prep; portals.put(portal.name, portal); int formatCodeCount = readShort(); int[] formatCodes = new int[formatCodeCount]; for (int i = 0; i < formatCodeCount; i++) { formatCodes[i] = readShort(); } int paramCount = readShort(); for (int i = 0; i < paramCount; i++) { int paramLen = readInt(); byte[] d2 = Utils.newBytes(paramLen); readFully(d2); try { setParameter(prep.prep, i, d2, formatCodes); } catch (Exception e) { sendErrorResponse(e); break switchBlock; } } int resultCodeCount = readShort(); portal.resultColumnFormat = new int[resultCodeCount]; for (int i = 0; i < resultCodeCount; i++) { portal.resultColumnFormat[i] = readShort(); } sendBindComplete(); break; } case 'C': { char type = (char) readByte(); String name = readString(); server.trace("Close"); if (type == 'S') { Prepared p = prepared.remove(name); if (p != null) { JdbcUtils.closeSilently(p.prep); } } else if (type == 'P') { portals.remove(name); } else { server.trace("expected S or P, got " + type); sendErrorResponse("expected S or P"); break; } sendCloseComplete(); break; } case 'D': { char type = (char) readByte(); String name = readString(); server.trace("Describe"); if (type == 'S') { Prepared p = prepared.get(name); if (p == null) { sendErrorResponse("Prepared not found: " + name); } else { sendParameterDescription(p); } } else if (type == 'P') { Portal p = portals.get(name); if (p == null) { sendErrorResponse("Portal not found: " + name); } else { PreparedStatement prep = p.prep.prep; try { ResultSetMetaData meta = prep.getMetaData(); sendRowDescription(meta); } catch (Exception e) { sendErrorResponse(e); } } } else { server.trace("expected S or P, got " + type); sendErrorResponse("expected S or P"); } break; } case 'E': { String name = readString(); server.trace("Execute"); Portal p = portals.get(name); if (p == null) { sendErrorResponse("Portal not found: " + name); break; } int maxRows = readShort(); Prepared prepared = p.prep; JdbcPreparedStatement prep = prepared.prep; server.trace(prepared.sql); try { prep.setMaxRows(maxRows); boolean result = prep.execute(); if (result) { try { ResultSet rs = prep.getResultSet(); ResultSetMetaData meta = rs.getMetaData(); sendRowDescription(meta); while (rs.next()) { sendDataRow(rs); } sendCommandComplete(prep, 0); } catch (Exception e) { sendErrorResponse(e); } } else { sendCommandComplete(prep, prep.getUpdateCount()); } } catch (Exception e) { sendErrorResponse(e); } break; } case 'S': { server.trace("Sync"); sendReadyForQuery(); break; } case 'Q': { server.trace("Query"); String query = readString(); ScriptReader reader = new ScriptReader(new StringReader(query)); while (true) { JdbcStatement stat = null; try { String s = reader.readStatement(); if (s == null) { break; } s = getSQL(s); stat = (JdbcStatement) conn.createStatement(); boolean result = stat.execute(s); if (result) { ResultSet rs = stat.getResultSet(); ResultSetMetaData meta = rs.getMetaData(); try { sendRowDescription(meta); while (rs.next()) { sendDataRow(rs); } sendCommandComplete(stat, 0); } catch (Exception e) { sendErrorResponse(e); break; } } else { sendCommandComplete(stat, stat.getUpdateCount()); } } catch (SQLException e) { sendErrorResponse(e); break; } finally { JdbcUtils.closeSilently(stat); } } sendReadyForQuery(); break; } case 'X': { server.trace("Terminate"); close(); break; } default: server.trace("Unsupported: " + x + " (" + (char) x + ")"); break; } }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendCommandComplete(JdbcStatement stat, int updateCount) throws IOException { startMessage('C'); switch (stat.getLastExecutedCommandType()) { case CommandInterface.INSERT: writeStringPart("INSERT 0 "); writeString(Integer.toString(updateCount)); break; case CommandInterface.UPDATE: writeStringPart("UPDATE "); writeString(Integer.toString(updateCount)); break; case CommandInterface.DELETE: writeStringPart("DELETE "); writeString(Integer.toString(updateCount)); break; case CommandInterface.SELECT: case CommandInterface.CALL: writeString("SELECT"); break; case CommandInterface.BEGIN: writeString("BEGIN"); break; default: server.trace("check CommandComplete tag for command " + stat); writeStringPart("UPDATE "); writeString(Integer.toString(updateCount)); } sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendErrorResponse(Exception re) throws IOException { SQLException e = DbException.toSQLException(re); server.traceError(e); startMessage('E'); write('S'); writeString("ERROR"); write('C'); writeString(e.getSQLState()); write('M'); writeString(e.getMessage()); write('D'); writeString(e.toString()); write(0); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendParameterDescription(Prepared p) throws IOException { try { PreparedStatement prep = p.prep; ParameterMetaData meta = prep.getParameterMetaData(); int count = meta.getParameterCount(); startMessage('t'); writeShort(count); for (int i = 0; i < count; i++) { int type; if (p.paramType != null && p.paramType[i] != 0) { type = p.paramType[i]; } else { type = PgServer.PG_TYPE_VARCHAR; } server.checkType(type); writeInt(type); } sendMessage(); } catch (Exception e) { sendErrorResponse(e); } }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendNoData() throws IOException { startMessage('n'); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendErrorResponse(String message) throws IOException { server.trace("Exception: " + message); startMessage('E'); write('S'); writeString("ERROR"); write('C'); // PROTOCOL VIOLATION writeString("08P01"); write('M'); writeString(message); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendParseComplete() throws IOException { startMessage('1'); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendBindComplete() throws IOException { startMessage('2'); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendCloseComplete() throws IOException { startMessage('3'); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendAuthenticationCleartextPassword() throws IOException { startMessage('R'); writeInt(3); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendAuthenticationOk() throws IOException { startMessage('R'); writeInt(0); sendMessage(); sendParameterStatus("client_encoding", clientEncoding); sendParameterStatus("DateStyle", dateStyle); sendParameterStatus("integer_datetimes", "off"); sendParameterStatus("is_superuser", "off"); sendParameterStatus("server_encoding", "SQL_ASCII"); sendParameterStatus("server_version", "8.1.4"); sendParameterStatus("session_authorization", userName); sendParameterStatus("standard_conforming_strings", "off"); // TODO PostgreSQL TimeZone sendParameterStatus("TimeZone", "CET"); sendBackendKeyData(); sendReadyForQuery(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendReadyForQuery() throws IOException { startMessage('Z'); char c; try { if (conn.getAutoCommit()) { // idle c = 'I'; } else { // in a transaction block c = 'T'; } } catch (SQLException e) { // failed transaction block c = 'E'; } write((byte) c); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendBackendKeyData() throws IOException { startMessage('K'); writeInt(processId); writeInt(processId); sendMessage(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void writeString(String s) throws IOException { writeStringPart(s); write(0); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void writeStringPart(String s) throws IOException { write(s.getBytes(getEncoding())); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void writeInt(int i) throws IOException { dataOut.writeInt(i); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void writeShort(int i) throws IOException { dataOut.writeShort(i); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void write(byte[] data) throws IOException { dataOut.write(data); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void write(int b) throws IOException { dataOut.write(b); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendMessage() throws IOException { dataOut.flush(); byte[] buff = outBuffer.toByteArray(); int len = buff.length; dataOut = new DataOutputStream(out); dataOut.write(messageType); dataOut.writeInt(len + 4); dataOut.write(buff); dataOut.flush(); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void sendParameterStatus(String param, String value) throws IOException { startMessage('S'); writeString(param); writeString(value); sendMessage(); }
// in src/main/org/h2/server/TcpServerThread.java
private void setParameters(Command command) throws IOException { int len = transfer.readInt(); ArrayList<? extends ParameterInterface> params = command.getParameters(); for (int i = 0; i < len; i++) { Parameter p = (Parameter) params.get(i); p.setValue(transfer.readValue()); } }
// in src/main/org/h2/server/TcpServerThread.java
private void process() throws IOException { int operation = transfer.readInt(); switch (operation) { case SessionRemote.SESSION_PREPARE_READ_PARAMS: case SessionRemote.SESSION_PREPARE: { int id = transfer.readInt(); String sql = transfer.readString(); int old = session.getModificationId(); Command command = session.prepareLocal(sql); boolean readonly = command.isReadOnly(); cache.addObject(id, command); boolean isQuery = command.isQuery(); ArrayList<? extends ParameterInterface> params = command.getParameters(); transfer.writeInt(getState(old)).writeBoolean(isQuery).writeBoolean(readonly) .writeInt(params.size()); if (operation == SessionRemote.SESSION_PREPARE_READ_PARAMS) { for (ParameterInterface p : params) { ParameterRemote.writeMetaData(transfer, p); } } transfer.flush(); break; } case SessionRemote.SESSION_CLOSE: { stop = true; closeSession(); transfer.writeInt(SessionRemote.STATUS_OK).flush(); close(); break; } case SessionRemote.COMMAND_COMMIT: { if (commit == null) { commit = session.prepareLocal("COMMIT"); } int old = session.getModificationId(); commit.executeUpdate(); transfer.writeInt(getState(old)).flush(); break; } case SessionRemote.COMMAND_GET_META_DATA: { int id = transfer.readInt(); int objectId = transfer.readInt(); Command command = (Command) cache.getObject(id, false); ResultInterface result = command.getMetaData(); cache.addObject(objectId, result); int columnCount = result.getVisibleColumnCount(); transfer.writeInt(SessionRemote.STATUS_OK).writeInt(columnCount).writeInt(0); for (int i = 0; i < columnCount; i++) { ResultColumn.writeColumn(transfer, result, i); } transfer.flush(); break; } case SessionRemote.COMMAND_EXECUTE_QUERY: { int id = transfer.readInt(); int objectId = transfer.readInt(); int maxRows = transfer.readInt(); int fetchSize = transfer.readInt(); Command command = (Command) cache.getObject(id, false); setParameters(command); int old = session.getModificationId(); ResultInterface result = command.executeQuery(maxRows, false); cache.addObject(objectId, result); int columnCount = result.getVisibleColumnCount(); int state = getState(old); transfer.writeInt(state).writeInt(columnCount); int rowCount = result.getRowCount(); transfer.writeInt(rowCount); for (int i = 0; i < columnCount; i++) { ResultColumn.writeColumn(transfer, result, i); } int fetch = Math.min(rowCount, fetchSize); for (int i = 0; i < fetch; i++) { sendRow(result); } transfer.flush(); break; } case SessionRemote.COMMAND_EXECUTE_UPDATE: { int id = transfer.readInt(); Command command = (Command) cache.getObject(id, false); setParameters(command); int old = session.getModificationId(); int updateCount = command.executeUpdate(); int status; if (session.isClosed()) { status = SessionRemote.STATUS_CLOSED; } else { status = getState(old); } transfer.writeInt(status).writeInt(updateCount).writeBoolean(session.getAutoCommit()); transfer.flush(); break; } case SessionRemote.COMMAND_CLOSE: { int id = transfer.readInt(); Command command = (Command) cache.getObject(id, true); if (command != null) { command.close(); cache.freeObject(id); } break; } case SessionRemote.RESULT_FETCH_ROWS: { int id = transfer.readInt(); int count = transfer.readInt(); ResultInterface result = (ResultInterface) cache.getObject(id, false); transfer.writeInt(SessionRemote.STATUS_OK); for (int i = 0; i < count; i++) { sendRow(result); } transfer.flush(); break; } case SessionRemote.RESULT_RESET: { int id = transfer.readInt(); ResultInterface result = (ResultInterface) cache.getObject(id, false); result.reset(); break; } case SessionRemote.RESULT_CLOSE: { int id = transfer.readInt(); ResultInterface result = (ResultInterface) cache.getObject(id, true); if (result != null) { result.close(); cache.freeObject(id); } break; } case SessionRemote.CHANGE_ID: { int oldId = transfer.readInt(); int newId = transfer.readInt(); Object obj = cache.getObject(oldId, false); cache.freeObject(oldId); cache.addObject(newId, obj); break; } case SessionRemote.SESSION_SET_ID: { sessionId = transfer.readString(); transfer.writeInt(SessionRemote.STATUS_OK).flush(); break; } case SessionRemote.SESSION_SET_AUTOCOMMIT: { boolean autoCommit = transfer.readBoolean(); session.setAutoCommit(autoCommit); transfer.writeInt(SessionRemote.STATUS_OK).flush(); break; } case SessionRemote.SESSION_UNDO_LOG_POS: { transfer.writeInt(SessionRemote.STATUS_OK). writeInt(session.getUndoLogPos()).flush(); break; } case SessionRemote.LOB_READ: { long lobId = transfer.readLong(); CachedInputStream in = lobs.get(lobId); if (in == null) { throw DbException.get(ErrorCode.OBJECT_CLOSED); } long offset = transfer.readLong(); if (in.getPos() != offset) { LobStorage lobStorage = session.getDataHandler().getLobStorage(); InputStream lobIn = lobStorage.getInputStream(lobId, -1); in = new CachedInputStream(lobIn); lobs.put(lobId, in); lobIn.skip(offset); } int length = transfer.readInt(); // limit the buffer size length = Math.min(16 * Constants.IO_BUFFER_SIZE, length); transfer.writeInt(SessionRemote.STATUS_OK); byte[] buff = new byte[length]; length = IOUtils.readFully(in, buff, 0, length); transfer.writeInt(length); transfer.writeBytes(buff, 0, length); transfer.flush(); break; } default: trace("Unknown operation: " + operation); closeSession(); close(); } }
// in src/main/org/h2/server/TcpServerThread.java
private void sendRow(ResultInterface result) throws IOException { if (result.next()) { transfer.writeBoolean(true); Value[] v = result.currentRow(); for (int i = 0; i < result.getVisibleColumnCount(); i++) { writeValue(v[i]); } } else { transfer.writeBoolean(false); } }
// in src/main/org/h2/server/TcpServerThread.java
private void writeValue(Value v) throws IOException { if (v.getType() == Value.CLOB || v.getType() == Value.BLOB) { if (v instanceof ValueLobDb) { ValueLobDb lob = (ValueLobDb) v; if (lob.isStored()) { long id = lob.getLobId(); lobs.put(id, new CachedInputStream(null)); } } } transfer.writeValue(v); }
// in src/main/org/h2/server/TcpServerThread.java
public int read(byte[] buff, int off, int len) throws IOException { len = super.read(buff, off, len); if (len > 0) { pos += len; } return len; }
// in src/main/org/h2/server/TcpServerThread.java
public int read() throws IOException { int x = in.read(); if (x >= 0) { pos++; } return x; }
// in src/main/org/h2/server/TcpServerThread.java
public long skip(long n) throws IOException { n = super.skip(n); if (n > 0) { pos += n; } return n; }
// in src/main/org/h2/server/web/WebThread.java
private String readHeaderLine() throws IOException { StringBuilder buff = new StringBuilder(); while (true) { headerBytes++; int c = input.read(); if (c == -1) { throw new IOException("Unexpected EOF"); } else if (c == '\r') { headerBytes++; if (input.read() == '\n') { return buff.length() > 0 ? buff.toString() : null; } } else if (c == '\n') { return buff.length() > 0 ? buff.toString() : null; } else { buff.append((char) c); } } }
// in src/main/org/h2/server/web/WebThread.java
private boolean parseHeader() throws IOException { boolean keepAlive = false; trace("parseHeader"); int len = 0; ifModifiedSince = null; boolean multipart = false; while (true) { String line = readHeaderLine(); if (line == null) { break; } trace(" " + line); String lower = StringUtils.toLowerEnglish(line); if (lower.startsWith("if-modified-since")) { ifModifiedSince = getHeaderLineValue(line); } else if (lower.startsWith("connection")) { String conn = getHeaderLineValue(line); if ("keep-alive".equals(conn)) { keepAlive = true; } } else if (lower.startsWith("content-type")) { String type = getHeaderLineValue(line); if (type.startsWith("multipart/form-data")) { multipart = true; } } else if (lower.startsWith("content-length")) { len = Integer.parseInt(getHeaderLineValue(line)); trace("len=" + len); } else if (lower.startsWith("user-agent")) { boolean isWebKit = lower.indexOf("webkit/") >= 0; if (isWebKit && session != null) { // workaround for what seems to be a WebKit bug: // http://code.google.com/p/chromium/issues/detail?id=6402 session.put("frame-border", "1"); session.put("frameset-border", "2"); } } else if (lower.startsWith("accept-language")) { Locale locale = session == null ? null : session.locale; if (locale == null) { String languages = getHeaderLineValue(line); StringTokenizer tokenizer = new StringTokenizer(languages, ",;"); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (!token.startsWith("q=")) { if (server.supportsLanguage(token)) { int dash = token.indexOf('-'); if (dash >= 0) { String language = token.substring(0, dash); String country = token.substring(dash + 1); locale = new Locale(language, country); } else { locale = new Locale(token, ""); } headerLanguage = locale.getLanguage(); if (session != null) { session.locale = locale; session.put("language", headerLanguage); server.readTranslations(session, headerLanguage); } break; } } } } } else if (line.trim().length() == 0) { break; } } if (multipart) { uploadMultipart(input, len); } else if (session != null && len > 0) { byte[] bytes = Utils.newBytes(len); for (int pos = 0; pos < len;) { pos += input.read(bytes, pos, len - pos); } String s = new String(bytes); parseAttributes(s); } return keepAlive; }
// in src/main/org/h2/server/web/WebThread.java
private void uploadMultipart(InputStream in, int len) throws IOException { if (!new File(WebServer.TRANSFER).exists()) { return; } String fileName = "temp.bin"; headerBytes = 0; String boundary = readHeaderLine(); while (true) { String line = readHeaderLine(); if (line == null) { break; } int index = line.indexOf("filename=\""); if (index > 0) { fileName = line.substring(index + "filename=\"".length(), line.lastIndexOf('"')); } trace(" " + line); } if (!WebServer.isSimpleName(fileName)) { return; } len -= headerBytes; File file = new File(WebServer.TRANSFER, fileName); OutputStream out = new FileOutputStream(file); IOUtils.copy(in, out, len); out.close(); // remove the boundary RandomAccessFile f = new RandomAccessFile(file, "rw"); int testSize = (int) Math.min(f.length(), Constants.IO_BUFFER_SIZE); f.seek(f.length() - testSize); byte[] bytes = Utils.newBytes(Constants.IO_BUFFER_SIZE); f.readFully(bytes, 0, testSize); String s = new String(bytes, "ASCII"); int x = s.lastIndexOf(boundary); f.setLength(f.length() - testSize + x - 2); f.close(); }
// in src/main/org/h2/server/web/WebServlet.java
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { req.setCharacterEncoding("utf-8"); String file = req.getPathInfo(); if (file == null) { resp.sendRedirect(req.getRequestURI() + "/"); return; } else if (file.startsWith("/")) { file = file.substring(1); } file = getAllowedFile(req, file); byte[] bytes = null; Properties attributes = new Properties(); Enumeration<?> en = req.getAttributeNames(); while (en.hasMoreElements()) { String name = en.nextElement().toString(); String value = req.getAttribute(name).toString(); attributes.put(name, value); } en = req.getParameterNames(); while (en.hasMoreElements()) { String name = en.nextElement().toString(); String value = req.getParameter(name); attributes.put(name, value); } WebSession session = null; String sessionId = attributes.getProperty("jsessionid"); if (sessionId != null) { session = server.getSession(sessionId); } WebApp app = new WebApp(server); app.setSession(session, attributes); String ifModifiedSince = req.getHeader("if-modified-since"); String hostAddr = req.getRemoteAddr(); file = app.processRequest(file, hostAddr); session = app.getSession(); String mimeType = app.getMimeType(); boolean cache = app.getCache(); if (cache && server.getStartDateTime().equals(ifModifiedSince)) { resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED); return; } bytes = server.getFile(file); if (bytes == null) { resp.sendError(HttpServletResponse.SC_NOT_FOUND); bytes = StringUtils.utf8Encode("File not found: " + file); } else { if (session != null && file.endsWith(".jsp")) { String page = StringUtils.utf8Decode(bytes); page = PageParser.parse(page, session.map); bytes = StringUtils.utf8Encode(page); } resp.setContentType(mimeType); if (!cache) { resp.setHeader("Cache-Control", "no-cache"); } else { resp.setHeader("Cache-Control", "max-age=10"); resp.setHeader("Last-Modified", server.getStartDateTime()); } } if (bytes != null) { ServletOutputStream out = resp.getOutputStream(); out.write(bytes); } }
// in src/main/org/h2/server/web/WebServlet.java
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { doGet(req, resp); }
// in src/main/org/h2/server/web/WebServer.java
byte[] getFile(String file) throws IOException { trace("getFile <" + file + ">"); if (file.startsWith(TRANSFER + "/") && new File(TRANSFER).exists()) { file = file.substring(TRANSFER.length() + 1); if (!isSimpleName(file)) { return null; } File f = new File(TRANSFER, file); if (!f.exists()) { return null; } return IOUtils.readBytesAndClose(new FileInputStream(f), -1); } byte[] data = Utils.getResource("/org/h2/server/web/res/" + file); if (data == null) { trace(" null"); } else { trace(" size=" + data.length); } return data; }
// in src/main/org/h2/security/CipherFactory.java
public static Socket createSocket(InetAddress address, int port) throws IOException { Socket socket = null; setKeystore(); SSLSocketFactory f = (SSLSocketFactory) SSLSocketFactory.getDefault(); SSLSocket secureSocket = (SSLSocket) f.createSocket(); secureSocket.connect(new InetSocketAddress(address, port), SysProperties.SOCKET_CONNECT_TIMEOUT); if (SysProperties.ENABLE_ANONYMOUS_SSL) { String[] list = secureSocket.getEnabledCipherSuites(); list = addAnonymous(list); secureSocket.setEnabledCipherSuites(list); } socket = secureSocket; return socket; }
// in src/main/org/h2/security/CipherFactory.java
public static ServerSocket createServerSocket(int port, InetAddress bindAddress) throws IOException { ServerSocket socket = null; setKeystore(); ServerSocketFactory f = SSLServerSocketFactory.getDefault(); SSLServerSocket secureSocket; if (bindAddress == null) { secureSocket = (SSLServerSocket) f.createServerSocket(port); } else { secureSocket = (SSLServerSocket) f.createServerSocket(port, 0, bindAddress); } if (SysProperties.ENABLE_ANONYMOUS_SSL) { String[] list = secureSocket.getEnabledCipherSuites(); list = addAnonymous(list); secureSocket.setEnabledCipherSuites(list); } socket = secureSocket; return socket; }
// in src/main/org/h2/security/CipherFactory.java
private static byte[] getKeyStoreBytes(KeyStore store, String password) throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); try { store.store(bout, password.toCharArray()); } catch (Exception e) { throw DbException.convertToIOException(e); } return bout.toByteArray(); }
// in src/main/org/h2/security/CipherFactory.java
public static KeyStore getKeyStore(String password) throws IOException { try { // The following source code can be re-generated // if you have a keystore file. // This code is (hopefully) more Java version independent // than using keystores directly. See also: // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4887561 // (1.4.2 cannot read keystore written with 1.4.1) // --- generated code start --- KeyStore store = KeyStore.getInstance(KeyStore.getDefaultType()); store.load(null, password.toCharArray()); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); store.load(null, password.toCharArray()); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec( StringUtils.convertHexToBytes( "30820277020100300d06092a864886f70d010101" + "0500048202613082025d02010002818100dc0a13" + "c602b7141110eade2f051b54777b060d0f74e6a1" + "10f9cce81159f271ebc88d8e8aa1f743b505fc2e" + "7dfe38d33b8d3f64d1b363d1af4d877833897954" + "cbaec2fa384c22a415498cf306bb07ac09b76b00" + "1cd68bf77ea0a628f5101959cf2993a9c23dbee7" + "9b19305977f8715ae78d023471194cc900b231ee" + "cb0aaea98d02030100010281810099aa4ff4d0a0" + "9a5af0bd953cb10c4d08c3d98df565664ac5582e" + "494314d5c3c92dddedd5d316a32a206be4ec0846" + "16fe57be15e27cad111aa3c21fa79e32258c6ca8" + "430afc69eddd52d3b751b37da6b6860910b94653" + "192c0db1d02abcfd6ce14c01f238eec7c20bd3bb" + "750940004bacba2880349a9494d10e139ecb2355" + "d101024100ffdc3defd9c05a2d377ef6019fa62b" + "3fbd5b0020a04cc8533bca730e1f6fcf5dfceea1" + "b044fbe17d9eababfbc7d955edad6bc60f9be826" + "ad2c22ba77d19a9f65024100dc28d43fdbbc9385" + "2cc3567093157702bc16f156f709fb7db0d9eec0" + "28f41fd0edcd17224c866e66be1744141fb724a1" + "0fd741c8a96afdd9141b36d67fff6309024077b1" + "cddbde0f69604bdcfe33263fb36ddf24aa3b9922" + "327915b890f8a36648295d0139ecdf68c245652c" + "4489c6257b58744fbdd961834a4cab201801a3b1" + "e52d024100b17142e8991d1b350a0802624759d4" + "8ae2b8071a158ff91fabeb6a8f7c328e762143dc" + "726b8529f42b1fab6220d1c676fdc27ba5d44e84" + "7c72c52064afd351a902407c6e23fe35bcfcd1a6" + "62aa82a2aa725fcece311644d5b6e3894853fd4c" + "e9fe78218c957b1ff03fc9e5ef8ffeb6bd58235f" + "6a215c97d354fdace7e781e4a63e8b")); PrivateKey privateKey = keyFactory.generatePrivate(keySpec); Certificate[] certs = { CertificateFactory .getInstance("X.509") .generateCertificate( new ByteArrayInputStream( StringUtils.convertHexToBytes( "3082018b3081f502044295ce6b300d06092a8648" + "86f70d0101040500300d310b3009060355040313" + "024832301e170d3035303532363133323630335a" + "170d3337303933303036353734375a300d310b30" + "0906035504031302483230819f300d06092a8648" + "86f70d010101050003818d0030818902818100dc" + "0a13c602b7141110eade2f051b54777b060d0f74" + "e6a110f9cce81159f271ebc88d8e8aa1f743b505" + "fc2e7dfe38d33b8d3f64d1b363d1af4d87783389" + "7954cbaec2fa384c22a415498cf306bb07ac09b7" + "6b001cd68bf77ea0a628f5101959cf2993a9c23d" + "bee79b19305977f8715ae78d023471194cc900b2" + "31eecb0aaea98d0203010001300d06092a864886" + "f70d01010405000381810083f4401a279453701b" + "ef9a7681a5b8b24f153f7d18c7c892133d97bd5f" + "13736be7505290a445a7d5ceb75522403e509751" + "5cd966ded6351ff60d5193de34cd36e5cb04d380" + "398e66286f99923fd92296645fd4ada45844d194" + "dfd815e6cd57f385c117be982809028bba1116c8" + "5740b3d27a55b1a0948bf291ddba44bed337b9"))), }; store.setKeyEntry("h2", privateKey, password.toCharArray(), certs); // --- generated code end --- return store; } catch (Exception e) { throw DbException.convertToIOException(e); } }
// in src/main/org/h2/security/CipherFactory.java
private static void setKeystore() throws IOException { Properties p = System.getProperties(); if (p.getProperty(KEYSTORE_KEY) == null) { String fileName = KEYSTORE; byte[] data = getKeyStoreBytes(getKeyStore(KEYSTORE_PASSWORD), KEYSTORE_PASSWORD); boolean needWrite = true; if (FileUtils.exists(fileName) && FileUtils.size(fileName) == data.length) { // don't need to overwrite the file if it did not change InputStream fin = FileUtils.newInputStream(fileName); byte[] now = IOUtils.readBytesAndClose(fin, 0); if (now != null && Utils.compareNotNull(data, now) == 0) { needWrite = false; } } if (needWrite) { try { OutputStream out = FileUtils.newOutputStream(fileName, false); out.write(data); out.close(); } catch (Exception e) { throw DbException.convertToIOException(e); } } String absolutePath = FileUtils.toRealPath(fileName); System.setProperty(KEYSTORE_KEY, absolutePath); } if (p.getProperty(KEYSTORE_PASSWORD_KEY) == null) { System.setProperty(KEYSTORE_PASSWORD_KEY, KEYSTORE_PASSWORD); } }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public static FtpClient open(String url) throws IOException { FtpClient client = new FtpClient(); client.connect(url); return client; }
// in src/tools/org/h2/dev/ftp/FtpClient.java
private void connect(String url) throws IOException { socket = NetUtils.createSocket(url, 21, false); InputStream in = socket.getInputStream(); OutputStream out = socket.getOutputStream(); reader = new BufferedReader(new InputStreamReader(in)); writer = new PrintWriter(new OutputStreamWriter(out, Constants.UTF8)); readCode(220); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
private void readLine() throws IOException { while (true) { message = reader.readLine(); if (message != null) { int idxSpace = message.indexOf(' '); int idxMinus = message.indexOf('-'); int idx = idxSpace < 0 ? idxMinus : idxMinus < 0 ? idxSpace : Math.min(idxSpace, idxMinus); if (idx < 0) { code = 0; } else { code = Integer.parseInt(message.substring(0, idx)); message = message.substring(idx + 1); } } break; } }
// in src/tools/org/h2/dev/ftp/FtpClient.java
private void readCode(int optional, int expected) throws IOException { readLine(); if (code == optional) { readLine(); } if (code != expected) { throw new IOException("Expected: " + expected + " got: " + code + " " + message); } }
// in src/tools/org/h2/dev/ftp/FtpClient.java
private void readCode(int expected) throws IOException { readCode(-1, expected); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void login(String userName, String password) throws IOException { send("USER " + userName); readCode(331); send("PASS " + password); readCode(230); send("SYST"); readCode(215); send("SITE"); readCode(500); send("STRU F"); readCode(200); send("TYPE I"); readCode(200); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void close() throws IOException { if (socket != null) { send("QUIT"); readCode(221); socket.close(); } }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void changeWorkingDirectory(String dir) throws IOException { send("CWD " + dir); readCode(250); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void changeDirectoryUp() throws IOException { send("CDUP"); readCode(250); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
void delete(String fileName) throws IOException { send("DELE " + fileName); readCode(226, 250); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void makeDirectory(String dir) throws IOException { send("MKD " + dir); readCode(226, 257); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
void mode(String mode) throws IOException { send("MODE " + mode); readCode(200); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
void modificationTime(String fileName) throws IOException { send("MDTM " + fileName); readCode(213); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
void noOperation() throws IOException { send("NOOP"); readCode(200); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
String printWorkingDirectory() throws IOException { send("PWD"); readCode(257); return removeQuotes(); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
private void passive() throws IOException { send("PASV"); readCode(226, 227); int first = message.indexOf('(') + 1; int last = message.indexOf(')'); String[] address = StringUtils.arraySplit(message.substring(first, last), ',', true); StatementBuilder buff = new StatementBuilder(); for (int i = 0; i < 4; i++) { buff.appendExceptFirst("."); buff.append(address[i]); } String ip = buff.toString(); InetAddress addr = InetAddress.getByName(ip); int port = (Integer.parseInt(address[4]) << 8) | Integer.parseInt(address[5]); socketData = NetUtils.createSocket(addr, port, false); inData = socketData.getInputStream(); outData = socketData.getOutputStream(); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
void rename(String fromFileName, String toFileName) throws IOException { send("RNFR " + fromFileName); readCode(350); send("RNTO " + toFileName); readCode(250); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public byte[] retrieve(String fileName) throws IOException { ByteArrayOutputStream buff = new ByteArrayOutputStream(); retrieve(fileName, buff, 0); return buff.toByteArray(); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
void retrieve(String fileName, OutputStream out, long restartAt) throws IOException { passive(); if (restartAt > 0) { send("REST " + restartAt); readCode(350); } send("RETR " + fileName); IOUtils.copyAndClose(inData, out); readCode(150, 226); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void removeDirectory(String dir) throws IOException { send("RMD " + dir); readCode(226, 250); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void removeDirectoryRecursive(String dir) throws IOException { for (File f : listFiles(dir)) { if (f.isDirectory()) { removeDirectoryRecursive(dir + "/" + f.getName()); } else { delete(dir + "/" + f.getName()); } } removeDirectory(dir); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
long size(String fileName) throws IOException { send("SIZE " + fileName); readCode(250); long size = Long.parseLong(message); return size; }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void store(String fileName, InputStream in) throws IOException { passive(); send("STOR " + fileName); readCode(150); IOUtils.copyAndClose(in, outData); readCode(226); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public void storeRecursive(File file) throws IOException { if (file.isDirectory()) { makeDirectory(file.getName()); changeWorkingDirectory(file.getName()); for (File f : file.listFiles()) { storeRecursive(f); } changeWorkingDirectory(".."); } else { InputStream in = new FileInputStream(file); store(file.getName(), in); } }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public String nameList(String dir) throws IOException { passive(); send("NLST " + dir); readCode(150); ByteArrayOutputStream out = new ByteArrayOutputStream(); IOUtils.copyAndClose(inData, out); readCode(226); byte[] data = out.toByteArray(); return new String(data); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public String list(String dir) throws IOException { passive(); send("LIST " + dir); readCode(150); ByteArrayOutputStream out = new ByteArrayOutputStream(); IOUtils.copyAndClose(inData, out); readCode(226); byte[] data = out.toByteArray(); return new String(data); }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public boolean exists(String dir, String name) throws IOException { for (File f : listFiles(dir)) { if (f.getName().equals(name)) { return true; } } return false; }
// in src/tools/org/h2/dev/ftp/FtpClient.java
public File[] listFiles(String dir) throws IOException { String content = list(dir); String[] list = StringUtils.arraySplit(content.trim(), '\n', true); File[] files = new File[list.length]; for (int i = 0; i < files.length; i++) { String s = list[i]; while (true) { String s2 = StringUtils.replaceAll(s, " ", " "); if (s2.equals(s)) { break; } s = s2; } String[] tokens = StringUtils.arraySplit(s, ' ', true); boolean directory = tokens[0].charAt(0) == 'd'; long length = Long.parseLong(tokens[4]); String name = tokens[8]; File f = new FtpFile(name, directory, length); files[i] = f; } return files; }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
private void process(String command) throws IOException { int idx = command.indexOf(' '); String param = ""; if (idx >= 0) { param = command.substring(idx).trim(); command = command.substring(0, idx); } command = StringUtils.toUpperEnglish(command); if (command.length() == 0) { reply(506, "No command"); return; } server.trace(">" + command); FtpEventListener listener = server.getEventListener(); FtpEvent event = null; if (listener != null) { event = new FtpEvent(this, command, param); listener.beforeCommand(event); } replied = false; if (connected) { processConnected(command, param); } if (!replied) { if ("USER".equals(command)) { userName = param; reply(331, "Need password"); } else if ("QUIT".equals(command)) { reply(221, "Bye"); stop = true; } else if ("PASS".equals(command)) { if (userName == null) { reply(332, "Need username"); } else if (server.checkUserPasswordWrite(userName, param)) { reply(230, "Ok"); readonly = false; connected = true; } else if (server.checkUserPasswordReadOnly(userName)) { reply(230, "Ok, readonly"); readonly = true; connected = true; } else { reply(431, "Wrong user/password"); } } else if ("REIN".equals(command)) { userName = null; connected = false; currentDir = "/"; reply(200, "Ok"); } else if ("HELP".equals(command)) { reply(214, SERVER_NAME); } } if (!replied) { if (listener != null) { listener.onUnsupportedCommand(event); } reply(506, "Invalid command"); } if (listener != null) { listener.afterCommand(event); } }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
private void processConnected(String command, String param) throws IOException { switch (command.charAt(0)) { case 'C': if ("CWD".equals(command)) { String path = getPath(param); String fileName = getFileName(path); if (FileUtils.exists(fileName) && FileUtils.isDirectory(fileName)) { if (!path.endsWith("/")) { path += "/"; } currentDir = path; reply(250, "Ok"); } else { reply(550, "Failed"); } } else if ("CDUP".equals(command)) { if (currentDir.length() > 1) { int idx = currentDir.lastIndexOf("/", currentDir.length() - 2); currentDir = currentDir.substring(0, idx + 1); reply(250, "Ok"); } else { reply(550, "Failed"); } } break; case 'D': if ("DELE".equals(command)) { String fileName = getFileName(param); if (!readonly && FileUtils.exists(fileName) && !FileUtils.isDirectory(fileName) && FileUtils.tryDelete(fileName)) { if (server.getAllowTask() && fileName.endsWith(FtpServer.TASK_SUFFIX)) { server.stopTask(fileName); } reply(250, "Ok"); } else { reply(500, "Delete failed"); } } break; case 'L': if ("LIST".equals(command)) { processList(param, true); } break; case 'M': if ("MKD".equals(command)) { processMakeDir(param); } else if ("MODE".equals(command)) { if ("S".equals(StringUtils.toUpperEnglish(param))) { reply(200, "Ok"); } else { reply(504, "Invalid"); } } else if ("MDTM".equals(command)) { String fileName = getFileName(param); if (FileUtils.exists(fileName) && !FileUtils.isDirectory(fileName)) { reply(213, server.formatLastModified(fileName)); } else { reply(550, "Failed"); } } break; case 'N': if ("NLST".equals(command)) { processList(param, false); } else if ("NOOP".equals(command)) { reply(200, "Ok"); } break; case 'P': if ("PWD".equals(command)) { reply(257, StringUtils.quoteIdentifier(currentDir) + " directory"); } else if ("PASV".equals(command)) { ServerSocket dataSocket = FtpServer.createDataSocket(); data = new FtpData(server, control.getInetAddress(), dataSocket); data.start(); int port = dataSocket.getLocalPort(); reply(227, "Passive Mode (" + serverIpAddress + "," + (port >> 8) + "," + (port & 255) + ")"); } else if ("PORT".equals(command)) { String[] list = StringUtils.arraySplit(param, ',', true); String host = list[0] + "." + list[1] + "." + list[2] + "." + list[3]; int port = (Integer.parseInt(list[4]) << 8) | Integer.parseInt(list[5]); InetAddress address = InetAddress.getByName(host); if (address.equals(control.getInetAddress())) { data = new FtpData(server, address, port); reply(200, "Ok"); } else { server.trace("Port REJECTED:" + address + " expected:" + control.getInetAddress()); reply(550, "Failed"); } } break; case 'R': if ("RNFR".equals(command)) { String fileName = getFileName(param); if (FileUtils.exists(fileName)) { renameFrom = fileName; reply(350, "Ok"); } else { reply(450, "Not found"); } } else if ("RNTO".equals(command)) { if (renameFrom == null) { reply(503, "RNFR required"); } else { String fileOld = renameFrom; String fileNew = getFileName(param); boolean ok = false; if (!readonly) { try { FileUtils.moveTo(fileOld, fileNew); reply(250, "Ok"); ok = true; } catch (Exception e) { server.traceError(e); } } if (!ok) { reply(550, "Failed"); } } } else if ("RETR".equals(command)) { String fileName = getFileName(param); if (FileUtils.exists(fileName) && !FileUtils.isDirectory(fileName)) { reply(150, "Starting transfer"); try { data.send(fileName, restart); reply(226, "Ok"); } catch (IOException e) { server.traceError(e); reply(426, "Failed"); } restart = 0; } else { // Firefox compatibility // (still not good) processList(param, true); // reply(426, "Not a file"); } } else if ("RMD".equals(command)) { processRemoveDir(param); } else if ("REST".equals(command)) { try { restart = Integer.parseInt(param); reply(350, "Ok"); } catch (NumberFormatException e) { reply(500, "Invalid"); } } break; case 'S': if ("SYST".equals(command)) { reply(215, "UNIX Type: L8"); } else if ("SITE".equals(command)) { reply(500, "Not understood"); } else if ("SIZE".equals(command)) { param = getFileName(param); if (FileUtils.exists(param) && !FileUtils.isDirectory(param)) { reply(250, String.valueOf(FileUtils.size(param))); } else { reply(500, "Failed"); } } else if ("STOR".equals(command)) { String fileName = getFileName(param); if (!readonly && !FileUtils.exists(fileName) || !FileUtils.isDirectory(fileName)) { reply(150, "Starting transfer"); try { data.receive(fileName); if (server.getAllowTask() && param.endsWith(FtpServer.TASK_SUFFIX)) { server.startTask(fileName); } reply(226, "Ok"); } catch (Exception e) { server.traceError(e); reply(426, "Failed"); } } else { reply(550, "Failed"); } } else if ("STRU".equals(command)) { if ("F".equals(StringUtils.toUpperEnglish(param))) { reply(200, "Ok"); } else { reply(504, "Invalid"); } } break; case 'T': if ("TYPE".equals(command)) { param = StringUtils.toUpperEnglish(param); if ("A".equals(param) || "A N".equals(param)) { reply(200, "Ok"); } else if ("I".equals(param) || "L 8".equals(param)) { reply(200, "Ok"); } else { reply(500, "Invalid"); } } break; case 'X': if ("XMKD".equals(command)) { processMakeDir(param); } else if ("XRMD".equals(command)) { processRemoveDir(param); } break; } }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
private void processList(String param, boolean directories) throws IOException { String directory = getFileName(param); if (!FileUtils.exists(directory)) { reply(450, "Directory does not exist"); return; } else if (!FileUtils.isDirectory(directory)) { reply(450, "Not a directory"); return; } String list = server.getDirectoryListing(directory, directories); reply(150, "Starting transfer"); server.trace(list); // need to use the current locale (UTF-8 would be wrong for the Windows // Explorer) data.send(list.getBytes()); reply(226, "Done"); }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
private void connect() throws IOException { if (active) { socket = new Socket(address, port); } else { waitUntilConnected(); } }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
synchronized void receive(String fileName) throws IOException { connect(); try { InputStream in = socket.getInputStream(); OutputStream out = FileUtils.newOutputStream(fileName, false); IOUtils.copy(in, out); out.close(); } finally { socket.close(); } server.trace("closed"); }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
synchronized void send(String fileName, long skip) throws IOException { connect(); try { OutputStream out = socket.getOutputStream(); InputStream in = FileUtils.newInputStream(fileName); IOUtils.skipFully(in, skip); IOUtils.copy(in, out); in.close(); } finally { socket.close(); } server.trace("closed"); }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
synchronized void send(byte[] data) throws IOException { connect(); try { OutputStream out = socket.getOutputStream(); out.write(data); } finally { socket.close(); } server.trace("closed"); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
void startTask(String path) throws IOException { stopTask(path); if (path.endsWith(".zip.task")) { trace("expand: " + path); Process p = Runtime.getRuntime().exec("jar -xf " + path, null, new File(root)); new StreamRedirect(path, p.getInputStream(), null).start(); return; } Properties prop = SortedProperties.loadProperties(path); String command = prop.getProperty("command"); String outFile = path.substring(0, path.length() - TASK_SUFFIX.length()); String errorFile = root + "/" + prop.getProperty("error", outFile + ".err.txt"); String outputFile = root + "/" + prop.getProperty("output", outFile + ".out.txt"); trace("start process: " + path + " / " + command); Process p = Runtime.getRuntime().exec(command, null, new File(root)); new StreamRedirect(path, p.getErrorStream(), errorFile).start(); new StreamRedirect(path, p.getInputStream(), outputFile).start(); tasks.put(path, p); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
String readStringNull(InputStream in) throws IOException { StringBuilder buff = new StringBuilder(); while (true) { int x = in.read(); if (x <= 0) { break; } buff.append((char) x); } return buff.toString(); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
private boolean processClient(InputStream inStream, OutputStream outStream) throws IOException { DataInputStream dataIn = new DataInputStream(inStream); ByteArrayOutputStream buff = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(buff); if (state == STATE_INIT_CLIENT) { state = STATE_REGULAR; int len = dataIn.readInt(); dataOut.writeInt(len); len -= 4; byte[] data = new byte[len]; dataIn.readFully(data, 0, len); dataOut.write(data); dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len)); int version = dataIn.readInt(); if (version == 80877102) { println("CancelRequest"); println(" pid: " + dataIn.readInt()); println(" key: " + dataIn.readInt()); } else if (version == 80877103) { println("SSLRequest"); } else { println("StartupMessage"); println(" version " + version + " (" + (version >> 16) + "." + (version & 0xff) + ")"); while (true) { String param = readStringNull(dataIn); if (param.length() == 0) { break; } String value = readStringNull(dataIn); println(" param " + param + "=" + value); } } } else { int x = dataIn.read(); if (x < 0) { println("end"); return false; } // System.out.println(" x=" + (char)x+" " +x); dataOut.write(x); int len = dataIn.readInt(); dataOut.writeInt(len); len -= 4; byte[] data = new byte[len]; dataIn.readFully(data, 0, len); dataOut.write(data); dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len)); switch (x) { case 'B': { println("Bind"); println(" destPortal: " + readStringNull(dataIn)); println(" prepName: " + readStringNull(dataIn)); int formatCodesCount = dataIn.readShort(); for (int i = 0; i < formatCodesCount; i++) { println(" formatCode[" + i + "]=" + dataIn.readShort()); } int paramCount = dataIn.readShort(); for (int i = 0; i < paramCount; i++) { int paramLen = dataIn.readInt(); println(" length[" + i + "]=" + paramLen); byte[] d2 = new byte[paramLen]; dataIn.readFully(d2); } int resultCodeCount = dataIn.readShort(); for (int i = 0; i < resultCodeCount; i++) { println(" resultCodeCount[" + i + "]=" + dataIn.readShort()); } break; } case 'C': { println("Close"); println(" type: (S:prepared statement, P:portal): " + dataIn.read()); break; } case 'd': { println("CopyData"); break; } case 'c': { println("CopyDone"); break; } case 'f': { println("CopyFail"); println(" message: " + readStringNull(dataIn)); break; } case 'D': { println("Describe"); println(" type (S=prepared statement, P=portal): " + (char) dataIn.readByte()); println(" name: " + readStringNull(dataIn)); break; } case 'E': { println("Execute"); println(" name: " + readStringNull(dataIn)); println(" maxRows: " + dataIn.readShort()); break; } case 'H': { println("Flush"); break; } case 'F': { println("FunctionCall"); println(" objectId:" + dataIn.readInt()); int columns = dataIn.readShort(); for (int i = 0; i < columns; i++) { println(" formatCode[" + i + "]: " + dataIn.readShort()); } int count = dataIn.readShort(); for (int i = 0; i < count; i++) { int l = dataIn.readInt(); println(" len[" + i + "]: " + l); if (l >= 0) { for (int j = 0; j < l; j++) { dataIn.readByte(); } } } println(" resultFormat: " + dataIn.readShort()); break; } case 'P': { println("Parse"); println(" name:" + readStringNull(dataIn)); println(" query:" + readStringNull(dataIn)); int count = dataIn.readShort(); for (int i = 0; i < count; i++) { println(" [" + i + "]: " + dataIn.readInt()); } break; } case 'p': { println("PasswordMessage"); println(" password: " + readStringNull(dataIn)); break; } case 'Q': { println("Query"); println(" sql : " + readStringNull(dataIn)); break; } case 'S': { println("Sync"); break; } case 'X': { println("Terminate"); break; } default: println("############## UNSUPPORTED: " + (char) x); } } dataOut.flush(); byte[] buffer = buff.toByteArray(); printData(buffer, buffer.length); try { outStream.write(buffer, 0, buffer.length); outStream.flush(); } catch (IOException e) { e.printStackTrace(); } return true; }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
private boolean processServer(InputStream inStream, OutputStream outStream) throws IOException { DataInputStream dataIn = new DataInputStream(inStream); ByteArrayOutputStream buff = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(buff); int x = dataIn.read(); if (x < 0) { println("end"); return false; } // System.out.println(" x=" + (char)x+" " +x); dataOut.write(x); int len = dataIn.readInt(); dataOut.writeInt(len); len -= 4; byte[] data = new byte[len]; dataIn.readFully(data, 0, len); dataOut.write(data); dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len)); switch (x) { case 'R': { println("Authentication"); int value = dataIn.readInt(); if (value == 0) { println(" Ok"); } else if (value == 2) { println(" KerberosV5"); } else if (value == 3) { println(" CleartextPassword"); } else if (value == 4) { println(" CryptPassword"); byte b1 = dataIn.readByte(); byte b2 = dataIn.readByte(); println(" salt1=" + b1 + " salt2=" + b2); } else if (value == 5) { println(" MD5Password"); byte b1 = dataIn.readByte(); byte b2 = dataIn.readByte(); byte b3 = dataIn.readByte(); byte b4 = dataIn.readByte(); println(" salt1=" + b1 + " salt2=" + b2 + " 3=" + b3 + " 4=" + b4); } else if (value == 6) { println(" SCMCredential"); } break; } case 'K': { println("BackendKeyData"); println(" process ID " + dataIn.readInt()); println(" key " + dataIn.readInt()); break; } case '2': { println("BindComplete"); break; } case '3': { println("CloseComplete"); break; } case 'C': { println("CommandComplete"); println(" command tag: " + readStringNull(dataIn)); break; } case 'd': { println("CopyData"); break; } case 'c': { println("CopyDone"); break; } case 'G': { println("CopyInResponse"); println(" format: " + dataIn.readByte()); int columns = dataIn.readShort(); for (int i = 0; i < columns; i++) { println(" formatCode[" + i + "]: " + dataIn.readShort()); } break; } case 'H': { println("CopyOutResponse"); println(" format: " + dataIn.readByte()); int columns = dataIn.readShort(); for (int i = 0; i < columns; i++) { println(" formatCode[" + i + "]: " + dataIn.readShort()); } break; } case 'D': { println("DataRow"); int columns = dataIn.readShort(); println(" columns : " + columns); for (int i = 0; i < columns; i++) { int l = dataIn.readInt(); if (l > 0) { for (int j = 0; j < l; j++) { dataIn.readByte(); } } // println(" ["+i+"] len: " + l); } break; } case 'I': { println("EmptyQueryResponse"); break; } case 'E': { println("ErrorResponse"); while (true) { int fieldType = dataIn.readByte(); if (fieldType == 0) { break; } String msg = readStringNull(dataIn); // http://developer.postgresql.org/pgdocs/postgres/protocol-error-fields.html // S Severity // C Code: the SQLSTATE code // M Message // D Detail // H Hint // P Position // p Internal position // q Internal query // W Where // F File // L Line // R Routine println(" fieldType: " + fieldType + " msg: " + msg); } break; } case 'V': { println("FunctionCallResponse"); int resultLen = dataIn.readInt(); println(" len: " + resultLen); break; } case 'n': { println("NoData"); break; } case 'N': { println("NoticeResponse"); while (true) { int fieldType = dataIn.readByte(); if (fieldType == 0) { break; } String msg = readStringNull(dataIn); // http://developer.postgresql.org/pgdocs/postgres/protocol-error-fields.html // S Severity // C Code: the SQLSTATE code // M Message // D Detail // H Hint // P Position // p Internal position // q Internal query // W Where // F File // L Line // R Routine println(" fieldType: " + fieldType + " msg: " + msg); } break; } case 'A': { println("NotificationResponse"); println(" processID: " + dataIn.readInt()); println(" condition: " + readStringNull(dataIn)); println(" information: " + readStringNull(dataIn)); break; } case 't': { println("ParameterDescription"); println(" processID: " + dataIn.readInt()); int count = dataIn.readShort(); for (int i = 0; i < count; i++) { println(" [" + i + "] objectId: " + dataIn.readInt()); } break; } case 'S': { println("ParameterStatus"); println(" parameter " + readStringNull(dataIn) + " = " + readStringNull(dataIn)); break; } case '1': { println("ParseComplete"); break; } case 's': { println("ParseComplete"); break; } case 'Z': { println("ReadyForQuery"); println(" status (I:idle, T:transaction, E:failed): " + (char) dataIn.readByte()); break; } case 'T': { println("RowDescription"); int columns = dataIn.readShort(); println(" columns : " + columns); for (int i = 0; i < columns; i++) { println(" [" + i + "]"); println(" name:" + readStringNull(dataIn)); println(" tableId:" + dataIn.readInt()); println(" columnId:" + dataIn.readShort()); println(" dataTypeId:" + dataIn.readInt()); println(" dataTypeSize (pg_type.typlen):" + dataIn.readShort()); println(" modifier (pg_attribute.atttypmod):" + dataIn.readInt()); println(" format code:" + dataIn.readShort()); } break; } default: println("############## UNSUPPORTED: " + (char) x); } dataOut.flush(); byte[] buffer = buff.toByteArray(); printData(buffer, buffer.length); try { outStream.write(buffer, 0, buffer.length); outStream.flush(); } catch (IOException e) { e.printStackTrace(); } return true; }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public FileChannel open(String mode) throws IOException { String[] parsed = parse(name); FileChannel file = FileUtils.open(parsed[2], mode); return new FileCrypt(name, parsed[0], parsed[1], file); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public long position() throws IOException { return Math.max(0, file.position() - HEADER_LENGTH); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public long size() throws IOException { return Math.max(0, file.size() - HEADER_LENGTH - BLOCK_SIZE); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public FileChannel position(long pos) throws IOException { file.position(pos + HEADER_LENGTH); return this; }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public void force(boolean metaData) throws IOException { file.force(metaData); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return file.tryLock(); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public void implCloseChannel() throws IOException { file.close(); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public FileChannel truncate(long newLength) throws IOException { if (newLength >= size()) { return this; } int mod = (int) (newLength % BLOCK_SIZE); if (mod == 0) { file.truncate(HEADER_LENGTH + newLength); } else { file.truncate(HEADER_LENGTH + newLength + BLOCK_SIZE - mod); byte[] buff = new byte[BLOCK_SIZE - mod]; long pos = position(); position(newLength); write(buff, 0, buff.length); position(pos); } file.truncate(HEADER_LENGTH + newLength + BLOCK_SIZE); if (newLength < position()) { position(newLength); } return this; }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public int read(ByteBuffer dst) throws IOException { int len = dst.remaining(); if (len == 0) { return 0; } long pos = position(); len = (int) Math.min(len, size() - pos); if (len <= 0) { return -1; } int posMod = (int) (pos % BLOCK_SIZE); if (posMod == 0 && len % BLOCK_SIZE == 0) { readAligned(pos, dst.array(), dst.position(), len); } else { long p = pos - posMod; int l = len; if (posMod != 0) { l += posMod; } l = MathUtils.roundUpInt(l, BLOCK_SIZE); position(p); byte[] temp = new byte[l]; try { readAligned(p, temp, 0, l); System.arraycopy(temp, posMod, dst.array(), dst.position(), len); } finally { position(pos + len); } } dst.position(dst.position() + len); return len; }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
public int write(ByteBuffer src) throws IOException { int len = src.remaining(); if (len == 0) { return 0; } write(src.array(), src.position(), len); src.position(src.position() + len); return len; }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
private void write(byte[] b, int off, int len) throws IOException { long pos = position(); int posMod = (int) (pos % BLOCK_SIZE); if (posMod == 0 && len % BLOCK_SIZE == 0) { byte[] temp = new byte[len]; System.arraycopy(b, off, temp, 0, len); writeAligned(pos, temp, 0, len); } else { long p = pos - posMod; int l = len; if (posMod != 0) { l += posMod; } l = MathUtils.roundUpInt(l, BLOCK_SIZE); position(p); byte[] temp = new byte[l]; if (file.size() < HEADER_LENGTH + p + l) { file.position(HEADER_LENGTH + p + l - 1); FileUtils.writeFully(file, ByteBuffer.wrap(new byte[1])); position(p); } readAligned(p, temp, 0, l); System.arraycopy(b, off, temp, posMod, len); position(p); try { writeAligned(p, temp, 0, l); } finally { position(pos + len); } } pos = file.position(); if (file.size() < pos + BLOCK_SIZE) { file.position(pos + BLOCK_SIZE - 1); FileUtils.writeFully(file, ByteBuffer.wrap(new byte[1])); file.position(pos); } }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
private void readAligned(long pos, byte[] b, int off, int len) throws IOException { FileUtils.readFully(file, ByteBuffer.wrap(b, off, len)); for (int p = 0; p < len; p += BLOCK_SIZE) { for (int i = 0; i < BLOCK_SIZE; i++) { // empty blocks are not decrypted if (b[p + off + i] != 0) { cipher.decrypt(b, p + off, BLOCK_SIZE); xorInitVector(b, p + off, BLOCK_SIZE, p + pos); break; } } } }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
private void writeAligned(long pos, byte[] b, int off, int len) throws IOException { for (int p = 0; p < len; p += BLOCK_SIZE) { for (int i = 0; i < BLOCK_SIZE; i++) { // empty blocks are not decrypted if (b[p + off + i] != 0) { xorInitVector(b, p + off, BLOCK_SIZE, p + pos); cipher.encrypt(b, p + off, BLOCK_SIZE); break; } } } FileUtils.writeFully(file, ByteBuffer.wrap(b, off, len)); }
// in src/tools/org/h2/dev/fs/FileShell.java
private void execute(String line) throws IOException { String[] commands = StringUtils.arraySplit(line, ';', true); for (String command : commands) { String[] list = StringUtils.arraySplit(command, ' ', true); if (!execute(list)) { break; } } }
// in src/tools/org/h2/dev/fs/FileShell.java
private boolean execute(String[] list) throws IOException { // TODO unit tests for everything (multiple commands, errors, ...) // TODO less (support large files) // TODO hex dump int i = 0; String c = list[i++]; if ("exit".equals(c) || "quit".equals(c)) { end(list, i); return false; } else if ("help".equals(c) || "?".equals(c)) { showHelp(); end(list, i); } else if ("cat".equals(c)) { String file = getFile(list[i++]); end(list, i); cat(file, Long.MAX_VALUE); } else if ("cd".equals(c)) { String dir = getFile(list[i++]); end(list, i); if (FileUtils.isDirectory(dir)) { currentWorkingDirectory = dir; println(dir); } else { println("Not a directory: " + dir); } } else if ("chmod".equals(c)) { String mode = list[i++]; String file = getFile(list[i++]); end(list, i); if ("-w".equals(mode)) { boolean success = FileUtils.setReadOnly(file); println(success ? "Success" : "Failed"); } else { println("Unsupported mode: " + mode); } } else if ("cp".equals(c)) { String source = getFile(list[i++]); String target = getFile(list[i++]); end(list, i); FileUtils.copy(source, target); } else if ("head".equals(c)) { String file = getFile(list[i++]); end(list, i); cat(file, 1024); } else if ("ls".equals(c)) { String dir = currentWorkingDirectory; if (i < list.length) { dir = getFile(list[i++]); } end(list, i); println(dir); for (String file : FileUtils.newDirectoryStream(dir)) { StringBuilder buff = new StringBuilder(); buff.append(FileUtils.isDirectory(file) ? "d" : "-"); buff.append(FileUtils.canWrite(file) ? "rw" : "r-"); buff.append(' '); buff.append(String.format("%10d", FileUtils.size(file))); buff.append(' '); long lastMod = FileUtils.lastModified(file); buff.append(new Timestamp(lastMod).toString()); buff.append(' '); buff.append(FileUtils.getName(file)); println(buff.toString()); } } else if ("mkdir".equals(c)) { String dir = getFile(list[i++]); end(list, i); FileUtils.createDirectories(dir); } else if ("mv".equals(c)) { String source = getFile(list[i++]); String target = getFile(list[i++]); end(list, i); FileUtils.moveTo(source, target); } else if ("pwd".equals(c)) { end(list, i); println(FileUtils.toRealPath(currentWorkingDirectory)); } else if ("rm".equals(c)) { if ("-r".equals(list[i])) { i++; String dir = getFile(list[i++]); end(list, i); FileUtils.deleteRecursive(dir, true); } else if ("-rf".equals(list[i])) { i++; String dir = getFile(list[i++]); end(list, i); FileUtils.deleteRecursive(dir, false); } else { String file = getFile(list[i++]); end(list, i); FileUtils.delete(file); } } else if ("touch".equals(c)) { String file = getFile(list[i++]); end(list, i); truncate(file, FileUtils.size(file)); } else if ("truncate".equals(c)) { if ("-s".equals(list[i])) { i++; long length = Long.decode(list[i++]); String file = getFile(list[i++]); end(list, i); truncate(file, length); } else { println("Unsupported option"); } } else if ("unzip".equals(c)) { String file = getFile(list[i++]); end(list, i); unzip(file, currentWorkingDirectory); } else if ("zip".equals(c)) { boolean recursive = false; if ("-r".equals(list[i])) { i++; recursive = true; } String target = getFile(list[i++]); ArrayList<String> source = New.arrayList(); readFileList(list, i, source, recursive); zip(target, currentWorkingDirectory, source); } return true; }
// in src/tools/org/h2/dev/fs/FileShell.java
private void end(String[] list, int index) throws IOException { if (list.length != index) { throw new IOException("End of command expected, got: " + list[index]); } }
// in src/tools/org/h2/dev/fs/FileShell.java
private int readFileList(String[] list, int i, ArrayList<String> target, boolean recursive) throws IOException { while (i < list.length) { String c = list[i++]; if (";".equals(c)) { break; } c = getFile(c); if (!FileUtils.exists(c)) { throw new IOException("File not found: " + c); } if (recursive) { addFilesRecursive(c, target); } else { target.add(c); } } return i; }
// in src/tools/org/h2/dev/fs/FileShell.java
private String readLine() throws IOException { String line = reader.readLine(); if (line == null) { throw new IOException("Aborted"); } return line; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public FilePath createTempFile(String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException { if (!inTempDir) { throw new IOException("File system is read-only"); } return new FilePathDisk().getPath(name).createTempFile(suffix, deleteOnExit, true); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public InputStream newInputStream() throws IOException { return new FileChannelInputStream(open("r")); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public FileChannel open(String mode) throws IOException { String entryName = getEntryName(); if (entryName.length() == 0) { throw new FileNotFoundException(); } ZipInputStream in = openZip(); while (true) { ZipEntry entry = in.getNextEntry(); if (entry == null) { break; } if (entry.getName().equals(entryName)) { return new FileZip2(name, entryName, in, size()); } in.closeEntry(); } in.close(); throw new FileNotFoundException(name); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
private ZipInputStream openZip() throws IOException { String fileName = translateFileName(name); return new ZipInputStream(FileUtils.newInputStream(fileName)); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public void implCloseChannel() throws IOException { try { in.close(); } catch (IOException e) { // ignore } }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public int read(ByteBuffer dst) throws IOException { seek(); int len = in.read(dst.array(), dst.position(), dst.remaining()); if (len > 0) { dst.position(dst.position() + len); pos += len; inPos += len; } return len; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
private void seek() throws IOException { if (inPos > pos) { if (in != null) { in.close(); } in = null; } if (in == null) { in = FileUtils.newInputStream(fullName); inPos = 0; } if (inPos < pos) { long skip = pos - inPos; if (!skipUsingRead) { try { IOUtils.skipFully(in, skip); } catch (NullPointerException e) { // workaround for Android skipUsingRead = true; } } if (skipUsingRead) { while (skip > 0) { int s = (int) Math.min(SKIP_BUFFER.length, skip); s = in.read(SKIP_BUFFER, 0, s); skip -= s; } } inPos = pos; } }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public FileChannel truncate(long newLength) throws IOException { throw new IOException("File is read-only"); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public void force(boolean metaData) throws IOException { // nothing to do }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public int write(ByteBuffer src) throws IOException { throw new IOException("File is read-only"); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
public synchronized FileLock tryLock(long position, long size, boolean shared) throws IOException { return null; }
// in src/tools/org/h2/dev/store/FilePathCache.java
public static FileChannel wrap(FileChannel f) throws IOException { return new FileCache(f); }
// in src/tools/org/h2/dev/store/FilePathCache.java
public FileChannel open(String mode) throws IOException { return new FileCache(getBase().open(mode)); }
// in src/tools/org/h2/dev/store/FilePathCache.java
public FileChannel position(long newPosition) throws IOException { this.pos = newPosition; return this; }
// in src/tools/org/h2/dev/store/FilePathCache.java
public long position() throws IOException { return pos; }
// in src/tools/org/h2/dev/store/FilePathCache.java
private void positionBase(long pos) throws IOException { if (posBase != pos) { base.position(pos); posBase = pos; } }
// in src/tools/org/h2/dev/store/FilePathCache.java
public int read(ByteBuffer dst) throws IOException { long cachePos = getCachePos(pos); int off = (int) (pos - cachePos); int len = CACHE_BLOCK_SIZE - off; ByteBuffer buff = cache.get(cachePos); if (buff == null) { buff = ByteBuffer.allocate(CACHE_BLOCK_SIZE); positionBase(cachePos); int read = base.read(buff); posBase += read; if (read == CACHE_BLOCK_SIZE) { cache.put(cachePos, buff); } else { if (read < 0) { return -1; } len = Math.min(len, read); } } len = Math.min(len, dst.remaining()); System.arraycopy(buff.array(), off, dst.array(), dst.position(), len); dst.position(dst.position() + len); pos += len; return len; }
// in src/tools/org/h2/dev/store/FilePathCache.java
public long size() throws IOException { return size; }
// in src/tools/org/h2/dev/store/FilePathCache.java
public FileChannel truncate(long newSize) throws IOException { cache.clear(); base.truncate(newSize); size = Math.min(size, newSize); pos = Math.min(pos, newSize); posBase = pos; return this; }
// in src/tools/org/h2/dev/store/FilePathCache.java
public int write(ByteBuffer src) throws IOException { if (cache.size() > 0) { for (long p = getCachePos(pos), len = src.remaining(); len > 0; p += CACHE_BLOCK_SIZE, len -= CACHE_BLOCK_SIZE) { cache.remove(p); } } positionBase(pos); int len = base.write(src); posBase += len; pos += len; size = Math.max(size, pos); return len; }
// in src/tools/org/h2/dev/store/FilePathCache.java
public void force(boolean metaData) throws IOException { base.force(metaData); }
// in src/tools/org/h2/dev/store/FilePathCache.java
public FileLock tryLock(long position, long size, boolean shared) throws IOException { return base.tryLock(position, size, shared); }
// in src/tools/org/h2/dev/util/ReaderInputStream.java
private void fillBuffer() throws IOException { if (remaining == 0) { pos = 0; remaining = reader.read(chars, 0, Constants.IO_BUFFER_SIZE); if (remaining < 0) { return; } writer.write(chars, 0, remaining); writer.flush(); buffer = out.toByteArray(); remaining = buffer.length; out.reset(); } }
// in src/tools/org/h2/dev/util/ReaderInputStream.java
public int read() throws IOException { if (remaining == 0) { fillBuffer(); } if (remaining < 0) { return -1; } remaining--; return buffer[pos++] & 0xff; }
// in src/tools/org/h2/dev/util/FileViewer.java
private static void process(String fileName, String find, boolean head, boolean tail, long start, int lines, boolean quiet) throws IOException { RandomAccessFile file = new RandomAccessFile(fileName, "r"); long length = file.length(); if (head) { file.seek(start); list(start, "Head", readLines(file, lines)); } if (find != null) { file.seek(start); long pos = find(file, find.getBytes(), quiet); if (pos >= 0) { file.seek(pos); list(pos, "Found " + find, readLines(file, lines)); } } if (tail) { long pos = length - 100L * lines; ArrayList<String> list = null; while (pos > 0) { file.seek(pos); list = readLines(file, Integer.MAX_VALUE); if (list.size() > lines) { break; } pos -= 100L * lines; } // remove the first (maybe partial) line list.remove(0); while (list.size() > lines) { list.remove(0); } list(pos, "Tail", list); } }
// in src/tools/org/h2/dev/util/FileViewer.java
private static long find(RandomAccessFile file, byte[] find, boolean quiet) throws IOException { long pos = file.getFilePointer(); long length = file.length(); int bufferSize = 4 * 1024; byte[] data = new byte[bufferSize * 2]; long last = System.currentTimeMillis(); while (pos < length) { System.arraycopy(data, bufferSize, data, 0, bufferSize); if (pos + bufferSize > length) { file.readFully(data, bufferSize, (int) (length - pos)); return find(data, find, (int) (bufferSize + length - pos - find.length)); } if (!quiet) { long now = System.currentTimeMillis(); if (now > last + 5000) { System.out.println((100 * pos / length) + "%"); last = now; } } file.readFully(data, bufferSize, bufferSize); int f = find(data, find, bufferSize); if (f >= 0) { return f + pos - bufferSize; } pos += bufferSize; } return -1; }
// in src/tools/org/h2/dev/util/FileViewer.java
private static ArrayList<String> readLines(RandomAccessFile file, int maxLines) throws IOException { ArrayList<String> lines = new ArrayList<String>(); ByteArrayOutputStream buff = new ByteArrayOutputStream(100); boolean lastNewline = false; while (maxLines > 0) { int x = file.read(); if (x < 0) { break; } if (x == '\r' || x == '\n') { if (!lastNewline) { maxLines--; lastNewline = true; byte[] data = buff.toByteArray(); String s = new String(data); lines.add(s); buff.reset(); } continue; } if (lastNewline) { lastNewline = false; } buff.write(x); } byte[] data = buff.toByteArray(); if (data.length > 0) { String s = new String(data); lines.add(s); } return lines; }
// in src/tools/org/h2/build/doc/UploadBuild.java
private static void zip(String destFile, String directory, boolean storeOnly) throws IOException { OutputStream out = new FileOutputStream(destFile); ZipOutputStream zipOut = new ZipOutputStream(out); if (storeOnly) { zipOut.setMethod(ZipOutputStream.STORED); } zipOut.setLevel(Deflater.BEST_COMPRESSION); addFiles(new File(directory), new File(directory), zipOut); zipOut.finish(); zipOut.close(); }
// in src/tools/org/h2/build/doc/UploadBuild.java
private static void addFiles(File base, File file, ZipOutputStream out) throws IOException { if (file.isDirectory()) { for (File f : file.listFiles()) { addFiles(base, f, out); } } else { String path = file.getAbsolutePath().substring(base.getAbsolutePath().length()); path = path.replace('\\', '/'); if (path.startsWith("/")) { path = path.substring(1); } byte[] data = IOUtils.readBytesAndClose(new FileInputStream(file), -1); ZipEntry entry = new ZipEntry(path); CRC32 crc = new CRC32(); crc.update(data); entry.setSize(file.length()); entry.setCrc(crc.getValue()); out.putNextEntry(entry); out.write(data); out.closeEntry(); } }
// in src/tools/org/h2/build/doc/WebSite.java
private void loadFragments() throws IOException { File dir = new File(sourceDir, "html"); for (File f : dir.listFiles()) { if (f.getName().startsWith("fragments")) { FileInputStream in = new FileInputStream(f); byte[] bytes = IOUtils.readBytesAndClose(in, 0); String page = new String(bytes, "UTF-8"); fragments.put(f.getName(), page); } } }
// in src/tools/org/h2/build/doc/WebSite.java
private void copy(File source, File target, boolean replaceFragments, boolean web) throws IOException { if (source.isDirectory()) { target.mkdirs(); for (File f : source.listFiles()) { copy(f, new File(target, f.getName()), replaceFragments, web); } } else { String name = source.getName(); if (name.endsWith("onePage.html") || name.startsWith("fragments")) { return; } if (web) { if (name.endsWith("main.html") || name.endsWith("main_ja.html")) { return; } } else { if (name.endsWith("mainWeb.html") || name.endsWith("mainWeb_ja.html")) { return; } } FileInputStream in = new FileInputStream(source); byte[] bytes = IOUtils.readBytesAndClose(in, 0); if (name.endsWith(".html")) { String page = new String(bytes, "UTF-8"); if (web) { page = StringUtils.replaceAll(page, ANALYTICS_TAG, ANALYTICS_SCRIPT); } if (replaceFragments) { page = replaceFragments(name, page); page = StringUtils.replaceAll(page, "<a href=\"frame", "<a href=\"main"); page = StringUtils.replaceAll(page, "html/frame.html", "html/main.html"); } if (web) { page = StringUtils.replaceAll(page, TRANSLATE_START, ""); page = StringUtils.replaceAll(page, TRANSLATE_END, ""); page = StringUtils.replaceAll(page, "<pre>", "<pre class=\"notranslate\">"); page = StringUtils.replaceAll(page, "<code>", "<code class=\"notranslate\">"); } bytes = page.getBytes("UTF-8"); } FileOutputStream out = new FileOutputStream(target); out.write(bytes); out.close(); if (web) { if (name.endsWith("mainWeb.html")) { target.renameTo(new File(target.getParentFile(), "main.html")); } else if (name.endsWith("mainWeb_ja.html")) { target.renameTo(new File(target.getParentFile(), "main_ja.html")); } } } }
// in src/tools/org/h2/build/doc/SpellChecker.java
public static void main(String... args) throws IOException { String dir = Utils.getProperty("spellcheckDir", "src"); new SpellChecker().run("src/tools/org/h2/build/doc/dictionary.txt", dir); }
// in src/tools/org/h2/build/doc/SpellChecker.java
private void run(String dictionaryFileName, String dir) throws IOException { process(new File(dictionaryFileName)); process(new File(dir)); if (printDictionary) { System.out.println("USED WORDS"); String[] list = new String[used.size()]; used.toArray(list); Arrays.sort(list); StringBuilder buff = new StringBuilder(); for (String s : list) { if (buff.length() > 0) { if (buff.length() + s.length() > 80) { System.out.println(buff.toString()); buff.setLength(0); } else { buff.append(' '); } } buff.append(s); } System.out.println(buff.toString()); } if (unknown.size() > 0) { System.out.println(); System.out.println("UNKNOWN WORDS"); for (String s : unknown.keySet()) { // int count = unknown.get(s); System.out.print(s + " "); errorCount++; } System.out.println(); System.out.println(); } if (errorCount > 0) { throw new IOException(errorCount + " error found"); } }
// in src/tools/org/h2/build/doc/SpellChecker.java
private void process(File file) throws IOException { String name = file.getName(); if (name.endsWith(".svn") || name.endsWith(".DS_Store")) { return; } if (name.startsWith("_") && name.indexOf("_en") < 0) { return; } if (file.isDirectory()) { for (File f : file.listFiles()) { process(f); } } else { String fileName = file.getAbsolutePath(); int idx = fileName.lastIndexOf('.'); String suffix; if (idx < 0) { suffix = ""; } else { suffix = fileName.substring(idx + 1); } for (String s : IGNORE) { if (s.equals(suffix)) { return; } } for (String ignoreFile : IGNORE_FILES) { if (fileName.endsWith(ignoreFile)) { return; } } boolean ok = false; for (String s : SUFFIX) { if (s.equals(suffix)) { ok = true; break; } } if (!ok) { throw new IOException("Unsupported suffix: " + suffix + " for file: " + fileName); } String text = new String(BuildBase.readFile(file)); if (fileName.endsWith("dictionary.txt")) { addToDictionary = true; } else { addToDictionary = false; } scan(fileName, text); } }
// in src/tools/org/h2/build/BuildBase.java
private PrintStream filter(PrintStream out, final String[] exclude) { return new PrintStream(new FilterOutputStream(out) { private ByteArrayOutputStream buff = new ByteArrayOutputStream(); public void write(byte[] b) throws IOException { write(b, 0, b.length); } public void write(byte[] b, int off, int len) throws IOException { for (int i = off; i < len; i++) { write(b[i]); } } public void write(byte b) throws IOException { buff.write(b); if (b == '\n') { byte[] data = buff.toByteArray(); String line = new String(data, "UTF-8"); boolean print = true; for (String l : exclude) { if (line.startsWith(l)) { print = false; break; } } if (print) { out.write(data); } buff.reset(); } } public void close() throws IOException { write('\n'); } }); }
// in src/tools/org/h2/build/BuildBase.java
public void write(byte[] b) throws IOException { write(b, 0, b.length); }
// in src/tools/org/h2/build/BuildBase.java
public void write(byte[] b, int off, int len) throws IOException { for (int i = off; i < len; i++) { write(b[i]); } }
// in src/tools/org/h2/build/BuildBase.java
public void write(byte b) throws IOException { buff.write(b); if (b == '\n') { byte[] data = buff.toByteArray(); String line = new String(data, "UTF-8"); boolean print = true; for (String l : exclude) { if (line.startsWith(l)) { print = false; break; } } if (print) { out.write(data); } buff.reset(); } }
// in src/tools/org/h2/build/BuildBase.java
public void close() throws IOException { write('\n'); }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static void buildHtml(String templateDir, String targetDir, String language) throws IOException { File[] list = new File(templateDir).listFiles(); new File(targetDir).mkdirs(); // load the main 'translation' String propName = templateDir + "/_docs_" + MAIN_LANGUAGE + ".properties"; Properties prop = load(propName, false); propName = templateDir + "/_docs_" + language + ".properties"; if (!(new File(propName)).exists()) { throw new IOException("Translation not found: " + propName); } Properties transProp = load(propName, false); for (Object k : transProp.keySet()) { String key = (String) k; String t = transProp.getProperty(key); // overload with translations, but not the ones starting with # if (t.startsWith("##")) { prop.put(key, t.substring(2)); } else if (!t.startsWith("#")) { prop.put(key, t); } } ArrayList <String>fileNames = new ArrayList<String>(); for (File f : list) { String name = f.getName(); if (!name.endsWith(".jsp")) { continue; } // remove '.jsp' name = name.substring(0, name.length() - 4); fileNames.add(name); } for (File f : list) { String name = f.getName(); if (!name.endsWith(".jsp")) { continue; } // remove '.jsp' name = name.substring(0, name.length() - 4); String template = IOUtils.readStringAndClose(new FileReader(templateDir + "/" + name + ".jsp"), -1); HashMap<String, Object> map = New.hashMap(); for (Object k : prop.keySet()) { map.put(k.toString(), prop.get(k)); } String html = PageParser.parse(template, map); html = StringUtils.replaceAll(html, "lang=\"" + MAIN_LANGUAGE + "\"", "lang=\"" + language + "\""); for (String n : fileNames) { if ("frame".equals(n)) { // don't translate 'frame.html' to 'frame_ja.html', // otherwise we can't switch back to English continue; } html = StringUtils.replaceAll(html, n + ".html\"", n + "_" + language + ".html\""); } html = StringUtils.replaceAll(html, "_" + MAIN_LANGUAGE + ".html\"", ".html\""); String target; if (language.equals(MAIN_LANGUAGE)) { target = targetDir + "/" + name + ".html"; } else { target = targetDir + "/" + name + "_" + language + ".html"; } OutputStream out = new FileOutputStream(target); OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8"); writer.write(html); writer.close(); } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static void prepare(String baseDir, String path, boolean utf8) throws IOException { String suffix = utf8 ? ".prop" : ".properties"; File dir = new File(path); File main = null; ArrayList<File> translations = new ArrayList<File>(); for (File f : dir.listFiles()) { if (f.getName().endsWith(suffix) && f.getName().indexOf('_') >= 0) { if (f.getName().endsWith("_" + MAIN_LANGUAGE + suffix)) { main = f; } else { translations.add(f); } } } SortedProperties p = load(main.getAbsolutePath(), utf8); Properties base = load(baseDir + "/" + main.getName(), utf8); store(p, main.getAbsolutePath(), utf8); for (File trans : translations) { String language = trans.getName(); language = language.substring(language.lastIndexOf('_') + 1, language.lastIndexOf('.')); prepare(p, base, trans, utf8); } store(p, baseDir + "/" + main.getName(), utf8); }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static SortedProperties load(String fileName, boolean utf8) throws IOException { if (utf8) { String s = new String(IOUtils.readBytesAndClose(new FileInputStream(fileName), -1), "UTF-8"); return SortedProperties.fromLines(s); } return SortedProperties.loadProperties(fileName); }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static void store(SortedProperties p, String fileName, boolean utf8) throws IOException { if (utf8) { String s = p.toLines(); FileOutputStream f = new FileOutputStream(fileName); f.write(s.getBytes("UTF-8")); f.close(); } else { p.store(fileName); } }
// in src/tools/org/h2/build/i18n/PrepareTranslation.java
private static void prepare(Properties main, Properties base, File trans, boolean utf8) throws IOException { SortedProperties p = load(trans.getAbsolutePath(), utf8); Properties oldTranslations = new Properties(); for (Object k : base.keySet()) { String key = (String) k; String m = base.getProperty(key); String t = p.getProperty(key); if (t != null && !t.startsWith("#")) { oldTranslations.setProperty(m, t); } } HashSet<String> toTranslate = new HashSet<String>(); // add missing keys, using # and the value from the main file for (Object k : main.keySet()) { String key = (String) k; String now = main.getProperty(key); if (!p.containsKey(key)) { String t = oldTranslations.getProperty(now); if (t == null) { // System.out.println(trans.getName() + // ": key " + key + " not found in " + // "translation file; added # 'translation'"); t = "#" + now; p.put(key, t); } else { p.put(key, t); } } else { String t = p.getProperty(key); String last = base.getProperty(key); if (t.startsWith("#") && !t.startsWith("##")) { // not translated before t = oldTranslations.getProperty(now); if (t == null) { t = "#" + now; } p.put(key, t); } else if (last != null && !last.equals(now)) { t = oldTranslations.getProperty(now); if (t == null) { // main data changed since the last run: review translation System.out.println(trans.getName() + ": key " + key + " changed, please review; last=" + last + " now=" + now); String old = p.getProperty(key); t = "#" + now + " #" + old; p.put(key, t); } else { p.put(key, t); } } } } for (String key : toTranslate) { String now = main.getProperty(key); String t; System.out.println(trans.getName() + ": key " + key + " not found in translation file; added dummy # 'translation'"); t = "#" + now; p.put(key, t); } // remove keys that don't exist in the main file (deleted or typo in the key) for (Object k : new ArrayList<Object>(p.keySet())) { String key = (String) k; if (!main.containsKey(key)) { p.remove(key); } } store(p, trans.getAbsolutePath(), utf8); }
// in src/tools/org/h2/build/doclet/ResourceDoclet.java
public static boolean start(RootDoc root) throws IOException { return new ResourceDoclet().startDoc(root); }
// in src/tools/org/h2/build/doclet/ResourceDoclet.java
private boolean startDoc(RootDoc root) throws IOException { ClassDoc[] classes = root.classes(); String[][] options = root.options(); for (String[] op : options) { if (op[0].equals("dest")) { destFile = op[1]; } } for (ClassDoc clazz : classes) { processClass(clazz); } resources.store(destFile); return true; }
// in src/tools/org/h2/build/doclet/Doclet.java
public static boolean start(RootDoc root) throws IOException { return new Doclet().startDoc(root); }
// in src/tools/org/h2/build/doclet/Doclet.java
private boolean startDoc(RootDoc root) throws IOException { ClassDoc[] classes = root.classes(); String[][] options = root.options(); for (String[] op : options) { if (op[0].equals("destdir")) { destDir = op[1]; } } for (ClassDoc clazz : classes) { processClass(clazz); } if (errorCount > 0) { throw new IOException("FAILED: " + errorCount + " errors found"); } return true; }
// in src/tools/org/h2/build/doclet/Doclet.java
private void processClass(ClassDoc clazz) throws IOException { String packageName = clazz.containingPackage().name(); String dir = destDir + "/" + packageName.replace('.', '/'); (new File(dir)).mkdirs(); String fileName = dir + "/" + clazz.name() + ".html"; String className = getClass(clazz); FileWriter out = new FileWriter(fileName); PrintWriter writer = new PrintWriter(new BufferedWriter(out)); writer.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" " + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"); String language = "en"; writer.println("<html xmlns=\"http://www.w3.org/1999/xhtml\" " + "lang=\"" + language + "\" xml:lang=\"" + language + "\">"); writer.println("<head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /><title>"); writer.println(className); writer.println("</title><link rel=\"stylesheet\" type=\"text/css\" href=\"../../../stylesheet.css\" />"); writer.println("<script type=\"text/javascript\" src=\"../../../animate.js\"></script>"); writer.println("</head><body onload=\"openLink();\">"); writer.println("<table class=\"content\"><tr class=\"content\"><td class=\"content\"><div class=\"contentDiv\">"); writer.println("<h1>" + className + "</h1>"); writer.println(formatText(clazz.commentText()) + "<br /><br />"); // methods ConstructorDoc[] constructors = clazz.constructors(); MethodDoc[] methods = clazz.methods(); ExecutableMemberDoc[] constructorsMethods = new ExecutableMemberDoc[constructors.length + methods.length]; System.arraycopy(constructors, 0, constructorsMethods, 0, constructors.length); System.arraycopy(methods, 0, constructorsMethods, constructors.length, methods.length); Arrays.sort(constructorsMethods, new Comparator<ExecutableMemberDoc>() { public int compare(ExecutableMemberDoc a, ExecutableMemberDoc b) { // sort static method before non-static methods if (a.isStatic() != b.isStatic()) { return a.isStatic() ? -1 : 1; } return a.name().compareTo(b.name()); } }); // // // Arrays.sort(methods, new Comparator<MethodDoc>() { // public int compare(MethodDoc a, MethodDoc b) { // // sort static method before non-static methods // if (a.isStatic() != b.isStatic()) { // return a.isStatic() ? -1 : 1; // } // return a.name().compareTo(b.name()); // } // }); ArrayList<String> signatures = new ArrayList<String>(); boolean hasMethods = false; int id = 0; for (int i = 0; i < constructorsMethods.length; i++) { ExecutableMemberDoc method = constructorsMethods[i]; String name = method.name(); if (skipMethod(method)) { continue; } if (!hasMethods) { writer.println("<table class=\"block\"><tr onclick=\"return allDetails()\"><th colspan=\"2\">Methods</th></tr>"); hasMethods = true; } String type = getTypeName(method.isStatic(), false, getReturnType(method)); writer.println("<tr id=\"__"+id+"\" onclick=\"return on("+ id +")\">"); writer.println("<td class=\"return\">" + type + "</td><td class=\"method\">"); Parameter[] params = method.parameters(); StringBuilder buff = new StringBuilder(); StringBuilder buffSignature = new StringBuilder(name); buff.append('('); for (int j = 0; j < params.length; j++) { if (j > 0) { buff.append(", "); } buffSignature.append('_'); Parameter param = params[j]; boolean isVarArgs = method.isVarArgs() && j == params.length - 1; String typeName = getTypeName(false, isVarArgs, param.type()); buff.append(typeName); buffSignature.append(StringUtils.replaceAll(typeName, "[]", "-")); buff.append(' '); buff.append(param.name()); } buff.append(')'); if (isDeprecated(method)) { name = "<span class=\"deprecated\">" + name + "</span>"; } String signature = buffSignature.toString(); while (signatures.size() < i) { signatures.add(null); } signatures.add(i, signature); writer.println("<a id=\"" + signature + "\" href=\"#" + signature + "\">" + name + "</a>" + buff.toString()); String firstSentence = getFirstSentence(method.firstSentenceTags()); if (firstSentence != null) { writer.println("<div class=\"methodText\">" + formatText(firstSentence) + "</div>"); } writer.println("</td></tr>"); writer.println("<tr onclick=\"return off("+ id +")\" class=\"detail\" id=\"_"+id+"\">"); writer.println("<td class=\"return\">" + type + "</td><td>"); writeMethodDetails(writer, clazz, method, signature); writer.println("</td></tr>"); id++; } if (hasMethods) { writer.println("</table>"); } // field overview FieldDoc[] fields = clazz.fields(); if (clazz.interfaces().length > 0) { fields = clazz.interfaces()[0].fields(); } Arrays.sort(fields, new Comparator<FieldDoc>() { public int compare(FieldDoc a, FieldDoc b) { return a.name().compareTo(b.name()); } }); int fieldId = 0; for (FieldDoc field : fields) { if (skipField(clazz, field)) { continue; } String name = field.name(); String text = field.commentText(); if (text == null || text.trim().length() == 0) { addError("Undocumented field (" + clazz.name() + ".java:" + field.position().line() + ") " + name); } if (text != null && text.startsWith("INTERNAL")) { continue; } if (fieldId == 0) { writer.println("<br /><table><tr><th colspan=\"2\">Fields</th></tr>"); } String type = getTypeName(true, false, field.type()); writer.println("<tr><td class=\"return\">" + type + "</td><td class=\"method\">"); String constant = field.constantValueExpression(); // add a link (a name) if there is a <code> tag String link = getFieldLink(text, constant, clazz, name); writer.print("<a href=\"#" + link + "\">" + name + "</a>"); if (constant == null) { writer.println(); } else { writer.println(" = " + constant); } writer.println("</td></tr>"); fieldId++; } if (fieldId > 0) { writer.println("</table>"); } // field details Arrays.sort(fields, new Comparator<FieldDoc>() { public int compare(FieldDoc a, FieldDoc b) { String ca = a.constantValueExpression(); if (ca == null) { ca = a.name(); } String cb = b.constantValueExpression(); if (cb == null) { cb = b.name(); } return ca.compareTo(cb); } }); for (FieldDoc field : fields) { writeFieldDetails(writer, clazz, field); } writer.println("</div></td></tr></table></body></html>"); writer.close(); out.close(); }
// in src/tools/org/h2/build/code/CheckJavadoc.java
private void checkJavadoc(File file) throws IOException { RandomAccessFile in = new RandomAccessFile(file, "r"); byte[] data = new byte[(int) file.length()]; in.readFully(data); in.close(); String text = new String(data); int comment = text.indexOf("/**"); if (comment < 0) { System.out.println("No Javadoc comment: " + file.getAbsolutePath()); errorCount++; } int open = text.indexOf('{'); if (open < 0 || open < comment) { System.out.println("No '{' or '{' before the first Javadoc comment: " + file.getAbsolutePath()); errorCount++; } int pos = 0; int lineNumber = 1; boolean inComment = false; while (true) { int next = text.indexOf("\n", pos); if (next < 0) { break; } String line = text.substring(pos, next).trim(); if (line.startsWith("/*")) { inComment = true; } if (inComment) { if (line.length() > MAX_COMMENT_LINE_SIZE && !line.trim().startsWith("* http://")) { System.out.println("Long line : " + file.getAbsolutePath() + " (" + file.getName() + ":" + lineNumber + ")"); errorCount++; } if (line.endsWith("*/")) { inComment = false; } } if (!inComment && line.startsWith("//") && line.length() > MAX_COMMENT_LINE_SIZE && !line.trim().startsWith("// http://")) { System.out.println("Long line: " + file.getAbsolutePath() + " (" + file.getName() + ":" + lineNumber + ")"); errorCount++; } else if (!inComment && line.length() > MAX_SOURCE_LINE_SIZE) { System.out.println("Long line: " + file.getAbsolutePath() + " (" + file.getName() + ":" + lineNumber + ")"); } lineNumber++; pos = next + 1; } }
// in src/tools/org/h2/build/code/SwitchSource.java
public static void main(String... args) throws IOException { new SwitchSource().run(args); }
// in src/tools/org/h2/build/code/SwitchSource.java
private void run(String... args) throws IOException { String dir = null; String version = null; for (int i = 0; i < args.length; i++) { String a = args[i]; if ("-dir".equals(a)) { dir = args[++i]; } else if ("-auto".equals(a)) { enable.add("AWT"); version = System.getProperty("java.specification.version"); } else if ("-version".equals(a)) { version = args[++i]; } else if (a.startsWith("-")) { String x = a.substring(1); disable.add(x); enable.remove(x); } else if (a.startsWith("+")) { String x = a.substring(1); enable.add(x); disable.remove(x); } else { showUsage(); return; } } if (version == null) { // ok } else if ("1.5".equals(version)) { disable.add("Java 1.6"); disable.add("Java 1.7"); } else if ("1.6".equals(version)) { enable.add("Java 1.6"); disable.add("Java 1.7"); } else if (version.compareTo("1.7") >= 0) { enable.add("Java 1.6"); enable.add("Java 1.7"); } else { throw new IllegalArgumentException("version: " + version); } if (dir == null) { showUsage(); } else { process(new File(dir)); } }
// in src/tools/org/h2/build/code/SwitchSource.java
private void process(File f) throws IOException { String name = f.getName(); if (name.startsWith(".svn")) { return; } else if (name.endsWith(".java")) { processFile(f); } else if (f.isDirectory()) { for (File file : f.listFiles()) { process(file); } } }
// in src/tools/org/h2/build/code/SwitchSource.java
private void processFile(File f) throws IOException { RandomAccessFile read = new RandomAccessFile(f, "r"); byte[] buffer; try { long len = read.length(); if (len >= Integer.MAX_VALUE) { throw new IOException("Files bigger than Integer.MAX_VALUE are not supported"); } buffer = new byte[(int) len]; read.readFully(buffer); } finally { read.close(); } boolean found = false; // check for ## without creating a string for (int i = 0; i < buffer.length - 1; i++) { if (buffer[i] == '#' && buffer[i + 1] == '#') { found = true; break; } } if (!found) { return; } String source = new String(buffer); String target = source; for (String x : enable) { target = replaceAll(target, "/*## " + x + " ##", "//## " + x + " ##"); } for (String x : disable) { target = replaceAll(target, "//## " + x + " ##", "/*## " + x + " ##"); } if (!source.equals(target)) { String name = f.getPath(); File fileNew = new File(name + ".new"); FileWriter write = new FileWriter(fileNew); write.write(target); write.close(); File fileBack = new File(name + ".bak"); fileBack.delete(); f.renameTo(fileBack); File fileCopy = new File(name); if (!fileNew.renameTo(fileCopy)) { throw new IOException("Could not rename " + fileNew.getAbsolutePath() + " to " + name); } if (!fileBack.delete()) { throw new IOException("Could not delete " + fileBack.getAbsolutePath()); } // System.out.println(name); } }
// in src/tools/org/h2/java/Test.java
public static void main(String... args) throws IOException { new Test().test(); }
// in src/tools/org/h2/java/Test.java
public void test() throws IOException { // gcc --std=c99 test.c // (for "mixed declarations and code") // not supported yet: // HexadecimalFloatingPointLiteral // int x()[] { return null; } // annotations // import static // import * // initializer blocks // access to static fields with instance variable // final variables (within blocks, parameter list) // Identifier : (labels) // ClassOrInterfaceDeclaration within blocks (or any other nested classes) // assert assertEquals("\\\\" + "u0000", JavaParser.replaceUnicode("\\\\" + "u0000")); assertEquals("\u0000", JavaParser.replaceUnicode("\\" + "u0000")); assertEquals("\u0000", JavaParser.replaceUnicode("\\" + "uu0000")); assertEquals("\\\\" + "\u0000", JavaParser.replaceUnicode("\\\\\\" + "u0000")); assertEquals("0", JavaParser.readNumber("0a")); assertEquals("0l", JavaParser.readNumber("0l")); assertEquals("0xFFL", JavaParser.readNumber("0xFFLx")); assertEquals("0xDadaCafe", JavaParser.readNumber("0xDadaCafex")); assertEquals("1.40e-45f", JavaParser.readNumber("1.40e-45fx")); assertEquals("1e1f", JavaParser.readNumber("1e1fx")); assertEquals("2.f", JavaParser.readNumber("2.fx")); assertEquals(".3d", JavaParser.readNumber(".3dx")); assertEquals("6.022137e+23f", JavaParser.readNumber("6.022137e+23f+1")); JavaParser parser = new JavaParser(); parser.parse("src/tools/org/h2", "java.lang.Object"); parser.parse("src/tools/org/h2", "java.lang.String"); parser.parse("src/tools/org/h2", "java.lang.Math"); parser.parse("src/tools/org/h2", "java.lang.Integer"); parser.parse("src/tools/org/h2", "java.lang.StringBuilder"); parser.parse("src/tools/org/h2", "java.io.PrintStream"); parser.parse("src/tools/org/h2", "java.lang.System"); parser.parse("src/tools/org/h2", "java.util.Arrays"); parser.parse("src/tools", "org.h2.java.TestApp"); PrintWriter w = new PrintWriter(System.out); parser.writeHeader(w); parser.writeSource(w); w.flush(); w = new PrintWriter(new FileWriter("bin/test.c")); parser.writeHeader(w); parser.writeSource(w); w.close(); }
156
            
// in src/main/org/h2/jmx/DocumentedMBean.java
catch (IOException e) { // ignore }
// in src/main/org/h2/message/TraceSystem.java
catch (IOException e) { // ignore }
// in src/main/org/h2/message/DbException.java
catch (IOException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/tools/Restore.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/main/org/h2/tools/CompressTool.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/CompressTool.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/ConvertTraceFile.java
catch (IOException e) { throw DbException.convertIOException(e, traceFile); }
// in src/main/org/h2/tools/Backup.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException writing " + outputFileName, e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException reading " + inputFileName, e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { close(); throw e; }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException reading from " + fileName, e); }
// in src/main/org/h2/tools/Recover.java
catch (IOException e) { // ignore }
// in src/main/org/h2/tools/RunScript.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/tools/Console.java
catch (IOException e) { e.printStackTrace(); return null; }
// in src/main/org/h2/tools/Shell.java
catch (IOException e) { println(e.getMessage()); break; }
// in src/main/org/h2/tools/Shell.java
catch (IOException e) { // ignore }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/Transfer.java
catch (IOException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { trace.error(e, "close"); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/expression/Function.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/store/LobStorage.java
catch (IOException e) { if (lobId != -1) { removeLob(lobId); } throw DbException.convertIOException(e, null); }
// in src/main/org/h2/store/PageLog.java
catch (IOException e) { trace.debug("log recovery completed"); }
// in src/main/org/h2/store/FileStoreInputStream.java
catch (IOException e) { throw DbException.convertIOException(e, store.name); }
// in src/main/org/h2/store/fs/FilePathMem.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (IOException e) { if (i > 16 || e.toString().indexOf("user-mapped section open") < 0) { throw e; } }
// in src/main/org/h2/store/fs/FilePathZip.java
catch (IOException e) { return false; }
// in src/main/org/h2/store/fs/FilePathZip.java
catch (IOException e) { return false; }
// in src/main/org/h2/store/fs/FilePathZip.java
catch (IOException e) { return 0; }
// in src/main/org/h2/store/fs/FilePathZip.java
catch (IOException e) { throw DbException.convertIOException(e, "listFiles " + path); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { // 'access denied' is really a concurrent access problem wait(i); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { // ignore }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { return new FileOutputStream(name); } catch (IOException e2) { throw DbException.convertIOException(e, name); } }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e2) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { f = new FileDisk(name, mode); } catch (IOException e2) { throw e; } }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e2) { throw e; }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, "name: " + name + " mode: " + mode); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { // ignore }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { throw getExceptionFatal("Could not save properties " + fileName, e); }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { return; }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { lastException = e; }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { throw getExceptionFatal("IOException", null); }
// in src/main/org/h2/command/dml/RunScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/command/dml/ScriptBase.java
catch (IOException e) { throw DbException.convertIOException(e, file); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, getFileName()); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/command/dml/BackupCommand.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { s.removeServer(e, i--, ++count); }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { session.removeServer(e, i--, ++count); }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { session.removeServer(e, i--, ++count); }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { session.removeServer(e, i--, ++count); }
// in src/main/org/h2/command/CommandRemote.java
catch (IOException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (IOException e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (IOException e) { throw DbException.convertIOException(e, databaseName); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { removeServer(e, i--, ++count); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { trace.debug(e, "could not cancel statement"); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { removeServer(e, i--, ++count); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { removeServer(e, i--, ++count); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { throw DbException.convertIOException(e, prefix); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { if (len == 1) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, e, e + ": " + s); } switchOffCluster = true; }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { removeServer(e, i--, ++count); }
// in src/main/org/h2/util/ScriptReader.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/util/ScriptReader.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { try { return createSocket("localhost", port, ssl); } catch (IOException e2) { // throw the original exception throw e; } }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e2) { // throw the original exception throw e; }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { throw DbException.convertIOException(e, "port: " + port + " ssl: " + ssl); }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { // ignore }
// in src/main/org/h2/util/Utils.java
catch (IOException e) { // if this happens we have a real problem e.printStackTrace(); }
// in src/main/org/h2/util/MathUtils.java
catch (IOException e) { warn("generateAlternativeSeed", e); return new byte[1]; }
// in src/main/org/h2/util/Tool.java
catch (IOException e) { out.println("Cannot load " + resourceName); }
// in src/main/org/h2/server/TcpServer.java
catch (IOException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/pg/PgServer.java
catch (IOException e) { // TODO log exception e.printStackTrace(); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (IOException e) { throw DbException.convertIOException(e, "Can not read pg_catalog resource"); }
// in src/main/org/h2/server/web/WebThread.java
catch (IOException e) { // ignore }
// in src/main/org/h2/server/web/WebThread.java
catch (IOException e) { // ignore }
// in src/main/org/h2/server/web/WebServer.java
catch (IOException e) { traceError(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (IOException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (IOException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (IOException e) { throw DbException.convertIOException(e, "Tokenizer error"); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (IOException e) { // ignore }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (IOException e) { server.traceError(e); reply(426, "Failed"); }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
catch (IOException e) { e.printStackTrace(); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
catch (IOException e) { traceError(e); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
catch (IOException e) { if (traceError) { traceError(e); } return false; }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
catch (IOException e) { // ignore }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
catch (IOException e) { e.printStackTrace(); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
catch (IOException e) { e.printStackTrace(); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
catch (IOException e) { // ignore }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
catch (IOException e) { // ignore }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { throw DbException.convertIOException(e, "cwd"); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { error(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { error(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { error(e); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { error(e); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { return false; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { return false; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { return 0; }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { throw DbException.convertIOException(e, "listFiles " + path); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { // ignore }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/FileViewer.java
catch (IOException e) { throw DbException.toSQLException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error downloading", e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/build/doc/RailroadImages.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error downloading " + fileURL + " to " + target, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error reading from file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error creating file " + destFile, e); }
// in src/tools/org/h2/build/Build.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/Build.java
catch (IOException e) { e.printStackTrace(); }
// in src/tools/org/h2/jaqu/bytecode/ClassReader.java
catch (IOException e) { throw new RuntimeException("Could not read class bytecode", e); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (IOException io) { throw DbException.convertIOException(io, "could not generate model").getSQLException(); }
// in src/tools/org/h2/java/JavaParser.java
catch (IOException e) { throw new RuntimeException(e); }
97
            
// in src/main/org/h2/tools/Restore.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/main/org/h2/tools/CompressTool.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/CompressTool.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/ConvertTraceFile.java
catch (IOException e) { throw DbException.convertIOException(e, traceFile); }
// in src/main/org/h2/tools/Backup.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException writing " + outputFileName, e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException reading " + inputFileName, e); }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { close(); throw e; }
// in src/main/org/h2/tools/Csv.java
catch (IOException e) { throw convertException("IOException reading from " + fileName, e); }
// in src/main/org/h2/tools/RunScript.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/value/ValueLob.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, toString()); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/value/ValueLobDb.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/result/ResultRemote.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/expression/Function.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/store/LobStorage.java
catch (IOException e) { if (lobId != -1) { removeLob(lobId); } throw DbException.convertIOException(e, null); }
// in src/main/org/h2/store/FileStoreInputStream.java
catch (IOException e) { throw DbException.convertIOException(e, store.name); }
// in src/main/org/h2/store/fs/FilePathMem.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (IOException e) { if (i > 16 || e.toString().indexOf("user-mapped section open") < 0) { throw e; } }
// in src/main/org/h2/store/fs/FilePathZip.java
catch (IOException e) { throw DbException.convertIOException(e, "listFiles " + path); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { return new FileOutputStream(name); } catch (IOException e2) { throw DbException.convertIOException(e, name); } }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e2) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e) { freeMemoryAndFinalize(); try { f = new FileDisk(name, mode); } catch (IOException e2) { throw e; } }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (IOException e2) { throw e; }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, "name: " + name + " mode: " + mode); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileStore.java
catch (IOException e) { closeFileSilently(); throw DbException.convertIOException(e, name); }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { throw getExceptionFatal("Could not save properties " + fileName, e); }
// in src/main/org/h2/store/FileLock.java
catch (IOException e) { throw getExceptionFatal("IOException", null); }
// in src/main/org/h2/command/dml/RunScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/command/dml/ScriptBase.java
catch (IOException e) { throw DbException.convertIOException(e, file); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, getFileName()); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/command/dml/BackupCommand.java
catch (IOException e) { throw DbException.convertIOException(e, fileName); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (IOException e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (IOException e) { throw DbException.convertIOException(e, databaseName); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { throw DbException.convertIOException(e, prefix); }
// in src/main/org/h2/engine/SessionRemote.java
catch (IOException e) { if (len == 1) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, e, e + ": " + s); } switchOffCluster = true; }
// in src/main/org/h2/util/ScriptReader.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/util/ScriptReader.java
catch (IOException e) { throw DbException.convertIOException(e, null); }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { try { return createSocket("localhost", port, ssl); } catch (IOException e2) { // throw the original exception throw e; } }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e2) { // throw the original exception throw e; }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { throw DbException.convertIOException(e, "port: " + port + " ssl: " + ssl); }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (IOException e) { throw DbException.convertIOException(e, "Can not read pg_catalog resource"); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (IOException e) { throw convertException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (IOException e) { throw DbException.toSQLException(e); }
// in src/main/org/h2/fulltext/FullText.java
catch (IOException e) { throw DbException.convertIOException(e, "Tokenizer error"); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/tools/org/h2/dev/fs/FilePathCrypt.java
catch (IOException e) { throw DbException.convertIOException(e, name); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { throw DbException.convertIOException(e, "cwd"); }
// in src/tools/org/h2/dev/fs/FileShell.java
catch (IOException e) { throw DbException.convertIOException(e, zipFileName); }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (IOException e) { throw DbException.convertIOException(e, "listFiles " + path); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/FileViewer.java
catch (IOException e) { throw DbException.toSQLException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error downloading", e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/build/doc/RailroadImages.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error downloading " + fileURL + " to " + target, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error reading from file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error creating file " + destFile, e); }
// in src/tools/org/h2/build/Build.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/bytecode/ClassReader.java
catch (IOException e) { throw new RuntimeException("Could not read class bytecode", e); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (IOException io) { throw DbException.convertIOException(io, "could not generate model").getSQLException(); }
// in src/tools/org/h2/java/JavaParser.java
catch (IOException e) { throw new RuntimeException(e); }
17
runtime (Lib) IllegalArgumentException 25
            
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
public synchronized void setMaxConnections(int max) { if (max < 1) { throw new IllegalArgumentException("Invalid maxConnections value: " + max); } this.maxConnections = max; // notify waiting threads if the value was increased notifyAll(); }
// in src/main/org/h2/tools/MultiDimension.java
public int normalize(int dimensions, double value, double min, double max) { if (value < min || value > max) { throw new IllegalArgumentException(min + "<" + value + "<" + max); } double x = (value - min) / (max - min); return (int) (x * getMaxValue(dimensions)); }
// in src/main/org/h2/tools/MultiDimension.java
public int getMaxValue(int dimensions) { if (dimensions < 2 || dimensions > 32) { throw new IllegalArgumentException("" + dimensions); } int bitsPerValue = getBitsPerValue(dimensions); return (int) ((1L << bitsPerValue) - 1); }
// in src/main/org/h2/tools/MultiDimension.java
public long interleave(int... values) { int dimensions = values.length; long max = getMaxValue(dimensions); int bitsPerValue = getBitsPerValue(dimensions); long x = 0; for (int i = 0; i < dimensions; i++) { long k = values[i]; if (k < 0 || k > max) { throw new IllegalArgumentException(0 + "<" + k + "<" + max); } for (int b = 0; b < bitsPerValue; b++) { x |= (k & (1L << b)) << (i + (dimensions - 1) * b); } } return x; }
// in src/main/org/h2/tools/MultiDimension.java
public long interleave(int x, int y) { if (x < 0) { throw new IllegalArgumentException(0 + "<" + x); } if (y < 0) { throw new IllegalArgumentException(0 + "<" + y); } long z = 0; for (int i = 0; i < 32; i++) { z |= (x & (1L << i)) << i; z |= (y & (1L << i)) << (i + 1); } return z; }
// in src/main/org/h2/tools/MultiDimension.java
private long[][] getMortonRanges(int[] min, int[] max) { int len = min.length; if (max.length != len) { throw new IllegalArgumentException(len + "=" + max.length); } for (int i = 0; i < len; i++) { if (min[i] > max[i]) { int temp = min[i]; min[i] = max[i]; max[i] = temp; } } int total = getSize(min, max, len); ArrayList<long[]> list = New.arrayList(); addMortonRanges(list, min, max, len, 0); combineEntries(list, total); long[][] ranges = new long[list.size()][2]; list.toArray(ranges); return ranges; }
// in src/main/org/h2/tools/MultiDimension.java
private void addMortonRanges(ArrayList<long[]> list, int[] min, int[] max, int len, int level) { if (level > 100) { throw new IllegalArgumentException("" + level); } int largest = 0, largestDiff = 0; long size = 1; for (int i = 0; i < len; i++) { int diff = max[i] - min[i]; if (diff < 0) { throw new IllegalArgumentException(""+ diff); } size *= diff + 1; if (size < 0) { throw new IllegalArgumentException("" + size); } if (diff > largestDiff) { largestDiff = diff; largest = i; } } long low = interleave(min), high = interleave(max); if (high < low) { throw new IllegalArgumentException(high + "<" + low); } long range = high - low + 1; if (range == size) { long[] item = { low, high }; list.add(item); } else { int middle = findMiddle(min[largest], max[largest]); int temp = max[largest]; max[largest] = middle; addMortonRanges(list, min, max, len, level + 1); max[largest] = temp; temp = min[largest]; min[largest] = middle + 1; addMortonRanges(list, min, max, len, level + 1); min[largest] = temp; } }
// in src/main/org/h2/tools/MultiDimension.java
private static int findMiddle(int a, int b) { int diff = b - a - 1; if (diff == 0) { return a; } if (diff == 1) { return a + 1; } int scale = 0; while ((1 << scale) < diff) { scale++; } scale--; int m = roundUp(a + 2, 1 << scale) - 1; if (m <= a || m >= b) { throw new IllegalArgumentException(a + "<" + m + "<" + b); } return m; }
// in src/main/org/h2/value/ValueTimestamp.java
private static ValueTimestamp parseTry(String s) { int dateEnd = s.indexOf(' '); if (dateEnd < 0) { // ISO 8601 compatibility dateEnd = s.indexOf('T'); } int timeStart; if (dateEnd < 0) { dateEnd = s.length(); timeStart = -1; } else { timeStart = dateEnd + 1; } long dateValue = DateTimeUtils.parseDateValue(s, 0, dateEnd); long nanos; if (timeStart < 0) { nanos = 0; } else { int timeEnd = s.length(); TimeZone tz = null; if (s.endsWith("Z")) { tz = TimeZone.getTimeZone("UTC"); timeEnd--; } else { int timeZoneStart = s.indexOf('+', dateEnd); if (timeZoneStart < 0) { timeZoneStart = s.indexOf('-', dateEnd); } if (timeZoneStart >= 0) { String tzName = "GMT" + s.substring(timeZoneStart); tz = TimeZone.getTimeZone(tzName); if (!tz.getID().startsWith(tzName)) { throw new IllegalArgumentException(tzName); } timeEnd = timeZoneStart; } else { timeZoneStart = s.indexOf(' ', dateEnd + 1); if (timeZoneStart > 0) { String tzName = s.substring(timeZoneStart + 1); tz = TimeZone.getTimeZone(tzName); if (!tz.getID().startsWith(tzName)) { throw new IllegalArgumentException(tzName); } timeEnd = timeZoneStart; } } } nanos = DateTimeUtils.parseTimeNanos(s, dateEnd + 1, timeEnd, true); if (tz != null) { int year = DateTimeUtils.yearFromDateValue(dateValue); int month = DateTimeUtils.monthFromDateValue(dateValue); int day = DateTimeUtils.dayFromDateValue(dateValue); long ms = nanos / 1000000; nanos -= ms * 1000000; long second = ms / 1000; ms -= second * 1000; int minute = (int) (second / 60); second -= minute * 60; int hour = minute / 60; minute -= hour * 60; long millis = DateTimeUtils.getMillis(tz, year, month, day, hour, minute, (int) second, (int) ms); ms = DateTimeUtils.convertToLocal(new Date(millis), Calendar.getInstance(TimeZone.getTimeZone("UTC"))); long md = DateTimeUtils.MILLIS_PER_DAY; long absoluteDay = (ms >= 0 ? ms : ms - md + 1) / md; ms -= absoluteDay * md; nanos += ms * 1000000; } } return ValueTimestamp.fromDateValueAndNanos(dateValue, nanos); }
// in src/main/org/h2/compress/CompressLZF.java
public void expand(byte[] in, int inPos, int inLen, byte[] out, int outPos, int outLen) { // if ((inPos | outPos | outLen) < 0) { if (inPos < 0 || outPos < 0 || outLen < 0) { throw new IllegalArgumentException(); } do { int ctrl = in[inPos++] & 255; if (ctrl < MAX_LITERAL) { // literal run of length = ctrl + 1, ctrl++; // copy to output and move forward this many bytes System.arraycopy(in, inPos, out, outPos, ctrl); outPos += ctrl; inPos += ctrl; } else { // back reference // the highest 3 bits are the match length int len = ctrl >> 5; // if the length is maxed, add the next byte to the length if (len == 7) { len += in[inPos++] & 255; } // minimum back-reference is 3 bytes, // so 2 was subtracted before storing size len += 2; // ctrl is now the offset for a back-reference... // the logical AND operation removes the length bits ctrl = -((ctrl & 0x1f) << 8) - 1; // the next byte augments/increases the offset ctrl -= in[inPos++] & 255; // copy the back-reference bytes from the given // location in output to current position ctrl += outPos; if (outPos + len >= out.length) { // reduce array bounds checking throw new ArrayIndexOutOfBoundsException(); } for (int i = 0; i < len; i++) { out[outPos++] = out[ctrl++]; } } } while (outPos < outLen); }
// in src/main/org/h2/util/DateTimeUtils.java
public static long parseDateValue(String s, int start, int end) { if (s.charAt(start) == '+') { // +year start++; } // start at position 1 to support "-year" int s1 = s.indexOf('-', start + 1); int s2 = s.indexOf('-', s1 + 1); if (s1 <= 0 || s2 <= s1) { throw new IllegalArgumentException(s); } int year = Integer.parseInt(s.substring(start, s1)); int month = Integer.parseInt(s.substring(s1 + 1, s2)); int day = Integer.parseInt(s.substring(s2 + 1, end)); if (!isValidDate(year, month, day)) { throw new IllegalArgumentException(year + "-" + month + "-" + day); } return dateValue(year, month, day); }
// in src/main/org/h2/util/DateTimeUtils.java
public static long parseTimeNanos(String s, int start, int end, boolean timeOfDay) { int hour = 0, minute = 0, second = 0; long nanos = 0; int s1 = s.indexOf(':', start); int s2 = s.indexOf(':', s1 + 1); int s3 = s.indexOf('.', s2 + 1); if (s1 <= 0 || s2 <= s1) { throw new IllegalArgumentException(s); } boolean negative; hour = Integer.parseInt(s.substring(start, s1)); if (hour < 0) { if (timeOfDay) { throw new IllegalArgumentException(s); } negative = true; hour = -hour; } else { negative = false; } minute = Integer.parseInt(s.substring(s1 + 1, s2)); if (s3 < 0) { second = Integer.parseInt(s.substring(s2 + 1, end)); } else { second = Integer.parseInt(s.substring(s2 + 1, s3)); String n = (s.substring(s3 + 1, end) + "000000000").substring(0, 9); nanos = Integer.parseInt(n); } if (hour >= 2000000 || minute < 0 || minute >= 60 || second < 0 || second >= 60) { throw new IllegalArgumentException(s); } if (timeOfDay && hour >= 24) { throw new IllegalArgumentException(s); } nanos += ((((hour * 60L) + minute) * 60) + second) * 1000000000; return negative ? -nanos : nanos; }
// in src/main/org/h2/util/StringUtils.java
public static String urlDecode(String encoded) { int length = encoded.length(); byte[] buff = new byte[length]; int j = 0; for (int i = 0; i < length; i++) { char ch = encoded.charAt(i); if (ch == '+') { buff[j++] = ' '; } else if (ch == '%') { buff[j++] = (byte) Integer.parseInt(encoded.substring(i + 1, i + 3), 16); i += 2; } else { if (SysProperties.CHECK) { if (ch > 127 || ch < ' ') { throw new IllegalArgumentException("Unexpected char " + (int) ch + " decoding " + encoded); } } buff[j++] = (byte) ch; } } String s = utf8Decode(buff, 0, j); return s; }
// in src/tools/org/h2/build/code/SwitchSource.java
private void run(String... args) throws IOException { String dir = null; String version = null; for (int i = 0; i < args.length; i++) { String a = args[i]; if ("-dir".equals(a)) { dir = args[++i]; } else if ("-auto".equals(a)) { enable.add("AWT"); version = System.getProperty("java.specification.version"); } else if ("-version".equals(a)) { version = args[++i]; } else if (a.startsWith("-")) { String x = a.substring(1); disable.add(x); enable.remove(x); } else if (a.startsWith("+")) { String x = a.substring(1); enable.add(x); disable.remove(x); } else { showUsage(); return; } } if (version == null) { // ok } else if ("1.5".equals(version)) { disable.add("Java 1.6"); disable.add("Java 1.7"); } else if ("1.6".equals(version)) { enable.add("Java 1.6"); disable.add("Java 1.7"); } else if (version.compareTo("1.7") >= 0) { enable.add("Java 1.6"); enable.add("Java 1.7"); } else { throw new IllegalArgumentException("version: " + version); } if (dir == null) { showUsage(); } else { process(new File(dir)); } }
0 0 2
            
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (IllegalArgumentException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; }
// in src/main/org/h2/util/DateTimeUtils.java
catch (IllegalArgumentException e) { // special case: if the time simply doesn't exist because of // daylight saving time changes, use the lenient version String message = e.toString(); if (message.indexOf("HOUR_OF_DAY") > 0) { if (hour < 0 || hour > 23) { throw e; } return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else if (message.indexOf("DAY_OF_MONTH") > 0) { int maxDay; if (month == 2) { maxDay = new GregorianCalendar().isLeapYear(year) ? 29 : 28; } else { maxDay = 30 + ((month + (month > 7 ? 1 : 0)) & 1); } if (day < 1 || day > maxDay) { throw e; } // DAY_OF_MONTH is thrown for years > 2037 // using the timezone Brasilia and others, // for example for 2042-10-12 00:00:00. hour += 6; return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else { return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } }
3
            
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (IllegalArgumentException e) { EOFException e2 = new EOFException("EOF"); e2.initCause(e); throw e2; }
// in src/main/org/h2/util/DateTimeUtils.java
catch (IllegalArgumentException e) { // special case: if the time simply doesn't exist because of // daylight saving time changes, use the lenient version String message = e.toString(); if (message.indexOf("HOUR_OF_DAY") > 0) { if (hour < 0 || hour > 23) { throw e; } return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else if (message.indexOf("DAY_OF_MONTH") > 0) { int maxDay; if (month == 2) { maxDay = new GregorianCalendar().isLeapYear(year) ? 29 : 28; } else { maxDay = 30 + ((month + (month > 7 ? 1 : 0)) & 1); } if (day < 1 || day > maxDay) { throw e; } // DAY_OF_MONTH is thrown for years > 2037 // using the timezone Brasilia and others, // for example for 2042-10-12 00:00:00. hour += 6; return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } else { return getTimeTry(true, tz, year, month, day, hour, minute, second, millis); } }
0
runtime (Lib) IllegalStateException 8
            
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
private Connection getConnectionNow() throws SQLException { if (isDisposed) { throw new IllegalStateException("Connection pool has been disposed."); } PooledConnection pc; if (!recycledConnections.isEmpty()) { pc = recycledConnections.remove(recycledConnections.size() - 1); } else { pc = dataSource.getPooledConnection(); } Connection conn = pc.getConnection(); activeConnections++; pc.addConnectionEventListener(this); return conn; }
// in src/main/org/h2/tools/SimpleResultSet.java
public void addColumn(String name, int sqlType, int precision, int scale) { if (rows != null && rows.size() > 0) { throw new IllegalStateException("Cannot add a column after adding rows"); } if (name == null) { name = "C" + (columns.size() + 1); } Column column = new Column(); column.name = name; column.sqlType = sqlType; column.precision = precision; column.scale = scale; columns.add(column); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void addRow(Object... row) { if (rows == null) { throw new IllegalStateException("Cannot add a row when using RowSource"); } rows.add(row); }
// in src/main/org/h2/bnf/Sentence.java
void stopIfRequired() { if (System.currentTimeMillis() > stopAt) { throw new IllegalStateException(); } }
// in src/main/org/h2/util/Task.java
public Exception getException() { stop = true; if (thread == null) { throw new IllegalStateException("Thread not started"); } try { thread.join(); } catch (InterruptedException e) { // ignore } if (ex != null) { return ex; } return null; }
// in src/tools/org/h2/jaqu/TableDefinition.java
void merge(Db db, Object obj) { if (primaryKeyColumnNames == null || primaryKeyColumnNames.size() == 0) { throw new IllegalStateException("No primary key columns defined " + "for table " + obj.getClass() + " - no update possible"); } SQLStatement stat = new SQLStatement(db); StatementBuilder buff = new StatementBuilder("MERGE INTO "); buff.append(db.getDialect().getTableName(schemaName, tableName)).append(" ("); buff.resetCount(); for (FieldDefinition field : fields) { buff.appendExceptFirst(", "); buff.append(field.columnName); } buff.append(") KEY("); buff.resetCount(); for (FieldDefinition field : fields) { if (field.isPrimaryKey) { buff.appendExceptFirst(", "); buff.append(field.columnName); } } buff.append(") "); buff.resetCount(); buff.append("VALUES ("); for (FieldDefinition field : fields) { buff.appendExceptFirst(", "); buff.append('?'); Object value = getValue(obj, field); stat.addParameter(value); } buff.append(')'); stat.setSQL(buff.toString()); StatementLogger.merge(stat.getSQL()); stat.executeUpdate(); }
// in src/tools/org/h2/jaqu/TableDefinition.java
void update(Db db, Object obj) { if (primaryKeyColumnNames == null || primaryKeyColumnNames.size() == 0) { throw new IllegalStateException("No primary key columns defined " + "for table " + obj.getClass() + " - no update possible"); } SQLStatement stat = new SQLStatement(db); StatementBuilder buff = new StatementBuilder("UPDATE "); buff.append(db.getDialect().getTableName(schemaName, tableName)).append(" SET "); buff.resetCount(); for (FieldDefinition field : fields) { if (!field.isPrimaryKey) { buff.appendExceptFirst(", "); buff.append(field.columnName); buff.append(" = ?"); Object value = getValue(obj, field); stat.addParameter(value); } } Object alias = ClassUtils.newObject(obj.getClass()); Query<Object> query = Query.from(db, alias); boolean firstCondition = true; for (FieldDefinition field : fields) { if (field.isPrimaryKey) { Object aliasValue = field.getValue(alias); Object value = field.getValue(obj); if (!firstCondition) { query.addConditionToken(ConditionAndOr.AND); } firstCondition = false; query.addConditionToken( new Condition<Object>( aliasValue, value, CompareType.EQUAL)); } } stat.setSQL(buff.toString()); query.appendWhere(stat); StatementLogger.update(stat.getSQL()); stat.executeUpdate(); }
// in src/tools/org/h2/jaqu/TableDefinition.java
void delete(Db db, Object obj) { if (primaryKeyColumnNames == null || primaryKeyColumnNames.size() == 0) { throw new IllegalStateException("No primary key columns defined " + "for table " + obj.getClass() + " - no update possible"); } SQLStatement stat = new SQLStatement(db); StatementBuilder buff = new StatementBuilder("DELETE FROM "); buff.append(db.getDialect().getTableName(schemaName, tableName)); buff.resetCount(); Object alias = ClassUtils.newObject(obj.getClass()); Query<Object> query = Query.from(db, alias); boolean firstCondition = true; for (FieldDefinition field : fields) { if (field.isPrimaryKey) { Object aliasValue = field.getValue(alias); Object value = field.getValue(obj); if (!firstCondition) { query.addConditionToken(ConditionAndOr.AND); } firstCondition = false; query.addConditionToken( new Condition<Object>( aliasValue, value, CompareType.EQUAL)); } } stat.setSQL(buff.toString()); query.appendWhere(stat); StatementLogger.delete(stat.getSQL()); stat.executeUpdate(); }
0 0 3
            
// in src/main/org/h2/bnf/Bnf.java
catch (IllegalStateException e) { // ignore }
// in src/main/org/h2/engine/Database.java
catch (IllegalStateException e) { // shutdown in progress - just don't register the handler // (maybe an application wants to write something into a // database at shutdown time) }
// in src/main/org/h2/engine/Database.java
catch (IllegalStateException e) { // ignore }
0 0
unknown (Lib) InterruptedException 0 0 1
            
// in src/main/org/h2/server/web/WebThread.java
void join(int millis) throws InterruptedException { thread.join(millis); }
24
            
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/tools/Server.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/tools/Shell.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/tools/Shell.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/store/WriterThread.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/store/FileLock.java
catch (InterruptedException e) { throw getExceptionFatal("Sleep interrupted", e); }
// in src/main/org/h2/store/FileLock.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/command/Command.java
catch (InterruptedException e1) { // ignore }
// in src/main/org/h2/engine/Database.java
catch (InterruptedException e) { trace.error(e, "close"); }
// in src/main/org/h2/engine/Engine.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/engine/Engine.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/engine/Engine.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/engine/Session.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } }
// in src/main/org/h2/util/NetUtils.java
catch (InterruptedException e2) { // ignore }
// in src/main/org/h2/util/Task.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/util/MathUtils.java
catch (InterruptedException e) { warn("InterruptedException", e); }
// in src/main/org/h2/util/SynchronizedVerifier.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/util/Profiler.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/server/TcpServer.java
catch (InterruptedException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (InterruptedException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/web/WebServer.java
catch (InterruptedException e) { // ignore }
// in src/main/org/h2/table/RegularTable.java
catch (InterruptedException e) { // ignore }
// in src/tools/org/h2/dev/ftp/server/FtpData.java
catch (InterruptedException e) { // ignore }
1
            
// in src/main/org/h2/store/FileLock.java
catch (InterruptedException e) { throw getExceptionFatal("Sleep interrupted", e); }
// in src/main/org/h2/util/NetUtils.java
catch (IOException e) { if (System.currentTimeMillis() - start >= SysProperties.SOCKET_CONNECT_TIMEOUT) { // either it was a connect timeout, // or list of different exceptions throw e; } if (i >= SysProperties.SOCKET_CONNECT_RETRY) { throw e; } // wait a bit and retry try { // sleep at most 256 ms long sleep = Math.min(256, i * i); Thread.sleep(sleep); } catch (InterruptedException e2) { // ignore } }
0
unknown (Lib) InvocationTargetException 0 0 0 3
            
// in src/main/org/h2/engine/FunctionAlias.java
catch (InvocationTargetException e) { StatementBuilder buff = new StatementBuilder(method.getName()); buff.append('('); for (Object o : params) { buff.appendExceptFirst(", "); buff.append(o == null ? "null" : o.toString()); } buff.append(')'); throw DbException.convertInvocation(e, buff.toString()); }
// in src/main/org/h2/server/web/WebApp.java
catch (InvocationTargetException e) { rs.addRow("meta." + m.getName(), e.getTargetException().toString()); }
// in src/tools/org/h2/build/BuildBase.java
catch (InvocationTargetException e) { throw e.getCause(); }
2
            
// in src/main/org/h2/engine/FunctionAlias.java
catch (InvocationTargetException e) { StatementBuilder buff = new StatementBuilder(method.getName()); buff.append('('); for (Object o : params) { buff.appendExceptFirst(", "); buff.append(o == null ? "null" : o.toString()); } buff.append(')'); throw DbException.convertInvocation(e, buff.toString()); }
// in src/tools/org/h2/build/BuildBase.java
catch (InvocationTargetException e) { throw e.getCause(); }
0
unknown (Domain) JdbcBatchUpdateException
public class JdbcBatchUpdateException extends BatchUpdateException {

    private static final long serialVersionUID = 1L;

    /**
     * INTERNAL
     */
    JdbcBatchUpdateException(SQLException next, int[] updateCounts) {
        super(next.getMessage(), next.getSQLState(), next.getErrorCode(), updateCounts);
        setNextException(next);
    }

    /**
     * INTERNAL
     */
    public void printStackTrace() {
        // The default implementation already does that,
        // but we do it again to avoid problems.
        // If it is not implemented, somebody might implement it
        // later on which would be a problem if done in the wrong way.
        printStackTrace(System.err);
    }

    /**
     * INTERNAL
     */
    public void printStackTrace(PrintWriter s) {
        if (s != null) {
            super.printStackTrace(s);
            if (getNextException() != null) {
                getNextException().printStackTrace(s);
            }
        }
    }

    /**
     * INTERNAL
     */
    public void printStackTrace(PrintStream s) {
        if (s != null) {
            super.printStackTrace(s);
            if (getNextException() != null) {
                getNextException().printStackTrace(s);
            }
        }
    }

}
1
            
// in src/main/org/h2/jdbc/JdbcStatement.java
public int[] executeBatch() throws SQLException { try { debugCodeCall("executeBatch"); checkClosedForWrite(); try { if (batchCommands == null) { // TODO batch: check what other database do if no commands are set batchCommands = New.arrayList(); } int size = batchCommands.size(); int[] result = new int[size]; boolean error = false; SQLException next = null; for (int i = 0; i < size; i++) { String sql = batchCommands.get(i); try { result[i] = executeUpdateInternal(sql); } catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; } } batchCommands = null; if (error) { throw new JdbcBatchUpdateException(next, result); } return result; } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
0 0 0 0 0
checked (Domain) JdbcSQLException
public class JdbcSQLException extends SQLException {

    /**
     * If the SQL statement contains this text, then it is never added to the
     * SQL exception. Hiding the SQL statement may be important if it contains a
     * passwords, such as a CREATE LINKED TABLE statement.
     */
    public static final String HIDE_SQL = "--hide--";

    private static final long serialVersionUID = 1L;
    private final String originalMessage;
    private final Throwable cause;
    private final String stackTrace;
    private String message;
    private String sql;

    /**
     * Creates a SQLException.
     *
     * @param message the reason
     * @param sql the SQL statement
     * @param state the SQL state
     * @param errorCode the error code
     * @param cause the exception that was the reason for this exception
     * @param stackTrace the stack trace
     */
    public JdbcSQLException(String message, String sql, String state, int errorCode, Throwable cause, String stackTrace) {
        super(message, state, errorCode);
        this.originalMessage = message;
        setSQL(sql);
        this.cause = cause;
        this.stackTrace = stackTrace;
        buildMessage();
        initCause(cause);
    }

    /**
     * Get the detail error message.
     *
     * @return the message
     */
    public String getMessage() {
        return message;
    }

    /**
     * INTERNAL
     */
    public String getOriginalMessage() {
        return originalMessage;
    }

    /**
     * Prints the stack trace to the standard error stream.
     */
    public void printStackTrace() {
        // The default implementation already does that,
        // but we do it again to avoid problems.
        // If it is not implemented, somebody might implement it
        // later on which would be a problem if done in the wrong way.
        printStackTrace(System.err);
    }

    /**
     * Prints the stack trace to the specified print writer.
     *
     * @param s the print writer
     */
    public void printStackTrace(PrintWriter s) {
        if (s != null) {
            super.printStackTrace(s);
            // getNextException().printStackTrace(s) would be very very slow
            // if many exceptions are joined
            SQLException next = getNextException();
            for (int i = 0; i < 100 && next != null; i++) {
                s.println(next.toString());
                next = next.getNextException();
            }
            if (next != null) {
                s.println("(truncated)");
            }
        }
    }

    /**
     * Prints the stack trace to the specified print stream.
     *
     * @param s the print stream
     */
    public void printStackTrace(PrintStream s) {
        if (s != null) {
            super.printStackTrace(s);
            // getNextException().printStackTrace(s) would be very very slow
            // if many exceptions are joined
            SQLException next = getNextException();
            for (int i = 0; i < 100 && next != null; i++) {
                s.println(next.toString());
                next = next.getNextException();
            }
            if (next != null) {
                s.println("(truncated)");
            }
        }
    }

    /**
     * INTERNAL
     */
    public Throwable getOriginalCause() {
        return cause;
    }

    /**
     * Returns the SQL statement.
     * SQL statements that contain '--hide--' are not listed.
     *
     * @return the SQL statement
     */
    public String getSQL() {
        return sql;
    }

    /**
     * INTERNAL
     */
    public void setSQL(String sql) {
        if (sql != null && sql.indexOf(HIDE_SQL) >= 0) {
            sql = "-";
        }
        this.sql = sql;
        buildMessage();
    }

    private void buildMessage() {
        StringBuilder buff = new StringBuilder(originalMessage == null ? "- " : originalMessage);
        if (sql != null) {
            buff.append("; SQL statement:\n").append(sql);
        }
        buff.append(" [").append(getErrorCode()).append('-').append(Constants.BUILD_ID).append(']');
        message = buff.toString();
    }

    /**
     * Returns the class name, the message, and in the server mode, the stack
     * trace of the server
     *
     * @return the string representation
     */
    public String toString() {
        if (stackTrace == null) {
            return super.toString();
        }
        return stackTrace;
    }

}
0 0 0 0 0 0
unknown (Lib) NoClassDefFoundError 0 0 0 4
            
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (NoClassDefFoundError e) { throw DbException.get(ErrorCode.UNSUPPORTED_JAVA_VERSION); }
// in src/main/org/h2/util/Utils.java
catch (NoClassDefFoundError e) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); }
// in src/main/org/h2/server/web/WebServlet.java
catch (NoClassDefFoundError e) { // Google App Engine does not allow java.net.InetAddress return false; }
// in src/main/org/h2/server/web/WebServer.java
catch (NoClassDefFoundError e) { // Google App Engine does not allow java.net.InetAddress }
2
            
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (NoClassDefFoundError e) { throw DbException.get(ErrorCode.UNSUPPORTED_JAVA_VERSION); }
// in src/main/org/h2/util/Utils.java
catch (NoClassDefFoundError e) { throw DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, className); }
0
unknown (Lib) NoSuchAlgorithmException 0 0 1
            
// in src/tools/org/h2/dev/security/SecureKeyStoreBuilder.java
private static void printKeystore(KeyStore store, String password) throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException, CertificateEncodingException { System.out.println("KeyStore store = KeyStore.getInstance(\""+store.getType()+"\");"); System.out.println("store.load(null, password.toCharArray());"); //System.out.println("keystore provider="+store.getProvider().getName()); Enumeration<String> en = store.aliases(); while (en.hasMoreElements()) { String alias = en.nextElement(); Key key = store.getKey(alias, password.toCharArray()); System.out.println("KeyFactory keyFactory = KeyFactory.getInstance(\"" + key.getAlgorithm() + "\");"); System.out.println("store.load(null, password.toCharArray());"); String pkFormat = key.getFormat(); String encoded = StringUtils.convertBytesToHex(key.getEncoded()); System.out.println(pkFormat + "EncodedKeySpec keySpec = new " + pkFormat + "EncodedKeySpec(getBytes(\"" + encoded + "\"));"); System.out.println("PrivateKey privateKey = keyFactory.generatePrivate(keySpec);"); System.out.println("Certificate[] certs = {"); for (Certificate cert : store.getCertificateChain(alias)) { System.out.println(" CertificateFactory.getInstance(\""+cert.getType()+"\")."); String enc = StringUtils.convertBytesToHex(cert.getEncoded()); System.out.println(" generateCertificate(new ByteArrayInputStream(getBytes(\""+enc+"\"))),"); // PublicKey pubKey = cert.getPublicKey(); // System.out.println(" pubKey algorithm="+pubKey.getAlgorithm()); // System.out.println(" pubKey format="+pubKey.getFormat()); // System.out.println(" pubKey format="+ // Utils.convertBytesToString(pubKey.getEncoded())); } System.out.println("};"); System.out.println("store.setKeyEntry(\""+alias+"\", privateKey, password.toCharArray(), certs);"); } }
2
            
// in src/tools/org/h2/dev/util/Migrate.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
2
            
// in src/tools/org/h2/dev/util/Migrate.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
2
unknown (Lib) NoSuchMethodException 2
            
// in src/main/org/h2/util/Utils.java
private static Object callMethod( Object instance, Class<?> clazz, String methodName, Object... params) throws Exception { Method best = null; int bestMatch = 0; boolean isStatic = instance == null; for (Method m : clazz.getMethods()) { if (Modifier.isStatic(m.getModifiers()) == isStatic && m.getName().equals(methodName)) { int p = match(m.getParameterTypes(), params); if (p > bestMatch) { bestMatch = p; best = m; } } } if (best == null) { throw new NoSuchMethodException(methodName); } return best.invoke(instance, params); }
// in src/main/org/h2/util/Utils.java
public static Object newInstance(String className, Object... params) throws Exception { Constructor<?> best = null; int bestMatch = 0; for (Constructor<?> c : Class.forName(className).getConstructors()) { int p = match(c.getParameterTypes(), params); if (p > bestMatch) { bestMatch = p; best = c; } } if (best == null) { throw new NoSuchMethodException(className); } return best.newInstance(params); }
0 0 0 0 0
unknown (Lib) NonWritableChannelException 0 0 0 2
            
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
2
            
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
// in src/main/org/h2/store/fs/FilePathNio.java
catch (NonWritableChannelException e) { throw new IOException("read only"); }
0
runtime (Lib) NullPointerException 0 0 0 6
            
// in src/main/org/h2/store/fs/FilePathZip.java
catch (NullPointerException e) { // workaround for Android skipUsingRead = true; }
// in src/main/org/h2/store/FileLock.java
catch (NullPointerException e) { // ignore }
// in src/main/org/h2/jdbc/JdbcConnection.java
catch (NullPointerException e) { // ignore }
// in src/main/org/h2/server/TcpServer.java
catch (NullPointerException e) { // ignore }
// in src/main/org/h2/server/web/WebApp.java
catch (NullPointerException e) { // ignore // workaround for a JDBC-ODBC bridge problem }
// in src/tools/org/h2/dev/fs/FilePathZip2.java
catch (NullPointerException e) { // workaround for Android skipUsingRead = true; }
0 0
unknown (Lib) NumberFormatException 0 0 0 19
            
// in src/main/org/h2/tools/Shell.java
catch (NumberFormatException e) { println("Usage: maxwidth <integer value>"); }
// in src/main/org/h2/value/ValueLob.java
catch (NumberFormatException e) { id = -1; }
// in src/main/org/h2/value/Value.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, getString()); }
// in src/main/org/h2/expression/Function.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s); }
// in src/main/org/h2/store/fs/FilePathSplit.java
catch (NumberFormatException e) { // ignore }
// in src/main/org/h2/command/Parser.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, sub); }
// in src/main/org/h2/engine/ConnectionInfo.java
catch (NumberFormatException e) { return defaultValue; }
// in src/main/org/h2/engine/SettingsBase.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); }
// in src/main/org/h2/engine/SettingsBase.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); }
// in src/main/org/h2/util/Utils.java
catch (NumberFormatException e) { // ignore }
// in src/main/org/h2/util/Utils.java
catch (NumberFormatException e) { // ignore }
// in src/main/org/h2/util/StringUtils.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/main/org/h2/util/StringUtils.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (NumberFormatException e) { reply(500, "Invalid"); }
// in src/tools/org/h2/build/indexer/HtmlConverter.java
catch (NumberFormatException e) { repl = null; }
// in src/tools/org/h2/build/indexer/HtmlConverter.java
catch (NumberFormatException e) { repl = null; }
// in src/tools/org/h2/jaqu/ModelUtils.java
catch (NumberFormatException ex) { return false; }
// in src/tools/org/h2/java/JavaParser.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/tools/org/h2/java/JavaParser.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
9
            
// in src/main/org/h2/value/Value.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, getString()); }
// in src/main/org/h2/expression/Function.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s); }
// in src/main/org/h2/command/Parser.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, sub); }
// in src/main/org/h2/engine/SettingsBase.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); }
// in src/main/org/h2/engine/SettingsBase.java
catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); }
// in src/main/org/h2/util/StringUtils.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/main/org/h2/util/StringUtils.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/tools/org/h2/java/JavaParser.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
// in src/tools/org/h2/java/JavaParser.java
catch (NumberFormatException e) { throw getFormatException(s, i); }
0
unknown (Lib) OutOfMemoryError 0 0 0 5
            
// in src/main/org/h2/tools/Recover.java
catch (OutOfMemoryError e) { writeDataError(writer, "out of memory", s.getBytes()); return null; }
// in src/main/org/h2/tools/Recover.java
catch (OutOfMemoryError e) { writeDataError(writer, "out of memory", s.getBytes()); continue; }
// in src/main/org/h2/store/FileLock.java
catch (OutOfMemoryError e) { // ignore }
// in src/main/org/h2/util/Utils.java
catch (OutOfMemoryError e) { Error e2 = new OutOfMemoryError("Requested memory: " + len); e2.initCause(e); throw e2; }
// in src/main/org/h2/server/web/WebApp.java
catch (OutOfMemoryError e2) { server.traceError(e); return e.toString(); }
1
            
// in src/main/org/h2/util/Utils.java
catch (OutOfMemoryError e) { Error e2 = new OutOfMemoryError("Requested memory: " + len); e2.initCause(e); throw e2; }
0
unknown (Lib) ParseException 2
            
// in src/main/org/h2/server/web/PageParser.java
private String parseBlockUntil(String end) throws ParseException { PageParser block = new PageParser(page, settings, pos); block.parseAll(); if (!block.readIf(end)) { throw new ParseException(page, block.pos); } pos = block.pos; return block.result.toString(); }
// in src/main/org/h2/server/web/PageParser.java
private void read(String s) throws ParseException { if (!readIf(s)) { throw new ParseException(s, pos); } }
0 3
            
// in src/main/org/h2/server/web/PageParser.java
private String parseBlockUntil(String end) throws ParseException { PageParser block = new PageParser(page, settings, pos); block.parseAll(); if (!block.readIf(end)) { throw new ParseException(page, block.pos); } pos = block.pos; return block.result.toString(); }
// in src/main/org/h2/server/web/PageParser.java
private String readParam(String name) throws ParseException { read(name); read("="); read("\""); int start = pos; while (page.charAt(pos) != '"') { pos++; } int end = pos; read("\""); String s = page.substring(start, end); return PageParser.parse(s, settings); }
// in src/main/org/h2/server/web/PageParser.java
private void read(String s) throws ParseException { if (!readIf(s)) { throw new ParseException(s, pos); } }
1
            
// in src/main/org/h2/server/web/PageParser.java
catch (ParseException e) { setError(pos); }
0 0
unknown (Lib) PatternSyntaxException 0 0 0 2
            
// in src/main/org/h2/expression/Function.java
catch (PatternSyntaxException e) { throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, regexp); }
// in src/main/org/h2/expression/CompareLike.java
catch (PatternSyntaxException e) { throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, p); }
2
            
// in src/main/org/h2/expression/Function.java
catch (PatternSyntaxException e) { throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, regexp); }
// in src/main/org/h2/expression/CompareLike.java
catch (PatternSyntaxException e) { throw DbException.get(ErrorCode.LIKE_ESCAPE_ERROR_1, e, p); }
0
runtime (Lib) RuntimeException 114
            
// in src/main/org/h2/util/Task.java
public Object get() { Exception e = getException(); if (e != null) { throw new RuntimeException(e); } return result; }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
private static RuntimeException convert(Exception e) { throw new RuntimeException("Exception: " + e, e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
private long getPosition(long nodeId) { Block b = getBlock(nodeId); if (b == null) { throw new RuntimeException("Block " + getBlockId(nodeId) + " not found"); } long pos = b.start; pos += (int) (nodeId & Integer.MAX_VALUE); return pos; }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
public void store() { if (!meta.isChanged() && mapsChanged.size() == 0) { // TODO truncate file if empty return; } commit(); // the length estimate is not correct, // as we don't know the exact positions and entry counts int lenEstimate = 1 + 8; for (StoredMap<?, ?> m : mapsChanged.values()) { meta.put("map." + m.getName(), String.valueOf(Long.MAX_VALUE) + "," + m.getKeyType().getName() + "," + m.getValueType().getName()); lenEstimate += length(m.getRoot()); } int blockId = ++lastBlockId; Block b = new Block(blockId); b.start = Long.MAX_VALUE; b.entryCount = Integer.MAX_VALUE; b.liveCount = Integer.MAX_VALUE; blocks.put(b.id, b); for (Block x : blocks.values()) { if (x.liveCount == 0) { meta.remove("block." + x.id); } else { meta.put("block." + x.id, "temp " + x.toString()); } } // modifying the meta can itself affect the metadata // TODO solve this in a better way for (Block x : new ArrayList<Block>(blocks.values())) { if (x.liveCount == 0) { meta.remove("block." + x.id); blocks.remove(x.id); } else { meta.put("block." + x.id, x.toString()); } } lenEstimate += length(meta.getRoot()); b.length = lenEstimate; long storePos = allocateBlock(lenEstimate); long nodeId = getId(blockId, 1 + 8); for (StoredMap<?, ?> m : mapsChanged.values()) { Node r = m.getRoot(); long p = r == null ? 0 : nodeId; meta.put("map." + m.getName(), String.valueOf(p) + "," + m.getKeyType().getName() + "," + m.getValueType().getName()); nodeId = updateId(r, nodeId); } int metaNodeOffset = (int) (nodeId - getId(blockId, 0)); // add a dummy entry so the count is correct meta.put("block." + b.id, b.toString()); int count = 0; for (StoredMap<?, ?> m : mapsChanged.values()) { count += count(m.getRoot()); } count += count(meta.getRoot()); b.start = storePos; b.entryCount = count; b.liveCount = b.entryCount; meta.put("block." + b.id, b.toString()); nodeId = updateId(meta.getRoot(), nodeId); int len = (int) (nodeId - getId(blockId, 0)); ByteBuffer buff = ByteBuffer.allocate(len); buff.put((byte) 'd'); buff.putInt(b.id); buff.putInt(metaNodeOffset); for (StoredMap<?, ?> m : mapsChanged.values()) { store(buff, m.getRoot()); } store(buff, meta.getRoot()); if (buff.hasRemaining()) { throw new RuntimeException("remaining: " + buff.remaining()); } buff.rewind(); try { file.position(storePos); file.write(buff); } catch (IOException e) { throw new RuntimeException(e); } rootBlockStart = storePos; writeHeader(); tempNodeId = 0; mapsChanged.clear(); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
private long readMetaRootId(long blockStart) { try { file.position(blockStart); ByteBuffer buff = ByteBuffer.wrap(new byte[16]); file.read(buff); buff.rewind(); if (buff.get() != 'd') { throw new RuntimeException("File corrupt"); } int blockId = buff.getInt(); int offset = buff.getInt(); return getId(blockId, offset); } catch (IOException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
Node readNode(StoredMap<?, ?> map, long id) { Node n = cache.get(id); if (n == null) { try { long pos = getPosition(id); file.position(pos); ByteBuffer buff = ByteBuffer.wrap(new byte[1024]); // TODO read fully; read only required bytes do { int len = file.read(buff); if (len < 0) { break; } } while (buff.remaining() > 0); buff.rewind(); n = Node.read(map, id, buff); } catch (Exception e) { throw new RuntimeException(e); } cache.put(id, n); } return n; }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
void removeNode(long id) { if (id > 0) { if (getBlock(id).liveCount == 0) { throw new RuntimeException("Negative live count: " + id); } getBlock(id).liveCount--; } }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
static Block fromString(String s) { Block b = new Block(0); Properties prop = new Properties(); try { prop.load(new ByteArrayInputStream(s.getBytes("UTF-8"))); b.id = Integer.parseInt(prop.get("id").toString()); b.start = Long.parseLong(prop.get("start").toString()); b.length = Long.parseLong(prop.get("length").toString()); b.entryCount = Integer.parseInt(prop.get("entryCount").toString()); b.liveCount = Integer.parseInt(prop.get("liveCount").toString()); return b; } catch (IOException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
static Class<?> getClass(String name) { if (name.equals("i")) { return Integer.class; } else if (name.equals("s")) { return String.class; } throw new RuntimeException("Unknown class name " + name); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
public int length(Object obj) { try { byte[] bytes = obj.toString().getBytes("UTF-8"); return getVarIntLen(bytes.length) + bytes.length; } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
public String read(ByteBuffer buff) { int len = readVarInt(buff); byte[] bytes = new byte[len]; buff.get(bytes); try { return new String(bytes, "UTF-8"); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
public void write(ByteBuffer buff, Object x) { try { byte[] bytes = x.toString().getBytes("UTF-8"); writeVarInt(buff, bytes.length); buff.put(bytes); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
static Class<?> getClass(String name) { if (name.equals("i")) { return Integer.class; } else if (name.equals("s")) { return String.class; } throw new RuntimeException("Unknown class name " + name); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
public int length(Object obj) { try { byte[] bytes = obj.toString().getBytes("UTF-8"); return getVarIntLen(bytes.length) + bytes.length; } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
public String read(ByteBuffer buff) { int len = readVarInt(buff); byte[] bytes = new byte[len]; buff.get(bytes); try { return new String(bytes, "UTF-8"); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
public void write(ByteBuffer buff, Object x) { try { byte[] bytes = x.toString().getBytes("UTF-8"); writeVarInt(buff, bytes.length); buff.put(bytes); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
private static RuntimeException convert(Exception e) { throw new RuntimeException("Exception: " + e, e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
private long getPosition(long pageId) { Block b = getBlock(pageId); if (b == null) { throw new RuntimeException("Block " + getBlockId(pageId) + " not found"); } long pos = b.start; pos += (int) (pageId & Integer.MAX_VALUE); return pos; }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
public void store() { if (!meta.isChanged() && mapsChanged.size() == 0) { // TODO truncate file if empty return; } commit(); // the length estimate is not correct, // as we don't know the exact positions and entry counts int lenEstimate = 1 + 8; for (BtreeMap<?, ?> m : mapsChanged.values()) { meta.put("map." + m.getName(), String.valueOf(Long.MAX_VALUE) + "," + m.getKeyType().getName() + "," + m.getValueType().getName()); Page p = m.getRoot(); if (p != null) { lenEstimate += p.lengthIncludingTempChildren(); } } int blockId = ++lastBlockId; Block b = new Block(blockId); b.start = Long.MAX_VALUE; b.entryCount = Integer.MAX_VALUE; b.liveCount = Integer.MAX_VALUE; blocks.put(b.id, b); for (Block x : blocks.values()) { if (x.liveCount == 0) { meta.remove("block." + x.id); } else { meta.put("block." + x.id, "temp-" + x.toString()); } } // modifying the meta can itself affect the metadata // TODO solve this in a better way ArrayList<Integer> removedBlocks = New.arrayList(); for (Block x : new ArrayList<Block>(blocks.values())) { if (x.liveCount == 0) { meta.remove("block." + x.id); removedBlocks.add(x.id); } else { meta.put("block." + x.id, x.toString()); } } lenEstimate += meta.getRoot().lengthIncludingTempChildren(); b.length = lenEstimate; blocks.remove(b.id); long storePos = allocateBlock(lenEstimate); blocks.put(b.id, b); for (int id : removedBlocks) { blocks.remove(id); } long pageId = getId(blockId, 1 + 8); for (BtreeMap<?, ?> m : mapsChanged.values()) { Page r = m.getRoot(); long p = r == null ? 0 : pageId; meta.put("map." + m.getName(), String.valueOf(p) + "," + m.getKeyType().getName() + "," + m.getValueType().getName()); if (r != null) { pageId = r.updatePageIds(pageId); } } int metaRootOffset = (int) (pageId - getId(blockId, 0)); // add a dummy entry so the count is correct meta.put("block." + b.id, b.toString()); int count = 0; for (BtreeMap<?, ?> m : mapsChanged.values()) { Page p = m.getRoot(); if (p != null) { count += p.countTemp(); } } count += meta.getRoot().countTemp(); b.start = storePos; b.entryCount = count; b.liveCount = b.entryCount; meta.put("block." + b.id, b.toString()); pageId = meta.getRoot().updatePageIds(pageId); int len = (int) (pageId - getId(blockId, 0)); ByteBuffer buff = ByteBuffer.allocate(len); buff.put((byte) 'd'); buff.putInt(b.id); buff.putInt(metaRootOffset); for (BtreeMap<?, ?> m : mapsChanged.values()) { Page p = m.getRoot(); if (p != null) { p.storeTemp(buff); } } meta.getRoot().storeTemp(buff); if (buff.hasRemaining()) { throw new RuntimeException("remaining: " + buff.remaining()); } buff.rewind(); try { file.position(storePos); file.write(buff); } catch (IOException e) { throw new RuntimeException(e); } rootBlockStart = storePos; writeHeader(); mapsChanged.clear(); temp.clear(); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
private long readMetaRootId(long blockStart) { try { file.position(blockStart); ByteBuffer buff = ByteBuffer.wrap(new byte[16]); file.read(buff); buff.rewind(); if (buff.get() != 'd') { throw new RuntimeException("File corrupt"); } int blockId = buff.getInt(); int offset = buff.getInt(); return getId(blockId, offset); } catch (IOException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
Page readPage(BtreeMap<?, ?> map, long id) { if (id < 0) { return temp.get((int) (-id - 1)); } Page p = cache.get(id); if (p == null) { try { long pos = getPosition(id); file.position(pos); ByteBuffer buff = ByteBuffer.wrap(new byte[8 * 1024]); // TODO read fully; read only required bytes do { int len = file.read(buff); if (len < 0) { break; } } while (buff.remaining() > 0); buff.rewind(); p = Page.read(map, id, buff); } catch (Exception e) { throw new RuntimeException(e); } cache.put(id, p); } return p; }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
void removePage(long id) { if (id > 0) { if (getBlock(id).liveCount == 0) { throw new RuntimeException("Negative live count: " + id); } getBlock(id).liveCount--; } }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
static Block fromString(String s) { Block b = new Block(0); Properties prop = new Properties(); try { prop.load(new ByteArrayInputStream(s.getBytes("UTF-8"))); b.id = Integer.parseInt(prop.get("id").toString()); b.start = Long.parseLong(prop.get("start").toString()); b.length = Long.parseLong(prop.get("length").toString()); b.entryCount = Integer.parseInt(prop.get("entryCount").toString()); b.liveCount = Integer.parseInt(prop.get("liveCount").toString()); return b; } catch (IOException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/util/Base64.java
private static void check(String a, String b) { if (!a.equals(b)) { throw new RuntimeException("mismatch: " + a + " <> " + b); } }
// in src/tools/org/h2/dev/util/Base64.java
private static void test(byte[] in, byte[] out) { if (in.length != out.length) { throw new RuntimeException("Length error"); } for (int i = 0; i < in.length; i++) { if (in[i] != out[i]) { throw new RuntimeException("Error at " + i); } } }
// in src/tools/org/h2/dev/util/Migrate.java
private void download(String target, String fileURL, String sha1Checksum) { File targetFile = new File(target); if (targetFile.exists()) { return; } mkdirs(targetFile.getAbsoluteFile().getParentFile()); ByteArrayOutputStream buff = new ByteArrayOutputStream(); try { println("Downloading " + fileURL); URL url = new URL(fileURL); InputStream in = new BufferedInputStream(url.openStream()); long last = System.currentTimeMillis(); int len = 0; while (true) { long now = System.currentTimeMillis(); if (now > last + 1000) { println("Downloaded " + len + " bytes"); last = now; } int x = in.read(); len++; if (x < 0) { break; } buff.write(x); } in.close(); } catch (IOException e) { throw new RuntimeException("Error downloading", e); } byte[] data = buff.toByteArray(); String got = getSHA1(data); if (sha1Checksum == null) { println("SHA1 checksum: " + got); } else { if (!got.equals(sha1Checksum)) { throw new RuntimeException("SHA1 checksum mismatch; got: " + got); } } writeFile(targetFile, data); }
// in src/tools/org/h2/dev/util/Migrate.java
private static void mkdirs(File f) { if (!f.exists()) { if (!f.mkdirs()) { throw new RuntimeException("Can not create directory " + f.getAbsolutePath()); } } }
// in src/tools/org/h2/dev/util/Migrate.java
private static String getSHA1(byte[] data) { MessageDigest md; try { md = MessageDigest.getInstance("SHA-1"); return convertBytesToString(md.digest(data)); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/util/Migrate.java
private static void writeFile(File file, byte[] data) { try { RandomAccessFile ra = new RandomAccessFile(file, "rw"); ra.write(data); ra.setLength(data.length); ra.close(); } catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); } }
// in src/tools/org/h2/dev/util/Migrate.java
private int exec(String[] command) { try { for (String c : command) { print(c + " "); } println(""); Process p = Runtime.getRuntime().exec(command); copyInThread(p.getInputStream(), quiet ? null : sysOut); copyInThread(p.getErrorStream(), quiet ? null : sysOut); p.waitFor(); return p.exitValue(); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/dev/util/Migrate.java
public void run() { try { while (true) { int x = in.read(); if (x < 0) { return; } if (out != null) { out.write(x); } } } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/doc/MergeDocs.java
private static String removeHeaderFooter(String fileName, String text) { // String start = "<body"; // String end = "</body>"; String start = "<!-- } -->"; String end = "<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html>"; int idx = text.indexOf(end); if (idx < 0) { throw new RuntimeException("Footer not found in file " + fileName); } text = text.substring(0, idx); idx = text.indexOf(start) + start.length(); text = text.substring(idx + 1); return text; }
// in src/tools/org/h2/build/doc/XMLParser.java
private void error(String expected) { throw new RuntimeException("Expected: " + expected + " got: " + xml.substring(pos, Math.min(pos + 1000, xml.length()))); }
// in src/tools/org/h2/build/doc/RailroadImages.java
private void savePng(BufferedImage img, String fileName) { int w = img.getWidth(); int h = img.getHeight(); BufferedImage smaller = new BufferedImage(w / DIV, h / DIV, img.getType()); Graphics2D g = smaller.createGraphics(); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g.drawImage(img, 0, 0, w / DIV, h / DIV, 0, 0, w, h, null); g.dispose(); try { ImageIO.write(smaller, "png", new File(outDir + "/" + fileName)); } catch (IOException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/BuildBase.java
private FileList filter(boolean keep, String pattern) { boolean start = false; if (pattern.endsWith("*")) { pattern = pattern.substring(0, pattern.length() - 1); start = true; } else if (pattern.startsWith("*")) { pattern = pattern.substring(1); } if (pattern.indexOf('*') >= 0) { throw new RuntimeException("Unsupported pattern, may only start or end with *:" + pattern); } // normalize / and \ pattern = replaceAll(pattern, "/", File.separator); FileList list = new FileList(); for (File f : this) { String path = f.getPath(); boolean match = start ? path.startsWith(pattern) : path.endsWith(pattern); if (match == keep) { list.add(f); } } return list; }
// in src/tools/org/h2/build/BuildBase.java
private void runShell() { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String last = "", line; System.out.println("Shell mode. Type the target, then [Enter]. Just [Enter] repeats the last target."); while (true) { System.out.print("build> "); try { line = reader.readLine(); } catch (IOException e) { throw new RuntimeException(e); } if (line == null || line.equals("exit") || line.equals("quit")) { break; } else if (line.length() == 0) { line = last; } long time = System.currentTimeMillis(); try { runTarget(line); } catch (Exception e) { System.out.println(e); } println("Done in " + (System.currentTimeMillis() - time) + " ms"); last = line; } }
// in src/tools/org/h2/build/BuildBase.java
private static Object invoke(Method m, Object instance, Object[] args) { try { try { return m.invoke(instance, args); } catch (InvocationTargetException e) { throw e.getCause(); } } catch (Error e) { throw e; } catch (RuntimeException e) { throw e; } catch (Throwable e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/BuildBase.java
protected int exec(String command, StringList args) { try { print(command); StringList cmd = new StringList(); cmd = cmd.plus(command); if (args != null) { for (String a : args) { print(" " + a); } cmd.addAll(args); } println(""); ProcessBuilder pb = new ProcessBuilder(); pb.command(cmd.array()); pb.redirectErrorStream(true); Process p = pb.start(); copyInThread(p.getInputStream(), quiet ? null : sysOut); p.waitFor(); return p.exitValue(); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/BuildBase.java
public void run() { try { while (true) { int x = in.read(); if (x < 0) { return; } if (out != null) { out.write(x); } } } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/BuildBase.java
protected static String getStaticField(String className, String fieldName) { try { Class<?> clazz = Class.forName(className); Field field = clazz.getField(fieldName); return field.get(null).toString(); } catch (Exception e) { throw new RuntimeException("Can not read field " + className + "." + fieldName, e); } }
// in src/tools/org/h2/build/BuildBase.java
protected static String getStaticValue(String className, String methodName) { try { Class<?> clazz = Class.forName(className); Method method = clazz.getMethod(methodName); return method.invoke(null).toString(); } catch (Exception e) { throw new RuntimeException("Can not read value " + className + "." + methodName + "()", e); } }
// in src/tools/org/h2/build/BuildBase.java
protected void javadoc(String...args) { int result; PrintStream old = System.out; try { println("Javadoc"); if (quiet) { System.setOut(filter(System.out, new String[] { "Loading source files for package", "Constructing Javadoc information...", "Generating ", "Standard Doclet", "Building tree for all the packages and classes...", "Building index for all the packages and classes...", "Building index for all classes..." })); } else { System.setOut(filter(System.out, new String[] { "Loading source files for package ", "Generating ", })); } Class<?> clazz = Class.forName("com.sun.tools.javadoc.Main"); Method execute = clazz.getMethod("execute", String[].class); result = (Integer) invoke(execute, null, new Object[] { args }); } catch (Exception e) { result = exec("javadoc", args(args)); } finally { System.setOut(old); } if (result != 0) { throw new RuntimeException("An error occurred, result=" + result); } }
// in src/tools/org/h2/build/BuildBase.java
protected static String getSHA1(byte[] data) { MessageDigest md; try { md = MessageDigest.getInstance("SHA-1"); return convertBytesToString(md.digest(data)); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/BuildBase.java
protected void downloadUsingMaven(String target, String group, String artifact, String version, String sha1Checksum) { String repoDir = "http://repo1.maven.org/maven2"; File targetFile = new File(target); if (targetFile.exists()) { return; } String repoFile = group + "/" + artifact + "/" + version + "/" + artifact + "-" + version + ".jar"; mkdirs(targetFile.getAbsoluteFile().getParentFile()); String localMavenDir = getLocalMavenDir(); if (new File(localMavenDir).exists()) { File f = new File(localMavenDir, repoFile); if (!f.exists()) { try { execScript("mvn", args( "org.apache.maven.plugins:maven-dependency-plugin:2.1:get", "-D" + "repoUrl=" + repoDir, "-D" + "artifact="+ group +":"+ artifact +":" + version)); } catch (RuntimeException e) { println("Could not download using Maven: " + e.toString()); } } if (f.exists()) { byte[] data = readFile(f); String got = getSHA1(data); if (sha1Checksum == null) { println("SHA1 checksum: " + got); } else { if (!got.equals(sha1Checksum)) { throw new RuntimeException("SHA1 checksum mismatch; got: " + got + " expected: " + sha1Checksum + " for file " + f.getAbsolutePath()); } } writeFile(targetFile, data); return; } } String fileURL = repoDir + "/" + repoFile; download(target, fileURL, sha1Checksum); }
// in src/tools/org/h2/build/BuildBase.java
protected void download(String target, String fileURL, String sha1Checksum) { File targetFile = new File(target); if (targetFile.exists()) { return; } mkdirs(targetFile.getAbsoluteFile().getParentFile()); ByteArrayOutputStream buff = new ByteArrayOutputStream(); try { println("Downloading " + fileURL); URL url = new URL(fileURL); InputStream in = new BufferedInputStream(url.openStream()); long last = System.currentTimeMillis(); int len = 0; while (true) { long now = System.currentTimeMillis(); if (now > last + 1000) { println("Downloaded " + len + " bytes"); last = now; } int x = in.read(); len++; if (x < 0) { break; } buff.write(x); } in.close(); } catch (IOException e) { throw new RuntimeException("Error downloading " + fileURL + " to " + target, e); } byte[] data = buff.toByteArray(); String got = getSHA1(data); if (sha1Checksum == null) { println("SHA1 checksum: " + got); } else { if (!got.equals(sha1Checksum)) { throw new RuntimeException("SHA1 checksum mismatch; got: " + got + " expected: " + sha1Checksum + " for file " + target); } } writeFile(targetFile, data); }
// in src/tools/org/h2/build/BuildBase.java
public static void writeFile(File file, byte[] data) { try { RandomAccessFile ra = new RandomAccessFile(file, "rw"); ra.write(data); ra.setLength(data.length); ra.close(); } catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); } }
// in src/tools/org/h2/build/BuildBase.java
public static byte[] readFile(File file) { try { RandomAccessFile ra = new RandomAccessFile(file, "r"); long len = ra.length(); if (len >= Integer.MAX_VALUE) { throw new RuntimeException("File " + file.getPath() + " is too large"); } byte[] buffer = new byte[(int) len]; ra.readFully(buffer); ra.close(); return buffer; } catch (IOException e) { throw new RuntimeException("Error reading from file " + file, e); } }
// in src/tools/org/h2/build/BuildBase.java
protected void javac(StringList args, FileList files) { println("Compiling " + files.size() + " classes"); StringList params = new StringList(); params.addAll(args); params.addAll(getPaths(files.keep(".java"))); String[] array = params.array(); int result; PrintStream old = System.err; try { Class<?> clazz = Class.forName("com.sun.tools.javac.Main"); if (quiet) { System.setErr(filter(System.err, new String[] { "Note:" })); } Method compile = clazz.getMethod("compile", new Class<?>[] { String[].class }); Object instance = clazz.newInstance(); result = (Integer) invoke(compile, instance, new Object[] { array }); } catch (Exception e) { e.printStackTrace(); result = exec("javac", new StringList(array)); } finally { System.setErr(old); } if (result != 0) { throw new RuntimeException("An error occurred"); } }
// in src/tools/org/h2/build/BuildBase.java
protected void java(String className, StringList args) { println("Running " + className); String[] array = args == null ? new String[0] : args.array(); try { Method main = Class.forName(className).getMethod("main", String[].class); invoke(main, null, new Object[] { array }); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/BuildBase.java
protected static void mkdir(String dir) { File f = new File(dir); if (f.exists()) { if (f.isFile()) { throw new RuntimeException("Can not create directory " + dir + " because a file with this name exists"); } } else { mkdirs(f); } }
// in src/tools/org/h2/build/BuildBase.java
private static void mkdirs(File f) { if (!f.exists()) { if (!f.mkdirs()) { throw new RuntimeException("Can not create directory " + f.getAbsolutePath()); } } }
// in src/tools/org/h2/build/BuildBase.java
private void delete(File file) { if (file.exists()) { if (file.isDirectory()) { String path = file.getPath(); for (String fileName : file.list()) { delete(new File(path, fileName)); } } if (!file.delete()) { throw new RuntimeException("Can not delete " + file.getPath()); } } }
// in src/tools/org/h2/build/Build.java
private static void switchSource(boolean enableCheck) { try { String version = System.getProperty("version"); String check = enableCheck ? "+CHECK" : "-CHECK"; if (version == null) { SwitchSource.main("-dir", "src", "-auto", check); } else { SwitchSource.main("-dir", "src", "-version", version, check); } SwitchSource.main("-dir", "src", "-LUCENE2", "-LUCENE3", "+LUCENE" + getLuceneVersion()); } catch (IOException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/build/Build.java
public void jarClient() { compile(true, true, false); FileList files = files("temp"). exclude("temp/org/h2/build/*"). exclude("temp/org/h2/dev/*"). exclude("temp/org/h2/jaqu/*"). exclude("temp/org/h2/java/*"). exclude("temp/org/h2/jcr/*"). exclude("temp/org/h2/mode/*"). exclude("temp/org/h2/samples/*"). exclude("temp/org/h2/test/*"). exclude("*.bat"). exclude("*.sh"). exclude("*.txt"); long kb = jar("bin/h2client" + getJarSuffix(), files, "temp"); if (kb < 300 || kb > 400) { throw new RuntimeException("Expected file size 300 - 400 KB, got: " + kb); } }
// in src/tools/org/h2/build/Build.java
public void uploadBuild() { String password = System.getProperty("h2.ftpPassword"); if (password == null) { throw new RuntimeException("h2.ftpPassword not set"); } downloadTest(); FileList files = files("src/tools").keep("*/UploadBuild.java"); StringList args = args("-d", "temp", "-sourcepath", "src/tools" + File.pathSeparator + "src/test" + File.pathSeparator + "src/main"); mkdir("temp"); javac(args, files); String cp = "bin" + File.pathSeparator + "temp" + File.pathSeparator + "ext/h2mig_pagestore_addon.jar"; exec("java", args("-Xmx128m", "-cp", cp, "-Dh2.ftpPassword=" + password, "org.h2.build.doc.UploadBuild")); }
// in src/tools/org/h2/build/code/CheckTextFiles.java
private void check(File file) throws Exception { String name = file.getName(); if (file.isDirectory()) { if (name.equals("CVS") || name.equals(".svn")) { return; } for (File f : file.listFiles()) { check(f); } } else { String suffix = ""; int lastDot = name.lastIndexOf('.'); if (lastDot >= 0) { suffix = name.substring(lastDot + 1); } boolean check = false, ignore = false; for (String s : SUFFIX_CHECK) { if (suffix.equals(s)) { check = true; } } // if (name.endsWith(".html") && name.indexOf("_ja") > 0) { // int todoRemoveJapaneseFiles; // // Japanese html files are UTF-8 at this time // check = false; // ignore = true; // } if (name.endsWith(".utf8.txt") || (name.startsWith("_docs_") && name.endsWith(".properties"))) { check = false; ignore = true; } for (String s : SUFFIX_IGNORE) { if (suffix.equals(s)) { ignore = true; } } boolean checkLicense = true; for (String ig : suffixIgnoreLicense) { if (suffix.equals(ig) || name.endsWith(ig)) { checkLicense = false; break; } } if (ignore == check) { throw new RuntimeException("Unknown suffix: " + suffix + " for file: " + file.getAbsolutePath()); } useCRLF = false; for (String s : SUFFIX_CRLF) { if (suffix.equals(s)) { useCRLF = true; break; } } if (check) { checkOrFixFile(file, autoFix, checkLicense); } } }
// in src/tools/org/h2/build/code/CheckTextFiles.java
private void fail(File file, String error, int line) { if (line <= 0) { line = 1; } String name = file.getAbsolutePath(); int idx = name.lastIndexOf(File.separatorChar); if (idx >= 0) { name = name.replace(File.separatorChar, '.'); name = name + "(" + name.substring(idx + 1) + ":" + line + ")"; idx = name.indexOf("org."); if (idx > 0) { name = name.substring(idx); } } System.out.println("FAIL at " + name + " " + error + " " + file.getAbsolutePath()); hasError = true; if (failOnError) { throw new RuntimeException("FAIL"); } }
// in src/tools/org/h2/jaqu/Query.java
public long selectCount() { SQLStatement stat = getSelectStatement(false); stat.appendSQL("COUNT(*) "); appendFromWhere(stat); ResultSet rs = stat.executeQuery(); Statement s = null; try { s = rs.getStatement(); rs.next(); long value = rs.getLong(1); return value; } catch (SQLException e) { throw new RuntimeException(e); } finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(s); } }
// in src/tools/org/h2/jaqu/Query.java
private List<T> select(boolean distinct) { List<T> result = New.arrayList(); TableDefinition<T> def = from.getAliasDefinition(); SQLStatement stat = getSelectStatement(distinct); def.appendSelectList(stat); appendFromWhere(stat); ResultSet rs = stat.executeQuery(); Statement s = null; try { s = rs.getStatement(); while (rs.next()) { T item = from.newObject(); from.getAliasDefinition().readRow(item, rs); result.add(item); } } catch (SQLException e) { throw new RuntimeException(e); } finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(s); } return result; }
// in src/tools/org/h2/jaqu/Query.java
public int update() { if (updateColumnDeclarations.size() == 0) { throw new RuntimeException("Missing set or increment call."); } SQLStatement stat = new SQLStatement(db); stat.appendSQL("UPDATE "); from.appendSQL(stat); stat.appendSQL(" SET "); int i = 0; for (UpdateColumn declaration : updateColumnDeclarations) { if (i++ > 0) { stat.appendSQL(", "); } declaration.appendSQL(stat); } appendWhere(stat); StatementLogger.update(stat.getSQL()); return stat.executeUpdate(); }
// in src/tools/org/h2/jaqu/Query.java
private <X> List<X> select(Class<X> clazz, X x, boolean distinct) { List<X> result = New.arrayList(); TableDefinition<X> def = db.define(clazz); SQLStatement stat = getSelectStatement(distinct); def.appendSelectList(stat, this, x); appendFromWhere(stat); ResultSet rs = stat.executeQuery(); Statement s = null; try { s = rs.getStatement(); while (rs.next()) { X row = ClassUtils.newObject(clazz); def.readRow(row, rs); result.add(row); } } catch (SQLException e) { throw new RuntimeException(e); } finally { JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(s); } return result; }
// in src/tools/org/h2/jaqu/Query.java
public <A> QueryWhere<T> where(Filter filter) { HashMap<String, Object> fieldMap = New.hashMap(); for (Field f : filter.getClass().getDeclaredFields()) { f.setAccessible(true); try { Object obj = f.get(filter); if (obj == from.getAlias()) { List<TableDefinition.FieldDefinition> fields = from.getAliasDefinition().getFields(); String name = f.getName(); for (TableDefinition.FieldDefinition field : fields) { String n = name + "." + field.field.getName(); Object o = field.field.get(obj); fieldMap.put(n, o); } } fieldMap.put(f.getName(), f.get(filter)); } catch (Exception e) { throw new RuntimeException(e); } } Token filterCode = new ClassReader().decompile(filter, fieldMap, "where"); // String filterQuery = filterCode.toString(); conditions.add(filterCode); return new QueryWhere<T>(this); }
// in src/tools/org/h2/jaqu/DbUpgrader.java
public boolean upgradeTable(Db db, String schema, String table, int fromVersion, int toVersion) { throw new RuntimeException("Please provide your own DbUpgrader implementation."); }
// in src/tools/org/h2/jaqu/bytecode/ClassReader.java
public Token decompile(Object instance, Map<String, Object> fields, String method) { this.fieldMap = fields; this.convertMethodName = method; Class<?> clazz = instance.getClass(); String className = clazz.getName(); debug("class name " + className); ByteArrayOutputStream buff = new ByteArrayOutputStream(); try { InputStream in = clazz.getClassLoader().getResource(className.replace('.', '/') + ".class").openStream(); while (true) { int x = in.read(); if (x < 0) { break; } buff.write(x); } } catch (IOException e) { throw new RuntimeException("Could not read class bytecode", e); } data = buff.toByteArray(); int header = readInt(); debug("header: " + Integer.toHexString(header)); int minorVersion = readShort(); int majorVersion = readShort(); debug("version: " + majorVersion + "." + minorVersion); int constantPoolCount = readShort(); constantPool = new Constant[constantPoolCount]; for (int i = 1; i < constantPoolCount; i++) { int type = readByte(); switch(type) { case 1: constantPool[i] = ConstantString.get(readString()); break; case 3: { int x = readInt(); constantPool[i] = ConstantNumber.get(x); break; } case 4: { int x = readInt(); constantPool[i] = ConstantNumber.get("" + Float.intBitsToFloat(x), x, Constant.Type.FLOAT); break; } case 5: { long x = readLong(); constantPool[i] = ConstantNumber.get(x); i++; break; } case 6: { long x = readLong(); constantPool[i] = ConstantNumber.get("" + Double.longBitsToDouble(x), x, Constant.Type.DOUBLE); i++; break; } case 7: { int x = readShort(); constantPool[i] = ConstantNumber.get(null, x, ConstantNumber.Type.CLASS_REF); break; } case 8: { int x = readShort(); constantPool[i] = ConstantNumber.get(null, x, ConstantNumber.Type.STRING_REF); break; } case 9: { int x = readInt(); constantPool[i] = ConstantNumber.get(null, x, ConstantNumber.Type.FIELD_REF); break; } case 10: { int x = readInt(); constantPool[i] = ConstantNumber.get(null, x, ConstantNumber.Type.METHOD_REF); break; } case 11: { int x = readInt(); constantPool[i] = ConstantNumber.get(null, x, ConstantNumber.Type.INTERFACE_METHOD_REF); break; } case 12: { int x = readInt(); constantPool[i] = ConstantNumber.get(null, x, ConstantNumber.Type.NAME_AND_TYPE); break; } default: throw new RuntimeException("Unsupported constant pool tag: " + type); } } int accessFlags = readShort(); debug("access flags: " + accessFlags); int classRef = readShort(); debug("class: " + constantPool[constantPool[classRef].intValue()]); int superClassRef = readShort(); debug(" extends " + constantPool[constantPool[superClassRef].intValue()]); int interfaceCount = readShort(); for (int i = 0; i < interfaceCount; i++) { int interfaceRef = readShort(); debug(" implements " + constantPool[constantPool[interfaceRef].intValue()]); } int fieldCount = readShort(); for (int i = 0; i < fieldCount; i++) { readField(); } int methodCount = readShort(); for (int i = 0; i < methodCount; i++) { readMethod(); } readAttributes(); return result; }
// in src/tools/org/h2/jaqu/bytecode/ClassReader.java
private void readByteCode() { int startPos = pos - startByteCode; int opCode = readByte(); String op; endOfMethod = false; condition = false; nextPc = 0; switch(opCode) { case 0: op = "nop"; break; case 1: op = "aconst_null"; stack.push(Null.INSTANCE); break; case 2: op = "iconst_m1"; stack.push(ConstantNumber.get("-1")); break; case 3: op = "iconst_0"; stack.push(ConstantNumber.get("0")); break; case 4: op = "iconst_1"; stack.push(ConstantNumber.get("1")); break; case 5: op = "iconst_2"; stack.push(ConstantNumber.get("2")); break; case 6: op = "iconst_3"; stack.push(ConstantNumber.get("3")); break; case 7: op = "iconst_4"; stack.push(ConstantNumber.get("4")); break; case 8: op = "iconst_5"; stack.push(ConstantNumber.get("5")); break; case 9: op = "lconst_0"; stack.push(ConstantNumber.get("0")); break; case 10: op = "lconst_1"; stack.push(ConstantNumber.get("1")); break; case 11: op = "fconst_0"; stack.push(ConstantNumber.get("0.0")); break; case 12: op = "fconst_1"; stack.push(ConstantNumber.get("1.0")); break; case 13: op = "fconst_2"; stack.push(ConstantNumber.get("2.0")); break; case 14: op = "dconst_0"; stack.push(ConstantNumber.get("0.0")); break; case 15: op = "dconst_1"; stack.push(ConstantNumber.get("1.0")); break; case 16: { int x = (byte) readByte(); op = "bipush " + x; stack.push(ConstantNumber.get(x)); break; } case 17: { int x = (short) readShort(); op = "sipush " + x; stack.push(ConstantNumber.get(x)); break; } case 18: { Token s = getConstant(readByte()); op = "ldc " + s; stack.push(s); break; } case 19: { Token s = getConstant(readShort()); op = "ldc_w " + s; stack.push(s); break; } case 20: { Token s = getConstant(readShort()); op = "ldc2_w " + s; stack.push(s); break; } case 21: { int x = readByte(); op = "iload " + x; stack.push(getVariable(x)); break; } case 22: { int x = readByte(); op = "lload " + x; stack.push(getVariable(x)); break; } case 23: { int x = readByte(); op = "fload " + x; stack.push(getVariable(x)); break; } case 24: { int x = readByte(); op = "dload " + x; stack.push(getVariable(x)); break; } case 25: { int x = readByte(); op = "aload " + x; stack.push(getVariable(x)); break; } case 26: op = "iload_0"; stack.push(getVariable(0)); break; case 27: op = "iload_1"; stack.push(getVariable(1)); break; case 28: op = "iload_2"; stack.push(getVariable(2)); break; case 29: op = "iload_3"; stack.push(getVariable(3)); break; case 30: op = "lload_0"; stack.push(getVariable(0)); break; case 31: op = "lload_1"; stack.push(getVariable(1)); break; case 32: op = "lload_2"; stack.push(getVariable(2)); break; case 33: op = "lload_3"; stack.push(getVariable(3)); break; case 34: op = "fload_0"; stack.push(getVariable(0)); break; case 35: op = "fload_1"; stack.push(getVariable(1)); break; case 36: op = "fload_2"; stack.push(getVariable(2)); break; case 37: op = "fload_3"; stack.push(getVariable(3)); break; case 38: op = "dload_0"; stack.push(getVariable(0)); break; case 39: op = "dload_1"; stack.push(getVariable(1)); break; case 40: op = "dload_2"; stack.push(getVariable(2)); break; case 41: op = "dload_3"; stack.push(getVariable(3)); break; case 42: op = "aload_0"; stack.push(getVariable(0)); break; case 43: op = "aload_1"; stack.push(getVariable(1)); break; case 44: op = "aload_2"; stack.push(getVariable(2)); break; case 45: op = "aload_3"; stack.push(getVariable(3)); break; case 46: { Token index = stack.pop(); Token ref = stack.pop(); op = "iaload"; stack.push(ArrayGet.get(ref, index)); break; } case 47: { Token index = stack.pop(); Token ref = stack.pop(); op = "laload"; stack.push(ArrayGet.get(ref, index)); break; } case 48: { Token index = stack.pop(); Token ref = stack.pop(); op = "faload"; stack.push(ArrayGet.get(ref, index)); break; } case 49: { Token index = stack.pop(); Token ref = stack.pop(); op = "daload"; stack.push(ArrayGet.get(ref, index)); break; } case 50: { Token index = stack.pop(); Token ref = stack.pop(); op = "aaload"; stack.push(ArrayGet.get(ref, index)); break; } case 51: { Token index = stack.pop(); Token ref = stack.pop(); op = "baload"; stack.push(ArrayGet.get(ref, index)); break; } case 52: { Token index = stack.pop(); Token ref = stack.pop(); op = "caload"; stack.push(ArrayGet.get(ref, index)); break; } case 53: { Token index = stack.pop(); Token ref = stack.pop(); op = "saload"; stack.push(ArrayGet.get(ref, index)); break; } case 54: { int var = readByte(); op = "istore " + var; setVariable(var, stack.pop()); break; } case 55: { int var = readByte(); op = "lstore " + var; setVariable(var, stack.pop()); break; } case 56: { int var = readByte(); op = "fstore " + var; setVariable(var, stack.pop()); break; } case 57: { int var = readByte(); op = "dstore " + var; setVariable(var, stack.pop()); break; } case 58: { int var = readByte(); op = "astore " + var; setVariable(var, stack.pop()); break; } case 59: op = "istore_0"; setVariable(0, stack.pop()); break; case 60: op = "istore_1"; setVariable(1, stack.pop()); break; case 61: op = "istore_2"; setVariable(2, stack.pop()); break; case 62: op = "istore_3"; setVariable(3, stack.pop()); break; case 63: op = "lstore_0"; setVariable(0, stack.pop()); break; case 64: op = "lstore_1"; setVariable(1, stack.pop()); break; case 65: op = "lstore_2"; setVariable(2, stack.pop()); break; case 66: op = "lstore_3"; setVariable(3, stack.pop()); break; case 67: op = "fstore_0"; setVariable(0, stack.pop()); break; case 68: op = "fstore_1"; setVariable(1, stack.pop()); break; case 69: op = "fstore_2"; setVariable(2, stack.pop()); break; case 70: op = "fstore_3"; setVariable(3, stack.pop()); break; case 71: op = "dstore_0"; setVariable(0, stack.pop()); break; case 72: op = "dstore_1"; setVariable(1, stack.pop()); break; case 73: op = "dstore_2"; setVariable(2, stack.pop()); break; case 74: op = "dstore_3"; setVariable(3, stack.pop()); break; case 75: op = "astore_0"; setVariable(0, stack.pop()); break; case 76: op = "astore_1"; setVariable(1, stack.pop()); break; case 77: op = "astore_2"; setVariable(2, stack.pop()); break; case 78: op = "astore_3"; setVariable(3, stack.pop()); break; case 79: { // String value = stack.pop(); // String index = stack.pop(); // String ref = stack.pop(); op = "iastore"; // TODO side effect - not supported break; } case 80: op = "lastore"; // TODO side effect - not supported break; case 81: op = "fastore"; // TODO side effect - not supported break; case 82: op = "dastore"; // TODO side effect - not supported break; case 83: op = "aastore"; // TODO side effect - not supported break; case 84: op = "bastore"; // TODO side effect - not supported break; case 85: op = "castore"; // TODO side effect - not supported break; case 86: op = "sastore"; // TODO side effect - not supported break; case 87: op = "pop"; stack.pop(); break; case 88: op = "pop2"; // TODO currently we don't know the stack types stack.pop(); stack.pop(); break; case 89: { op = "dup"; Token x = stack.pop(); stack.push(x); stack.push(x); break; } case 90: { op = "dup_x1"; Token a = stack.pop(); Token b = stack.pop(); stack.push(a); stack.push(b); stack.push(a); break; } case 91: { // TODO currently we don't know the stack types op = "dup_x2"; Token a = stack.pop(); Token b = stack.pop(); Token c = stack.pop(); stack.push(a); stack.push(c); stack.push(b); stack.push(a); break; } case 92: { // TODO currently we don't know the stack types op = "dup2"; Token a = stack.pop(); Token b = stack.pop(); stack.push(b); stack.push(a); stack.push(b); stack.push(a); break; } case 93: { // TODO currently we don't know the stack types op = "dup2_x1"; Token a = stack.pop(); Token b = stack.pop(); Token c = stack.pop(); stack.push(b); stack.push(a); stack.push(c); stack.push(b); stack.push(a); break; } case 94: { // TODO currently we don't know the stack types op = "dup2_x2"; Token a = stack.pop(); Token b = stack.pop(); Token c = stack.pop(); Token d = stack.pop(); stack.push(b); stack.push(a); stack.push(d); stack.push(c); stack.push(b); stack.push(a); break; } case 95: { op = "swap"; Token a = stack.pop(); Token b = stack.pop(); stack.push(a); stack.push(b); break; } case 96: { Token b = stack.pop(); Token a = stack.pop(); op = "iadd"; stack.push(Operation.get(a, Operation.Type.ADD, b)); break; } case 97: { Token b = stack.pop(); Token a = stack.pop(); op = "ladd"; stack.push(Operation.get(a, Operation.Type.ADD, b)); break; } case 98: { Token b = stack.pop(); Token a = stack.pop(); op = "fadd"; stack.push(Operation.get(a, Operation.Type.ADD, b)); break; } case 99: { Token b = stack.pop(); Token a = stack.pop(); op = "dadd"; stack.push(Operation.get(a, Operation.Type.ADD, b)); break; } case 100: { Token b = stack.pop(); Token a = stack.pop(); op = "isub"; stack.push(Operation.get(a, Operation.Type.SUBTRACT, b)); break; } case 101: { Token b = stack.pop(); Token a = stack.pop(); op = "lsub"; stack.push(Operation.get(a, Operation.Type.SUBTRACT, b)); break; } case 102: { Token b = stack.pop(); Token a = stack.pop(); op = "fsub"; stack.push(Operation.get(a, Operation.Type.SUBTRACT, b)); break; } case 103: { Token b = stack.pop(); Token a = stack.pop(); op = "dsub"; stack.push(Operation.get(a, Operation.Type.SUBTRACT, b)); break; } case 104: { Token b = stack.pop(); Token a = stack.pop(); op = "imul"; stack.push(Operation.get(a, Operation.Type.MULTIPLY, b)); break; } case 105: { Token b = stack.pop(); Token a = stack.pop(); op = "lmul"; stack.push(Operation.get(a, Operation.Type.MULTIPLY, b)); break; } case 106: { Token b = stack.pop(); Token a = stack.pop(); op = "fmul"; stack.push(Operation.get(a, Operation.Type.MULTIPLY, b)); break; } case 107: { Token b = stack.pop(); Token a = stack.pop(); op = "dmul"; stack.push(Operation.get(a, Operation.Type.MULTIPLY, b)); break; } case 108: { Token b = stack.pop(); Token a = stack.pop(); op = "idiv"; stack.push(Operation.get(a, Operation.Type.DIVIDE, b)); break; } case 109: { Token b = stack.pop(); Token a = stack.pop(); op = "ldiv"; stack.push(Operation.get(a, Operation.Type.DIVIDE, b)); break; } case 110: { Token b = stack.pop(); Token a = stack.pop(); op = "fdiv"; stack.push(Operation.get(a, Operation.Type.DIVIDE, b)); break; } case 111: { Token b = stack.pop(); Token a = stack.pop(); op = "ddiv"; stack.push(Operation.get(a, Operation.Type.DIVIDE, b)); break; } case 112: { Token b = stack.pop(); Token a = stack.pop(); op = "irem"; stack.push(Operation.get(a, Operation.Type.MOD, b)); break; } case 113: { Token b = stack.pop(); Token a = stack.pop(); op = "lrem"; stack.push(Operation.get(a, Operation.Type.MOD, b)); break; } case 114: { Token b = stack.pop(); Token a = stack.pop(); op = "frem"; stack.push(Operation.get(a, Operation.Type.MOD, b)); break; } case 115: { Token b = stack.pop(); Token a = stack.pop(); op = "drem"; stack.push(Operation.get(a, Operation.Type.MOD, b)); break; } // case 116: // op = "ineg"; // break; // case 117: // op = "lneg"; // break; // case 118: // op = "fneg"; // break; // case 119: // op = "dneg"; // break; // case 120: // op = "ishl"; // break; // case 121: // op = "lshl"; // break; // case 122: // op = "ishr"; // break; // case 123: // op = "lshr"; // break; // case 124: // op = "iushr"; // break; // case 125: // op = "lushr"; // break; // case 126: // op = "iand"; // break; // case 127: // op = "land"; // break; // case 128: // op = "ior"; // break; // case 129: // op = "lor"; // break; // case 130: // op = "ixor"; // break; // case 131: // op = "lxor"; // break; // case 132: { // int var = readByte(); // int off = (byte) readByte(); // op = "iinc " + var + " " + off; // break; // } // case 133: // op = "i2l"; // break; // case 134: // op = "i2f"; // break; // case 135: // op = "i2d"; // break; // case 136: // op = "l2i"; // break; // case 137: // op = "l2f"; // break; // case 138: // op = "l2d"; // break; // case 139: // op = "f2i"; // break; // case 140: // op = "f2l"; // break; // case 141: // op = "f2d"; // break; // case 142: // op = "d2i"; // break; // case 143: // op = "d2l"; // break; // case 144: // op = "d2f"; // break; // case 145: // op = "i2b"; // break; // case 146: // op = "i2c"; // break; // case 147: // op = "i2s"; // break; case 148: { Token b = stack.pop(), a = stack.pop(); stack.push(new Function("SIGN", Operation.get(a, Operation.Type.SUBTRACT, b))); op = "lcmp"; break; } // case 149: // op = "fcmpl"; // break; // case 150: // op = "fcmpg"; // break; // case 151: // op = "dcmpl"; // break; // case 152: // op = "dcmpg"; // break; case 153: condition = true; nextPc = getAbsolutePos(pos, readShort()); stack.push(Operation.get(stack.pop(), Operation.Type.EQUALS, ConstantNumber.get(0))); op = "ifeq " + nextPc; break; case 154: condition = true; nextPc = getAbsolutePos(pos, readShort()); stack.push(Operation.get(stack.pop(), Operation.Type.NOT_EQUALS, ConstantNumber.get(0))); op = "ifne " + nextPc; break; case 155: condition = true; nextPc = getAbsolutePos(pos, readShort()); stack.push(Operation.get(stack.pop(), Operation.Type.SMALLER, ConstantNumber.get(0))); op = "iflt " + nextPc; break; case 156: condition = true; nextPc = getAbsolutePos(pos, readShort()); stack.push(Operation.get(stack.pop(), Operation.Type.BIGGER_EQUALS, ConstantNumber.get(0))); op = "ifge " + nextPc; break; case 157: condition = true; nextPc = getAbsolutePos(pos, readShort()); stack.push(Operation.get(stack.pop(), Operation.Type.BIGGER, ConstantNumber.get(0))); op = "ifgt " + nextPc; break; case 158: condition = true; nextPc = getAbsolutePos(pos, readShort()); stack.push(Operation.get(stack.pop(), Operation.Type.SMALLER_EQUALS, ConstantNumber.get(0))); op = "ifle " + nextPc; break; case 159: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.EQUALS, b)); op = "if_icmpeq " + nextPc; break; } case 160: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.NOT_EQUALS, b)); op = "if_icmpne " + nextPc; break; } case 161: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.SMALLER, b)); op = "if_icmplt " + nextPc; break; } case 162: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.BIGGER_EQUALS, b)); op = "if_icmpge " + nextPc; break; } case 163: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.BIGGER, b)); op = "if_icmpgt " + nextPc; break; } case 164: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.SMALLER_EQUALS, b)); op = "if_icmple " + nextPc; break; } case 165: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.EQUALS, b)); op = "if_acmpeq " + nextPc; break; } case 166: { condition = true; nextPc = getAbsolutePos(pos, readShort()); Token b = stack.pop(), a = stack.pop(); stack.push(Operation.get(a, Operation.Type.NOT_EQUALS, b)); op = "if_acmpne " + nextPc; break; } case 167: nextPc = getAbsolutePos(pos, readShort()); op = "goto " + nextPc; break; // case 168: // // TODO not supported yet // op = "jsr " + getAbsolutePos(pos, readShort()); // break; // case 169: // // TODO not supported yet // op = "ret " + readByte(); // break; // case 170: { // int start = pos; // pos += 4 - ((pos - startByteCode) & 3); // int def = readInt(); // int low = readInt(), high = readInt(); // int n = high - low + 1; // op = "tableswitch default:" + getAbsolutePos(start, def); // StringBuilder buff = new StringBuilder(); // for (int i = 0; i < n; i++) { // buff.append(' ').append(low++). // append(":"). // append(getAbsolutePos(start, readInt())); // } // op += buff.toString(); // // pos += n * 4; // break; // } // case 171: { // int start = pos; // pos += 4 - ((pos - startByteCode) & 3); // int def = readInt(); // int n = readInt(); // op = "lookupswitch default:" + getAbsolutePos(start, def); // StringBuilder buff = new StringBuilder(); // for (int i = 0; i < n; i++) { // buff.append(' '). // append(readInt()). // append(":"). // append(getAbsolutePos(start, readInt())); // } // op += buff.toString(); // // pos += n * 8; // break; // } case 172: op = "ireturn"; endOfMethod = true; break; case 173: op = "lreturn"; endOfMethod = true; break; case 174: op = "freturn"; endOfMethod = true; break; case 175: op = "dreturn"; endOfMethod = true; break; case 176: op = "areturn"; endOfMethod = true; break; case 177: op = "return"; // no value returned stack.push(null); endOfMethod = true; break; // case 178: // op = "getstatic " + getField(readShort()); // break; // case 179: // op = "putstatic " + getField(readShort()); // break; case 180: { String field = getField(readShort()); Token p = stack.pop(); String s = p + "." + field.substring(field.lastIndexOf('.') + 1, field.indexOf(' ')); if (s.startsWith("this.")) { s = s.substring(5); } stack.push(Variable.get(s, fieldMap.get(s))); op = "getfield " + field; break; } // case 181: // op = "putfield " + getField(readShort()); // break; case 182: { String method = getMethod(readShort()); op = "invokevirtual " + method; if (method.equals("java/lang/String.equals (Ljava/lang/Object;)Z")) { Token a = stack.pop(); Token b = stack.pop(); stack.push(Operation.get(a, Operation.Type.EQUALS, b)); } else if (method.equals("java/lang/Integer.intValue ()I")) { // ignore } else if (method.equals("java/lang/Long.longValue ()J")) { // ignore } break; } case 183: { String method = getMethod(readShort()); op = "invokespecial " + method; break; } case 184: op = "invokestatic " + getMethod(readShort()); break; // case 185: { // int methodRef = readShort(); // readByte(); // readByte(); // op = "invokeinterface " + getMethod(methodRef); // break; // } case 187: { String className = constantPool[constantPool[readShort()].intValue()].toString(); op = "new " + className; break; } // case 188: // op = "newarray " + readByte(); // break; // case 189: // op = "anewarray " + cpString[readShort()]; // break; // case 190: // op = "arraylength"; // break; // case 191: // op = "athrow"; // break; // case 192: // op = "checkcast " + cpString[readShort()]; // break; // case 193: // op = "instanceof " + cpString[readShort()]; // break; // case 194: // op = "monitorenter"; // break; // case 195: // op = "monitorexit"; // break; // case 196: { // opCode = readByte(); // switch (opCode) { // case 21: // op = "wide iload " + readShort(); // break; // case 22: // op = "wide lload " + readShort(); // break; // case 23: // op = "wide fload " + readShort(); // break; // case 24: // op = "wide dload " + readShort(); // break; // case 25: // op = "wide aload " + readShort(); // break; // case 54: // op = "wide istore " + readShort(); // break; // case 55: // op = "wide lstore " + readShort(); // break; // case 56: // op = "wide fstore " + readShort(); // break; // case 57: // op = "wide dstore " + readShort(); // break; // case 58: // op = "wide astore " + readShort(); // break; // case 132: { // int var = readShort(); // int off = (short) readShort(); // op = "wide iinc " + var + " " + off; // break; // } // case 169: // op = "wide ret " + readShort(); // break; // default: // throw new RuntimeException( // "Unsupported wide opCode " + opCode); // } // break; // } // case 197: // op = "multianewarray " + cpString[readShort()] + " " + readByte(); // break; // case 198: { // condition = true; // nextPc = getAbsolutePos(pos, readShort()); // Token a = stack.pop(); // stack.push("(" + a + " IS NULL)"); // op = "ifnull " + nextPc; // break; // } // case 199: { // condition = true; // nextPc = getAbsolutePos(pos, readShort()); // Token a = stack.pop(); // stack.push("(" + a + " IS NOT NULL)"); // op = "ifnonnull " + nextPc; // break; // } case 200: op = "goto_w " + getAbsolutePos(pos, readInt()); break; case 201: op = "jsr_w " + getAbsolutePos(pos, readInt()); break; default: throw new RuntimeException("Unsupported opCode " + opCode); } debug(" " + startPos + ": " + op); }
// in src/tools/org/h2/jaqu/bytecode/ClassReader.java
private Constant getConstant(int constantRef) { Constant c = constantPool[constantRef]; switch (c.getType()) { case INT: case FLOAT: case DOUBLE: case LONG: return c; case STRING_REF: return constantPool[c.intValue()]; default: throw new RuntimeException("Not a constant: " + constantRef); } }
// in src/tools/org/h2/jaqu/DbInspector.java
public List<String> generateModel(String schema, String table, String packageName, boolean annotateSchema, boolean trimStrings) { try { List<String> models = New.arrayList(); List<TableInspector> tables = getTables(schema, table); for (TableInspector t : tables) { t.read(metaData); String model = t.generateModel(packageName, annotateSchema, trimStrings); models.add(model); } return models; } catch (SQLException s) { throw new RuntimeException(s); } }
// in src/tools/org/h2/jaqu/DbInspector.java
public <T> List<ValidationRemark> validateModel(T model, boolean throwOnError) { try { TableInspector inspector = getTable(model); inspector.read(metaData); @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) model.getClass(); TableDefinition<T> def = db.define(clazz); return inspector.validate(def, throwOnError); } catch (SQLException s) { throw new RuntimeException(s); } }
// in src/tools/org/h2/jaqu/DbInspector.java
private List<TableInspector> getTables(String schema, String table) throws SQLException { ResultSet rs = null; try { rs = getMetaData().getSchemas(); ArrayList<String> schemaList = New.arrayList(); while (rs.next()) { schemaList.add(rs.getString("TABLE_SCHEM")); } JdbcUtils.closeSilently(rs); String jaquTables = DbVersion.class.getAnnotation(JQTable.class).name(); List<TableInspector> tables = New.arrayList(); if (schemaList.size() == 0) { schemaList.add(null); } for (String s : schemaList) { rs = getMetaData().getTables(null, s, null, new String[] { "TABLE" }); while (rs.next()) { String t = rs.getString("TABLE_NAME"); if (!t.equalsIgnoreCase(jaquTables)) { tables.add(new TableInspector(s, t, getMetaData().storesUpperCaseIdentifiers(), dateTimeClass)); } } } if (StringUtils.isNullOrEmpty(schema) && StringUtils.isNullOrEmpty(table)) { // all schemas and tables return tables; } // schema subset OR table subset OR exact match List<TableInspector> matches = New.arrayList(); for (TableInspector t : tables) { if (t.matches(schema, table)) { matches.add(t); } } if (matches.size() == 0) { throw new RuntimeException( MessageFormat.format("Failed to find schema={0} table={1}", schema == null ? "" : schema, table == null ? "" : table)); } return matches; } finally { JdbcUtils.closeSilently(rs); } }
// in src/tools/org/h2/jaqu/TableDefinition.java
Object getValue(Object obj) { try { return field.get(obj); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/TableDefinition.java
void setValue(Object obj, Object o) { try { if (!field.isAccessible()) { field.setAccessible(true); } o = ClassUtils.convert(o, field.getType()); field.set(obj, o); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/TableDefinition.java
Object read(ResultSet rs, int columnIndex) { try { return rs.getObject(columnIndex); } catch (SQLException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/ValidationRemark.java
public ValidationRemark throwError(boolean throwOnError) { if (throwOnError && isError()) { throw new RuntimeException(toString()); } return this; }
// in src/tools/org/h2/jaqu/Db.java
private static <T> T instance(Class<T> clazz) { try { return clazz.newInstance(); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/Db.java
public synchronized void setDbUpgrader(DbUpgrader upgrader) { if (!upgrader.getClass().isAnnotationPresent(JQDatabase.class)) { throw new RuntimeException("DbUpgrader must be annotated with " + JQDatabase.class.getSimpleName()); } this.dbUpgrader = upgrader; upgradeChecked.clear(); }
// in src/tools/org/h2/jaqu/Db.java
public void close() { try { conn.close(); } catch (Exception e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/Db.java
PreparedStatement prepare(String sql, boolean returnGeneratedKeys) { try { if (returnGeneratedKeys) { return conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); } return conn.prepareStatement(sql); } catch (SQLException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/Db.java
public ResultSet executeQuery(String sql) { try { return conn.createStatement().executeQuery(sql); } catch (SQLException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/Db.java
public int executeUpdate(String sql) { try { Statement stat = conn.createStatement(); int updateCount = stat.executeUpdate(sql); stat.close(); return updateCount; } catch (SQLException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/Define.java
private static void checkInDefine() { if (currentTable == null) { throw new RuntimeException("This method may only be called " + "from within the define() method, and the define() method " + "is called by the framework."); } }
// in src/tools/org/h2/jaqu/ModelUtils.java
static String getDataType(FieldDefinition fieldDef, boolean strictTypeMapping) { Class<?> fieldClass = fieldDef.field.getType(); if (SUPPORTED_TYPES.containsKey(fieldClass)) { String type = SUPPORTED_TYPES.get(fieldClass); if (type.equals("VARCHAR") && fieldDef.maxLength <= 0) { // unspecified length strings are TEXT, not VARCHAR return "TEXT"; } return type; } if (!strictTypeMapping) { return "VARCHAR"; } throw new RuntimeException("Unsupported type " + fieldClass.getName()); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
public static Object convert(Object o, Class<?> targetType) { if (o == null) { return null; } Class<?> currentType = o.getClass(); if (targetType.isAssignableFrom(currentType)) { return o; } if (targetType == String.class) { if (Clob.class.isAssignableFrom(currentType)) { Clob c = (Clob) o; try { Reader r = c.getCharacterStream(); return IOUtils.readStringAndClose(r, -1); } catch (Exception e) { throw new RuntimeException("Error converting CLOB to String: " + e.toString(), e); } } return o.toString(); } if (Number.class.isAssignableFrom(currentType)) { Number n = (Number) o; if (targetType == Byte.class) { return n.byteValue(); } else if (targetType == Short.class) { return n.shortValue(); } else if (targetType == Integer.class) { return n.intValue(); } else if (targetType == Long.class) { return n.longValue(); } else if (targetType == Double.class) { return n.doubleValue(); } else if (targetType == Float.class) { return n.floatValue(); } } throw new RuntimeException("Can not convert the value " + o + " from " + currentType + " to " + targetType); }
// in src/tools/org/h2/jaqu/SQLStatement.java
ResultSet executeQuery() { try { return prepare(false).executeQuery(); } catch (SQLException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/jaqu/SQLStatement.java
int executeUpdate() { PreparedStatement ps = null; try { ps = prepare(false); return ps.executeUpdate(); } catch (SQLException e) { throw new RuntimeException(e); } finally { JdbcUtils.closeSilently(ps); } }
// in src/tools/org/h2/jaqu/SQLStatement.java
long executeInsert() { PreparedStatement ps = null; try { ps = prepare(true); ps.executeUpdate(); long identity = -1; ResultSet rs = ps.getGeneratedKeys(); if (rs != null && rs.next()) { identity = rs.getLong(1); } JdbcUtils.closeSilently(rs); return identity; } catch (SQLException e) { throw new RuntimeException(e); } finally { JdbcUtils.closeSilently(ps); } }
// in src/tools/org/h2/jaqu/SQLStatement.java
private static void setValue(PreparedStatement prep, int parameterIndex, Object x) { try { prep.setObject(parameterIndex, x); } catch (SQLException e) { throw new RuntimeException(e); } }
// in src/tools/org/h2/java/Expr.java
private void init() { if (field == null) { Type t = base.getType(); if (t.arrayLevel > 0) { if ("length".equals(name)) { field = new FieldObj(); field.type = context.getClassObj("int").baseType; } else { throw new RuntimeException("Unknown array method: " + name); } } else { field = t.classObj.getField(name); } } }
// in src/tools/org/h2/java/ClassObj.java
MethodObj getMethod(String find, ArrayList<Expr> args) { ArrayList<MethodObj> list = methods.get(find); if (list == null) { throw new RuntimeException("Method not found: " + className + " " + find); } if (list.size() == 1) { return list.get(0); } for (MethodObj m : list) { if (!m.isVarArgs && m.parameters.size() != args.size()) { continue; } boolean match = true; int i = 0; for (FieldObj f : m.parameters.values()) { Expr a = args.get(i++); Type t = a.getType(); if (!t.equals(f.type)) { match = false; break; } } if (match) { return m; } } throw new RuntimeException("Method not found: " + className); }
// in src/tools/org/h2/java/JavaParser.java
ClassObj getWrapper(ClassObj c) { switch (c.id) { case 1: return getClass("java.lang.Boolean"); case 2: return getClass("java.lang.Byte"); case 3: return getClass("java.lang.Short"); case 4: return getClass("java.lang.Character"); case 5: return getClass("java.lang.Integer"); case 6: return getClass("java.lang.Long"); case 7: return getClass("java.lang.Float"); case 8: return getClass("java.lang.Double"); } throw new RuntimeException("not a primitive type: " + classObj); }
// in src/tools/org/h2/java/JavaParser.java
void parse(String baseDir, String className) { String fileName = baseDir + "/" + className.replace('.', '/') + ".java"; current = new ParseState(); try { RandomAccessFile file = new RandomAccessFile(fileName, "r"); byte[] buff = new byte[(int) file.length()]; file.readFully(buff); source = new String(buff, "UTF-8"); file.close(); } catch (IOException e) { throw new RuntimeException(e); } source = replaceUnicode(source); source = removeRemarks(source); try { readToken(); parseCompilationUnit(); } catch (Exception e) { throw new RuntimeException(source.substring(0, current.index) + "[*]" + source.substring(current.index), e); } }
// in src/tools/org/h2/java/JavaParser.java
private ClassObj getClass(String type) { ClassObj c = getClassIf(type); if (c == null) { throw new RuntimeException("Unknown type: " + type); } return c; }
// in src/tools/org/h2/java/JavaParser.java
private ClassObj getClassIf(String type) { ClassObj c = builtInTypes.get(type); if (c != null) { return c; } c = classes.get(type); if (c != null) { return c; } String mappedType = importMap.get(type); if (mappedType == null) { mappedType = JAVA_IMPORT_MAP.get(type); if (mappedType == null) { return null; } } c = classes.get(mappedType); if (c == null) { c = builtInTypes.get(mappedType); if (c == null) { throw new RuntimeException("Unknown class: " + mappedType); } } return c; }
58
            
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/TreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/store/btree/BtreeMapStore.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error downloading", e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/dev/util/Migrate.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/doc/RailroadImages.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Throwable e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read field " + className + "." + fieldName, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException("Can not read value " + className + "." + methodName + "()", e); }
// in src/tools/org/h2/build/BuildBase.java
catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error downloading " + fileURL + " to " + target, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error writing to file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error reading from file " + file, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (IOException e) { throw new RuntimeException("Error creating file " + destFile, e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/Build.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/bytecode/ClassReader.java
catch (IOException e) { throw new RuntimeException("Could not read class bytecode", e); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (Exception e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { if (MAKE_ACCESSIBLE) { Constructor[] constructors = clazz.getDeclaredConstructors(); // try 0 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 0) { c.setAccessible(true); try { return clazz.newInstance(); } catch (Exception e2) { // ignore } } } // try 1 length constructors for (Constructor c : constructors) { if (c.getParameterTypes().length == 1) { c.setAccessible(true); try { return (T) c.newInstance(new Object[1]); } catch (Exception e2) { // ignore } } } } throw new RuntimeException("Exception trying to create " + clazz.getName() + ": " + e, e); }
// in src/tools/org/h2/jaqu/util/ClassUtils.java
catch (Exception e) { throw new RuntimeException("Error converting CLOB to String: " + e.toString(), e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/java/JavaParser.java
catch (IOException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/java/JavaParser.java
catch (Exception e) { throw new RuntimeException(source.substring(0, current.index) + "[*]" + source.substring(current.index), e); }
0 8
            
// in src/main/org/h2/jdbcx/JdbcXid.java
catch (RuntimeException e) { throw DbException.get(ErrorCode.WRONG_XID_FORMAT_1, tid); }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (RuntimeException e) { // this can happen when stopping a web application, // if loading classes is no longer allowed // it would throw an IllegalStateException try { trace.error(e, "could not close the database"); // if this was successful, we ignore the exception // otherwise not } catch (RuntimeException e2) { throw e; } }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (RuntimeException e2) { throw e; }
// in src/main/org/h2/engine/SessionRemote.java
catch (RuntimeException e) { trace.error(e, "close"); closeError = e; }
// in src/main/org/h2/server/TcpServerThread.java
catch (RuntimeException e) { closeError = e; server.traceError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (RuntimeException e) { if (closeError == null) { closeError = e; server.traceError(e); } }
// in src/tools/org/h2/build/BuildBase.java
catch (RuntimeException e) { throw e; }
// in src/tools/org/h2/build/BuildBase.java
catch (RuntimeException e) { println("Could not download using Maven: " + e.toString()); }
3
            
// in src/main/org/h2/jdbcx/JdbcXid.java
catch (RuntimeException e) { throw DbException.get(ErrorCode.WRONG_XID_FORMAT_1, tid); }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (RuntimeException e) { // this can happen when stopping a web application, // if loading classes is no longer allowed // it would throw an IllegalStateException try { trace.error(e, "could not close the database"); // if this was successful, we ignore the exception // otherwise not } catch (RuntimeException e2) { throw e; } }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (RuntimeException e2) { throw e; }
// in src/tools/org/h2/build/BuildBase.java
catch (RuntimeException e) { throw e; }
0
unknown (Lib) SQLClientInfoException 3
            
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setClientInfo(String name, String value) throws SQLClientInfoException { throw new SQLClientInfoException(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setClientInfo(Properties properties) throws SQLClientInfoException { throw new SQLClientInfoException(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Properties getClientInfo() throws SQLClientInfoException { throw new SQLClientInfoException(); }
0 3
            
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setClientInfo(String name, String value) throws SQLClientInfoException { throw new SQLClientInfoException(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setClientInfo(Properties properties) throws SQLClientInfoException { throw new SQLClientInfoException(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Properties getClientInfo() throws SQLClientInfoException { throw new SQLClientInfoException(); }
0 0 0
checked (Domain) SQLException
public class SQLException extends Exception {

    private static final long serialVersionUID = 1L;

    public SQLException() {
        super();
    }

    public SQLException(String error) {
        super(error);
    }

}
16
            
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
public Connection getConnection() throws SQLException { long max = System.currentTimeMillis() + timeout * 1000; do { synchronized (this) { if (activeConnections < maxConnections) { return getConnectionNow(); } try { wait(1000); } catch (InterruptedException e) { // ignore } } } while (System.currentTimeMillis() <= max); throw new SQLException("Login timeout", "08001", 8001); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
private JdbcConnection getJdbcConnection(String user, char[] password) throws SQLException { if (isDebugEnabled()) { debugCode("getJdbcConnection("+quote(user)+", new char[0]);"); } Properties info = new Properties(); info.setProperty("user", user); info.put("password", password); Connection conn = Driver.load().connect(url, info); if (conn == null) { throw new SQLException("No suitable driver found for " + url, "08001", 8001); } else if (!(conn instanceof JdbcConnection)) { throw new SQLException("Connecting with old version is not supported: " + url, "08001", 8001); } return (JdbcConnection) conn; }
// in src/main/org/h2/tools/Script.java
public void runTool(String... args) throws SQLException { String url = null; String user = "sa"; String password = ""; String file = "backup.sql"; String options1 = null, options2 = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-script")) { file = args[++i]; } else if (arg.equals("-options")) { StringBuilder buff1 = new StringBuilder(); StringBuilder buff2 = new StringBuilder(); i++; for (; i < args.length; i++) { String a = args[i]; String upper = StringUtils.toUpperEnglish(a); if ("SIMPLE".equals(upper) || upper.startsWith("NO") || "DROP".equals(upper)) { buff1.append(' '); buff1.append(args[i]); } else { buff2.append(' '); buff2.append(args[i]); } } options1 = buff1.toString(); options2 = buff2.toString(); } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (url == null) { showUsage(); throw new SQLException("URL not set"); } if (options1 != null) { processScript(url, user, password, file, options1, options2); } else { execute(url, user, password, file); } }
// in src/main/org/h2/tools/ChangeFileEncryption.java
public void runTool(String... args) throws SQLException { String dir = "."; String cipher = null; char[] decryptPassword = null; char[] encryptPassword = null; String db = null; boolean quiet = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-cipher")) { cipher = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-decrypt")) { decryptPassword = args[++i].toCharArray(); } else if (arg.equals("-encrypt")) { encryptPassword = args[++i].toCharArray(); } else if (arg.equals("-quiet")) { quiet = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if ((encryptPassword == null && decryptPassword == null) || cipher == null) { showUsage(); throw new SQLException("Encryption or decryption password not set, or cipher not set"); } try { process(dir, db, cipher, decryptPassword, encryptPassword, quiet); } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/ChangeFileEncryption.java
private void process(String dir, String db, String cipher, char[] decryptPassword, char[] encryptPassword, boolean quiet) throws SQLException { dir = FileLister.getDir(dir); ChangeFileEncryption change = new ChangeFileEncryption(); if (encryptPassword != null) { for (char c : encryptPassword) { if (c == ' ') { throw new SQLException("The file password may not contain spaces"); } } } change.out = out; change.directory = dir; change.cipherType = cipher; change.decrypt = getFileEncryptionKey(decryptPassword); change.encrypt = getFileEncryptionKey(encryptPassword); ArrayList<String> files = FileLister.getDatabaseFiles(dir, db, true); FileLister.tryUnlockDatabase(files, "encryption"); files = FileLister.getDatabaseFiles(dir, db, false); if (files.size() == 0 && !quiet) { printNoDatabaseFilesFound(dir, db); } // first, test only if the file can be renamed // (to find errors with locked files early) for (String fileName : files) { String temp = dir + "/temp.db"; FileUtils.delete(temp); FileUtils.moveTo(fileName, temp); FileUtils.moveTo(temp, fileName); } // if this worked, the operation will (hopefully) be successful // TODO changeFileEncryption: this is a workaround! // make the operation atomic (all files or none) for (String fileName : files) { // Don't process a lob directory, just the files in the directory. if (!FileUtils.isDirectory(fileName)) { change.process(fileName); } } }
// in src/main/org/h2/tools/Csv.java
public void reset() throws SQLException { throw new SQLException("Method is not supported", "CSV"); }
// in src/main/org/h2/tools/CreateCluster.java
public void runTool(String... args) throws SQLException { String urlSource = null; String urlTarget = null; String user = "sa"; String password = ""; String serverList = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-urlSource")) { urlSource = args[++i]; } else if (arg.equals("-urlTarget")) { urlTarget = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-serverList")) { serverList = args[++i]; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (urlSource == null || urlTarget == null || serverList == null) { showUsage(); throw new SQLException("Source URL, target URL, or server list not set"); } process(urlSource, urlTarget, user, password, serverList); }
// in src/main/org/h2/tools/CreateCluster.java
private void process(String urlSource, String urlTarget, String user, String password, String serverList) throws SQLException { Connection connSource = null, connTarget = null; Statement statSource = null, statTarget = null; String scriptFile = "backup.sql"; try { org.h2.Driver.load(); // verify that the database doesn't exist, // or if it exists (an old cluster instance), it is deleted boolean exists = true; try { connTarget = DriverManager.getConnection(urlTarget + ";IFEXISTS=TRUE;CLUSTER=" + Constants.CLUSTERING_ENABLED, user, password); Statement stat = connTarget.createStatement(); stat.execute("DROP ALL OBJECTS DELETE FILES"); stat.close(); exists = false; connTarget.close(); } catch (SQLException e) { if (e.getErrorCode() == ErrorCode.DATABASE_NOT_FOUND_1) { // database does not exists yet - ok exists = false; } else { throw e; } } if (exists) { throw new SQLException("Target database must not yet exist. Please delete it first: " + urlTarget); } // use cluster='' so connecting is possible // even if the cluster is enabled connSource = DriverManager.getConnection(urlSource + ";CLUSTER=''", user, password); statSource = connSource.createStatement(); // enable the exclusive mode and close other connections, // so that data can't change while restoring the second database statSource.execute("SET EXCLUSIVE 2"); try { // backup Script script = new Script(); script.setOut(out); OutputStream scriptOut = null; try { scriptOut = FileUtils.newOutputStream(scriptFile, false); Script.process(connSource, scriptOut); } finally { IOUtils.closeSilently(scriptOut); } // delete the target database and then restore connTarget = DriverManager.getConnection(urlTarget + ";CLUSTER=''", user, password); statTarget = connTarget.createStatement(); statTarget.execute("DROP ALL OBJECTS DELETE FILES"); connTarget.close(); RunScript runScript = new RunScript(); runScript.setOut(out); runScript.process(urlTarget, user, password, scriptFile, null, false); connTarget = DriverManager.getConnection(urlTarget, user, password); statTarget = connTarget.createStatement(); // set the cluster to the serverList on both databases statSource.executeUpdate("SET CLUSTER '" + serverList + "'"); statTarget.executeUpdate("SET CLUSTER '" + serverList + "'"); } finally { // switch back to the regular mode statSource.execute("SET EXCLUSIVE FALSE"); } } finally { FileUtils.delete(scriptFile); JdbcUtils.closeSilently(statSource); JdbcUtils.closeSilently(statTarget); JdbcUtils.closeSilently(connSource); JdbcUtils.closeSilently(connTarget); } }
// in src/main/org/h2/tools/RunScript.java
public void runTool(String... args) throws SQLException { String url = null; String user = "sa"; String password = ""; String script = "backup.sql"; String options = null; boolean continueOnError = false; boolean showTime = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-continueOnError")) { continueOnError = true; } else if (arg.equals("-checkResults")) { checkResults = true; } else if (arg.equals("-showResults")) { showResults = true; } else if (arg.equals("-script")) { script = args[++i]; } else if (arg.equals("-time")) { showTime = true; } else if (arg.equals("-driver")) { String driver = args[++i]; Utils.loadUserClass(driver); } else if (arg.equals("-options")) { StringBuilder buff = new StringBuilder(); i++; for (; i < args.length; i++) { buff.append(' ').append(args[i]); } options = buff.toString(); } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (url == null) { showUsage(); throw new SQLException("URL not set"); } long time = System.currentTimeMillis(); if (options != null) { processRunscript(url, user, password, script, options); } else { process(url, user, password, script, null, continueOnError); } if (showTime) { time = System.currentTimeMillis() - time; out.println("Done in " + time + " ms"); } }
// in src/main/org/h2/tools/RunScript.java
private void process(Connection conn, boolean continueOnError, String path, Reader reader, String charsetName) throws SQLException, IOException { Statement stat = conn.createStatement(); ScriptReader r = new ScriptReader(reader); while (true) { String sql = r.readStatement(); if (sql == null) { break; } String trim = sql.trim(); if (trim.length() == 0) { continue; } if (trim.startsWith("@") && StringUtils.toUpperEnglish(trim).startsWith("@INCLUDE")) { sql = trim; sql = sql.substring("@INCLUDE".length()).trim(); if (!FileUtils.isAbsolute(sql)) { sql = path + SysProperties.FILE_SEPARATOR + sql; } process(conn, sql, continueOnError, charsetName); } else { try { if (showResults && !trim.startsWith("-->")) { out.print(sql + ";"); } if (showResults || checkResults) { boolean query = stat.execute(sql); if (query) { ResultSet rs = stat.getResultSet(); int columns = rs.getMetaData().getColumnCount(); StringBuilder buff = new StringBuilder(); while (rs.next()) { buff.append("\n-->"); for (int i = 0; i < columns; i++) { String s = rs.getString(i + 1); if (s != null) { s = StringUtils.replaceAll(s, "\r\n", "\n"); s = StringUtils.replaceAll(s, "\n", "\n--> "); s = StringUtils.replaceAll(s, "\r", "\r--> "); } buff.append(' ').append(s); } } buff.append("\n;"); String result = buff.toString(); if (showResults) { out.print(result); } if (checkResults) { String expected = r.readStatement() + ";"; expected = StringUtils.replaceAll(expected, "\r\n", "\n"); expected = StringUtils.replaceAll(expected, "\r", "\n"); if (!expected.equals(result)) { expected = StringUtils.replaceAll(expected, " ", "+"); result = StringUtils.replaceAll(result, " ", "+"); throw new SQLException("Unexpected output for:\n" + sql.trim() + "\nGot:\n" + result + "\nExpected:\n" + expected); } } } } else { stat.execute(sql); } } catch (Exception e) { if (continueOnError) { e.printStackTrace(out); } else { throw DbException.toSQLException(e); } } } } }
// in src/main/org/h2/fulltext/FullText.java
protected static SQLException throwException(String message) throws SQLException { throw new SQLException(message, "FULLTEXT"); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
public void runTool(String... args) throws SQLException { String url = null; String user = "sa"; String password = ""; String schema = null; String table = null; String packageName = ""; String folder = null; boolean annotateSchema = true; boolean trimStrings = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-schema")) { schema = args[++i]; } else if (arg.equals("-table")) { table = args[++i]; } else if (arg.equals("-package")) { packageName = args[++i]; } else if (arg.equals("-folder")) { folder = args[++i]; } else if (arg.equals("-annotateSchema")) { try { annotateSchema = Boolean.parseBoolean(args[++i]); } catch (Throwable t) { throw new SQLException("Can not parse -annotateSchema value"); } } else if (arg.equals("-trimStrings")) { try { trimStrings = Boolean.parseBoolean(args[++i]); } catch (Throwable t) { throw new SQLException("Can not parse -trimStrings value"); } } else { throwUnsupportedOption(arg); } } if (url == null) { throw new SQLException("URL not set"); } execute(url, user, password, schema, table, packageName, folder, annotateSchema, trimStrings); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
protected SQLException throwUnsupportedOption(String option) throws SQLException { showUsage(); throw new SQLException("Unsupported option: " + option); }
2
            
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -annotateSchema value"); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -trimStrings value"); }
990
            
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void close() throws SQLException { debugCodeCall("close"); Connection lastHandle = handleConn; if (lastHandle != null) { listeners.clear(); lastHandle.close(); } if (physicalConn != null) { try { physicalConn.close(); } finally { physicalConn = null; } } }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public Connection getConnection() throws SQLException { debugCodeCall("getConnection"); Connection lastHandle = handleConn; if (lastHandle != null) { lastHandle.close(); } // this will ensure the rollback command is cached physicalConn.rollback(); handleConn = new PooledJdbcConnection(physicalConn); return handleConn; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public synchronized void close() throws SQLException { if (!isClosed) { try { rollback(); setAutoCommit(true); } catch (SQLException e) { // ignore } closedHandle(); isClosed = true; } }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public synchronized boolean isClosed() throws SQLException { return isClosed || super.isClosed(); }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
public Connection getConnection() throws SQLException { long max = System.currentTimeMillis() + timeout * 1000; do { synchronized (this) { if (activeConnections < maxConnections) { return getConnectionNow(); } try { wait(1000); } catch (InterruptedException e) { // ignore } } } while (System.currentTimeMillis() <= max); throw new SQLException("Login timeout", "08001", 8001); }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
private Connection getConnectionNow() throws SQLException { if (isDisposed) { throw new IllegalStateException("Connection pool has been disposed."); } PooledConnection pc; if (!recycledConnections.isEmpty()) { pc = recycledConnections.remove(recycledConnections.size() - 1); } else { pc = dataSource.getPooledConnection(); } Connection conn = pc.getConnection(); activeConnections++; pc.addConnectionEventListener(this); return conn; }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw DbException.getUnsupportedException("unwrap"); }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw DbException.getUnsupportedException("isWrapperFor"); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public Connection getConnection() throws SQLException { debugCodeCall("getConnection"); return getJdbcConnection(userName, StringUtils.cloneCharArray(passwordChars)); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public Connection getConnection(String user, String password) throws SQLException { if (isDebugEnabled()) { debugCode("getConnection("+quote(user)+", \"\");"); } return getJdbcConnection(user, convertToCharArray(password)); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
private JdbcConnection getJdbcConnection(String user, char[] password) throws SQLException { if (isDebugEnabled()) { debugCode("getJdbcConnection("+quote(user)+", new char[0]);"); } Properties info = new Properties(); info.setProperty("user", user); info.put("password", password); Connection conn = Driver.load().connect(url, info); if (conn == null) { throw new SQLException("No suitable driver found for " + url, "08001", 8001); } else if (!(conn instanceof JdbcConnection)) { throw new SQLException("Connecting with old version is not supported: " + url, "08001", 8001); } return (JdbcConnection) conn; }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public XAConnection getXAConnection() throws SQLException { debugCodeCall("getXAConnection"); int id = getNextId(XA_DATA_SOURCE); return new JdbcXAConnection(factory, id, getJdbcConnection(userName, StringUtils.cloneCharArray(passwordChars))); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public XAConnection getXAConnection(String user, String password) throws SQLException { if (isDebugEnabled()) { debugCode("getXAConnection("+quote(user)+", \"\");"); } int id = getNextId(XA_DATA_SOURCE); return new JdbcXAConnection(factory, id, getJdbcConnection(user, convertToCharArray(password))); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public PooledConnection getPooledConnection() throws SQLException { debugCodeCall("getPooledConnection"); return getXAConnection(); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public PooledConnection getPooledConnection(String user, String password) throws SQLException { if (isDebugEnabled()) { debugCode("getPooledConnection("+quote(user)+", \"\");"); } return getXAConnection(user, password); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbcx/JdbcDataSource.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/message/TraceObject.java
protected SQLException unsupported(String message) throws SQLException { try { throw DbException.getUnsupportedException(message); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/tools/TriggerAdapter.java
public void init(Connection conn, String schemaName, String triggerName, String tableName, boolean before, int type) throws SQLException { ResultSet rs = conn.getMetaData().getColumns( null, schemaName, tableName, null); oldSource = new TriggerRowSource(); newSource = new TriggerRowSource(); oldResultSet = new SimpleResultSet(oldSource); newResultSet = new SimpleResultSet(newSource); while (rs.next()) { String column = rs.getString("COLUMN_NAME"); int dataType = rs.getInt("DATA_TYPE"); int precision = rs.getInt("COLUMN_SIZE"); int scale = rs.getInt("DECIMAL_DIGITS"); oldResultSet.addColumn(column, dataType, precision, scale); newResultSet.addColumn(column, dataType, precision, scale); } this.schemaName = schemaName; this.triggerName = triggerName; this.tableName = tableName; this.before = before; this.type = type; }
// in src/main/org/h2/tools/TriggerAdapter.java
public void fire(Connection conn, Object[] oldRow, Object[] newRow) throws SQLException { fire(conn, wrap(oldResultSet, oldSource, oldRow), wrap(newResultSet, newSource, newRow)); }
// in src/main/org/h2/tools/TriggerAdapter.java
private static SimpleResultSet wrap(SimpleResultSet rs, TriggerRowSource source, Object[] row) throws SQLException { if (row == null) { return null; } source.setRow(row); rs.next(); return rs; }
// in src/main/org/h2/tools/TriggerAdapter.java
public void remove() throws SQLException { // do nothing by default }
// in src/main/org/h2/tools/TriggerAdapter.java
public void close() throws SQLException { // do nothing by default }
// in src/main/org/h2/tools/Restore.java
public static void main(String... args) throws SQLException { new Restore().runTool(args); }
// in src/main/org/h2/tools/Restore.java
public void runTool(String... args) throws SQLException { String zipFileName = "backup.zip"; String dir = "."; String db = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-file")) { zipFileName = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-quiet")) { // ignore } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } execute(zipFileName, dir, db, false); }
// in src/main/org/h2/tools/Script.java
public static void main(String... args) throws SQLException { new Script().runTool(args); }
// in src/main/org/h2/tools/Script.java
public void runTool(String... args) throws SQLException { String url = null; String user = "sa"; String password = ""; String file = "backup.sql"; String options1 = null, options2 = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-script")) { file = args[++i]; } else if (arg.equals("-options")) { StringBuilder buff1 = new StringBuilder(); StringBuilder buff2 = new StringBuilder(); i++; for (; i < args.length; i++) { String a = args[i]; String upper = StringUtils.toUpperEnglish(a); if ("SIMPLE".equals(upper) || upper.startsWith("NO") || "DROP".equals(upper)) { buff1.append(' '); buff1.append(args[i]); } else { buff2.append(' '); buff2.append(args[i]); } } options1 = buff1.toString(); options2 = buff2.toString(); } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (url == null) { showUsage(); throw new SQLException("URL not set"); } if (options1 != null) { processScript(url, user, password, file, options1, options2); } else { execute(url, user, password, file); } }
// in src/main/org/h2/tools/Script.java
private static void processScript(String url, String user, String password, String fileName, String options1, String options2) throws SQLException { Connection conn = null; Statement stat = null; try { org.h2.Driver.load(); conn = DriverManager.getConnection(url, user, password); stat = conn.createStatement(); String sql = "SCRIPT " + options1 + " TO '" + fileName + "' " + options2; stat.execute(sql); } finally { JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(conn); } }
// in src/main/org/h2/tools/Script.java
public static void execute(String url, String user, String password, String fileName) throws SQLException { OutputStream o = null; try { o = FileUtils.newOutputStream(fileName, false); execute(url, user, password, o); } finally { IOUtils.closeSilently(o); } }
// in src/main/org/h2/tools/Script.java
public static void execute(String url, String user, String password, OutputStream out) throws SQLException { Connection conn = null; try { org.h2.Driver.load(); conn = DriverManager.getConnection(url, user, password); process(conn, out); } finally { JdbcUtils.closeSilently(conn); } }
// in src/main/org/h2/tools/Script.java
static void process(Connection conn, OutputStream out) throws SQLException { Statement stat = null; try { stat = conn.createStatement(); PrintWriter writer = new PrintWriter(IOUtils.getBufferedWriter(out)); ResultSet rs = stat.executeQuery("SCRIPT"); while (rs.next()) { String s = rs.getString(1); writer.println(s); } writer.flush(); } finally { JdbcUtils.closeSilently(stat); } }
// in src/main/org/h2/tools/ChangeFileEncryption.java
public static void main(String... args) throws SQLException { new ChangeFileEncryption().runTool(args); }
// in src/main/org/h2/tools/ChangeFileEncryption.java
public void runTool(String... args) throws SQLException { String dir = "."; String cipher = null; char[] decryptPassword = null; char[] encryptPassword = null; String db = null; boolean quiet = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-cipher")) { cipher = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-decrypt")) { decryptPassword = args[++i].toCharArray(); } else if (arg.equals("-encrypt")) { encryptPassword = args[++i].toCharArray(); } else if (arg.equals("-quiet")) { quiet = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if ((encryptPassword == null && decryptPassword == null) || cipher == null) { showUsage(); throw new SQLException("Encryption or decryption password not set, or cipher not set"); } try { process(dir, db, cipher, decryptPassword, encryptPassword, quiet); } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/ChangeFileEncryption.java
public static void execute(String dir, String db, String cipher, char[] decryptPassword, char[] encryptPassword, boolean quiet) throws SQLException { try { new ChangeFileEncryption().process(dir, db, cipher, decryptPassword, encryptPassword, quiet); } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/ChangeFileEncryption.java
private void process(String dir, String db, String cipher, char[] decryptPassword, char[] encryptPassword, boolean quiet) throws SQLException { dir = FileLister.getDir(dir); ChangeFileEncryption change = new ChangeFileEncryption(); if (encryptPassword != null) { for (char c : encryptPassword) { if (c == ' ') { throw new SQLException("The file password may not contain spaces"); } } } change.out = out; change.directory = dir; change.cipherType = cipher; change.decrypt = getFileEncryptionKey(decryptPassword); change.encrypt = getFileEncryptionKey(encryptPassword); ArrayList<String> files = FileLister.getDatabaseFiles(dir, db, true); FileLister.tryUnlockDatabase(files, "encryption"); files = FileLister.getDatabaseFiles(dir, db, false); if (files.size() == 0 && !quiet) { printNoDatabaseFilesFound(dir, db); } // first, test only if the file can be renamed // (to find errors with locked files early) for (String fileName : files) { String temp = dir + "/temp.db"; FileUtils.delete(temp); FileUtils.moveTo(fileName, temp); FileUtils.moveTo(temp, fileName); } // if this worked, the operation will (hopefully) be successful // TODO changeFileEncryption: this is a workaround! // make the operation atomic (all files or none) for (String fileName : files) { // Don't process a lob directory, just the files in the directory. if (!FileUtils.isDirectory(fileName)) { change.process(fileName); } } }
// in src/main/org/h2/tools/ConvertTraceFile.java
public static void main(String... args) throws SQLException { new ConvertTraceFile().runTool(args); }
// in src/main/org/h2/tools/ConvertTraceFile.java
public void runTool(String... args) throws SQLException { String traceFile = "test.trace.db"; String javaClass = "Test"; String script = "test.sql"; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-traceFile")) { traceFile = args[++i]; } else if (arg.equals("-javaClass")) { javaClass = args[++i]; } else if (arg.equals("-script")) { script = args[++i]; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } try { convertFile(traceFile, javaClass, script); } catch (IOException e) { throw DbException.convertIOException(e, traceFile); } }
// in src/main/org/h2/tools/Backup.java
public static void main(String... args) throws SQLException { new Backup().runTool(args); }
// in src/main/org/h2/tools/Backup.java
public void runTool(String... args) throws SQLException { String zipFileName = "backup.zip"; String dir = "."; String db = null; boolean quiet = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-quiet")) { quiet = true; } else if (arg.equals("-file")) { zipFileName = args[++i]; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } try { process(zipFileName, dir, db, quiet); } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/Backup.java
public static void execute(String zipFileName, String directory, String db, boolean quiet) throws SQLException { try { new Backup().process(zipFileName, directory, db, quiet); } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/Backup.java
private void process(String zipFileName, String directory, String db, boolean quiet) throws SQLException { List<String> list; boolean allFiles = db != null && db.length() == 0; if (allFiles) { list = FileUtils.newDirectoryStream(directory); } else { list = FileLister.getDatabaseFiles(directory, db, true); } if (list.size() == 0) { if (!quiet) { printNoDatabaseFilesFound(directory, db); } return; } if (!quiet) { FileLister.tryUnlockDatabase(list, "backup"); } zipFileName = FileUtils.toRealPath(zipFileName); FileUtils.delete(zipFileName); OutputStream fileOut = null; try { fileOut = FileUtils.newOutputStream(zipFileName, false); ZipOutputStream zipOut = new ZipOutputStream(fileOut); String base = ""; for (String fileName : list) { if (fileName.endsWith(Constants.SUFFIX_PAGE_FILE) || allFiles) { base = FileUtils.getParent(fileName); break; } } for (String fileName : list) { String f = FileUtils.toRealPath(fileName); if (!f.startsWith(base)) { DbException.throwInternalError(f + " does not start with " + base); } if (f.endsWith(zipFileName)) { continue; } if (FileUtils.isDirectory(fileName)) { continue; } f = f.substring(base.length()); f = BackupCommand.correctFileName(f); ZipEntry entry = new ZipEntry(f); zipOut.putNextEntry(entry); InputStream in = null; try { in = FileUtils.newInputStream(fileName); IOUtils.copyAndCloseInput(in, zipOut); } catch (FileNotFoundException e) { // the file could have been deleted in the meantime // ignore this (in this case an empty file is created) } finally { IOUtils.closeSilently(in); } zipOut.closeEntry(); if (!quiet) { out.println("Processed: " + fileName); } } zipOut.closeEntry(); zipOut.close(); } catch (IOException e) { throw DbException.convertIOException(e, zipFileName); } finally { IOUtils.closeSilently(fileOut); } }
// in src/main/org/h2/tools/Csv.java
private int writeResultSet(ResultSet rs) throws SQLException { try { int rows = 0; ResultSetMetaData meta = rs.getMetaData(); int columnCount = meta.getColumnCount(); String[] row = new String[columnCount]; int[] sqlTypes = new int[columnCount]; for (int i = 0; i < columnCount; i++) { row[i] = meta.getColumnLabel(i + 1); sqlTypes[i] = meta.getColumnType(i + 1); } if (writeColumnHeader) { writeRow(row); } while (rs.next()) { for (int i = 0; i < columnCount; i++) { Object o; switch (sqlTypes[i]) { case Types.DATE: o = rs.getDate(i + 1); break; case Types.TIME: o = rs.getTime(i + 1); break; case Types.TIMESTAMP: o = rs.getTimestamp(i + 1); break; default: o = rs.getString(i + 1); } row[i] = o == null ? null : o.toString(); } writeRow(row); rows++; } output.close(); return rows; } catch (IOException e) { throw DbException.convertIOException(e, null); } finally { close(); JdbcUtils.closeSilently(rs); } }
// in src/main/org/h2/tools/Csv.java
public int write(Writer writer, ResultSet rs) throws SQLException { this.output = writer; return writeResultSet(rs); }
// in src/main/org/h2/tools/Csv.java
public int write(String outputFileName, ResultSet rs, String charset) throws SQLException { init(outputFileName, charset); try { initWrite(); return writeResultSet(rs); } catch (IOException e) { throw convertException("IOException writing " + outputFileName, e); } }
// in src/main/org/h2/tools/Csv.java
public int write(Connection conn, String outputFileName, String sql, String charset) throws SQLException { Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery(sql); int rows = write(outputFileName, rs, charset); stat.close(); return rows; }
// in src/main/org/h2/tools/Csv.java
public ResultSet read(String inputFileName, String[] colNames, String charset) throws SQLException { init(inputFileName, charset); try { return readResultSet(colNames); } catch (IOException e) { throw convertException("IOException reading " + inputFileName, e); } }
// in src/main/org/h2/tools/Csv.java
public Object[] readRow() throws SQLException { if (input == null) { return null; } String[] row = new String[columnNames.length]; try { int i = 0; while (true) { String v = readValue(); if (v == null) { if (endOfLine) { if (i == 0) { if (endOfFile) { return null; } // empty line continue; } break; } } if (i < row.length) { row[i++] = v; } if (endOfLine) { break; } } } catch (IOException e) { throw convertException("IOException reading from " + fileName, e); } return row; }
// in src/main/org/h2/tools/Csv.java
public void reset() throws SQLException { throw new SQLException("Method is not supported", "CSV"); }
// in src/main/org/h2/tools/CreateCluster.java
public static void main(String... args) throws SQLException { new CreateCluster().runTool(args); }
// in src/main/org/h2/tools/CreateCluster.java
public void runTool(String... args) throws SQLException { String urlSource = null; String urlTarget = null; String user = "sa"; String password = ""; String serverList = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-urlSource")) { urlSource = args[++i]; } else if (arg.equals("-urlTarget")) { urlTarget = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-serverList")) { serverList = args[++i]; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (urlSource == null || urlTarget == null || serverList == null) { showUsage(); throw new SQLException("Source URL, target URL, or server list not set"); } process(urlSource, urlTarget, user, password, serverList); }
// in src/main/org/h2/tools/CreateCluster.java
public void execute(String urlSource, String urlTarget, String user, String password, String serverList) throws SQLException { process(urlSource, urlTarget, user, password, serverList); }
// in src/main/org/h2/tools/CreateCluster.java
private void process(String urlSource, String urlTarget, String user, String password, String serverList) throws SQLException { Connection connSource = null, connTarget = null; Statement statSource = null, statTarget = null; String scriptFile = "backup.sql"; try { org.h2.Driver.load(); // verify that the database doesn't exist, // or if it exists (an old cluster instance), it is deleted boolean exists = true; try { connTarget = DriverManager.getConnection(urlTarget + ";IFEXISTS=TRUE;CLUSTER=" + Constants.CLUSTERING_ENABLED, user, password); Statement stat = connTarget.createStatement(); stat.execute("DROP ALL OBJECTS DELETE FILES"); stat.close(); exists = false; connTarget.close(); } catch (SQLException e) { if (e.getErrorCode() == ErrorCode.DATABASE_NOT_FOUND_1) { // database does not exists yet - ok exists = false; } else { throw e; } } if (exists) { throw new SQLException("Target database must not yet exist. Please delete it first: " + urlTarget); } // use cluster='' so connecting is possible // even if the cluster is enabled connSource = DriverManager.getConnection(urlSource + ";CLUSTER=''", user, password); statSource = connSource.createStatement(); // enable the exclusive mode and close other connections, // so that data can't change while restoring the second database statSource.execute("SET EXCLUSIVE 2"); try { // backup Script script = new Script(); script.setOut(out); OutputStream scriptOut = null; try { scriptOut = FileUtils.newOutputStream(scriptFile, false); Script.process(connSource, scriptOut); } finally { IOUtils.closeSilently(scriptOut); } // delete the target database and then restore connTarget = DriverManager.getConnection(urlTarget + ";CLUSTER=''", user, password); statTarget = connTarget.createStatement(); statTarget.execute("DROP ALL OBJECTS DELETE FILES"); connTarget.close(); RunScript runScript = new RunScript(); runScript.setOut(out); runScript.process(urlTarget, user, password, scriptFile, null, false); connTarget = DriverManager.getConnection(urlTarget, user, password); statTarget = connTarget.createStatement(); // set the cluster to the serverList on both databases statSource.executeUpdate("SET CLUSTER '" + serverList + "'"); statTarget.executeUpdate("SET CLUSTER '" + serverList + "'"); } finally { // switch back to the regular mode statSource.execute("SET EXCLUSIVE FALSE"); } } finally { FileUtils.delete(scriptFile); JdbcUtils.closeSilently(statSource); JdbcUtils.closeSilently(statTarget); JdbcUtils.closeSilently(connSource); JdbcUtils.closeSilently(connTarget); } }
// in src/main/org/h2/tools/Recover.java
public static void main(String... args) throws SQLException { new Recover().runTool(args); }
// in src/main/org/h2/tools/Recover.java
public void runTool(String... args) throws SQLException { String dir = "."; String db = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if ("-dir".equals(arg)) { dir = args[++i]; } else if ("-db".equals(arg)) { db = args[++i]; } else if ("-removePassword".equals(arg)) { remove = true; } else if ("-trace".equals(arg)) { trace = true; } else if ("-transactionLog".equals(arg)) { transactionLog = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } process(dir, db); }
// in src/main/org/h2/tools/Recover.java
public static void execute(String dir, String db) throws SQLException { try { new Recover().process(dir, db); } catch (DbException e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/Server.java
public static void main(String... args) throws SQLException { new Server().runTool(args); }
// in src/main/org/h2/tools/Server.java
private void verifyArgs(String... args) throws SQLException { for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg == null) { continue; } else if ("-?".equals(arg) || "-help".equals(arg)) { // ok } else if (arg.startsWith("-web")) { if ("-web".equals(arg)) { // ok } else if ("-webAllowOthers".equals(arg)) { // no parameters } else if ("-webDaemon".equals(arg)) { // no parameters } else if ("-webSSL".equals(arg)) { // no parameters } else if ("-webPort".equals(arg)) { i++; } else { throwUnsupportedOption(arg); } } else if ("-browser".equals(arg)) { // ok } else if (arg.startsWith("-tcp")) { if ("-tcp".equals(arg)) { // ok } else if ("-tcpAllowOthers".equals(arg)) { // no parameters } else if ("-tcpDaemon".equals(arg)) { // no parameters } else if ("-tcpSSL".equals(arg)) { // no parameters } else if ("-tcpPort".equals(arg)) { i++; } else if ("-tcpPassword".equals(arg)) { i++; } else if ("-tcpShutdown".equals(arg)) { i++; } else if ("-tcpShutdownForce".equals(arg)) { // ok } else { throwUnsupportedOption(arg); } } else if (arg.startsWith("-pg")) { if ("-pg".equals(arg)) { // ok } else if ("-pgAllowOthers".equals(arg)) { // no parameters } else if ("-pgDaemon".equals(arg)) { // no parameters } else if ("-pgPort".equals(arg)) { i++; } else { throwUnsupportedOption(arg); } } else if (arg.startsWith("-ftp")) { if ("-ftpPort".equals(arg)) { i++; } else if ("-ftpDir".equals(arg)) { i++; } else if ("-ftpRead".equals(arg)) { i++; } else if ("-ftpWrite".equals(arg)) { i++; } else if ("-ftpWritePassword".equals(arg)) { i++; } else if ("-ftpTask".equals(arg)) { // no parameters } else { throwUnsupportedOption(arg); } } else if ("-properties".equals(arg)) { i++; } else if ("-trace".equals(arg)) { // no parameters } else if ("-ifExists".equals(arg)) { // no parameters } else if ("-baseDir".equals(arg)) { i++; } else if ("-key".equals(arg)) { i += 2; } else if ("-tool".equals(arg)) { // no parameters } else { throwUnsupportedOption(arg); } } }
// in src/main/org/h2/tools/Server.java
public void runTool(String... args) throws SQLException { boolean tcpStart = false, pgStart = false, webStart = false; boolean browserStart = false; boolean tcpShutdown = false, tcpShutdownForce = false; String tcpPassword = ""; String tcpShutdownServer = ""; boolean startDefaultServers = true; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg == null) { continue; } else if ("-?".equals(arg) || "-help".equals(arg)) { showUsage(); return; } else if (arg.startsWith("-web")) { if ("-web".equals(arg)) { startDefaultServers = false; webStart = true; } else if ("-webAllowOthers".equals(arg)) { // no parameters } else if ("-webDaemon".equals(arg)) { // no parameters } else if ("-webSSL".equals(arg)) { // no parameters } else if ("-webPort".equals(arg)) { i++; } else { showUsageAndThrowUnsupportedOption(arg); } } else if ("-browser".equals(arg)) { startDefaultServers = false; browserStart = true; } else if (arg.startsWith("-tcp")) { if ("-tcp".equals(arg)) { startDefaultServers = false; tcpStart = true; } else if ("-tcpAllowOthers".equals(arg)) { // no parameters } else if ("-tcpDaemon".equals(arg)) { // no parameters } else if ("-tcpSSL".equals(arg)) { // no parameters } else if ("-tcpPort".equals(arg)) { i++; } else if ("-tcpPassword".equals(arg)) { tcpPassword = args[++i]; } else if ("-tcpShutdown".equals(arg)) { startDefaultServers = false; tcpShutdown = true; tcpShutdownServer = args[++i]; } else if ("-tcpShutdownForce".equals(arg)) { tcpShutdownForce = true; } else { showUsageAndThrowUnsupportedOption(arg); } } else if (arg.startsWith("-pg")) { if ("-pg".equals(arg)) { startDefaultServers = false; pgStart = true; } else if ("-pgAllowOthers".equals(arg)) { // no parameters } else if ("-pgDaemon".equals(arg)) { // no parameters } else if ("-pgPort".equals(arg)) { i++; } else { showUsageAndThrowUnsupportedOption(arg); } } else if ("-properties".equals(arg)) { i++; } else if ("-trace".equals(arg)) { // no parameters } else if ("-ifExists".equals(arg)) { // no parameters } else if ("-baseDir".equals(arg)) { i++; } else if ("-key".equals(arg)) { i += 2; } else { showUsageAndThrowUnsupportedOption(arg); } } verifyArgs(args); if (startDefaultServers) { tcpStart = true; pgStart = true; webStart = true; browserStart = true; } // TODO server: maybe use one single properties file? if (tcpShutdown) { out.println("Shutting down TCP Server at " + tcpShutdownServer); shutdownTcpServer(tcpShutdownServer, tcpPassword, tcpShutdownForce, false); } try { if (webStart) { web = createWebServer(args); web.setShutdownHandler(this); SQLException result = null; try { web.start(); } catch (Exception e) { result = DbException.toSQLException(e); } out.println(web.getStatus()); // start browser in any case (even if the server is already running) // because some people don't look at the output, // but are wondering why nothing happens if (browserStart) { try { openBrowser(web.getURL()); } catch (Exception e) { out.println(e.getMessage()); } } if (result != null) { throw result; } } if (tcpStart) { tcp = createTcpServer(args); tcp.start(); out.println(tcp.getStatus()); tcp.setShutdownHandler(this); } if (pgStart) { pg = createPgServer(args); pg.start(); out.println(pg.getStatus()); } } catch (SQLException e) { stopAll(); throw e; } }
// in src/main/org/h2/tools/Server.java
public static void shutdownTcpServer(String url, String password, boolean force, boolean all) throws SQLException { TcpServer.shutdown(url, password, force, all); }
// in src/main/org/h2/tools/Server.java
public static Server createWebServer(String... args) throws SQLException { WebServer service = new WebServer(); Server server = new Server(service, args); service.setShutdownHandler(server); return server; }
// in src/main/org/h2/tools/Server.java
public static Server createTcpServer(String... args) throws SQLException { TcpServer service = new TcpServer(); Server server = new Server(service, args); service.setShutdownHandler(server); return server; }
// in src/main/org/h2/tools/Server.java
public static Server createPgServer(String... args) throws SQLException { return new Server(new PgServer(), args); }
// in src/main/org/h2/tools/Server.java
public Server start() throws SQLException { try { started = true; service.start(); String name = service.getName() + " (" + service.getURL() + ")"; Thread t = new Thread(this, name); t.setDaemon(service.isDaemon()); t.start(); for (int i = 1; i < 64; i += i) { wait(i); if (isRunning(false)) { return this; } } if (isRunning(true)) { return this; } throw DbException.get(ErrorCode.EXCEPTION_OPENING_PORT_2, name, "timeout; " + "please check your network configuration, specially the file /etc/hosts"); } catch (DbException e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/tools/Server.java
public static void startWebServer(Connection conn) throws SQLException { WebServer webServer = new WebServer(); Server web = new Server(webServer, new String[] { "-webPort", "0" }); web.start(); Server server = new Server(); server.web = web; webServer.setShutdownHandler(server); String url = webServer.addSession(conn); try { Server.openBrowser(url); while (!webServer.isStopped()) { Thread.sleep(1000); } } catch (Exception e) { // ignore } }
// in src/main/org/h2/tools/RunScript.java
public static void main(String... args) throws SQLException { new RunScript().runTool(args); }
// in src/main/org/h2/tools/RunScript.java
public void runTool(String... args) throws SQLException { String url = null; String user = "sa"; String password = ""; String script = "backup.sql"; String options = null; boolean continueOnError = false; boolean showTime = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-continueOnError")) { continueOnError = true; } else if (arg.equals("-checkResults")) { checkResults = true; } else if (arg.equals("-showResults")) { showResults = true; } else if (arg.equals("-script")) { script = args[++i]; } else if (arg.equals("-time")) { showTime = true; } else if (arg.equals("-driver")) { String driver = args[++i]; Utils.loadUserClass(driver); } else if (arg.equals("-options")) { StringBuilder buff = new StringBuilder(); i++; for (; i < args.length; i++) { buff.append(' ').append(args[i]); } options = buff.toString(); } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (url == null) { showUsage(); throw new SQLException("URL not set"); } long time = System.currentTimeMillis(); if (options != null) { processRunscript(url, user, password, script, options); } else { process(url, user, password, script, null, continueOnError); } if (showTime) { time = System.currentTimeMillis() - time; out.println("Done in " + time + " ms"); } }
// in src/main/org/h2/tools/RunScript.java
public static ResultSet execute(Connection conn, Reader reader) throws SQLException { Statement stat = conn.createStatement(); ResultSet rs = null; ScriptReader r = new ScriptReader(reader); while (true) { String sql = r.readStatement(); if (sql == null) { break; } if (sql.trim().length() == 0) { continue; } boolean resultSet = stat.execute(sql); if (resultSet) { if (rs != null) { rs.close(); rs = null; } rs = stat.getResultSet(); } } return rs; }
// in src/main/org/h2/tools/RunScript.java
private void process(Connection conn, String fileName, boolean continueOnError, String charsetName) throws SQLException, IOException { InputStream in = FileUtils.newInputStream(fileName); String path = FileUtils.getParent(fileName); try { in = new BufferedInputStream(in, Constants.IO_BUFFER_SIZE); Reader reader = new InputStreamReader(in, charsetName); process(conn, continueOnError, path, reader, charsetName); } finally { IOUtils.closeSilently(in); } }
// in src/main/org/h2/tools/RunScript.java
private void process(Connection conn, boolean continueOnError, String path, Reader reader, String charsetName) throws SQLException, IOException { Statement stat = conn.createStatement(); ScriptReader r = new ScriptReader(reader); while (true) { String sql = r.readStatement(); if (sql == null) { break; } String trim = sql.trim(); if (trim.length() == 0) { continue; } if (trim.startsWith("@") && StringUtils.toUpperEnglish(trim).startsWith("@INCLUDE")) { sql = trim; sql = sql.substring("@INCLUDE".length()).trim(); if (!FileUtils.isAbsolute(sql)) { sql = path + SysProperties.FILE_SEPARATOR + sql; } process(conn, sql, continueOnError, charsetName); } else { try { if (showResults && !trim.startsWith("-->")) { out.print(sql + ";"); } if (showResults || checkResults) { boolean query = stat.execute(sql); if (query) { ResultSet rs = stat.getResultSet(); int columns = rs.getMetaData().getColumnCount(); StringBuilder buff = new StringBuilder(); while (rs.next()) { buff.append("\n-->"); for (int i = 0; i < columns; i++) { String s = rs.getString(i + 1); if (s != null) { s = StringUtils.replaceAll(s, "\r\n", "\n"); s = StringUtils.replaceAll(s, "\n", "\n--> "); s = StringUtils.replaceAll(s, "\r", "\r--> "); } buff.append(' ').append(s); } } buff.append("\n;"); String result = buff.toString(); if (showResults) { out.print(result); } if (checkResults) { String expected = r.readStatement() + ";"; expected = StringUtils.replaceAll(expected, "\r\n", "\n"); expected = StringUtils.replaceAll(expected, "\r", "\n"); if (!expected.equals(result)) { expected = StringUtils.replaceAll(expected, " ", "+"); result = StringUtils.replaceAll(result, " ", "+"); throw new SQLException("Unexpected output for:\n" + sql.trim() + "\nGot:\n" + result + "\nExpected:\n" + expected); } } } } else { stat.execute(sql); } } catch (Exception e) { if (continueOnError) { e.printStackTrace(out); } else { throw DbException.toSQLException(e); } } } } }
// in src/main/org/h2/tools/RunScript.java
private static void processRunscript(String url, String user, String password, String fileName, String options) throws SQLException { Connection conn = null; Statement stat = null; try { org.h2.Driver.load(); conn = DriverManager.getConnection(url, user, password); stat = conn.createStatement(); String sql = "RUNSCRIPT FROM '" + fileName + "' " + options; stat.execute(sql); } finally { JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(conn); } }
// in src/main/org/h2/tools/RunScript.java
public static void execute(String url, String user, String password, String fileName, String charsetName, boolean continueOnError) throws SQLException { new RunScript().process(url, user, password, fileName, charsetName, continueOnError); }
// in src/main/org/h2/tools/RunScript.java
void process(String url, String user, String password, String fileName, String charsetName, boolean continueOnError) throws SQLException { try { org.h2.Driver.load(); Connection conn = DriverManager.getConnection(url, user, password); if (charsetName == null) { charsetName = Constants.UTF8; } try { process(conn, fileName, continueOnError, charsetName); } finally { conn.close(); } } catch (IOException e) { throw DbException.convertIOException(e, fileName); } }
// in src/main/org/h2/tools/Console.java
public static void main(String... args) throws SQLException { new Console().runTool(args); }
// in src/main/org/h2/tools/Console.java
public void runTool(String... args) throws SQLException { isWindows = Utils.getProperty("os.name", "").startsWith("Windows"); boolean tcpStart = false, pgStart = false, webStart = false, toolStart = false; boolean browserStart = false; boolean startDefaultServers = true; boolean printStatus = args != null && args.length > 0; String driver = null, url = null, user = null, password = null; boolean tcpShutdown = false, tcpShutdownForce = false; String tcpPassword = ""; String tcpShutdownServer = ""; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg == null) { continue; } else if ("-?".equals(arg) || "-help".equals(arg)) { showUsage(); return; } else if ("-url".equals(arg)) { startDefaultServers = false; url = args[++i]; } else if ("-driver".equals(arg)) { driver = args[++i]; } else if ("-user".equals(arg)) { user = args[++i]; } else if ("-password".equals(arg)) { password = args[++i]; } else if (arg.startsWith("-web")) { if ("-web".equals(arg)) { startDefaultServers = false; webStart = true; } else if ("-webAllowOthers".equals(arg)) { // no parameters } else if ("-webDaemon".equals(arg)) { // no parameters } else if ("-webSSL".equals(arg)) { // no parameters } else if ("-webPort".equals(arg)) { i++; } else { showUsageAndThrowUnsupportedOption(arg); } } else if ("-tool".equals(arg)) { startDefaultServers = false; webStart = true; toolStart = true; } else if ("-browser".equals(arg)) { startDefaultServers = false; webStart = true; browserStart = true; } else if (arg.startsWith("-tcp")) { if ("-tcp".equals(arg)) { startDefaultServers = false; tcpStart = true; } else if ("-tcpAllowOthers".equals(arg)) { // no parameters } else if ("-tcpDaemon".equals(arg)) { // no parameters } else if ("-tcpSSL".equals(arg)) { // no parameters } else if ("-tcpPort".equals(arg)) { i++; } else if ("-tcpPassword".equals(arg)) { tcpPassword = args[++i]; } else if ("-tcpShutdown".equals(arg)) { startDefaultServers = false; tcpShutdown = true; tcpShutdownServer = args[++i]; } else if ("-tcpShutdownForce".equals(arg)) { tcpShutdownForce = true; } else { showUsageAndThrowUnsupportedOption(arg); } } else if (arg.startsWith("-pg")) { if ("-pg".equals(arg)) { startDefaultServers = false; pgStart = true; } else if ("-pgAllowOthers".equals(arg)) { // no parameters } else if ("-pgDaemon".equals(arg)) { // no parameters } else if ("-pgPort".equals(arg)) { i++; } else { showUsageAndThrowUnsupportedOption(arg); } } else if ("-properties".equals(arg)) { i++; } else if ("-trace".equals(arg)) { // no parameters } else if ("-ifExists".equals(arg)) { // no parameters } else if ("-baseDir".equals(arg)) { i++; } else { showUsageAndThrowUnsupportedOption(arg); } } if (startDefaultServers) { webStart = true; toolStart = true; browserStart = true; tcpStart = true; pgStart = true; } if (tcpShutdown) { out.println("Shutting down TCP Server at " + tcpShutdownServer); Server.shutdownTcpServer(tcpShutdownServer, tcpPassword, tcpShutdownForce, false); } SQLException startException = null; boolean webRunning = false; if (url != null) { Connection conn = JdbcUtils.getConnection(driver, url, user, password); Server.startWebServer(conn); } if (webStart) { try { web = Server.createWebServer(args); web.setShutdownHandler(this); web.start(); if (printStatus) { out.println(web.getStatus()); } webRunning = true; } catch (SQLException e) { printProblem(e, web); startException = e; } } //## AWT ## if (toolStart && webRunning && !GraphicsEnvironment.isHeadless()) { loadFont(); try { if (!createTrayIcon()) { showWindow(); } } catch (Exception e) { e.printStackTrace(); } } //*/ // start browser in any case (even if the server is already running) // because some people don't look at the output, // but are wondering why nothing happens if (browserStart && web != null) { openBrowser(web.getURL()); } if (tcpStart) { try { tcp = Server.createTcpServer(args); tcp.start(); if (printStatus) { out.println(tcp.getStatus()); } tcp.setShutdownHandler(this); } catch (SQLException e) { printProblem(e, tcp); if (startException == null) { startException = e; } } } if (pgStart) { try { pg = Server.createPgServer(args); pg.start(); if (printStatus) { out.println(pg.getStatus()); } } catch (SQLException e) { printProblem(e, pg); if (startException == null) { startException = e; } } } if (startException != null) { shutdown(); throw startException; } }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getArray(Map<String, Class<?>> map) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getArray(long index, int count) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getArray(long index, int count, Map<String, Class<?>> map) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public ResultSet getResultSet() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public ResultSet getResultSet(Map<String, Class<?>> map) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public ResultSet getResultSet(long index, int count) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public ResultSet getResultSet(long index, int count, Map<String, Class<?>> map) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean next() throws SQLException { if (source != null) { rowId++; currentRow = source.readRow(); if (currentRow != null) { return true; } } else if (rows != null && rowId < rows.size()) { rowId++; if (rowId < rows.size()) { currentRow = rows.get(rowId); return true; } } if (autoClose) { close(); } return false; }
// in src/main/org/h2/tools/SimpleResultSet.java
public void beforeFirst() throws SQLException { rowId = -1; if (source != null) { source.reset(); } }
// in src/main/org/h2/tools/SimpleResultSet.java
public int findColumn(String columnLabel) throws SQLException { if (columnLabel != null && columns != null) { for (int i = 0, size = columns.size(); i < size; i++) { if (columnLabel.equalsIgnoreCase(getColumn(i).name)) { return i + 1; } } } throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnLabel).getSQLException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Array getArray(int columnIndex) throws SQLException { Object[] o = (Object[]) get(columnIndex); return o == null ? null : new SimpleArray(o); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Array getArray(String columnLabel) throws SQLException { return getArray(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public InputStream getAsciiStream(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public InputStream getAsciiStream(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public BigDecimal getBigDecimal(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof BigDecimal)) { o = new BigDecimal(o.toString()); } return (BigDecimal) o; }
// in src/main/org/h2/tools/SimpleResultSet.java
public BigDecimal getBigDecimal(String columnLabel) throws SQLException { return getBigDecimal(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public InputStream getBinaryStream(int columnIndex) throws SQLException { Blob b = (Blob) get(columnIndex); return b == null ? null : b.getBinaryStream(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public InputStream getBinaryStream(String columnLabel) throws SQLException { return getBinaryStream(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Blob getBlob(int columnIndex) throws SQLException { Blob b = (Blob) get(columnIndex); return b == null ? null : b; }
// in src/main/org/h2/tools/SimpleResultSet.java
public Blob getBlob(String columnLabel) throws SQLException { return getBlob(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean getBoolean(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Boolean)) { o = Boolean.valueOf(o.toString()); } return o == null ? false : ((Boolean) o).booleanValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean getBoolean(String columnLabel) throws SQLException { return getBoolean(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public byte getByte(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { o = Byte.decode(o.toString()); } return o == null ? 0 : ((Number) o).byteValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public byte getByte(String columnLabel) throws SQLException { return getByte(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public byte[] getBytes(int columnIndex) throws SQLException { return (byte[]) get(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public byte[] getBytes(String columnLabel) throws SQLException { return getBytes(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Reader getCharacterStream(int columnIndex) throws SQLException { Clob c = (Clob) get(columnIndex); return c == null ? null : c.getCharacterStream(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Reader getCharacterStream(String columnLabel) throws SQLException { return getCharacterStream(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Clob getClob(int columnIndex) throws SQLException { Clob c = (Clob) get(columnIndex); return c == null ? null : c; }
// in src/main/org/h2/tools/SimpleResultSet.java
public Clob getClob(String columnLabel) throws SQLException { return getClob(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Date getDate(int columnIndex) throws SQLException { return (Date) get(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Date getDate(String columnLabel) throws SQLException { return getDate(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Date getDate(int columnIndex, Calendar cal) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Date getDate(String columnLabel, Calendar cal) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public double getDouble(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { return Double.parseDouble(o.toString()); } return o == null ? 0 : ((Number) o).doubleValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public double getDouble(String columnLabel) throws SQLException { return getDouble(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public float getFloat(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { return Float.parseFloat(o.toString()); } return o == null ? 0 : ((Number) o).floatValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public float getFloat(String columnLabel) throws SQLException { return getFloat(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public int getInt(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { o = Integer.decode(o.toString()); } return o == null ? 0 : ((Number) o).intValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public int getInt(String columnLabel) throws SQLException { return getInt(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public long getLong(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { o = Long.decode(o.toString()); } return o == null ? 0 : ((Number) o).longValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public long getLong(String columnLabel) throws SQLException { return getLong(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Reader getNCharacterStream(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Reader getNCharacterStream(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public NClob getNClob(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public NClob getNClob(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getNString(int columnIndex) throws SQLException { return getString(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getNString(String columnLabel) throws SQLException { return getString(columnLabel); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getObject(int columnIndex) throws SQLException { return get(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getObject(String columnLabel) throws SQLException { return getObject(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Ref getRef(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Ref getRef(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public RowId getRowId(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public RowId getRowId(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public short getShort(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { o = Short.decode(o.toString()); } return o == null ? 0 : ((Number) o).shortValue(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public short getShort(String columnLabel) throws SQLException { return getShort(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public SQLXML getSQLXML(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public SQLXML getSQLXML(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getString(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o == null) { return null; } switch (columns.get(columnIndex - 1).sqlType) { case Types.CLOB: Clob c = (Clob) o; return c.getSubString(1, MathUtils.convertLongToInt(c.length())); } return o.toString(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getString(String columnLabel) throws SQLException { return getString(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Time getTime(int columnIndex) throws SQLException { return (Time) get(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Time getTime(String columnLabel) throws SQLException { return getTime(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Time getTime(int columnIndex, Calendar cal) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Time getTime(String columnLabel, Calendar cal) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Timestamp getTimestamp(int columnIndex) throws SQLException { return (Timestamp) get(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Timestamp getTimestamp(String columnLabel) throws SQLException { return getTimestamp(findColumn(columnLabel)); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public InputStream getUnicodeStream(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public InputStream getUnicodeStream(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public URL getURL(int columnIndex) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public URL getURL(String columnLabel) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateArray(int columnIndex, Array x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateArray(String columnLabel, Array x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBlob(int columnIndex, Blob x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBlob(String columnLabel, Blob x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBlob(int columnIndex, InputStream x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBlob(String columnLabel, InputStream x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBlob(int columnIndex, InputStream x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBlob(String columnLabel, InputStream x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBoolean(int columnIndex, boolean x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBoolean(String columnLabel, boolean x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateByte(int columnIndex, byte x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateByte(String columnLabel, byte x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBytes(int columnIndex, byte[] x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateBytes(String columnLabel, byte[] x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateCharacterStream(String columnLabel, Reader x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateCharacterStream(String columnLabel, Reader x, int length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateCharacterStream(String columnLabel, Reader x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateClob(int columnIndex, Clob x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateClob(String columnLabel, Clob x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateClob(int columnIndex, Reader x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateClob(String columnLabel, Reader x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateClob(int columnIndex, Reader x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateClob(String columnLabel, Reader x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateDate(int columnIndex, Date x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateDate(String columnLabel, Date x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateDouble(int columnIndex, double x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateDouble(String columnLabel, double x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateFloat(int columnIndex, float x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateFloat(String columnLabel, float x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateInt(int columnIndex, int x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateInt(String columnLabel, int x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateLong(int columnIndex, long x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateLong(String columnLabel, long x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNCharacterStream(String columnLabel, Reader x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNCharacterStream(String columnLabel, Reader x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNClob(int columnIndex, NClob x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNClob(String columnLabel, NClob x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNClob(int columnIndex, Reader x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNClob(String columnLabel, Reader x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNClob(int columnIndex, Reader x, long length) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNClob(String columnLabel, Reader x, long length) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNString(int columnIndex, String x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNString(String columnLabel, String x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNull(int columnIndex) throws SQLException { update(columnIndex, null); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateNull(String columnLabel) throws SQLException { update(columnLabel, null); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateObject(int columnIndex, Object x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateObject(String columnLabel, Object x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateObject(int columnIndex, Object x, int scale) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateObject(String columnLabel, Object x, int scale) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateRef(int columnIndex, Ref x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateRef(String columnLabel, Ref x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateRowId(int columnIndex, RowId x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateRowId(String columnLabel, RowId x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateShort(int columnIndex, short x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateShort(String columnLabel, short x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateSQLXML(int columnIndex, SQLXML x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateSQLXML(String columnLabel, SQLXML x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateString(int columnIndex, String x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateString(String columnLabel, String x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateTime(int columnIndex, Time x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateTime(String columnLabel, Time x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { update(columnIndex, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { update(columnLabel, x); }
// in src/main/org/h2/tools/SimpleResultSet.java
public int getColumnType(int columnIndex) throws SQLException { return getColumn(columnIndex - 1).sqlType; }
// in src/main/org/h2/tools/SimpleResultSet.java
public int getPrecision(int columnIndex) throws SQLException { return getColumn(columnIndex - 1).precision; }
// in src/main/org/h2/tools/SimpleResultSet.java
public int getScale(int columnIndex) throws SQLException { return getColumn(columnIndex - 1).scale; }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getColumnClassName(int columnIndex) throws SQLException { int sqlType = getColumn(columnIndex - 1).sqlType; int type = DataType.convertSQLTypeToValueType(sqlType); return DataType.getTypeClassName(type); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getColumnLabel(int columnIndex) throws SQLException { return getColumn(columnIndex - 1).name; }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getColumnName(int columnIndex) throws SQLException { return getColumnLabel(columnIndex); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getColumnTypeName(int columnIndex) throws SQLException { int sqlType = getColumn(columnIndex - 1).sqlType; int type = DataType.convertSQLTypeToValueType(sqlType); return DataType.getDataType(type).name; }
// in src/main/org/h2/tools/SimpleResultSet.java
public void afterLast() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void cancelRowUpdates() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void deleteRow() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void insertRow() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void moveToCurrentRow() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void moveToInsertRow() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void refreshRow() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void updateRow() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean first() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean isAfterLast() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean isBeforeFirst() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean isFirst() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean isLast() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean last() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean previous() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean rowDeleted() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean rowInserted() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean rowUpdated() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void setFetchDirection(int direction) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public void setFetchSize(int rows) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean absolute(int row) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean relative(int offset) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public String getCursorName() throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
private void update(int columnIndex, Object obj) throws SQLException { checkColumnIndex(columnIndex); this.currentRow[columnIndex - 1] = obj; }
// in src/main/org/h2/tools/SimpleResultSet.java
private void update(String columnLabel, Object obj) throws SQLException { this.currentRow[findColumn(columnLabel) - 1] = obj; }
// in src/main/org/h2/tools/SimpleResultSet.java
private void checkColumnIndex(int columnIndex) throws SQLException { if (columnIndex < 1 || columnIndex > columns.size()) { throw DbException.getInvalidValueException("columnIndex", columnIndex).getSQLException(); } }
// in src/main/org/h2/tools/SimpleResultSet.java
private Object get(int columnIndex) throws SQLException { if (currentRow == null) { throw DbException.get(ErrorCode.NO_DATA_AVAILABLE).getSQLException(); } checkColumnIndex(columnIndex); columnIndex--; Object o = columnIndex < currentRow.length ? currentRow[columnIndex] : null; wasNull = o == null; return o; }
// in src/main/org/h2/tools/SimpleResultSet.java
private Column getColumn(int i) throws SQLException { checkColumnIndex(i + 1); return columns.get(i); }
// in src/main/org/h2/tools/SimpleResultSet.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/SimpleResultSet.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw getUnsupportedException(); }
// in src/main/org/h2/tools/MultiDimension.java
public ResultSet getResult(PreparedStatement prep, int[] min, int[] max) throws SQLException { long[][] ranges = getMortonRanges(min, max); int len = ranges.length; Long[] from = new Long[len]; Long[] to = new Long[len]; for (int i = 0; i < len; i++) { from[i] = Long.valueOf(ranges[i][0]); to[i] = Long.valueOf(ranges[i][1]); } prep.setObject(1, from); prep.setObject(2, to); len = min.length; for (int i = 0, idx = 3; i < len; i++) { prep.setInt(idx++, min[i]); prep.setInt(idx++, max[i]); } return prep.executeQuery(); }
// in src/main/org/h2/tools/Shell.java
public static void main(String... args) throws SQLException { new Shell().runTool(args); }
// in src/main/org/h2/tools/Shell.java
public void runTool(String... args) throws SQLException { String url = null; String user = ""; String password = ""; String sql = null; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-driver")) { String driver = args[++i]; Utils.loadUserClass(driver); } else if (arg.equals("-sql")) { sql = args[++i]; } else if (arg.equals("-properties")) { serverPropertiesDir = args[++i]; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (url != null) { org.h2.Driver.load(); conn = DriverManager.getConnection(url, user, password); stat = conn.createStatement(); } if (sql == null) { promptLoop(); } else { ScriptReader r = new ScriptReader(new StringReader(sql)); while (true) { String s = r.readStatement(); if (s == null) { break; } execute(s); } } }
// in src/main/org/h2/tools/Shell.java
private void connect() throws IOException, SQLException { String url = "jdbc:h2:~/test"; String user = "sa"; String driver = null; try { Properties prop; if ("null".equals(serverPropertiesDir)) { prop = new Properties(); } else { prop = SortedProperties.loadProperties(serverPropertiesDir + "/" + Constants.SERVER_PROPERTIES_NAME); } String data = null; boolean found = false; for (int i = 0;; i++) { String d = prop.getProperty(String.valueOf(i)); if (d == null) { break; } found = true; data = d; } if (found) { ConnectionInfo info = new ConnectionInfo(data); url = info.url; user = info.user; driver = info.driver; } } catch (IOException e) { // ignore } println("[Enter] " + url); print("URL "); url = readLine(url).trim(); if (driver == null) { driver = JdbcUtils.getDriver(url); } if (driver != null) { println("[Enter] " + driver); } print("Driver "); driver = readLine(driver).trim(); println("[Enter] " + user); print("User "); user = readLine(user); println("[Enter] Hide"); print("Password "); String password = readLine(); if (password.length() == 0) { password = readPassword(); } conn = JdbcUtils.getConnection(driver, url, user, password); stat = conn.createStatement(); println("Connected"); }
// in src/main/org/h2/tools/Shell.java
private int printResult(ResultSet rs, boolean asList) throws SQLException { if (asList) { return printResultAsList(rs); } return printResultAsTable(rs); }
// in src/main/org/h2/tools/Shell.java
private int printResultAsTable(ResultSet rs) throws SQLException { ResultSetMetaData meta = rs.getMetaData(); int len = meta.getColumnCount(); boolean truncated = false; ArrayList<String[]> rows = New.arrayList(); // buffer the header String[] columns = new String[len]; for (int i = 0; i < len; i++) { String s = meta.getColumnLabel(i + 1); columns[i] = s == null ? "" : s; } rows.add(columns); int rowCount = 0; while (rs.next()) { rowCount++; truncated |= loadRow(rs, len, rows); if (rowCount > MAX_ROW_BUFFER) { printRows(rows, len); rows.clear(); } } printRows(rows, len); rows.clear(); if (truncated) { println("(data is partially truncated)"); } return rowCount; }
// in src/main/org/h2/tools/Shell.java
private boolean loadRow(ResultSet rs, int len, ArrayList<String[]> rows) throws SQLException { boolean truncated = false; String[] row = new String[len]; for (int i = 0; i < len; i++) { String s = rs.getString(i + 1); if (s == null) { s = "null"; } // only truncate if more than one column if (len > 1 && s.length() > maxColumnSize) { s = s.substring(0, maxColumnSize); truncated = true; } row[i] = s; } rows.add(row); return truncated; }
// in src/main/org/h2/tools/Shell.java
private int printResultAsList(ResultSet rs) throws SQLException { ResultSetMetaData meta = rs.getMetaData(); int longestLabel = 0; int len = meta.getColumnCount(); String[] columns = new String[len]; for (int i = 0; i < len; i++) { String s = meta.getColumnLabel(i + 1); columns[i] = s; longestLabel = Math.max(longestLabel, s.length()); } StringBuilder buff = new StringBuilder(); int rowCount = 0; while (rs.next()) { rowCount++; buff.setLength(0); if (rowCount > 1) { println(""); } for (int i = 0; i < len; i++) { if (i > 0) { buff.append('\n'); } String label = columns[i]; buff.append(label); for (int j = label.length(); j < longestLabel; j++) { buff.append(' '); } buff.append(": ").append(rs.getString(i + 1)); } println(buff.toString()); } if (rowCount == 0) { for (int i = 0; i < len; i++) { if (i > 0) { buff.append('\n'); } String label = columns[i]; buff.append(label); } println(buff.toString()); } return rowCount; }
// in src/main/org/h2/tools/DeleteDbFiles.java
public static void main(String... args) throws SQLException { new DeleteDbFiles().runTool(args); }
// in src/main/org/h2/tools/DeleteDbFiles.java
public void runTool(String... args) throws SQLException { String dir = "."; String db = null; boolean quiet = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-dir")) { dir = args[++i]; } else if (arg.equals("-db")) { db = args[++i]; } else if (arg.equals("-quiet")) { quiet = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } process(dir, db, quiet); }
// in src/main/org/h2/value/ValueNull.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setNull(parameterIndex, DataType.convertTypeToSQLType(Value.NULL)); }
// in src/main/org/h2/value/ValueTime.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setTime(parameterIndex, getTime()); }
// in src/main/org/h2/value/ValueLob.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { long p = getPrecision(); if (p > Integer.MAX_VALUE || p <= 0) { p = -1; } if (type == Value.BLOB) { prep.setBinaryStream(parameterIndex, getInputStream(), (int) p); } else { prep.setCharacterStream(parameterIndex, getReader(), (int) p); } }
// in src/main/org/h2/value/ValueDate.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setDate(parameterIndex, getDate()); }
// in src/main/org/h2/value/ValueInt.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setInt(parameterIndex, value); }
// in src/main/org/h2/value/ValueByte.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setByte(parameterIndex, value); }
// in src/main/org/h2/value/ValueLong.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setLong(parameterIndex, value); }
// in src/main/org/h2/value/ValueFloat.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setFloat(parameterIndex, value); }
// in src/main/org/h2/value/ValueLobDb.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { long p = getPrecision(); if (p > Integer.MAX_VALUE || p <= 0) { p = -1; } if (type == Value.BLOB) { prep.setBinaryStream(parameterIndex, getInputStream(), (int) p); } else { prep.setCharacterStream(parameterIndex, getReader(), (int) p); } }
// in src/main/org/h2/value/ValueBytes.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setBytes(parameterIndex, value); }
// in src/main/org/h2/value/ValueTimestamp.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setTimestamp(parameterIndex, getTimestamp()); }
// in src/main/org/h2/value/ValueDouble.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setDouble(parameterIndex, value); }
// in src/main/org/h2/value/ValueShort.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setShort(parameterIndex, value); }
// in src/main/org/h2/value/ValueJavaObject.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { Object obj = Utils.deserialize(getBytesNoCopy()); prep.setObject(parameterIndex, obj, Types.JAVA_OBJECT); }
// in src/main/org/h2/value/ValueString.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setString(parameterIndex, value); }
// in src/main/org/h2/value/ValueUuid.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setBytes(parameterIndex, getBytes()); }
// in src/main/org/h2/value/ValueBoolean.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setBoolean(parameterIndex, value.booleanValue()); }
// in src/main/org/h2/value/ValueDecimal.java
public void set(PreparedStatement prep, int parameterIndex) throws SQLException { prep.setBigDecimal(parameterIndex, value); }
// in src/main/org/h2/upgrade/DbUpgrade.java
public static Connection connectOrUpgrade(String url, Properties info) throws SQLException { if (!upgradeClassesPresent) { return null; } Properties i2 = new Properties(); i2.putAll(info); // clone so that the password (if set as a char array) is not cleared Object o = info.get("password"); if (o != null && o instanceof char[]) { i2.put("password", StringUtils.cloneCharArray((char[]) o)); } info = i2; ConnectionInfo ci = new ConnectionInfo(url, info); if (ci.isRemote() || !ci.isPersistent()) { return null; } String name = ci.getName(); if (FileUtils.exists(name + ".h2.db")) { return null; } if (!FileUtils.exists(name + ".data.db")) { return null; } if (ci.removeProperty("NO_UPGRADE", false)) { return connectWithOldVersion(url, info); } synchronized (DbUpgrade.class) { upgrade(ci, info); return null; }
// in src/main/org/h2/upgrade/DbUpgrade.java
private static Connection connectWithOldVersion(String url, Properties info) throws SQLException { url = "jdbc:h2v1_1:" + url.substring("jdbc:h2:".length()) + ";IGNORE_UNKNOWN_SETTINGS=TRUE"; return DriverManager.getConnection(url, info); }
// in src/main/org/h2/upgrade/DbUpgrade.java
private static void upgrade(ConnectionInfo ci, Properties info) throws SQLException { String name = ci.getName(); String data = name + ".data.db"; String index = name + ".index.db"; String lobs = name + ".lobs.db"; String backupData = data + ".backup"; String backupIndex = index + ".backup"; String backupLobs = lobs + ".backup"; String script = null; try { if (scriptInTempDir) { new File(Utils.getProperty("java.io.tmpdir", ".")).mkdirs(); script = File.createTempFile("h2dbmigration", "backup.sql").getAbsolutePath(); } else { script = name + ".script.sql"; } String oldUrl = "jdbc:h2v1_1:" + name + ";UNDO_LOG=0;LOG=0;LOCK_MODE=0"; String cipher = ci.getProperty("CIPHER", null); if (cipher != null) { oldUrl += ";CIPHER=" + cipher; } Connection conn = DriverManager.getConnection(oldUrl, info); Statement stat = conn.createStatement(); String uuid = UUID.randomUUID().toString(); if (cipher != null) { stat.execute("script to '" + script + "' cipher aes password '" + uuid + "' --hide--"); } else { stat.execute("script to '" + script + "'"); } conn.close(); FileUtils.moveTo(data, backupData); FileUtils.moveTo(index, backupIndex); if (FileUtils.exists(lobs)) { FileUtils.moveTo(lobs, backupLobs); } ci.removeProperty("IFEXISTS", false); conn = new JdbcConnection(ci, true); stat = conn.createStatement(); if (cipher != null) { stat.execute("runscript from '" + script + "' cipher aes password '" + uuid + "' --hide--"); } else { stat.execute("runscript from '" + script + "'"); } stat.execute("analyze"); stat.execute("shutdown compact"); stat.close(); conn.close(); if (deleteOldDb) { FileUtils.delete(backupData); FileUtils.delete(backupIndex); FileUtils.deleteRecursive(backupLobs, false); } } catch (Exception e) { if (FileUtils.exists(backupData)) { FileUtils.moveTo(backupData, data); } if (FileUtils.exists(backupIndex)) { FileUtils.moveTo(backupIndex, index); } if (FileUtils.exists(backupLobs)) { FileUtils.moveTo(backupLobs, lobs); } FileUtils.delete(name + ".h2.db"); throw DbException.toSQLException(e); } finally { if (script != null) { FileUtils.delete(script); } } }
// in src/main/org/h2/result/UpdatableRow.java
private void setKey(PreparedStatement prep, int start, Value[] current) throws SQLException { for (int i = 0, size = key.size(); i < size; i++) { String col = key.get(i); int idx = getColumnIndex(col); Value v = current[idx]; if (v == null || v == ValueNull.INSTANCE) { // rows with a unique key containing NULL are not supported, // as multiple such rows could exist throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } v.set(prep, start + i); } }
// in src/main/org/h2/result/UpdatableRow.java
public Value[] readRow(Value[] row) throws SQLException { StatementBuilder buff = new StatementBuilder("SELECT "); appendColumnList(buff, false); buff.append(" FROM "); appendTableName(buff); appendKeyCondition(buff); PreparedStatement prep = conn.prepareStatement(buff.toString()); setKey(prep, 1, row); ResultSet rs = prep.executeQuery(); if (!rs.next()) { throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } Value[] newRow = new Value[columnCount]; for (int i = 0; i < columnCount; i++) { int type = result.getColumnType(i); newRow[i] = DataType.readValue(conn.getSession(), rs, i + 1, type); } return newRow; }
// in src/main/org/h2/result/UpdatableRow.java
public void deleteRow(Value[] current) throws SQLException { StatementBuilder buff = new StatementBuilder("DELETE FROM "); appendTableName(buff); appendKeyCondition(buff); PreparedStatement prep = conn.prepareStatement(buff.toString()); setKey(prep, 1, current); int count = prep.executeUpdate(); if (count != 1) { // the row has already been deleted throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } }
// in src/main/org/h2/result/UpdatableRow.java
public void updateRow(Value[] current, Value[] updateRow) throws SQLException { StatementBuilder buff = new StatementBuilder("UPDATE "); appendTableName(buff); buff.append(" SET "); appendColumnList(buff, true); // TODO updatable result set: we could add all current values to the // where clause // - like this optimistic ('no') locking is possible appendKeyCondition(buff); PreparedStatement prep = conn.prepareStatement(buff.toString()); int j = 1; for (int i = 0; i < columnCount; i++) { Value v = updateRow[i]; if (v == null) { v = current[i]; } v.set(prep, j++); } setKey(prep, j, current); int count = prep.executeUpdate(); if (count != 1) { // the row has been deleted throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } }
// in src/main/org/h2/result/UpdatableRow.java
public void insertRow(Value[] row) throws SQLException { StatementBuilder buff = new StatementBuilder("INSERT INTO "); appendTableName(buff); buff.append('('); appendColumnList(buff, false); buff.append(")VALUES("); buff.resetCount(); for (int i = 0; i < columnCount; i++) { buff.appendExceptFirst(","); Value v = row[i]; if (v == null) { buff.append("DEFAULT"); } else { buff.append('?'); } } buff.append(')'); PreparedStatement prep = conn.prepareStatement(buff.toString()); for (int i = 0, j = 0; i < columnCount; i++) { Value v = row[i]; if (v != null) { v.set(prep, j++ + 1); } } int count = prep.executeUpdate(); if (count != 1) { throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } }
// in src/main/org/h2/schema/TriggerObject.java
public void close() throws SQLException { if (triggerCallback != null) { triggerCallback.close(); } }
// in src/main/org/h2/expression/JavaAggregate.java
private AggregateFunction getInstance() throws SQLException { AggregateFunction agg = userAggregate.getInstance(); agg.init(userConnection); return agg; }
// in src/main/org/h2/store/FileLister.java
public static void tryUnlockDatabase(List<String> files, String message) throws SQLException { for (String fileName : files) { if (fileName.endsWith(Constants.SUFFIX_LOCK_FILE)) { FileLock lock = new FileLock(new TraceSystem(null), fileName, Constants.LOCK_SLEEP); try { lock.lock(FileLock.LOCK_FILE); lock.unlock(); } catch (DbException e) { throw DbException.get( ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, message).getSQLException(); } } } }
// in src/main/org/h2/store/LobStorage.java
private long getNextLobId() throws SQLException { String sql = "SELECT MAX(LOB) FROM " + LOB_MAP; PreparedStatement prep = prepare(sql); ResultSet rs = prep.executeQuery(); rs.next(); long x = rs.getLong(1) + 1; reuse(sql, prep); sql = "SELECT MAX(ID) FROM " + LOBS; prep = prepare(sql); rs = prep.executeQuery(); rs.next(); x = Math.max(x, rs.getLong(1) + 1); reuse(sql, prep); return x; }
// in src/main/org/h2/store/LobStorage.java
byte[] readBlock(long lob, int seq) throws SQLException { synchronized (handler) { String sql = "SELECT COMPRESSED, DATA FROM " + LOB_MAP + " M " + "INNER JOIN " + LOB_DATA + " D ON M.BLOCK = D.BLOCK " + "WHERE M.LOB = ? AND M.SEQ = ?"; PreparedStatement prep = prepare(sql); prep.setLong(1, lob); prep.setInt(2, seq); ResultSet rs = prep.executeQuery(); if (!rs.next()) { throw DbException.get(ErrorCode.IO_EXCEPTION_1, "Missing lob entry: "+ lob + "/" + seq).getSQLException(); } int compressed = rs.getInt(1); byte[] buffer = rs.getBytes(2); if (compressed != 0) { buffer = compress.expand(buffer); } reuse(sql, prep); return buffer; } }
// in src/main/org/h2/store/LobStorage.java
long[] skipBuffer(long lob, long pos) throws SQLException { synchronized (handler) { String sql = "SELECT MAX(SEQ), MAX(POS) FROM " + LOB_MAP + " WHERE LOB = ? AND POS < ?"; PreparedStatement prep = prepare(sql); prep.setLong(1, lob); prep.setLong(2, pos); ResultSet rs = prep.executeQuery(); rs.next(); int seq = rs.getInt(1); pos = rs.getLong(2); boolean wasNull = rs.wasNull(); rs.close(); reuse(sql, prep); // upgraded: offset not set return wasNull ? null : new long[]{seq, pos}; } }
// in src/main/org/h2/store/LobStorage.java
private PreparedStatement prepare(String sql) throws SQLException { if (SysProperties.CHECK2) { if (!Thread.holdsLock(handler)) { throw DbException.throwInternalError(); } } PreparedStatement prep = prepared.remove(sql); if (prep == null) { prep = conn.prepareStatement(sql); } return prep; }
// in src/main/org/h2/store/LobStorage.java
void storeBlock(long lobId, int seq, long pos, byte[] b, String compressAlgorithm) throws SQLException { long block; boolean blockExists = false; if (compressAlgorithm != null) { b = compress.compress(b, compressAlgorithm); } int hash = Arrays.hashCode(b); synchronized (handler) { block = getHashCacheBlock(hash); if (block != -1) { String sql = "SELECT COMPRESSED, DATA FROM " + LOB_DATA + " WHERE BLOCK = ?"; PreparedStatement prep = prepare(sql); prep.setLong(1, block); ResultSet rs = prep.executeQuery(); if (rs.next()) { boolean compressed = rs.getInt(1) != 0; byte[] compare = rs.getBytes(2); if (compressed == (compressAlgorithm != null) && Arrays.equals(b, compare)) { blockExists = true; } } reuse(sql, prep); } if (!blockExists) { block = nextBlock++; setHashCacheBlock(hash, block); String sql = "INSERT INTO " + LOB_DATA + "(BLOCK, COMPRESSED, DATA) VALUES(?, ?, ?)"; PreparedStatement prep = prepare(sql); prep.setLong(1, block); prep.setInt(2, compressAlgorithm == null ? 0 : 1); prep.setBytes(3, b); prep.execute(); reuse(sql, prep); } String sql = "INSERT INTO " + LOB_MAP + "(LOB, SEQ, POS, HASH, BLOCK) VALUES(?, ?, ?, ?, ?)"; PreparedStatement prep = prepare(sql); prep.setLong(1, lobId); prep.setInt(2, seq); prep.setLong(3, pos); prep.setLong(4, hash); prep.setLong(5, block); prep.execute(); reuse(sql, prep); } }
// in src/main/org/h2/Driver.java
public Connection connect(String url, Properties info) throws SQLException { try { if (info == null) { info = new Properties(); } if (!acceptsURL(url)) { return null; } if (url.equals(DEFAULT_URL)) { return DEFAULT_CONNECTION.get(); } Connection c = DbUpgrade.connectOrUpgrade(url, info); if (c != null) { return c; } return new JdbcConnection(url, info); } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/command/dml/ScriptCommand.java
public static InputStream combineBlob(Connection conn, int id) throws SQLException { if (id < 0) { return null; } final ResultSet rs = getLobStream(conn, "BDATA", id); return new InputStream() { private InputStream current; private boolean closed; public int read() throws IOException { while (true) { try { if (current == null) { if (closed) { return -1; } if (!rs.next()) { close(); return -1; } current = rs.getBinaryStream(1); current = new BufferedInputStream(current); } int x = current.read(); if (x >= 0) { return x; } current = null; } catch (SQLException e) { throw DbException.convertToIOException(e); } } } public void close() throws IOException { if (closed) { return; } closed = true; try { rs.close(); } catch (SQLException e) { throw DbException.convertToIOException(e); } } }; }
// in src/main/org/h2/command/dml/ScriptCommand.java
public static Reader combineClob(Connection conn, int id) throws SQLException { if (id < 0) { return null; } final ResultSet rs = getLobStream(conn, "CDATA", id); return new Reader() { private Reader current; private boolean closed; public int read() throws IOException { while (true) { try { if (current == null) { if (closed) { return -1; } if (!rs.next()) { close(); return -1; } current = rs.getCharacterStream(1); current = new BufferedReader(current); } int x = current.read(); if (x >= 0) { return x; } current = null; } catch (SQLException e) { throw DbException.convertToIOException(e); } } } public void close() throws IOException { if (closed) { return; } closed = true; try { rs.close(); } catch (SQLException e) { throw DbException.convertToIOException(e); } } public int read(char[] buffer, int off, int len) throws IOException { if (len == 0) { return 0; } int c = read(); if (c == -1) { return -1; } buffer[off] = (char) c; int i = 1; for (; i < len; i++) { c = read(); if (c == -1) { break; } buffer[off + i] = (char) c; } return i; } }; }
// in src/main/org/h2/command/dml/ScriptCommand.java
private static ResultSet getLobStream(Connection conn, String column, int id) throws SQLException { PreparedStatement prep = conn.prepareStatement( "SELECT " + column + " FROM SYSTEM_LOB_STREAM WHERE ID=? ORDER BY PART"); prep.setInt(1, id); return prep.executeQuery(); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Statement createStatement() throws SQLException { try { int id = getNextId(TraceObject.STATEMENT); if (isDebugEnabled()) { debugCodeAssign("Statement", TraceObject.STATEMENT, id, "createStatement()"); } checkClosed(); return new JdbcStatement(this, id, ResultSet.TYPE_FORWARD_ONLY, Constants.DEFAULT_RESULT_SET_CONCURRENCY, false); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { try { int id = getNextId(TraceObject.STATEMENT); if (isDebugEnabled()) { debugCodeAssign("Statement", TraceObject.STATEMENT, id, "createStatement(" + resultSetType + ", " + resultSetConcurrency + ")"); } checkTypeConcurrency(resultSetType, resultSetConcurrency); checkClosed(); return new JdbcStatement(this, id, resultSetType, resultSetConcurrency, false); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { try { int id = getNextId(TraceObject.STATEMENT); if (isDebugEnabled()) { debugCodeAssign("Statement", TraceObject.STATEMENT, id, "createStatement(" + resultSetType + ", " + resultSetConcurrency + ", " + resultSetHoldability + ")"); } checkTypeConcurrency(resultSetType, resultSetConcurrency); checkHoldability(resultSetHoldability); checkClosed(); return new JdbcStatement(this, id, resultSetType, resultSetConcurrency, false); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public PreparedStatement prepareStatement(String sql) throws SQLException { try { int id = getNextId(TraceObject.PREPARED_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("PreparedStatement", TraceObject.PREPARED_STATEMENT, id, "prepareStatement(" + quote(sql) + ")"); } checkClosed(); sql = translateSQL(sql); return new JdbcPreparedStatement(this, sql, id, ResultSet.TYPE_FORWARD_ONLY, Constants.DEFAULT_RESULT_SET_CONCURRENCY, false); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
PreparedStatement prepareAutoCloseStatement(String sql) throws SQLException { try { int id = getNextId(TraceObject.PREPARED_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("PreparedStatement", TraceObject.PREPARED_STATEMENT, id, "prepareStatement(" + quote(sql) + ")"); } checkClosed(); sql = translateSQL(sql); return new JdbcPreparedStatement(this, sql, id, ResultSet.TYPE_FORWARD_ONLY, Constants.DEFAULT_RESULT_SET_CONCURRENCY, true); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public DatabaseMetaData getMetaData() throws SQLException { try { int id = getNextId(TraceObject.DATABASE_META_DATA); if (isDebugEnabled()) { debugCodeAssign("DatabaseMetaData", TraceObject.DATABASE_META_DATA, id, "getMetaData()"); } checkClosed(); return new JdbcDatabaseMetaData(this, trace, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public synchronized void close() throws SQLException { try { debugCodeCall("close"); if (session == null) { return; } CloseWatcher.unregister(watcher); session.cancel(); if (executingStatement != null) { try { executingStatement.cancel(); } catch (NullPointerException e) { // ignore } } synchronized (session) { try { if (!session.isClosed()) { try { if (session.getUndoLogPos() != 0) { // roll back unless that would require to re-connect // (the transaction can't be rolled back after re-connecting) if (!session.isReconnectNeeded(true)) { try { rollbackInternal(); } catch (DbException e) { // ignore if the connection is broken right now if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } } } session.afterWriting(); } closePreparedCommands(); } finally { session.close(); } } } finally { session = null; } } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public synchronized void setAutoCommit(boolean autoCommit) throws SQLException { try { if (isDebugEnabled()) { debugCode("setAutoCommit(" + autoCommit + ");"); } checkClosed(); if (autoCommit && !session.getAutoCommit()) { commit(); } session.setAutoCommit(autoCommit); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public synchronized boolean getAutoCommit() throws SQLException { try { checkClosed(); debugCodeCall("getAutoCommit"); return session.getAutoCommit(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public synchronized void commit() throws SQLException { try { debugCodeCall("commit"); checkClosedForWrite(); try { commit = prepareCommand("COMMIT", commit); commit.executeUpdate(); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public synchronized void rollback() throws SQLException { try { debugCodeCall("rollback"); checkClosedForWrite(); try { rollbackInternal(); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public boolean isClosed() throws SQLException { try { debugCodeCall("isClosed"); return session == null || session.isClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public String nativeSQL(String sql) throws SQLException { try { debugCodeCall("nativeSQL", sql); checkClosed(); return translateSQL(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setReadOnly(boolean readOnly) throws SQLException { try { if (isDebugEnabled()) { debugCode("setReadOnly(" + readOnly + ");"); } checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public boolean isReadOnly() throws SQLException { try { debugCodeCall("isReadOnly"); checkClosed(); getReadOnly = prepareCommand("CALL READONLY()", getReadOnly); ResultInterface result = getReadOnly.executeQuery(0, false); result.next(); boolean readOnly = result.currentRow()[0].getBoolean().booleanValue(); return readOnly; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setCatalog(String catalog) throws SQLException { try { debugCodeCall("setCatalog", catalog); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public String getCatalog() throws SQLException { try { debugCodeCall("getCatalog"); checkClosed(); if (catalog == null) { CommandInterface cat = prepareCommand("CALL DATABASE()", Integer.MAX_VALUE); ResultInterface result = cat.executeQuery(0, false); result.next(); catalog = result.currentRow()[0].getString(); cat.close(); } return catalog; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public SQLWarning getWarnings() throws SQLException { try { debugCodeCall("getWarnings"); checkClosed(); return null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void clearWarnings() throws SQLException { try { debugCodeCall("clearWarnings"); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { try { int id = getNextId(TraceObject.PREPARED_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("PreparedStatement", TraceObject.PREPARED_STATEMENT, id, "prepareStatement(" + quote(sql) + ", " + resultSetType + ", " + resultSetConcurrency + ")"); } checkTypeConcurrency(resultSetType, resultSetConcurrency); checkClosed(); sql = translateSQL(sql); return new JdbcPreparedStatement(this, sql, id, resultSetType, resultSetConcurrency, false); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setTransactionIsolation(int level) throws SQLException { try { debugCodeCall("setTransactionIsolation", level); checkClosed(); int lockMode; switch(level) { case Connection.TRANSACTION_READ_UNCOMMITTED: lockMode = Constants.LOCK_MODE_OFF; break; case Connection.TRANSACTION_READ_COMMITTED: lockMode = Constants.LOCK_MODE_READ_COMMITTED; break; case Connection.TRANSACTION_REPEATABLE_READ: case Connection.TRANSACTION_SERIALIZABLE: lockMode = Constants.LOCK_MODE_TABLE; break; default: throw DbException.getInvalidValueException("level", level); } commit(); setLockMode = prepareCommand("SET LOCK_MODE ?", setLockMode); setLockMode.getParameters().get(0).setValue(ValueInt.get(lockMode), false); setLockMode.executeUpdate(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setQueryTimeout(int seconds) throws SQLException { try { debugCodeCall("setQueryTimeout", seconds); checkClosed(); setQueryTimeout = prepareCommand("SET QUERY_TIMEOUT ?", setQueryTimeout); setQueryTimeout.getParameters().get(0).setValue(ValueInt.get(seconds * 1000), false); setQueryTimeout.executeUpdate(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public int getQueryTimeout() throws SQLException { try { debugCodeCall("getQueryTimeout"); checkClosed(); getQueryTimeout = prepareCommand("SELECT VALUE FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME=?", getQueryTimeout); getQueryTimeout.getParameters().get(0).setValue(ValueString.get("QUERY_TIMEOUT"), false); ResultInterface result = getQueryTimeout.executeQuery(0, false); result.next(); int queryTimeout = result.currentRow()[0].getInt(); result.close(); if (queryTimeout == 0) { return 0; } // round to the next second, otherwise 999 millis would return 0 seconds return (queryTimeout + 999) / 1000; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public int getTransactionIsolation() throws SQLException { try { debugCodeCall("getTransactionIsolation"); checkClosed(); getLockMode = prepareCommand("CALL LOCK_MODE()", getLockMode); ResultInterface result = getLockMode.executeQuery(0, false); result.next(); int lockMode = result.currentRow()[0].getInt(); result.close(); int transactionIsolationLevel; switch(lockMode) { case Constants.LOCK_MODE_OFF: transactionIsolationLevel = Connection.TRANSACTION_READ_UNCOMMITTED; break; case Constants.LOCK_MODE_READ_COMMITTED: transactionIsolationLevel = Connection.TRANSACTION_READ_COMMITTED; break; case Constants.LOCK_MODE_TABLE: case Constants.LOCK_MODE_TABLE_GC: transactionIsolationLevel = Connection.TRANSACTION_SERIALIZABLE; break; default: throw DbException.throwInternalError("lockMode:" + lockMode); } return transactionIsolationLevel; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setHoldability(int holdability) throws SQLException { try { debugCodeCall("setHoldability", holdability); checkClosed(); checkHoldability(holdability); this.holdability = holdability; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public int getHoldability() throws SQLException { try { debugCodeCall("getHoldability"); checkClosed(); return holdability; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Map<String, Class<?>> getTypeMap() throws SQLException { try { debugCodeCall("getTypeMap"); checkClosed(); return null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void setTypeMap(Map<String, Class<?>> map) throws SQLException { try { debugCode("setTypeMap(" + quoteMap(map) + ");"); checkMap(map); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public CallableStatement prepareCall(String sql) throws SQLException { try { int id = getNextId(TraceObject.CALLABLE_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("CallableStatement", TraceObject.CALLABLE_STATEMENT, id, "prepareCall(" + quote(sql) + ")"); } checkClosed(); sql = translateSQL(sql); return new JdbcCallableStatement(this, sql, id, ResultSet.TYPE_FORWARD_ONLY, Constants.DEFAULT_RESULT_SET_CONCURRENCY); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { try { int id = getNextId(TraceObject.CALLABLE_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("CallableStatement", TraceObject.CALLABLE_STATEMENT, id, "prepareCall(" + quote(sql) + ", " + resultSetType + ", " + resultSetConcurrency + ")"); } checkTypeConcurrency(resultSetType, resultSetConcurrency); checkClosed(); sql = translateSQL(sql); return new JdbcCallableStatement(this, sql, id, resultSetType, resultSetConcurrency); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { try { int id = getNextId(TraceObject.CALLABLE_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("CallableStatement", TraceObject.CALLABLE_STATEMENT, id, "prepareCall(" + quote(sql) + ", " + resultSetType + ", " + resultSetConcurrency + ", " + resultSetHoldability + ")"); } checkTypeConcurrency(resultSetType, resultSetConcurrency); checkHoldability(resultSetHoldability); checkClosed(); sql = translateSQL(sql); return new JdbcCallableStatement(this, sql, id, resultSetType, resultSetConcurrency); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Savepoint setSavepoint() throws SQLException { try { int id = getNextId(TraceObject.SAVEPOINT); if (isDebugEnabled()) { debugCodeAssign("Savepoint", TraceObject.SAVEPOINT, id, "setSavepoint()"); } checkClosed(); CommandInterface set = prepareCommand("SAVEPOINT " + JdbcSavepoint.getName(null, savepointId), Integer.MAX_VALUE); set.executeUpdate(); JdbcSavepoint savepoint = new JdbcSavepoint(this, savepointId, null, trace, id); savepointId++; return savepoint; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Savepoint setSavepoint(String name) throws SQLException { try { int id = getNextId(TraceObject.SAVEPOINT); if (isDebugEnabled()) { debugCodeAssign("Savepoint", TraceObject.SAVEPOINT, id, "setSavepoint(" + quote(name) + ")"); } checkClosed(); CommandInterface set = prepareCommand("SAVEPOINT " + JdbcSavepoint.getName(name, 0), Integer.MAX_VALUE); set.executeUpdate(); JdbcSavepoint savepoint = new JdbcSavepoint(this, 0, name, trace, id); return savepoint; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void rollback(Savepoint savepoint) throws SQLException { try { JdbcSavepoint sp = convertSavepoint(savepoint); debugCode("rollback(" + sp.getTraceObjectName() + ");"); checkClosedForWrite(); try { sp.rollback(); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public void releaseSavepoint(Savepoint savepoint) throws SQLException { try { debugCode("releaseSavepoint(savepoint);"); checkClosed(); convertSavepoint(savepoint).release(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { try { int id = getNextId(TraceObject.PREPARED_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("PreparedStatement", TraceObject.PREPARED_STATEMENT, id, "prepareStatement(" + quote(sql) + ", " + resultSetType + ", " + resultSetConcurrency + ", " + resultSetHoldability + ")"); } checkTypeConcurrency(resultSetType, resultSetConcurrency); checkHoldability(resultSetHoldability); checkClosed(); sql = translateSQL(sql); return new JdbcPreparedStatement(this, sql, id, resultSetType, resultSetConcurrency, false); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { try { if (isDebugEnabled()) { debugCode("prepareStatement(" + quote(sql) + ", " + autoGeneratedKeys + ");"); } return prepareStatement(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { try { if (isDebugEnabled()) { debugCode("prepareStatement(" + quote(sql) + ", " + quoteIntArray(columnIndexes) + ");"); } return prepareStatement(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { try { if (isDebugEnabled()) { debugCode("prepareStatement(" + quote(sql) + ", " + quoteArray(columnNames) + ");"); } return prepareStatement(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Clob createClob() throws SQLException { try { int id = getNextId(TraceObject.CLOB); debugCodeAssign("Clob", TraceObject.CLOB, id, "createClob()"); checkClosedForWrite(); try { Value v = session.getDataHandler().getLobStorage().createClob( new InputStreamReader( new ByteArrayInputStream(Utils.EMPTY_BYTES)), 0); return new JdbcClob(this, v, id); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Blob createBlob() throws SQLException { try { int id = getNextId(TraceObject.BLOB); debugCodeAssign("Blob", TraceObject.BLOB, id, "createClob()"); checkClosedForWrite(); try { Value v = session.getDataHandler().getLobStorage().createBlob( new ByteArrayInputStream(Utils.EMPTY_BYTES), 0); return new JdbcBlob(this, v, id); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public NClob createNClob() throws SQLException { try { int id = getNextId(TraceObject.CLOB); debugCodeAssign("NClob", TraceObject.CLOB, id, "createNClob()"); checkClosedForWrite(); try { Value v = session.getDataHandler().getLobStorage().createClob( new InputStreamReader( new ByteArrayInputStream(Utils.EMPTY_BYTES)), 0); return new JdbcClob(this, v, id); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcConnection.java
public SQLXML createSQLXML() throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Array createArrayOf(String typeName, Object[] elements) throws SQLException { throw unsupported("createArray"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public Struct createStruct(String typeName, Object[] attributes) throws SQLException { throw unsupported("Struct"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public String getClientInfo(String name) throws SQLException { throw unsupported("clientInfo"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbc/JdbcConnection.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public ResultSet executeQuery() throws SQLException { try { int id = getNextId(TraceObject.RESULT_SET); if (isDebugEnabled()) { debugCodeAssign("ResultSet", TraceObject.RESULT_SET, id, "executeQuery()"); } synchronized (session) { checkClosed(); closeOldResultSet(); ResultInterface result; boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY; boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE; try { setExecutingStatement(command); result = command.executeQuery(maxRows, scrollable); } finally { setExecutingStatement(null); } resultSet = new JdbcResultSet(conn, this, result, id, closedByResultSet, scrollable, updatable, cachedColumnLabelMap); } return resultSet; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public int executeUpdate() throws SQLException { try { debugCodeCall("executeUpdate"); checkClosedForWrite(); try { return executeUpdateInternal(); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
private int executeUpdateInternal() throws SQLException { closeOldResultSet(); synchronized (session) { try { setExecutingStatement(command); updateCount = command.executeUpdate(); } finally { setExecutingStatement(null); } } return updateCount; }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public boolean execute() throws SQLException { try { int id = getNextId(TraceObject.RESULT_SET); if (isDebugEnabled()) { debugCodeCall("execute"); } checkClosedForWrite(); try { boolean returnsResultSet; synchronized (conn.getSession()) { closeOldResultSet(); try { setExecutingStatement(command); if (command.isQuery()) { returnsResultSet = true; boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY; boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE; ResultInterface result = command.executeQuery(maxRows, scrollable); resultSet = new JdbcResultSet(conn, this, result, id, closedByResultSet, scrollable, updatable); } else { returnsResultSet = false; updateCount = command.executeUpdate(); } } finally { setExecutingStatement(null); } } return returnsResultSet; }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void clearParameters() throws SQLException { try { debugCodeCall("clearParameters"); checkClosed(); ArrayList<? extends ParameterInterface> parameters = command.getParameters(); for (int i = 0, size = parameters.size(); i < size; i++) { ParameterInterface param = parameters.get(i); // can only delete old temp files if they are not in the batch param.setValue(null, batchParameters == null); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public ResultSet executeQuery(String sql) throws SQLException { try { debugCodeCall("executeQuery", sql); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void addBatch(String sql) throws SQLException { try { debugCodeCall("addBatch", sql); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public int executeUpdate(String sql) throws SQLException { try { debugCodeCall("executeUpdate", sql); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public boolean execute(String sql) throws SQLException { try { debugCodeCall("execute", sql); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNull(int parameterIndex, int sqlType) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNull("+parameterIndex+", "+sqlType+");"); } setParameter(parameterIndex, ValueNull.INSTANCE); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setInt(int parameterIndex, int x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setInt("+parameterIndex+", "+x+");"); } setParameter(parameterIndex, ValueInt.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setString(int parameterIndex, String x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setString("+parameterIndex+", "+quote(x)+");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBigDecimal("+parameterIndex+", " + quoteBigDecimal(x) + ");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueDecimal.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setDate(int parameterIndex, java.sql.Date x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setDate("+parameterIndex+", " + quoteDate(x) + ");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueDate.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setTime(int parameterIndex, java.sql.Time x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setTime("+parameterIndex+", " + quoteTime(x) + ");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueTime.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setTimestamp("+parameterIndex+", " + quoteTimestamp(x) + ");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueTimestamp.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setObject(int parameterIndex, Object x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setObject("+parameterIndex+", x);"); } if (x == null) { // throw Errors.getInvalidValueException("null", "x"); setParameter(parameterIndex, ValueNull.INSTANCE); } else { setParameter(parameterIndex, DataType.convertToValue(session, x, Value.UNKNOWN)); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { try { if (isDebugEnabled()) { debugCode("setObject("+parameterIndex+", x, "+targetSqlType+");"); } int type = DataType.convertSQLTypeToValueType(targetSqlType); if (x == null) { setParameter(parameterIndex, ValueNull.INSTANCE); } else { Value v = DataType.convertToValue(conn.getSession(), x, type); setParameter(parameterIndex, v.convertTo(type)); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException { try { if (isDebugEnabled()) { debugCode("setObject("+parameterIndex+", x, "+targetSqlType+", "+scale+");"); } setObject(parameterIndex, x, targetSqlType); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBoolean(int parameterIndex, boolean x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBoolean("+parameterIndex+", "+x+");"); } setParameter(parameterIndex, ValueBoolean.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setByte(int parameterIndex, byte x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setByte("+parameterIndex+", "+x+");"); } setParameter(parameterIndex, ValueByte.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setShort(int parameterIndex, short x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setShort("+parameterIndex+", (short) "+x+");"); } setParameter(parameterIndex, ValueShort.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setLong(int parameterIndex, long x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setLong("+parameterIndex+", "+x+"L);"); } setParameter(parameterIndex, ValueLong.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setFloat(int parameterIndex, float x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setFloat("+parameterIndex+", "+x+"f);"); } setParameter(parameterIndex, ValueFloat.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setDouble(int parameterIndex, double x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setDouble("+parameterIndex+", "+x+"d);"); } setParameter(parameterIndex, ValueDouble.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setRef(int parameterIndex, Ref x) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setDate(int parameterIndex, java.sql.Date x, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("setDate("+parameterIndex+", " + quoteDate(x) + ", calendar);"); } if (x == null) { setParameter(parameterIndex, ValueNull.INSTANCE); } else { setParameter(parameterIndex, DateTimeUtils.convertDate(x, calendar)); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setTime(int parameterIndex, java.sql.Time x, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("setTime("+parameterIndex+", " + quoteTime(x) + ", calendar);"); } if (x == null) { setParameter(parameterIndex, ValueNull.INSTANCE); } else { setParameter(parameterIndex, DateTimeUtils.convertTime(x, calendar)); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("setTimestamp("+parameterIndex+", " + quoteTimestamp(x) + ", calendar);"); } if (x == null) { setParameter(parameterIndex, ValueNull.INSTANCE); } else { setParameter(parameterIndex, DateTimeUtils.convertTimestamp(x, calendar)); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { throw unsupported("unicodeStream"); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNull("+parameterIndex+", "+sqlType+", "+quote(typeName)+");"); } setNull(parameterIndex, sqlType); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBlob(int parameterIndex, Blob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBlob("+parameterIndex+", x);"); } checkClosedForWrite(); try { Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createBlob(x.getBinaryStream(), -1); } setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBlob(int parameterIndex, InputStream x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBlob("+parameterIndex+", x);"); } checkClosedForWrite(); try { Value v = conn.createBlob(x, -1); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setClob(int parameterIndex, Clob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setClob("+parameterIndex+", x);"); } checkClosedForWrite(); try { Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createClob(x.getCharacterStream(), -1); } setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setClob(int parameterIndex, Reader x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setClob("+parameterIndex+", x);"); } checkClosedForWrite(); try { Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createClob(x, -1); } setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setArray(int parameterIndex, Array x) throws SQLException { throw unsupported("setArray"); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBytes(int parameterIndex, byte[] x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBytes("+parameterIndex+", "+quoteBytes(x)+");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueBytes.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBinaryStream("+parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createBlob(x, length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { setBinaryStream(parameterIndex, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { setBinaryStream(parameterIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { setAsciiStream(parameterIndex, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setAsciiStream("+parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createClob(IOUtils.getAsciiReader(x), length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { setAsciiStream(parameterIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setCharacterStream(int parameterIndex, Reader x, int length) throws SQLException { setCharacterStream(parameterIndex, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setCharacterStream(int parameterIndex, Reader x) throws SQLException { setCharacterStream(parameterIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setCharacterStream(int parameterIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setCharacterStream("+parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createClob(x, length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setURL(int parameterIndex, URL x) throws SQLException { throw unsupported("url"); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public ResultSetMetaData getMetaData() throws SQLException { try { debugCodeCall("getMetaData"); checkClosed(); ResultInterface result = command.getMetaData(); if (result == null) { return null; } int id = getNextId(TraceObject.RESULT_SET_META_DATA); if (isDebugEnabled()) { debugCodeAssign("ResultSetMetaData", TraceObject.RESULT_SET_META_DATA, id, "getMetaData()"); } String catalog = conn.getCatalog(); JdbcResultSetMetaData meta = new JdbcResultSetMetaData(null, this, result, catalog, session.getTrace(), id); return meta; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void clearBatch() throws SQLException { try { debugCodeCall("clearBatch"); checkClosed(); batchParameters = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void close() throws SQLException { try { super.close(); batchParameters = null; if (command != null) { command.close(); command = null; } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public int[] executeBatch() throws SQLException { try { debugCodeCall("executeBatch"); if (batchParameters == null) { // TODO batch: check what other database do if no parameters are set batchParameters = New.arrayList(); } int size = batchParameters.size(); int[] result = new int[size]; boolean error = false; SQLException next = null; checkClosedForWrite(); try { for (int i = 0; i < size; i++) { Value[] set = batchParameters.get(i); ArrayList<? extends ParameterInterface> parameters = command.getParameters(); for (int j = 0; j < set.length; j++) { Value value = set[j]; ParameterInterface param = parameters.get(j); param.setValue(value, false); } try { result[i] = executeUpdateInternal(); } catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; } } batchParameters = null; if (error) { JdbcBatchUpdateException e = new JdbcBatchUpdateException(next, result); throw e; } return result; } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void addBatch() throws SQLException { try { debugCodeCall("addBatch"); checkClosedForWrite(); try { ArrayList<? extends ParameterInterface> parameters = command.getParameters(); int size = parameters.size(); Value[] set = new Value[size]; for (int i = 0; i < size; i++) { ParameterInterface param = parameters.get(i); Value value = param.getParamValue(); set[i] = value; } if (batchParameters == null) { batchParameters = New.arrayList(); } batchParameters.add(set); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { try { debugCode("executeUpdate("+quote(sql)+", "+autoGeneratedKeys+");"); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { try { debugCode("executeUpdate(" + quote(sql) + ", " + quoteIntArray(columnIndexes) + ");"); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public int executeUpdate(String sql, String[] columnNames) throws SQLException { try { debugCode("executeUpdate(" + quote(sql) + ", " + quoteArray(columnNames) + ");"); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { try { debugCode("execute(" + quote(sql) + ", " + autoGeneratedKeys + ");"); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public boolean execute(String sql, int[] columnIndexes) throws SQLException { try { debugCode("execute(" + quote(sql) + ", " + quoteIntArray(columnIndexes) + ");"); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public boolean execute(String sql, String[] columnNames) throws SQLException { try { debugCode("execute(" + quote(sql) + ", " + quoteArray(columnNames) + ");"); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public ParameterMetaData getParameterMetaData() throws SQLException { try { int id = getNextId(TraceObject.PARAMETER_META_DATA); if (isDebugEnabled()) { debugCodeAssign("ParameterMetaData", TraceObject.PARAMETER_META_DATA, id, "getParameterMetaData()"); } checkClosed(); JdbcParameterMetaData meta = new JdbcParameterMetaData(session.getTrace(), this, command, id); return meta; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setRowId(int parameterIndex, RowId x) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNString(int parameterIndex, String x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNString("+parameterIndex+", "+quote(x)+");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNCharacterStream(int parameterIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNCharacterStream("+ parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createClob(x, length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNCharacterStream(int parameterIndex, Reader x) throws SQLException { setNCharacterStream(parameterIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNClob(int parameterIndex, NClob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNClob("+parameterIndex+", x);"); } checkClosedForWrite(); Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createClob(x.getCharacterStream(), -1); } setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNClob(int parameterIndex, Reader x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNClob("+parameterIndex+", x);"); } checkClosedForWrite(); try { Value v = conn.createClob(x, -1); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setClob(int parameterIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setClob("+parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createClob(x, length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setBlob(int parameterIndex, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBlob("+parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createBlob(x, length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setNClob(int parameterIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("setNClob("+parameterIndex+", x, "+length+"L);"); } checkClosedForWrite(); try { Value v = conn.createClob(x, length); setParameter(parameterIndex, v); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcPreparedStatement.java
public void setSQLXML(int parameterIndex, SQLXML x) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public int getColumnCount() throws SQLException { try { debugCodeCall("getColumnCount"); checkClosed(); return columnCount; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getColumnLabel(int column) throws SQLException { try { debugCodeCall("getColumnLabel", column); checkColumnIndex(column); return result.getAlias(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getColumnName(int column) throws SQLException { try { debugCodeCall("getColumnName", column); checkColumnIndex(column); return result.getColumnName(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public int getColumnType(int column) throws SQLException { try { debugCodeCall("getColumnType", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.convertTypeToSQLType(type); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getColumnTypeName(int column) throws SQLException { try { debugCodeCall("getColumnTypeName", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.getDataType(type).name; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getSchemaName(int column) throws SQLException { try { debugCodeCall("getSchemaName", column); checkColumnIndex(column); return result.getSchemaName(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getTableName(int column) throws SQLException { try { debugCodeCall("getTableName", column); checkColumnIndex(column); return result.getTableName(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getCatalogName(int column) throws SQLException { try { debugCodeCall("getCatalogName", column); checkColumnIndex(column); return catalog; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isAutoIncrement(int column) throws SQLException { try { debugCodeCall("isAutoIncrement", column); checkColumnIndex(column); return result.isAutoIncrement(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isCaseSensitive(int column) throws SQLException { try { debugCodeCall("isCaseSensitive", column); checkColumnIndex(column); return true; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isSearchable(int column) throws SQLException { try { debugCodeCall("isSearchable", column); checkColumnIndex(column); return true; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isCurrency(int column) throws SQLException { try { debugCodeCall("isCurrency", column); checkColumnIndex(column); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public int isNullable(int column) throws SQLException { try { debugCodeCall("isNullable", column); checkColumnIndex(column); return result.getNullable(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isSigned(int column) throws SQLException { try { debugCodeCall("isSigned", column); checkColumnIndex(column); return true; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isReadOnly(int column) throws SQLException { try { debugCodeCall("isReadOnly", column); checkColumnIndex(column); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isWritable(int column) throws SQLException { try { debugCodeCall("isWritable", column); checkColumnIndex(column); return true; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isDefinitelyWritable(int column) throws SQLException { try { debugCodeCall("isDefinitelyWritable", column); checkColumnIndex(column); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public String getColumnClassName(int column) throws SQLException { try { debugCodeCall("getColumnClassName", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.getTypeClassName(type); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public int getPrecision(int column) throws SQLException { try { debugCodeCall("getPrecision", column); checkColumnIndex(column); long prec = result.getColumnPrecision(--column); return MathUtils.convertLongToInt(prec); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public int getScale(int column) throws SQLException { try { debugCodeCall("getScale", column); checkColumnIndex(column); return result.getColumnScale(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public int getColumnDisplaySize(int column) throws SQLException { try { debugCodeCall("getColumnDisplaySize", column); checkColumnIndex(column); return result.getDisplaySize(--column); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbc/JdbcResultSetMetaData.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
public int getSavepointId() throws SQLException { try { debugCodeCall("getSavepointId"); checkValid(); if (name != null) { throw DbException.get(ErrorCode.SAVEPOINT_IS_NAMED); } return savepointId; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcSavepoint.java
public String getSavepointName() throws SQLException { try { debugCodeCall("getSavepointName"); checkValid(); if (name == null) { throw DbException.get(ErrorCode.SAVEPOINT_IS_UNNAMED); } return name; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public long length() throws SQLException { try { debugCodeCall("length"); checkClosed(); if (value.getType() == Value.CLOB) { long precision = value.getPrecision(); if (precision > 0) { return precision; } } return IOUtils.copyAndCloseInput(value.getReader(), null, Long.MAX_VALUE); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public void truncate(long len) throws SQLException { throw unsupported("LOB update"); }
// in src/main/org/h2/jdbc/JdbcClob.java
public InputStream getAsciiStream() throws SQLException { try { debugCodeCall("getAsciiStream"); checkClosed(); String s = value.getString(); return IOUtils.getInputStreamFromString(s); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public OutputStream setAsciiStream(long pos) throws SQLException { throw unsupported("LOB update"); }
// in src/main/org/h2/jdbc/JdbcClob.java
public Reader getCharacterStream() throws SQLException { try { debugCodeCall("getCharacterStream"); checkClosed(); return value.getReader(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public Writer setCharacterStream(long pos) throws SQLException { try { if (isDebugEnabled()) { debugCodeCall("setCharacterStream(" + pos + ");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } if (value.getPrecision() != 0) { throw DbException.getInvalidValueException("length", value.getPrecision()); } final JdbcConnection c = conn; // PipedReader / PipedWriter are a lot slower // than PipedInputStream / PipedOutputStream // (Sun/Oracle Java 1.6.0_20) final PipedInputStream in = new PipedInputStream(); final Task task = new Task() { public void call() { value = c.createClob(IOUtils.getReader(in), -1); } }; PipedOutputStream out = new PipedOutputStream(in) { public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } } }; task.execute(); return IOUtils.getBufferedWriter(out); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public String getSubString(long pos, int length) throws SQLException { try { if (isDebugEnabled()) { debugCode("getSubString(" + pos + ", " + length + ");"); } checkClosed(); if (pos < 1) { throw DbException.getInvalidValueException("pos", pos); } if (length < 0) { throw DbException.getInvalidValueException("length", length); } StringWriter writer = new StringWriter(Math.min(Constants.IO_BUFFER_SIZE, length)); Reader reader = value.getReader(); try { IOUtils.skipFully(reader, pos - 1); IOUtils.copyAndCloseInput(reader, writer, length); } finally { reader.close(); } return writer.toString(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public int setString(long pos, String str) throws SQLException { try { if (isDebugEnabled()) { debugCode("setString(" + pos + ", " + quote(str) + ");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } else if (str == null) { throw DbException.getInvalidValueException("str", str); } value = conn.createClob(new StringReader(str), -1); return str.length(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcClob.java
public int setString(long pos, String str, int offset, int len) throws SQLException { throw unsupported("LOB update"); }
// in src/main/org/h2/jdbc/JdbcClob.java
public long position(String pattern, long start) throws SQLException { throw unsupported("LOB search"); }
// in src/main/org/h2/jdbc/JdbcClob.java
public long position(Clob clobPattern, long start) throws SQLException { throw unsupported("LOB search"); }
// in src/main/org/h2/jdbc/JdbcClob.java
public Reader getCharacterStream(long pos, long length) throws SQLException { throw unsupported("LOB subset"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getTables(String catalogPattern, String schemaPattern, String tableNamePattern, String[] types) throws SQLException { try { if (isDebugEnabled()) { debugCode("getTables(" + quote(catalogPattern) + ", " + quote(schemaPattern) + ", " + quote(tableNamePattern) + ", " + quoteArray(types) + ");"); } checkClosed(); String tableType; if (types != null && types.length > 0) { StatementBuilder buff = new StatementBuilder("TABLE_TYPE IN("); for (int i = 0; i < types.length; i++) { buff.appendExceptFirst(", "); buff.append('?'); } tableType = buff.append(')').toString(); } else { tableType = "TRUE"; } PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TABLE_CATALOG TABLE_CAT, " + "TABLE_SCHEMA TABLE_SCHEM, " + "TABLE_NAME, " + "TABLE_TYPE, " + "REMARKS, " + "TYPE_NAME TYPE_CAT, " + "TYPE_NAME TYPE_SCHEM, " + "TYPE_NAME, " + "TYPE_NAME SELF_REFERENCING_COL_NAME, " + "TYPE_NAME REF_GENERATION, " + "SQL " + "FROM INFORMATION_SCHEMA.TABLES " + "WHERE TABLE_CATALOG LIKE ? ESCAPE ? " + "AND TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND TABLE_NAME LIKE ? ESCAPE ? " + "AND (" + tableType + ") " + "ORDER BY TABLE_TYPE, TABLE_SCHEMA, TABLE_NAME"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, getPattern(tableNamePattern)); prep.setString(6, "\\"); for (int i = 0; types != null && i < types.length; i++) { prep.setString(7 + i, types[i]); } return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getColumns(String catalogPattern, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { try { if (isDebugEnabled()) { debugCode("getColumns(" + quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(tableNamePattern)+", " +quote(columnNamePattern)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TABLE_CATALOG TABLE_CAT, " + "TABLE_SCHEMA TABLE_SCHEM, " + "TABLE_NAME, " + "COLUMN_NAME, " + "DATA_TYPE, " + "TYPE_NAME, " + "CHARACTER_MAXIMUM_LENGTH COLUMN_SIZE, " + "CHARACTER_MAXIMUM_LENGTH BUFFER_LENGTH, " + "NUMERIC_SCALE DECIMAL_DIGITS, " + "NUMERIC_PRECISION_RADIX NUM_PREC_RADIX, " + "NULLABLE, " + "REMARKS, " + "COLUMN_DEFAULT COLUMN_DEF, " + "DATA_TYPE SQL_DATA_TYPE, " + "ZERO() SQL_DATETIME_SUB, " + "CHARACTER_OCTET_LENGTH CHAR_OCTET_LENGTH, " + "ORDINAL_POSITION, " + "IS_NULLABLE IS_NULLABLE, " + "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_CATALOG, " + "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_SCHEMA, " + "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_TABLE, " + "SOURCE_DATA_TYPE, " + "CASE WHEN SEQUENCE_NAME IS NULL THEN CAST(? AS VARCHAR) ELSE CAST(? AS VARCHAR) END IS_AUTOINCREMENT, " + "CAST(SOURCE_DATA_TYPE AS VARCHAR) SCOPE_CATLOG " + "FROM INFORMATION_SCHEMA.COLUMNS " + "WHERE TABLE_CATALOG LIKE ? ESCAPE ? " + "AND TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND TABLE_NAME LIKE ? ESCAPE ? " + "AND COLUMN_NAME LIKE ? ESCAPE ? " + "ORDER BY TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION"); prep.setString(1, "NO"); prep.setString(2, "YES"); prep.setString(3, getCatalogPattern(catalogPattern)); prep.setString(4, "\\"); prep.setString(5, getSchemaPattern(schemaPattern)); prep.setString(6, "\\"); prep.setString(7, getPattern(tableNamePattern)); prep.setString(8, "\\"); prep.setString(9, getPattern(columnNamePattern)); prep.setString(10, "\\"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getIndexInfo(String catalogPattern, String schemaPattern, String tableName, boolean unique, boolean approximate) throws SQLException { try { if (isDebugEnabled()) { debugCode("getIndexInfo(" + quote(catalogPattern) + ", " + quote(schemaPattern) + ", " + quote(tableName) + ", " + unique + ", " + approximate + ");"); } String uniqueCondition; if (unique) { uniqueCondition = "NON_UNIQUE=FALSE"; } else { uniqueCondition = "TRUE"; } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TABLE_CATALOG TABLE_CAT, " + "TABLE_SCHEMA TABLE_SCHEM, " + "TABLE_NAME, " + "NON_UNIQUE, " + "TABLE_CATALOG INDEX_QUALIFIER, " + "INDEX_NAME, " + "INDEX_TYPE TYPE, " + "ORDINAL_POSITION, " + "COLUMN_NAME, " + "ASC_OR_DESC, " // TODO meta data for number of unique values in an index + "CARDINALITY, " + "PAGES, " + "FILTER_CONDITION, " + "SORT_TYPE " + "FROM INFORMATION_SCHEMA.INDEXES " + "WHERE TABLE_CATALOG LIKE ? ESCAPE ? " + "AND TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND (" + uniqueCondition + ") " + "AND TABLE_NAME = ? " + "ORDER BY NON_UNIQUE, TYPE, TABLE_SCHEM, INDEX_NAME, ORDINAL_POSITION"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, tableName); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getPrimaryKeys(String catalogPattern, String schemaPattern, String tableName) throws SQLException { try { if (isDebugEnabled()) { debugCode("getPrimaryKeys(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(tableName)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TABLE_CATALOG TABLE_CAT, " + "TABLE_SCHEMA TABLE_SCHEM, " + "TABLE_NAME, " + "COLUMN_NAME, " + "ORDINAL_POSITION KEY_SEQ, " + "IFNULL(CONSTRAINT_NAME, INDEX_NAME) PK_NAME " + "FROM INFORMATION_SCHEMA.INDEXES " + "WHERE TABLE_CATALOG LIKE ? ESCAPE ? " + "AND TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND TABLE_NAME = ? " + "AND PRIMARY_KEY = TRUE " + "ORDER BY COLUMN_NAME"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, tableName); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public String getURL() throws SQLException { try { debugCodeCall("getURL"); return conn.getURL(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public String getUserName() throws SQLException { try { debugCodeCall("getUserName"); return conn.getUser(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public boolean isReadOnly() throws SQLException { try { debugCodeCall("isReadOnly"); return conn.isReadOnly(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getProcedures(String catalogPattern, String schemaPattern, String procedureNamePattern) throws SQLException { try { if (isDebugEnabled()) { debugCode("getProcedures(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(procedureNamePattern)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "ALIAS_CATALOG PROCEDURE_CAT, " + "ALIAS_SCHEMA PROCEDURE_SCHEM, " + "ALIAS_NAME PROCEDURE_NAME, " + "COLUMN_COUNT NUM_INPUT_PARAMS, " + "ZERO() NUM_OUTPUT_PARAMS, " + "ZERO() NUM_RESULT_SETS, " + "REMARKS, " + "RETURNS_RESULT PROCEDURE_TYPE, " + "ALIAS_NAME SPECIFIC_NAME " + "FROM INFORMATION_SCHEMA.FUNCTION_ALIASES " + "WHERE ALIAS_CATALOG LIKE ? ESCAPE ? " + "AND ALIAS_SCHEMA LIKE ? ESCAPE ? " + "AND ALIAS_NAME LIKE ? ESCAPE ? " + "ORDER BY PROCEDURE_SCHEM, PROCEDURE_NAME, NUM_INPUT_PARAMS"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, getPattern(procedureNamePattern)); prep.setString(6, "\\"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getProcedureColumns(String catalogPattern, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException { try { if (isDebugEnabled()) { debugCode("getProcedureColumns(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(procedureNamePattern)+", " +quote(columnNamePattern)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "ALIAS_CATALOG PROCEDURE_CAT, " + "ALIAS_SCHEMA PROCEDURE_SCHEM, " + "ALIAS_NAME PROCEDURE_NAME, " + "COLUMN_NAME, " + "COLUMN_TYPE, " + "DATA_TYPE, " + "TYPE_NAME, " + "PRECISION, " + "PRECISION LENGTH, " + "SCALE, " + "RADIX, " + "NULLABLE, " + "REMARKS, " + "COLUMN_DEFAULT COLUMN_DEF, " + "ZERO() SQL_DATA_TYPE, " + "ZERO() SQL_DATETIME_SUB, " + "ZERO() CHAR_OCTET_LENGTH, " + "POS ORDINAL_POSITION, " + "? IS_NULLABLE, " + "ALIAS_NAME SPECIFIC_NAME " + "FROM INFORMATION_SCHEMA.FUNCTION_COLUMNS " + "WHERE ALIAS_CATALOG LIKE ? ESCAPE ? " + "AND ALIAS_SCHEMA LIKE ? ESCAPE ? " + "AND ALIAS_NAME LIKE ? ESCAPE ? " + "AND COLUMN_NAME LIKE ? ESCAPE ? " + "ORDER BY PROCEDURE_SCHEM, PROCEDURE_NAME, ORDINAL_POSITION"); prep.setString(1, "YES"); prep.setString(2, getCatalogPattern(catalogPattern)); prep.setString(3, "\\"); prep.setString(4, getSchemaPattern(schemaPattern)); prep.setString(5, "\\"); prep.setString(6, getPattern(procedureNamePattern)); prep.setString(7, "\\"); prep.setString(8, getPattern(columnNamePattern)); prep.setString(9, "\\"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getSchemas() throws SQLException { try { debugCodeCall("getSchemas"); checkClosed(); PreparedStatement prep = conn .prepareAutoCloseStatement("SELECT " + "SCHEMA_NAME TABLE_SCHEM, " + "CATALOG_NAME TABLE_CATALOG, " +" IS_DEFAULT " + "FROM INFORMATION_SCHEMA.SCHEMATA " + "ORDER BY SCHEMA_NAME"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getCatalogs() throws SQLException { try { debugCodeCall("getCatalogs"); checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement( "SELECT CATALOG_NAME TABLE_CAT " + "FROM INFORMATION_SCHEMA.CATALOGS"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getTableTypes() throws SQLException { try { debugCodeCall("getTableTypes"); checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TYPE TABLE_TYPE " + "FROM INFORMATION_SCHEMA.TABLE_TYPES " + "ORDER BY TABLE_TYPE"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getColumnPrivileges(String catalogPattern, String schemaPattern, String table, String columnNamePattern) throws SQLException { try { if (isDebugEnabled()) { debugCode("getColumnPrivileges(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(table)+", " +quote(columnNamePattern)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TABLE_CATALOG TABLE_CAT, " + "TABLE_SCHEMA TABLE_SCHEM, " + "TABLE_NAME, " + "COLUMN_NAME, " + "GRANTOR, " + "GRANTEE, " + "PRIVILEGE_TYPE PRIVILEGE, " + "IS_GRANTABLE " + "FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES " + "WHERE TABLE_CATALOG LIKE ? ESCAPE ? " + "AND TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND TABLE_NAME = ? " + "AND COLUMN_NAME LIKE ? ESCAPE ? " + "ORDER BY COLUMN_NAME, PRIVILEGE"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, table); prep.setString(6, getPattern(columnNamePattern)); prep.setString(7, "\\"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getTablePrivileges(String catalogPattern, String schemaPattern, String tableNamePattern) throws SQLException { try { if (isDebugEnabled()) { debugCode("getTablePrivileges(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(tableNamePattern)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TABLE_CATALOG TABLE_CAT, " + "TABLE_SCHEMA TABLE_SCHEM, " + "TABLE_NAME, " + "GRANTOR, " + "GRANTEE, " + "PRIVILEGE_TYPE PRIVILEGE, " + "IS_GRANTABLE " + "FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES " + "WHERE TABLE_CATALOG LIKE ? ESCAPE ? " + "AND TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND TABLE_NAME LIKE ? ESCAPE ? " + "ORDER BY TABLE_SCHEM, TABLE_NAME, PRIVILEGE"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, getPattern(tableNamePattern)); prep.setString(6, "\\"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getBestRowIdentifier(String catalogPattern, String schemaPattern, String tableName, int scope, boolean nullable) throws SQLException { try { if (isDebugEnabled()) { debugCode("getBestRowIdentifier(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(tableName)+", " +scope+", "+nullable+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "CAST(? AS SMALLINT) SCOPE, " + "C.COLUMN_NAME, " + "C.DATA_TYPE, " + "C.TYPE_NAME, " + "C.CHARACTER_MAXIMUM_LENGTH COLUMN_SIZE, " + "C.CHARACTER_MAXIMUM_LENGTH BUFFER_LENGTH, " + "CAST(C.NUMERIC_SCALE AS SMALLINT) DECIMAL_DIGITS, " + "CAST(? AS SMALLINT) PSEUDO_COLUMN " + "FROM INFORMATION_SCHEMA.INDEXES I, " +" INFORMATION_SCHEMA.COLUMNS C " + "WHERE C.TABLE_NAME = I.TABLE_NAME " + "AND C.COLUMN_NAME = I.COLUMN_NAME " + "AND C.TABLE_CATALOG LIKE ? ESCAPE ? " + "AND C.TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND C.TABLE_NAME = ? " + "AND I.PRIMARY_KEY = TRUE " + "ORDER BY SCOPE"); // SCOPE prep.setInt(1, DatabaseMetaData.bestRowSession); // PSEUDO_COLUMN prep.setInt(2, DatabaseMetaData.bestRowNotPseudo); prep.setString(3, getCatalogPattern(catalogPattern)); prep.setString(4, "\\"); prep.setString(5, getSchemaPattern(schemaPattern)); prep.setString(6, "\\"); prep.setString(7, tableName); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getVersionColumns(String catalog, String schema, String tableName) throws SQLException { try { if (isDebugEnabled()) { debugCode("getVersionColumns(" +quote(catalog)+", " +quote(schema)+", " +quote(tableName)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "ZERO() SCOPE, " + "COLUMN_NAME, " + "CAST(DATA_TYPE AS INT) DATA_TYPE, " + "TYPE_NAME, " + "NUMERIC_PRECISION COLUMN_SIZE, " + "NUMERIC_PRECISION BUFFER_LENGTH, " + "NUMERIC_PRECISION DECIMAL_DIGITS, " + "ZERO() PSEUDO_COLUMN " + "FROM INFORMATION_SCHEMA.COLUMNS " + "WHERE FALSE"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getImportedKeys(String catalogPattern, String schemaPattern, String tableName) throws SQLException { try { if (isDebugEnabled()) { debugCode("getImportedKeys(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(tableName)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "PKTABLE_CATALOG PKTABLE_CAT, " + "PKTABLE_SCHEMA PKTABLE_SCHEM, " + "PKTABLE_NAME PKTABLE_NAME, " + "PKCOLUMN_NAME, " + "FKTABLE_CATALOG FKTABLE_CAT, " + "FKTABLE_SCHEMA FKTABLE_SCHEM, " + "FKTABLE_NAME, " + "FKCOLUMN_NAME, " + "ORDINAL_POSITION KEY_SEQ, " + "UPDATE_RULE, " + "DELETE_RULE, " + "FK_NAME, " + "PK_NAME, " + "DEFERRABILITY " + "FROM INFORMATION_SCHEMA.CROSS_REFERENCES " + "WHERE FKTABLE_CATALOG LIKE ? ESCAPE ? " + "AND FKTABLE_SCHEMA LIKE ? ESCAPE ? " + "AND FKTABLE_NAME = ? " + "ORDER BY PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, FK_NAME, KEY_SEQ"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, tableName); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getExportedKeys(String catalogPattern, String schemaPattern, String tableName) throws SQLException { try { if (isDebugEnabled()) { debugCode("getExportedKeys(" +quote(catalogPattern)+", " +quote(schemaPattern)+", " +quote(tableName)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "PKTABLE_CATALOG PKTABLE_CAT, " + "PKTABLE_SCHEMA PKTABLE_SCHEM, " + "PKTABLE_NAME PKTABLE_NAME, " + "PKCOLUMN_NAME, " + "FKTABLE_CATALOG FKTABLE_CAT, " + "FKTABLE_SCHEMA FKTABLE_SCHEM, " + "FKTABLE_NAME, " + "FKCOLUMN_NAME, " + "ORDINAL_POSITION KEY_SEQ, " + "UPDATE_RULE, " + "DELETE_RULE, " + "FK_NAME, " + "PK_NAME, " + "DEFERRABILITY " + "FROM INFORMATION_SCHEMA.CROSS_REFERENCES " + "WHERE PKTABLE_CATALOG LIKE ? ESCAPE ? " + "AND PKTABLE_SCHEMA LIKE ? ESCAPE ? " + "AND PKTABLE_NAME = ? " + "ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, FK_NAME, KEY_SEQ"); prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(4, "\\"); prep.setString(5, tableName); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getCrossReference(String primaryCatalogPattern, String primarySchemaPattern, String primaryTable, String foreignCatalogPattern, String foreignSchemaPattern, String foreignTable) throws SQLException { try { if (isDebugEnabled()) { debugCode("getCrossReference(" +quote(primaryCatalogPattern)+", " +quote(primarySchemaPattern)+", " +quote(primaryTable)+", " +quote(foreignCatalogPattern)+", " +quote(foreignSchemaPattern)+", " +quote(foreignTable)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "PKTABLE_CATALOG PKTABLE_CAT, " + "PKTABLE_SCHEMA PKTABLE_SCHEM, " + "PKTABLE_NAME PKTABLE_NAME, " + "PKCOLUMN_NAME, " + "FKTABLE_CATALOG FKTABLE_CAT, " + "FKTABLE_SCHEMA FKTABLE_SCHEM, " + "FKTABLE_NAME, " + "FKCOLUMN_NAME, " + "ORDINAL_POSITION KEY_SEQ, " + "UPDATE_RULE, " + "DELETE_RULE, " + "FK_NAME, " + "PK_NAME, " + "DEFERRABILITY " + "FROM INFORMATION_SCHEMA.CROSS_REFERENCES " + "WHERE PKTABLE_CATALOG LIKE ? ESCAPE ? " + "AND PKTABLE_SCHEMA LIKE ? ESCAPE ? " + "AND PKTABLE_NAME = ? " + "AND FKTABLE_CATALOG LIKE ? ESCAPE ? " + "AND FKTABLE_SCHEMA LIKE ? ESCAPE ? " + "AND FKTABLE_NAME = ? " + "ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, FK_NAME, KEY_SEQ"); prep.setString(1, getCatalogPattern(primaryCatalogPattern)); prep.setString(2, "\\"); prep.setString(3, getSchemaPattern(primarySchemaPattern)); prep.setString(4, "\\"); prep.setString(5, primaryTable); prep.setString(6, getCatalogPattern(foreignCatalogPattern)); prep.setString(7, "\\"); prep.setString(8, getSchemaPattern(foreignSchemaPattern)); prep.setString(9, "\\"); prep.setString(10, foreignTable); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws SQLException { try { if (isDebugEnabled()) { debugCode("getUDTs(" +quote(catalog)+", " +quote(schemaPattern)+", " +quote(typeNamePattern)+", " +quoteIntArray(types)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "CAST(NULL AS VARCHAR) TYPE_CAT, " + "CAST(NULL AS VARCHAR) TYPE_SCHEM, " + "CAST(NULL AS VARCHAR) TYPE_NAME, " + "CAST(NULL AS VARCHAR) CLASS_NAME, " + "CAST(NULL AS SMALLINT) DATA_TYPE, " + "CAST(NULL AS VARCHAR) REMARKS, " + "CAST(NULL AS SMALLINT) BASE_TYPE " + "FROM DUAL WHERE FALSE"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getTypeInfo() throws SQLException { try { debugCodeCall("getTypeInfo"); checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "TYPE_NAME, " + "DATA_TYPE, " + "PRECISION, " + "PREFIX LITERAL_PREFIX, " + "SUFFIX LITERAL_SUFFIX, " + "PARAMS CREATE_PARAMS, " + "NULLABLE, " + "CASE_SENSITIVE, " + "SEARCHABLE, " + "FALSE UNSIGNED_ATTRIBUTE, " + "FALSE FIXED_PREC_SCALE, " + "AUTO_INCREMENT, " + "TYPE_NAME LOCAL_TYPE_NAME, " + "MINIMUM_SCALE, " + "MAXIMUM_SCALE, " + "DATA_TYPE SQL_DATA_TYPE, " + "ZERO() SQL_DATETIME_SUB, " + "RADIX NUM_PREC_RADIX " + "FROM INFORMATION_SCHEMA.TYPE_INFO " + "ORDER BY DATA_TYPE, POS"); ResultSet rs = prep.executeQuery(); return rs; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public String getNumericFunctions() throws SQLException { debugCodeCall("getNumericFunctions"); return getFunctions("Functions (Numeric)"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public String getStringFunctions() throws SQLException { debugCodeCall("getStringFunctions"); return getFunctions("Functions (String)"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public String getSystemFunctions() throws SQLException { debugCodeCall("getSystemFunctions"); return getFunctions("Functions (System)"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public String getTimeDateFunctions() throws SQLException { debugCodeCall("getTimeDateFunctions"); return getFunctions("Functions (Time and Date)"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
private String getFunctions(String section) throws SQLException { try { checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT TOPIC " + "FROM INFORMATION_SCHEMA.HELP WHERE SECTION = ?"); prep.setString(1, section); ResultSet rs = prep.executeQuery(); StatementBuilder buff = new StatementBuilder(); while (rs.next()) { String s = rs.getString(1).trim(); String[] array = StringUtils.arraySplit(s, ',', true); for (String a : array) { buff.appendExceptFirst(","); String f = a.trim(); if (f.indexOf(' ') >= 0) { // remove 'Function' from 'INSERT Function' f = f.substring(0, f.indexOf(' ')).trim(); } buff.append(f); } } rs.close(); prep.close(); return buff.toString(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException { throw unsupported("superTypes"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException { try { if (isDebugEnabled()) { debugCode("getSuperTables(" +quote(catalog)+", " +quote(schemaPattern)+", " +quote(tableNamePattern)+");"); } checkClosed(); PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT " + "CATALOG_NAME TABLE_CAT, " + "CATALOG_NAME TABLE_SCHEM, " + "CATALOG_NAME TABLE_NAME, " + "CATALOG_NAME SUPERTABLE_NAME " + "FROM INFORMATION_SCHEMA.CATALOGS " + "WHERE FALSE"); return prep.executeQuery(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException { throw unsupported("attributes"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException { throw unsupported("getSchemas(., .)"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getClientInfoProperties() throws SQLException { throw unsupported("clientInfoProperties"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException { throw unsupported("getFunctionColumns"); }
// in src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException { throw unsupported("getFunctions"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean next() throws SQLException { try { debugCodeCall("next"); checkClosed(); return nextRow(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public ResultSetMetaData getMetaData() throws SQLException { try { int id = getNextId(TraceObject.RESULT_SET_META_DATA); if (isDebugEnabled()) { debugCodeAssign("ResultSetMetaData", TraceObject.RESULT_SET_META_DATA, id, "getMetaData()"); } checkClosed(); String catalog = conn.getCatalog(); JdbcResultSetMetaData meta = new JdbcResultSetMetaData(this, null, result, catalog, conn.getSession().getTrace(), id); return meta; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean wasNull() throws SQLException { try { debugCodeCall("wasNull"); checkClosed(); return wasNull; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int findColumn(String columnLabel) throws SQLException { try { debugCodeCall("findColumn", columnLabel); return getColumnIndex(columnLabel); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void close() throws SQLException { try { debugCodeCall("close"); closeInternal(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
void closeInternal() throws SQLException { if (result != null) { try { result.close(); if (closeStatement && stat != null) { stat.close(); } } finally { columnCount = 0; result = null; stat = null; conn = null; insertRow = null; updateRow = null; } } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Statement getStatement() throws SQLException { try { debugCodeCall("getStatement"); checkClosed(); if (closeStatement) { // if the result set was opened by a DatabaseMetaData call return null; } return stat; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public SQLWarning getWarnings() throws SQLException { try { debugCodeCall("getWarnings"); checkClosed(); return null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void clearWarnings() throws SQLException { try { debugCodeCall("clearWarnings"); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public String getString(int columnIndex) throws SQLException { try { debugCodeCall("getString", columnIndex); return get(columnIndex).getString(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public String getString(String columnLabel) throws SQLException { try { debugCodeCall("getString", columnLabel); return get(columnLabel).getString(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getInt(int columnIndex) throws SQLException { try { debugCodeCall("getInt", columnIndex); return get(columnIndex).getInt(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getInt(String columnLabel) throws SQLException { try { debugCodeCall("getInt", columnLabel); return get(columnLabel).getInt(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public BigDecimal getBigDecimal(int columnIndex) throws SQLException { try { debugCodeCall("getBigDecimal", columnIndex); return get(columnIndex).getBigDecimal(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Date getDate(int columnIndex) throws SQLException { try { debugCodeCall("getDate", columnIndex); return get(columnIndex).getDate(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Time getTime(int columnIndex) throws SQLException { try { debugCodeCall("getTime", columnIndex); return get(columnIndex).getTime(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Timestamp getTimestamp(int columnIndex) throws SQLException { try { debugCodeCall("getTimestamp", columnIndex); return get(columnIndex).getTimestamp(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public BigDecimal getBigDecimal(String columnLabel) throws SQLException { try { debugCodeCall("getBigDecimal", columnLabel); return get(columnLabel).getBigDecimal(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Date getDate(String columnLabel) throws SQLException { try { debugCodeCall("getDate", columnLabel); return get(columnLabel).getDate(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Time getTime(String columnLabel) throws SQLException { try { debugCodeCall("getTime", columnLabel); return get(columnLabel).getTime(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Timestamp getTimestamp(String columnLabel) throws SQLException { try { debugCodeCall("getTimestamp", columnLabel); return get(columnLabel).getTimestamp(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Object getObject(int columnIndex) throws SQLException { try { debugCodeCall("getObject", columnIndex); Value v = get(columnIndex); return conn.convertToDefaultObject(v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Object getObject(String columnLabel) throws SQLException { try { debugCodeCall("getObject", columnLabel); Value v = get(columnLabel); return conn.convertToDefaultObject(v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean getBoolean(int columnIndex) throws SQLException { try { debugCodeCall("getBoolean", columnIndex); Boolean v = get(columnIndex).getBoolean(); return v == null ? false : v.booleanValue(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean getBoolean(String columnLabel) throws SQLException { try { debugCodeCall("getBoolean", columnLabel); Boolean v = get(columnLabel).getBoolean(); return v == null ? false : v.booleanValue(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public byte getByte(int columnIndex) throws SQLException { try { debugCodeCall("getByte", columnIndex); return get(columnIndex).getByte(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public byte getByte(String columnLabel) throws SQLException { try { debugCodeCall("getByte", columnLabel); return get(columnLabel).getByte(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public short getShort(int columnIndex) throws SQLException { try { debugCodeCall("getShort", columnIndex); return get(columnIndex).getShort(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public short getShort(String columnLabel) throws SQLException { try { debugCodeCall("getShort", columnLabel); return get(columnLabel).getShort(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public long getLong(int columnIndex) throws SQLException { try { debugCodeCall("getLong", columnIndex); return get(columnIndex).getLong(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public long getLong(String columnLabel) throws SQLException { try { debugCodeCall("getLong", columnLabel); return get(columnLabel).getLong(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public float getFloat(int columnIndex) throws SQLException { try { debugCodeCall("getFloat", columnIndex); return get(columnIndex).getFloat(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public float getFloat(String columnLabel) throws SQLException { try { debugCodeCall("getFloat", columnLabel); return get(columnLabel).getFloat(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public double getDouble(int columnIndex) throws SQLException { try { debugCodeCall("getDouble", columnIndex); return get(columnIndex).getDouble(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public double getDouble(String columnLabel) throws SQLException { try { debugCodeCall("getDouble", columnLabel); return get(columnLabel).getDouble(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { try { if (isDebugEnabled()) { debugCode("getBigDecimal(" + StringUtils.quoteJavaString(columnLabel)+", "+scale+");"); } if (scale < 0) { throw DbException.getInvalidValueException("scale", scale); } BigDecimal bd = get(columnLabel).getBigDecimal(); return bd == null ? null : MathUtils.setScale(bd, scale); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { try { if (isDebugEnabled()) { debugCode("getBigDecimal(" + columnIndex + ", " + scale + ");"); } if (scale < 0) { throw DbException.getInvalidValueException("scale", scale); } BigDecimal bd = get(columnIndex).getBigDecimal(); return bd == null ? null : MathUtils.setScale(bd, scale); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public InputStream getUnicodeStream(int columnIndex) throws SQLException { throw unsupported("unicodeStream"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public InputStream getUnicodeStream(String columnLabel) throws SQLException { throw unsupported("unicodeStream"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException { throw unsupported("map"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException { throw unsupported("map"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Ref getRef(int columnIndex) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Ref getRef(String columnLabel) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Date getDate(int columnIndex, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("getDate(" + columnIndex + ", calendar)"); } return DateTimeUtils.convertDate(get(columnIndex), calendar); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Date getDate(String columnLabel, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("getDate(" + StringUtils.quoteJavaString(columnLabel) + ", calendar)"); } return DateTimeUtils.convertDate(get(columnLabel), calendar); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Time getTime(int columnIndex, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("getTime(" + columnIndex + ", calendar)"); } return DateTimeUtils.convertTime(get(columnIndex), calendar); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Time getTime(String columnLabel, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("getTime(" + StringUtils.quoteJavaString(columnLabel) + ", calendar)"); } return DateTimeUtils.convertTime(get(columnLabel), calendar); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Timestamp getTimestamp(int columnIndex, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("getTimestamp(" + columnIndex + ", calendar)"); } Value value = get(columnIndex); return DateTimeUtils.convertTimestamp(value, calendar); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Timestamp getTimestamp(String columnLabel, Calendar calendar) throws SQLException { try { if (isDebugEnabled()) { debugCode("getTimestamp(" + StringUtils.quoteJavaString(columnLabel) + ", calendar)"); } Value value = get(columnLabel); return DateTimeUtils.convertTimestamp(value, calendar); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Blob getBlob(int columnIndex) throws SQLException { try { int id = getNextId(TraceObject.BLOB); debugCodeAssign("Blob", TraceObject.BLOB, id, "getBlob(" + columnIndex + ")"); Value v = get(columnIndex); return v == ValueNull.INSTANCE ? null : new JdbcBlob(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Blob getBlob(String columnLabel) throws SQLException { try { int id = getNextId(TraceObject.BLOB); debugCodeAssign("Blob", TraceObject.BLOB, id, "getBlob(" + quote(columnLabel) + ")"); Value v = get(columnLabel); return v == ValueNull.INSTANCE ? null : new JdbcBlob(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public byte[] getBytes(int columnIndex) throws SQLException { try { debugCodeCall("getBytes", columnIndex); return get(columnIndex).getBytes(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public byte[] getBytes(String columnLabel) throws SQLException { try { debugCodeCall("getBytes", columnLabel); return get(columnLabel).getBytes(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public InputStream getBinaryStream(int columnIndex) throws SQLException { try { debugCodeCall("getBinaryStream", columnIndex); return get(columnIndex).getInputStream(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public InputStream getBinaryStream(String columnLabel) throws SQLException { try { debugCodeCall("getBinaryStream", columnLabel); return get(columnLabel).getInputStream(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Clob getClob(int columnIndex) throws SQLException { try { int id = getNextId(TraceObject.CLOB); debugCodeAssign("Clob", TraceObject.CLOB, id, "getClob(" + columnIndex + ")"); Value v = get(columnIndex); return v == ValueNull.INSTANCE ? null : new JdbcClob(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Clob getClob(String columnLabel) throws SQLException { try { int id = getNextId(TraceObject.CLOB); debugCodeAssign("Clob", TraceObject.CLOB, id, "getClob(" + quote(columnLabel) + ")"); Value v = get(columnLabel); return v == ValueNull.INSTANCE ? null : new JdbcClob(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Array getArray(int columnIndex) throws SQLException { try { int id = getNextId(TraceObject.ARRAY); debugCodeAssign("Clob", TraceObject.ARRAY, id, "getArray(" + columnIndex + ")"); Value v = get(columnIndex); return v == ValueNull.INSTANCE ? null : new JdbcArray(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Array getArray(String columnLabel) throws SQLException { try { int id = getNextId(TraceObject.ARRAY); debugCodeAssign("Clob", TraceObject.ARRAY, id, "getArray(" + quote(columnLabel) + ")"); Value v = get(columnLabel); return v == ValueNull.INSTANCE ? null : new JdbcArray(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public InputStream getAsciiStream(int columnIndex) throws SQLException { try { debugCodeCall("getAsciiStream", columnIndex); String s = get(columnIndex).getString(); return s == null ? null : IOUtils.getInputStreamFromString(s); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public InputStream getAsciiStream(String columnLabel) throws SQLException { try { debugCodeCall("getAsciiStream", columnLabel); String s = get(columnLabel).getString(); return IOUtils.getInputStreamFromString(s); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Reader getCharacterStream(int columnIndex) throws SQLException { try { debugCodeCall("getCharacterStream", columnIndex); return get(columnIndex).getReader(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Reader getCharacterStream(String columnLabel) throws SQLException { try { debugCodeCall("getCharacterStream", columnLabel); return get(columnLabel).getReader(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public URL getURL(int columnIndex) throws SQLException { throw unsupported("url"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public URL getURL(String columnLabel) throws SQLException { throw unsupported("url"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNull(int columnIndex) throws SQLException { try { debugCodeCall("updateNull", columnIndex); update(columnIndex, ValueNull.INSTANCE); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNull(String columnLabel) throws SQLException { try { debugCodeCall("updateNull", columnLabel); update(columnLabel, ValueNull.INSTANCE); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBoolean(int columnIndex, boolean x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBoolean("+columnIndex+", "+x+");"); } update(columnIndex, ValueBoolean.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBoolean(String columnLabel, boolean x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBoolean("+quote(columnLabel)+", "+x+");"); } update(columnLabel, ValueBoolean.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateByte(int columnIndex, byte x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateByte("+columnIndex+", "+x+");"); } update(columnIndex, ValueByte.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateByte(String columnLabel, byte x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateByte("+columnLabel+", "+x+");"); } update(columnLabel, ValueByte.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBytes(int columnIndex, byte[] x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBytes("+columnIndex+", x);"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueBytes.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBytes(String columnLabel, byte[] x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBytes("+quote(columnLabel)+", x);"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueBytes.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateShort(int columnIndex, short x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateShort("+columnIndex+", (short) "+x+");"); } update(columnIndex, ValueShort.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateShort(String columnLabel, short x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateShort("+quote(columnLabel)+", (short) "+x+");"); } update(columnLabel, ValueShort.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateInt(int columnIndex, int x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateInt("+columnIndex+", "+x+");"); } update(columnIndex, ValueInt.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateInt(String columnLabel, int x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateInt("+quote(columnLabel)+", "+x+");"); } update(columnLabel, ValueInt.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateLong(int columnIndex, long x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateLong("+columnIndex+", "+x+"L);"); } update(columnIndex, ValueLong.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateLong(String columnLabel, long x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateLong("+quote(columnLabel)+", "+x+"L);"); } update(columnLabel, ValueLong.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateFloat(int columnIndex, float x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateFloat("+columnIndex+", "+x+"f);"); } update(columnIndex, ValueFloat.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateFloat(String columnLabel, float x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateFloat("+quote(columnLabel)+", "+x+"f);"); } update(columnLabel, ValueFloat.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateDouble(int columnIndex, double x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateDouble("+columnIndex+", "+x+"d);"); } update(columnIndex, ValueDouble.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateDouble(String columnLabel, double x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateDouble("+quote(columnLabel)+", "+x+"d);"); } update(columnLabel, ValueDouble.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBigDecimal("+columnIndex+", " + quoteBigDecimal(x) + ");"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueDecimal.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBigDecimal("+quote(columnLabel)+", " + quoteBigDecimal(x) + ");"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueDecimal.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateString(int columnIndex, String x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateString("+columnIndex+", "+quote(x)+");"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateString(String columnLabel, String x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateString("+quote(columnLabel)+", "+quote(x)+");"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateDate(int columnIndex, Date x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateDate("+columnIndex+", x);"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueDate.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateDate(String columnLabel, Date x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateDate("+quote(columnLabel)+", x);"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueDate.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateTime(int columnIndex, Time x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateTime("+columnIndex+", x);"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueTime.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateTime(String columnLabel, Time x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateTime("+quote(columnLabel)+", x);"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueTime.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateTimestamp("+columnIndex+", x);"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueTimestamp.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateTimestamp("+quote(columnLabel)+", x);"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueTimestamp.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { updateAsciiStream(columnIndex, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { updateAsciiStream(columnIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateAsciiStream("+columnIndex+", x, "+length+"L);"); } checkClosed(); Value v = conn.createClob(IOUtils.getAsciiReader(x), length); update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { updateAsciiStream(columnLabel, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { updateAsciiStream(columnLabel, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateAsciiStream("+quote(columnLabel)+", x, "+length+"L);"); } checkClosed(); Value v = conn.createClob(IOUtils.getAsciiReader(x), length); update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { updateBinaryStream(columnIndex, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { updateBinaryStream(columnIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBinaryStream("+columnIndex+", x, "+length+"L);"); } checkClosed(); Value v = conn.createBlob(x, length); update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { updateBinaryStream(columnLabel, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { updateBinaryStream(columnLabel, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBinaryStream("+quote(columnLabel)+", x, "+length+"L);"); } checkClosed(); Value v = conn.createBlob(x, length); update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateCharacterStream("+columnIndex+", x, "+length+"L);"); } checkClosed(); Value v = conn.createClob(x, length); update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { updateCharacterStream(columnIndex, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { updateCharacterStream(columnIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateCharacterStream(String columnLabel, Reader x, int length) throws SQLException { updateCharacterStream(columnLabel, x, (long) length); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateCharacterStream(String columnLabel, Reader x) throws SQLException { updateCharacterStream(columnLabel, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateCharacterStream(String columnLabel, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateCharacterStream("+quote(columnLabel)+", x, "+length+"L);"); } checkClosed(); Value v = conn.createClob(x, length); update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateObject(int columnIndex, Object x, int scale) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateObject("+columnIndex+", x, "+scale+");"); } update(columnIndex, convertToUnknownValue(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateObject(String columnLabel, Object x, int scale) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateObject("+quote(columnLabel)+", x, "+scale+");"); } update(columnLabel, convertToUnknownValue(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateObject(int columnIndex, Object x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateObject("+columnIndex+", x);"); } update(columnIndex, convertToUnknownValue(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateObject(String columnLabel, Object x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateObject("+quote(columnLabel)+", x);"); } update(columnLabel, convertToUnknownValue(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateRef(int columnIndex, Ref x) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateRef(String columnLabel, Ref x) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBlob(int columnIndex, InputStream x) throws SQLException { updateBlob(columnIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBlob(int columnIndex, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBlob("+columnIndex+", x, " + length + "L);"); } checkClosed(); Value v = conn.createBlob(x, length); update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBlob(int columnIndex, Blob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBlob("+columnIndex+", x);"); } checkClosed(); Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createBlob(x.getBinaryStream(), -1); } update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBlob(String columnLabel, Blob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBlob("+quote(columnLabel)+", x);"); } checkClosed(); Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createBlob(x.getBinaryStream(), -1); } update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBlob(String columnLabel, InputStream x) throws SQLException { updateBlob(columnLabel, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateBlob(String columnLabel, InputStream x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBlob("+quote(columnLabel)+", x, " + length + "L);"); } checkClosed(); Value v = conn.createBlob(x, -1); update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateClob(int columnIndex, Clob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateClob("+columnIndex+", x);"); } checkClosed(); Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createClob(x.getCharacterStream(), -1); } update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateClob(int columnIndex, Reader x) throws SQLException { updateClob(columnIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateClob(int columnIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateClob("+columnIndex+", x, " + length + "L);"); } checkClosed(); Value v = conn.createClob(x, length); update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateClob(String columnLabel, Clob x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateClob("+quote(columnLabel)+", x);"); } checkClosed(); Value v; if (x == null) { v = ValueNull.INSTANCE; } else { v = conn.createClob(x.getCharacterStream(), -1); } update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateClob(String columnLabel, Reader x) throws SQLException { updateClob(columnLabel, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateClob(String columnLabel, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateClob("+quote(columnLabel)+", x, " + length + "L);"); } checkClosed(); Value v = conn.createClob(x, length); update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateArray(int columnIndex, Array x) throws SQLException { throw unsupported("setArray"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateArray(String columnLabel, Array x) throws SQLException { throw unsupported("setArray"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public String getCursorName() throws SQLException { throw unsupported("cursorName"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getRow() throws SQLException { try { debugCodeCall("getRow"); checkClosed(); int rowId = result.getRowId(); if (rowId >= result.getRowCount()) { return 0; } return rowId + 1; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getConcurrency() throws SQLException { try { debugCodeCall("getConcurrency"); checkClosed(); if (!updatable) { return ResultSet.CONCUR_READ_ONLY; } UpdatableRow row = new UpdatableRow(conn, result); return row.isUpdatable() ? ResultSet.CONCUR_UPDATABLE : ResultSet.CONCUR_READ_ONLY; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getFetchDirection() throws SQLException { try { debugCodeCall("getFetchDirection"); checkClosed(); return ResultSet.FETCH_FORWARD; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getFetchSize() throws SQLException { try { debugCodeCall("getFetchSize"); checkClosed(); return result.getFetchSize(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void setFetchSize(int rows) throws SQLException { try { debugCodeCall("setFetchSize", rows); checkClosed(); if (rows < 0) { throw DbException.getInvalidValueException("rows", rows); } else if (rows > 0) { if (stat != null) { int maxRows = stat.getMaxRows(); if (maxRows > 0 && rows > maxRows) { throw DbException.getInvalidValueException("rows", rows); } } } else { rows = SysProperties.SERVER_RESULT_SET_FETCH_SIZE; } result.setFetchSize(rows); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void setFetchDirection(int direction) throws SQLException { throw unsupported("setFetchDirection"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getType() throws SQLException { try { debugCodeCall("getType"); checkClosed(); return stat == null ? ResultSet.TYPE_FORWARD_ONLY : stat.resultSetType; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean isBeforeFirst() throws SQLException { try { debugCodeCall("isBeforeFirst"); checkClosed(); int row = result.getRowId(); int count = result.getRowCount(); return count > 0 && row < 0; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean isAfterLast() throws SQLException { try { debugCodeCall("isAfterLast"); checkClosed(); int row = result.getRowId(); int count = result.getRowCount(); return count > 0 && row >= count; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean isFirst() throws SQLException { try { debugCodeCall("isFirst"); checkClosed(); int row = result.getRowId(); return row == 0 && row < result.getRowCount(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean isLast() throws SQLException { try { debugCodeCall("isLast"); checkClosed(); int row = result.getRowId(); return row >= 0 && row == result.getRowCount() - 1; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void beforeFirst() throws SQLException { try { debugCodeCall("beforeFirst"); checkClosed(); if (result.getRowId() >= 0) { resetResult(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void afterLast() throws SQLException { try { debugCodeCall("afterLast"); checkClosed(); while (nextRow()) { // nothing } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean first() throws SQLException { try { debugCodeCall("first"); checkClosed(); if (result.getRowId() < 0) { return nextRow(); } resetResult(); return nextRow(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean last() throws SQLException { try { debugCodeCall("last"); checkClosed(); return absolute(-1); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean absolute(int rowNumber) throws SQLException { try { debugCodeCall("absolute", rowNumber); checkClosed(); if (rowNumber < 0) { rowNumber = result.getRowCount() + rowNumber + 1; } else if (rowNumber > result.getRowCount() + 1) { rowNumber = result.getRowCount() + 1; } if (rowNumber <= result.getRowId()) { resetResult(); } while (result.getRowId() + 1 < rowNumber) { nextRow(); } int row = result.getRowId(); return row >= 0 && row < result.getRowCount(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean relative(int rowCount) throws SQLException { try { debugCodeCall("relative", rowCount); checkClosed(); int row = result.getRowId() + 1 + rowCount; if (row < 0) { row = 0; } else if (row > result.getRowCount()) { row = result.getRowCount() + 1; } return absolute(row); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean previous() throws SQLException { try { debugCodeCall("previous"); checkClosed(); return relative(-1); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void moveToInsertRow() throws SQLException { try { debugCodeCall("moveToInsertRow"); checkUpdatable(); insertRow = new Value[columnCount]; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void moveToCurrentRow() throws SQLException { try { debugCodeCall("moveToCurrentRow"); checkUpdatable(); insertRow = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean rowUpdated() throws SQLException { try { debugCodeCall("rowUpdated"); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean rowInserted() throws SQLException { try { debugCodeCall("rowInserted"); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean rowDeleted() throws SQLException { try { debugCodeCall("rowDeleted"); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void insertRow() throws SQLException { try { debugCodeCall("insertRow"); checkUpdatable(); if (insertRow == null) { throw DbException.get(ErrorCode.NOT_ON_UPDATABLE_ROW); } getUpdatableRow().insertRow(insertRow); insertRow = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateRow() throws SQLException { try { debugCodeCall("updateRow"); checkUpdatable(); if (insertRow != null) { throw DbException.get(ErrorCode.NOT_ON_UPDATABLE_ROW); } checkOnValidRow(); if (updateRow != null) { UpdatableRow row = getUpdatableRow(); Value[] current = new Value[columnCount]; for (int i = 0; i < updateRow.length; i++) { current[i] = get(i + 1); } row.updateRow(current, updateRow); for (int i = 0; i < updateRow.length; i++) { if (updateRow[i] == null) { updateRow[i] = current[i]; } } Value[] patch = row.readRow(updateRow); patchCurrentRow(patch); updateRow = null; } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void deleteRow() throws SQLException { try { debugCodeCall("deleteRow"); checkUpdatable(); if (insertRow != null) { throw DbException.get(ErrorCode.NOT_ON_UPDATABLE_ROW); } checkOnValidRow(); getUpdatableRow().deleteRow(result.currentRow()); updateRow = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void refreshRow() throws SQLException { try { debugCodeCall("refreshRow"); checkClosed(); if (insertRow != null) { throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } checkOnValidRow(); patchCurrentRow(getUpdatableRow().readRow(result.currentRow())); updateRow = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void cancelRowUpdates() throws SQLException { try { debugCodeCall("cancelRowUpdates"); checkClosed(); if (insertRow != null) { throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } updateRow = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
private UpdatableRow getUpdatableRow() throws SQLException { UpdatableRow row = new UpdatableRow(conn, result); if (!row.isUpdatable()) { throw DbException.get(ErrorCode.RESULT_SET_NOT_UPDATABLE); } return row; }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public RowId getRowId(int columnIndex) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public RowId getRowId(String columnLabel) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateRowId(int columnIndex, RowId x) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateRowId(String columnLabel, RowId x) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public int getHoldability() throws SQLException { try { debugCodeCall("getHoldability"); checkClosed(); return conn.getHoldability(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean isClosed() throws SQLException { try { debugCodeCall("isClosed"); return result == null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNString(int columnIndex, String x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateNString("+columnIndex+", "+quote(x)+");"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNString(String columnLabel, String x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateNString("+quote(columnLabel)+", "+quote(x)+");"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueString.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNClob(int columnIndex, NClob x) throws SQLException { throw unsupported("NClob"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNClob(int columnIndex, Reader x) throws SQLException { throw unsupported("NClob"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNClob(int columnIndex, Reader x, long length) throws SQLException { throw unsupported("NClob"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNClob(String columnLabel, Reader x) throws SQLException { throw unsupported("NClob"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNClob(String columnLabel, Reader x, long length) throws SQLException { throw unsupported("NClob"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNClob(String columnLabel, NClob x) throws SQLException { throw unsupported("NClob"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public NClob getNClob(int columnIndex) throws SQLException { try { int id = getNextId(TraceObject.CLOB); debugCodeAssign("NClob", TraceObject.CLOB, id, "getNClob(" + columnIndex + ")"); Value v = get(columnIndex); return v == ValueNull.INSTANCE ? null : new JdbcClob(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public NClob getNClob(String columnLabel) throws SQLException { try { int id = getNextId(TraceObject.CLOB); debugCodeAssign("NClob", TraceObject.CLOB, id, "getNClob(" + columnLabel + ")"); Value v = get(columnLabel); return v == ValueNull.INSTANCE ? null : new JdbcClob(conn, v, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public SQLXML getSQLXML(int columnIndex) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public SQLXML getSQLXML(String columnLabel) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public String getNString(int columnIndex) throws SQLException { try { debugCodeCall("getNString", columnIndex); return get(columnIndex).getString(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public String getNString(String columnLabel) throws SQLException { try { debugCodeCall("getNString", columnLabel); return get(columnLabel).getString(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Reader getNCharacterStream(int columnIndex) throws SQLException { try { debugCodeCall("getNCharacterStream", columnIndex); return get(columnIndex).getReader(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public Reader getNCharacterStream(String columnLabel) throws SQLException { try { debugCodeCall("getNCharacterStream", columnLabel); return get(columnLabel).getReader(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { updateNCharacterStream(columnIndex, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateNCharacterStream("+columnIndex+", x, "+length+"L);"); } checkClosed(); Value v = conn.createClob(x, length); update(columnIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNCharacterStream(String columnLabel, Reader x) throws SQLException { updateNCharacterStream(columnLabel, x, -1); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public void updateNCharacterStream(String columnLabel, Reader x, long length) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateNCharacterStream("+quote(columnLabel)+", x, "+length+"L);"); } checkClosed(); Value v = conn.createClob(x, length); update(columnLabel, v); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbc/JdbcResultSet.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/jdbc/JdbcArray.java
public Object getArray() throws SQLException { try { debugCodeCall("getArray"); checkClosed(); return get(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public Object getArray(Map<String, Class<?>> map) throws SQLException { try { debugCode("getArray("+quoteMap(map)+");"); checkMap(map); checkClosed(); return get(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public Object getArray(long index, int count) throws SQLException { try { debugCode("getArray(" + index + ", " + count + ");"); checkClosed(); return get(index, count); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public Object getArray(long index, int count, Map<String, Class<?>> map) throws SQLException { try { debugCode("getArray(" + index + ", " + count + ", " + quoteMap(map)+");"); checkClosed(); checkMap(map); return get(index, count); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public int getBaseType() throws SQLException { try { debugCodeCall("getBaseType"); checkClosed(); return Types.NULL; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public String getBaseTypeName() throws SQLException { try { debugCodeCall("getBaseTypeName"); checkClosed(); return "NULL"; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public ResultSet getResultSet() throws SQLException { try { debugCodeCall("getResultSet"); checkClosed(); return getResultSet(get(), 0); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public ResultSet getResultSet(Map<String, Class<?>> map) throws SQLException { try { debugCode("getResultSet("+quoteMap(map)+");"); checkClosed(); checkMap(map); return getResultSet(get(), 0); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public ResultSet getResultSet(long index, int count) throws SQLException { try { debugCode("getResultSet("+index+", " + count+");"); checkClosed(); return getResultSet(get(index, count), index); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcArray.java
public ResultSet getResultSet(long index, int count, Map<String, Class<?>> map) throws SQLException { try { debugCode("getResultSet("+index+", " + count+", " + quoteMap(map)+");"); checkClosed(); checkMap(map); return getResultSet(get(index, count), index); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public int getParameterCount() throws SQLException { try { debugCodeCall("getParameterCount"); checkClosed(); return paramCount; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public int getParameterMode(int param) throws SQLException { try { debugCodeCall("getParameterMode", param); getParameter(param); return parameterModeIn; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public int getParameterType(int param) throws SQLException { try { debugCodeCall("getParameterType", param); ParameterInterface p = getParameter(param); int type = p.getType(); if (type == Value.UNKNOWN) { type = Value.STRING; } return DataType.getDataType(type).sqlType; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public int getPrecision(int param) throws SQLException { try { debugCodeCall("getPrecision", param); ParameterInterface p = getParameter(param); return MathUtils.convertLongToInt(p.getPrecision()); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public int getScale(int param) throws SQLException { try { debugCodeCall("getScale", param); ParameterInterface p = getParameter(param); return p.getScale(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public int isNullable(int param) throws SQLException { try { debugCodeCall("isNullable", param); return getParameter(param).getNullable(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public boolean isSigned(int param) throws SQLException { try { debugCodeCall("isSigned", param); getParameter(param); return true; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public String getParameterClassName(int param) throws SQLException { try { debugCodeCall("getParameterClassName", param); ParameterInterface p = getParameter(param); int type = p.getType(); if (type == Value.UNKNOWN) { type = Value.STRING; } return DataType.getTypeClassName(type); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public String getParameterTypeName(int param) throws SQLException { try { debugCodeCall("getParameterTypeName", param); ParameterInterface p = getParameter(param); int type = p.getType(); if (type == Value.UNKNOWN) { type = Value.STRING; } return DataType.getDataType(type).name; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbc/JdbcParameterMetaData.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public int executeUpdate() throws SQLException { try { checkClosed(); if (command.isQuery()) { super.executeQuery(); return 0; } return super.executeUpdate(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { registerOutParameter(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { registerOutParameter(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { registerOutParameter(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { registerOutParameter(getIndexForName(parameterName), sqlType, typeName); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { registerOutParameter(getIndexForName(parameterName), sqlType, scale); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void registerOutParameter(String parameterName, int sqlType) throws SQLException { registerOutParameter(getIndexForName(parameterName), sqlType); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public boolean wasNull() throws SQLException { return getOpenResultSet().wasNull(); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public URL getURL(int parameterIndex) throws SQLException { throw unsupported("url"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public String getString(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getString(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public boolean getBoolean(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getBoolean(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public byte getByte(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getByte(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public short getShort(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getShort(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public int getInt(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getInt(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public long getLong(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getLong(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public float getFloat(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getFloat(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public double getDouble(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getDouble(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getBigDecimal(parameterIndex, scale); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public byte[] getBytes(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getBytes(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Date getDate(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getDate(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Time getTime(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getTime(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Timestamp getTimestamp(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getTimestamp(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Object getObject(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getObject(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getBigDecimal(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Object getObject(int parameterIndex, Map<String, Class<?>> map) throws SQLException { throw unsupported("map"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Ref getRef(int parameterIndex) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Blob getBlob(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getBlob(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Clob getClob(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getClob(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Array getArray(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getArray(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Date getDate(int parameterIndex, Calendar cal) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getDate(parameterIndex, cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Time getTime(int parameterIndex, Calendar cal) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getTime(parameterIndex, cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getTimestamp(parameterIndex, cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public URL getURL(String parameterName) throws SQLException { throw unsupported("url"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { return getTimestamp(getIndexForName(parameterName), cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Time getTime(String parameterName, Calendar cal) throws SQLException { return getTime(getIndexForName(parameterName), cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Date getDate(String parameterName, Calendar cal) throws SQLException { return getDate(getIndexForName(parameterName), cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Array getArray(String parameterName) throws SQLException { return getArray(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Clob getClob(String parameterName) throws SQLException { return getClob(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Blob getBlob(String parameterName) throws SQLException { return getBlob(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Ref getRef(String parameterName) throws SQLException { throw unsupported("ref"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Object getObject(String parameterName, Map<String, Class<?>> map) throws SQLException { throw unsupported("map"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public BigDecimal getBigDecimal(String parameterName) throws SQLException { return getBigDecimal(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Object getObject(String parameterName) throws SQLException { return getObject(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Timestamp getTimestamp(String parameterName) throws SQLException { return getTimestamp(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Time getTime(String parameterName) throws SQLException { return getTime(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Date getDate(String parameterName) throws SQLException { return getDate(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public byte[] getBytes(String parameterName) throws SQLException { return getBytes(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public double getDouble(String parameterName) throws SQLException { return getDouble(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public float getFloat(String parameterName) throws SQLException { return getFloat(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public long getLong(String parameterName) throws SQLException { return getLong(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public int getInt(String parameterName) throws SQLException { return getInt(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public short getShort(String parameterName) throws SQLException { return getShort(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public byte getByte(String parameterName) throws SQLException { return getByte(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public boolean getBoolean(String parameterName) throws SQLException { return getBoolean(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public String getString(String parameterName) throws SQLException { return getString(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public RowId getRowId(int parameterIndex) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public RowId getRowId(String parameterName) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public NClob getNClob(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getNClob(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public NClob getNClob(String parameterName) throws SQLException { return getNClob(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public SQLXML getSQLXML(int parameterIndex) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public SQLXML getSQLXML(String parameterName) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public String getNString(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getNString(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public String getNString(String parameterName) throws SQLException { return getNString(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Reader getNCharacterStream(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getNCharacterStream(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Reader getNCharacterStream(String parameterName) throws SQLException { return getNCharacterStream(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Reader getCharacterStream(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getCharacterStream(parameterIndex); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public Reader getCharacterStream(String parameterName) throws SQLException { return getCharacterStream(getIndexForName(parameterName)); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { setNull(getIndexForName(parameterName), sqlType, typeName); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNull(String parameterName, int sqlType) throws SQLException { setNull(getIndexForName(parameterName), sqlType); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { setTimestamp(getIndexForName(parameterName), x, cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { setTime(getIndexForName(parameterName), x, cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { setDate(getIndexForName(parameterName), x, cal); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setCharacterStream(String parameterName, Reader x, int length) throws SQLException { setCharacterStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setObject(String parameterName, Object x) throws SQLException { setObject(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { setObject(getIndexForName(parameterName), x, targetSqlType); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { setObject(getIndexForName(parameterName), x, targetSqlType, scale); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { setBinaryStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { setAsciiStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setTimestamp(String parameterName, Timestamp x) throws SQLException { setTimestamp(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setTime(String parameterName, Time x) throws SQLException { setTime(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setDate(String parameterName, Date x) throws SQLException { setDate(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBytes(String parameterName, byte[] x) throws SQLException { setBytes(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setString(String parameterName, String x) throws SQLException { setString(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { setBigDecimal(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setDouble(String parameterName, double x) throws SQLException { setDouble(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setFloat(String parameterName, float x) throws SQLException { setFloat(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setLong(String parameterName, long x) throws SQLException { setLong(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setInt(String parameterName, int x) throws SQLException { setInt(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setShort(String parameterName, short x) throws SQLException { setShort(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setByte(String parameterName, byte x) throws SQLException { setByte(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBoolean(String parameterName, boolean x) throws SQLException { setBoolean(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setURL(String parameterName, URL val) throws SQLException { throw unsupported("url"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setRowId(String parameterName, RowId x) throws SQLException { throw unsupported("rowId"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNString(String parameterName, String x) throws SQLException { setNString(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNCharacterStream(String parameterName, Reader x, long length) throws SQLException { setNCharacterStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNClob(String parameterName, NClob x) throws SQLException { setNClob(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setClob(String parameterName, Reader x, long length) throws SQLException { setClob(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBlob(String parameterName, InputStream x, long length) throws SQLException { setBlob(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNClob(String parameterName, Reader x, long length) throws SQLException { setNClob(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBlob(String parameterName, Blob x) throws SQLException { setBlob(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setClob(String parameterName, Clob x) throws SQLException { setClob(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setAsciiStream(String parameterName, InputStream x) throws SQLException { setAsciiStream(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { setAsciiStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBinaryStream(String parameterName, InputStream x) throws SQLException { setBinaryStream(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { setBinaryStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setBlob(String parameterName, InputStream x) throws SQLException { setBlob(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setCharacterStream(String parameterName, Reader x) throws SQLException { setCharacterStream(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setCharacterStream(String parameterName, Reader x, long length) throws SQLException { setCharacterStream(getIndexForName(parameterName), x, length); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setClob(String parameterName, Reader x) throws SQLException { setClob(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNCharacterStream(String parameterName, Reader x) throws SQLException { setNCharacterStream(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setNClob(String parameterName, Reader x) throws SQLException { setNClob(getIndexForName(parameterName), x); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
public void setSQLXML(String parameterName, SQLXML x) throws SQLException { throw unsupported("SQLXML"); }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
private ResultSetMetaData getCheckedMetaData() throws SQLException { ResultSetMetaData meta = getMetaData(); if (meta == null) { throw DbException.getUnsupportedException("Supported only for calling stored procedures"); } return meta; }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
private void registerOutParameter(int parameterIndex) throws SQLException { try { checkClosed(); if (outParameters == null) { maxOutParameters = Math.min( getParameterMetaData().getParameterCount(), getCheckedMetaData().getColumnCount()); outParameters = new BitField(); } checkIndexBounds(parameterIndex); ParameterInterface param = command.getParameters().get(--parameterIndex); if (param.getParamValue() == null) { param.setValue(ValueNull.INSTANCE, false); } outParameters.set(parameterIndex); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
private void checkRegistered(int parameterIndex) throws SQLException { try { checkIndexBounds(parameterIndex); if (!outParameters.get(parameterIndex - 1)) { throw DbException.getInvalidValueException("parameterIndex", parameterIndex); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
private int getIndexForName(String parameterName) throws SQLException { try { checkClosed(); if (namedParameters == null) { ResultSetMetaData meta = getCheckedMetaData(); int columnCount = meta.getColumnCount(); HashMap<String, Integer> map = New.hashMap(columnCount); for (int i = 1; i <= columnCount; i++) { map.put(meta.getColumnLabel(i), i); } namedParameters = map; } Integer index = namedParameters.get(parameterName); if (index == null) { throw DbException.getInvalidValueException("parameterName", parameterName); } return index; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcCallableStatement.java
private JdbcResultSet getOpenResultSet() throws SQLException { try { checkClosed(); if (resultSet == null) { throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } if (resultSet.isBeforeFirst()) { resultSet.next(); } return resultSet; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public long length() throws SQLException { try { debugCodeCall("length"); checkClosed(); if (value.getType() == Value.BLOB) { long precision = value.getPrecision(); if (precision > 0) { return precision; } } return IOUtils.copyAndCloseInput(value.getInputStream(), null); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public void truncate(long len) throws SQLException { throw unsupported("LOB update"); }
// in src/main/org/h2/jdbc/JdbcBlob.java
public byte[] getBytes(long pos, int length) throws SQLException { try { if (isDebugEnabled()) { debugCode("getBytes("+pos+", "+length+");"); } checkClosed(); ByteArrayOutputStream out = new ByteArrayOutputStream(); InputStream in = value.getInputStream(); try { IOUtils.skipFully(in, pos - 1); IOUtils.copy(in, out, length); } finally { in.close(); } return out.toByteArray(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public int setBytes(long pos, byte[] bytes) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBytes("+pos+", "+quoteBytes(bytes)+");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } value = conn.createBlob(new ByteArrayInputStream(bytes), -1); return bytes.length; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException { throw unsupported("LOB update"); }
// in src/main/org/h2/jdbc/JdbcBlob.java
public InputStream getBinaryStream() throws SQLException { try { debugCodeCall("getBinaryStream"); checkClosed(); return value.getInputStream(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public OutputStream setBinaryStream(long pos) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBinaryStream("+pos+");"); } checkClosed(); if (pos != 1) { throw DbException.getInvalidValueException("pos", pos); } if (value.getPrecision() != 0) { throw DbException.getInvalidValueException("length", value.getPrecision()); } final JdbcConnection c = conn; final PipedInputStream in = new PipedInputStream(); final Task task = new Task() { public void call() { value = c.createBlob(in, -1); } }; PipedOutputStream out = new PipedOutputStream(in) { public void close() throws IOException { super.close(); try { task.get(); } catch (Exception e) { throw DbException.convertToIOException(e); } } }; task.execute(); return new BufferedOutputStream(out); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcBlob.java
public long position(byte[] pattern, long start) throws SQLException { if (isDebugEnabled()) { debugCode("position("+quoteBytes(pattern)+", "+start+");"); } if (Constants.BLOB_SEARCH) { try { checkClosed(); if (pattern == null) { return -1; } if (pattern.length == 0) { return 1; } // TODO performance: blob pattern search is slow BufferedInputStream in = new BufferedInputStream(value.getInputStream()); IOUtils.skipFully(in, start - 1); int pos = 0; int patternPos = 0; while (true) { int x = in.read(); if (x < 0) { break; } if (x == (pattern[patternPos] & 0xff)) { if (patternPos == 0) { in.mark(pattern.length); } if (patternPos == pattern.length) { return pos - patternPos; } patternPos++; } else { if (patternPos > 0) { in.reset(); pos -= patternPos; } } pos++; } return -1; } catch (Exception e) { throw logAndConvert(e); } } throw unsupported("LOB search"); }
// in src/main/org/h2/jdbc/JdbcBlob.java
public long position(Blob blobPattern, long start) throws SQLException { if (isDebugEnabled()) { debugCode("position(blobPattern, "+start+");"); } if (Constants.BLOB_SEARCH) { try { checkClosed(); if (blobPattern == null) { return -1; } ByteArrayOutputStream out = new ByteArrayOutputStream(); InputStream in = blobPattern.getBinaryStream(); while (true) { int x = in.read(); if (x < 0) { break; } out.write(x); } return position(out.toByteArray(), start); } catch (Exception e) { throw logAndConvert(e); } } throw unsupported("LOB subset"); }
// in src/main/org/h2/jdbc/JdbcBlob.java
public InputStream getBinaryStream(long pos, long length) throws SQLException { throw unsupported("LOB update"); }
// in src/main/org/h2/jdbc/JdbcStatement.java
public ResultSet executeQuery(String sql) throws SQLException { try { int id = getNextId(TraceObject.RESULT_SET); if (isDebugEnabled()) { debugCodeAssign("ResultSet", TraceObject.RESULT_SET, id, "executeQuery(" + quote(sql) + ")"); } synchronized (session) { checkClosed(); closeOldResultSet(); sql = JdbcConnection.translateSQL(sql, escapeProcessing); CommandInterface command = conn.prepareCommand(sql, fetchSize); ResultInterface result; boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY; boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE; setExecutingStatement(command); try { result = command.executeQuery(maxRows, scrollable); } finally { setExecutingStatement(null); } command.close(); resultSet = new JdbcResultSet(conn, this, result, id, closedByResultSet, scrollable, updatable); } return resultSet; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int executeUpdate(String sql) throws SQLException { try { debugCodeCall("executeUpdate", sql); return executeUpdateInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
private int executeUpdateInternal(String sql) throws SQLException { checkClosedForWrite(); try { closeOldResultSet(); sql = JdbcConnection.translateSQL(sql, escapeProcessing); CommandInterface command = conn.prepareCommand(sql, fetchSize); synchronized (session) { setExecutingStatement(command); try { updateCount = command.executeUpdate(); } finally { setExecutingStatement(null); } } command.close(); return updateCount; } finally { afterWriting(); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean execute(String sql) throws SQLException { try { debugCodeCall("execute", sql); return executeInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
private boolean executeInternal(String sql) throws SQLException { int id = getNextId(TraceObject.RESULT_SET); checkClosedForWrite(); try { closeOldResultSet(); sql = JdbcConnection.translateSQL(sql, escapeProcessing); CommandInterface command = conn.prepareCommand(sql, fetchSize); boolean returnsResultSet; synchronized (session) { setExecutingStatement(command); try { if (command.isQuery()) { returnsResultSet = true; boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY; boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE; ResultInterface result = command.executeQuery(maxRows, scrollable); resultSet = new JdbcResultSet(conn, this, result, id, closedByResultSet, scrollable, updatable); } else { returnsResultSet = false; updateCount = command.executeUpdate(); } } finally { setExecutingStatement(null); } } command.close(); return returnsResultSet; } finally { afterWriting(); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public ResultSet getResultSet() throws SQLException { try { checkClosed(); if (resultSet != null) { int id = resultSet.getTraceId(); debugCodeAssign("ResultSet", TraceObject.RESULT_SET, id, "getResultSet()"); } else { debugCodeCall("getResultSet"); } return resultSet; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getUpdateCount() throws SQLException { try { debugCodeCall("getUpdateCount"); checkClosed(); return updateCount; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void close() throws SQLException { try { debugCodeCall("close"); synchronized (session) { closeOldResultSet(); if (conn != null) { conn = null; } } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public SQLWarning getWarnings() throws SQLException { try { debugCodeCall("getWarnings"); checkClosed(); return null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void clearWarnings() throws SQLException { try { debugCodeCall("clearWarnings"); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setCursorName(String name) throws SQLException { try { debugCodeCall("setCursorName", name); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setFetchDirection(int direction) throws SQLException { try { debugCodeCall("setFetchDirection", direction); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getFetchDirection() throws SQLException { try { debugCodeCall("getFetchDirection"); checkClosed(); return ResultSet.FETCH_FORWARD; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getMaxRows() throws SQLException { try { debugCodeCall("getMaxRows"); checkClosed(); return maxRows; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setMaxRows(int maxRows) throws SQLException { try { debugCodeCall("setMaxRows", maxRows); checkClosed(); if (maxRows < 0) { throw DbException.getInvalidValueException("maxRows", maxRows); } this.maxRows = maxRows; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setFetchSize(int rows) throws SQLException { try { debugCodeCall("setFetchSize", rows); checkClosed(); if (rows < 0 || (rows > 0 && maxRows > 0 && rows > maxRows)) { throw DbException.getInvalidValueException("rows", rows); } if (rows == 0) { rows = SysProperties.SERVER_RESULT_SET_FETCH_SIZE; } fetchSize = rows; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getFetchSize() throws SQLException { try { debugCodeCall("getFetchSize"); checkClosed(); return fetchSize; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getResultSetConcurrency() throws SQLException { try { debugCodeCall("getResultSetConcurrency"); checkClosed(); return resultSetConcurrency; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getResultSetType() throws SQLException { try { debugCodeCall("getResultSetType"); checkClosed(); return resultSetType; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getMaxFieldSize() throws SQLException { try { debugCodeCall("getMaxFieldSize"); checkClosed(); return 0; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setMaxFieldSize(int max) throws SQLException { try { debugCodeCall("setMaxFieldSize", max); checkClosed(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setEscapeProcessing(boolean enable) throws SQLException { try { if (isDebugEnabled()) { debugCode("setEscapeProcessing("+enable+");"); } checkClosed(); escapeProcessing = enable; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void cancel() throws SQLException { try { debugCodeCall("cancel"); checkClosed(); // executingCommand can be reset by another thread CommandInterface c = executingCommand; try { if (c != null) { c.cancel(); } } finally { setExecutingStatement(null); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getQueryTimeout() throws SQLException { try { debugCodeCall("getQueryTimeout"); checkClosed(); return conn.getQueryTimeout(); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void setQueryTimeout(int seconds) throws SQLException { try { debugCodeCall("setQueryTimeout", seconds); checkClosed(); if (seconds < 0) { throw DbException.getInvalidValueException("seconds", seconds); } conn.setQueryTimeout(seconds); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void addBatch(String sql) throws SQLException { try { debugCodeCall("addBatch", sql); checkClosed(); sql = JdbcConnection.translateSQL(sql, escapeProcessing); if (batchCommands == null) { batchCommands = New.arrayList(); } batchCommands.add(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public void clearBatch() throws SQLException { try { debugCodeCall("clearBatch"); checkClosed(); batchCommands = null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int[] executeBatch() throws SQLException { try { debugCodeCall("executeBatch"); checkClosedForWrite(); try { if (batchCommands == null) { // TODO batch: check what other database do if no commands are set batchCommands = New.arrayList(); } int size = batchCommands.size(); int[] result = new int[size]; boolean error = false; SQLException next = null; for (int i = 0; i < size; i++) { String sql = batchCommands.get(i); try { result[i] = executeUpdateInternal(sql); } catch (Exception re) { SQLException e = logAndConvert(re); if (next == null) { next = e; } else { e.setNextException(next); next = e; } result[i] = Statement.EXECUTE_FAILED; error = true; } } batchCommands = null; if (error) { throw new JdbcBatchUpdateException(next, result); } return result; } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public ResultSet getGeneratedKeys() throws SQLException { try { int id = getNextId(TraceObject.RESULT_SET); if (isDebugEnabled()) { debugCodeAssign("ResultSet", TraceObject.RESULT_SET, id, "getGeneratedKeys()"); } checkClosed(); return conn.getGeneratedKeys(this, id); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean getMoreResults() throws SQLException { try { debugCodeCall("getMoreResults"); checkClosed(); closeOldResultSet(); return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean getMoreResults(int current) throws SQLException { try { debugCodeCall("getMoreResults", current); switch (current) { case Statement.CLOSE_CURRENT_RESULT: case Statement.CLOSE_ALL_RESULTS: checkClosed(); closeOldResultSet(); break; case Statement.KEEP_CURRENT_RESULT: // nothing to do break; default: throw DbException.getInvalidValueException("current", current); } return false; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { try { if (isDebugEnabled()) { debugCode("executeUpdate("+quote(sql)+", "+autoGeneratedKeys+");"); } return executeUpdateInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { try { if (isDebugEnabled()) { debugCode("executeUpdate("+quote(sql)+", "+quoteIntArray(columnIndexes)+");"); } return executeUpdateInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int executeUpdate(String sql, String[] columnNames) throws SQLException { try { if (isDebugEnabled()) { debugCode("executeUpdate("+quote(sql)+", "+quoteArray(columnNames)+");"); } return executeUpdateInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { try { if (isDebugEnabled()) { debugCode("execute("+quote(sql)+", "+autoGeneratedKeys+");"); } return executeInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean execute(String sql, int[] columnIndexes) throws SQLException { try { if (isDebugEnabled()) { debugCode("execute("+quote(sql)+", "+quoteIntArray(columnIndexes)+");"); } return executeInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean execute(String sql, String[] columnNames) throws SQLException { try { if (isDebugEnabled()) { debugCode("execute("+quote(sql)+", "+quoteArray(columnNames)+");"); } return executeInternal(sql); } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public int getResultSetHoldability() throws SQLException { try { debugCodeCall("getResultSetHoldability"); checkClosed(); return ResultSet.HOLD_CURSORS_OVER_COMMIT; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
protected void closeOldResultSet() throws SQLException { try { if (!closedByResultSet) { if (resultSet != null) { resultSet.closeInternal(); } } } finally { resultSet = null; updateCount = -1; } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean isClosed() throws SQLException { try { debugCodeCall("isClosed"); return conn == null; } catch (Exception e) { throw logAndConvert(e); } }
// in src/main/org/h2/jdbc/JdbcStatement.java
public <T> T unwrap(Class<T> iface) throws SQLException { throw unsupported("unwrap"); }
// in src/main/org/h2/jdbc/JdbcStatement.java
public boolean isWrapperFor(Class<?> iface) throws SQLException { throw unsupported("isWrapperFor"); }
// in src/main/org/h2/bnf/Bnf.java
public static Bnf getInstance(Reader csv) throws SQLException, IOException { Bnf bnf = new Bnf(); if (csv == null) { byte[] data = Utils.getResource("/org/h2/res/help.csv"); csv = new InputStreamReader(new ByteArrayInputStream(data)); } bnf.parse(csv); return bnf; }
// in src/main/org/h2/bnf/Bnf.java
private void parse(Reader reader) throws SQLException, IOException { Rule functions = null; statements = New.arrayList(); Csv csv = new Csv(); csv.setLineCommentCharacter('#'); ResultSet rs = csv.read(reader, null); while (rs.next()) { String section = rs.getString("SECTION").trim(); if (section.startsWith("System")) { continue; } String topic = rs.getString("TOPIC"); syntax = rs.getString("SYNTAX").trim(); currentTopic = section; tokens = tokenize(); index = 0; Rule rule = parseRule(); if (section.startsWith("Command")) { rule = new RuleList(rule, new RuleElement(";\n\n", currentTopic), false); } RuleHead head = addRule(topic, section, rule); if (section.startsWith("Function")) { if (functions == null) { functions = rule; } else { functions = new RuleList(rule, functions, true); } } else if (section.startsWith("Commands")) { statements.add(head); } } addRule("@func@", "Function", functions); addFixedRule("@ymd@", RuleFixed.YMD); addFixedRule("@hms@", RuleFixed.HMS); addFixedRule("@nanos@", RuleFixed.NANOS); addFixedRule("anything_except_single_quote", RuleFixed.ANY_EXCEPT_SINGLE_QUOTE); addFixedRule("anything_except_double_quote", RuleFixed.ANY_EXCEPT_DOUBLE_QUOTE); addFixedRule("anything_until_end_of_line", RuleFixed.ANY_UNTIL_EOL); addFixedRule("anything_until_end_comment", RuleFixed.ANY_UNTIL_END); addFixedRule("anything_except_two_dollar_signs", RuleFixed.ANY_EXCEPT_2_DOLLAR); addFixedRule("anything", RuleFixed.ANY_WORD); addFixedRule("@hex_start@", RuleFixed.HEX_START); addFixedRule("@concat@", RuleFixed.CONCAT); addFixedRule("@az_@", RuleFixed.AZ_UNDERSCORE); addFixedRule("@af@", RuleFixed.AF); addFixedRule("@digit@", RuleFixed.DIGIT); addFixedRule("@open_bracket@", RuleFixed.OPEN_BRACKET); addFixedRule("@close_bracket@", RuleFixed.CLOSE_BRACKET); }
// in src/main/org/h2/util/JdbcUtils.java
public static Connection getConnection(String driver, String url, String user, String password) throws SQLException { Properties prop = new Properties(); if (user != null) { prop.setProperty("user", user); } if (password != null) { prop.setProperty("password", password); } return getConnection(driver, url, prop); }
// in src/main/org/h2/util/JdbcUtils.java
public static Connection getConnection(String driver, String url, Properties prop) throws SQLException { if (StringUtils.isNullOrEmpty(driver)) { JdbcUtils.load(url); } else { Class<?> d = Utils.loadUserClass(driver); if (java.sql.Driver.class.isAssignableFrom(d)) { return DriverManager.getConnection(url, prop); } else if (javax.naming.Context.class.isAssignableFrom(d)) { // JNDI context try { Context context = (Context) d.newInstance(); DataSource ds = (DataSource) context.lookup(url); String user = prop.getProperty("user"); String password = prop.getProperty("password"); if (StringUtils.isNullOrEmpty(user) && StringUtils.isNullOrEmpty(password)) { return ds.getConnection(); } return ds.getConnection(user, password); } catch (Exception e) { throw DbException.toSQLException(e); } } else { // don't know, but maybe it loaded a JDBC Driver return DriverManager.getConnection(url, prop); } } return DriverManager.getConnection(url, prop); }
// in src/main/org/h2/util/Tool.java
protected SQLException showUsageAndThrowUnsupportedOption(String option) throws SQLException { showUsage(); throw throwUnsupportedOption(option); }
// in src/main/org/h2/util/Tool.java
protected SQLException throwUnsupportedOption(String option) throws SQLException { throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, option).getSQLException(); }
// in src/main/org/h2/server/TcpServer.java
private void initManagementDb() throws SQLException { Properties prop = new Properties(); prop.setProperty("user", ""); prop.setProperty("password", managementPassword); // avoid using the driver manager Connection conn = Driver.load().connect("jdbc:h2:" + getManagementDbName(port), prop); managementDb = conn; Statement stat = null; try { stat = conn.createStatement(); stat.execute("CREATE ALIAS IF NOT EXISTS STOP_SERVER FOR \"" + TcpServer.class.getName() + ".stopServer\""); stat.execute("CREATE TABLE IF NOT EXISTS SESSIONS(ID INT PRIMARY KEY, URL VARCHAR, USER VARCHAR, CONNECTED TIMESTAMP)"); managementDbAdd = conn.prepareStatement("INSERT INTO SESSIONS VALUES(?, ?, ?, NOW())"); managementDbRemove = conn.prepareStatement("DELETE FROM SESSIONS WHERE ID=?"); } finally { JdbcUtils.closeSilently(stat); } SERVERS.put(port, this); }
// in src/main/org/h2/server/TcpServer.java
public synchronized void start() throws SQLException { stop = false; try { serverSocket = NetUtils.createServerSocket(port, ssl); } catch (DbException e) { if (!portIsSet) { serverSocket = NetUtils.createServerSocket(0, ssl); } else { throw e; } } port = serverSocket.getLocalPort(); initManagementDb(); }
// in src/main/org/h2/server/TcpServer.java
public static synchronized void shutdown(String url, String password, boolean force, boolean all) throws SQLException { try { int port = Constants.DEFAULT_TCP_PORT; int idx = url.lastIndexOf(':'); if (idx >= 0) { String p = url.substring(idx + 1); if (StringUtils.isNumber(p)) { port = Integer.decode(p); } } String db = getManagementDbName(port); try { org.h2.Driver.load(); } catch (Throwable e) { throw DbException.convert(e); } for (int i = 0; i < 2; i++) { Connection conn = null; PreparedStatement prep = null; try { conn = DriverManager.getConnection("jdbc:h2:" + url + "/" + db, "", password); prep = conn.prepareStatement("CALL STOP_SERVER(?, ?, ?)"); prep.setInt(1, all ? 0 : port); prep.setString(2, password); prep.setInt(3, force ? SHUTDOWN_FORCE : SHUTDOWN_NORMAL); try { prep.execute(); } catch (SQLException e) { if (force) { // ignore } else { if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } } } break; } catch (SQLException e) { if (i == 1) { throw e; } } finally { JdbcUtils.closeSilently(prep); JdbcUtils.closeSilently(conn); } } } catch (Exception e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/server/pg/PgServer.java
public static String getIndexColumn(Connection conn, int indexId, Integer ordinalPosition, Boolean pretty) throws SQLException { if (ordinalPosition == null || ordinalPosition.intValue() == 0) { PreparedStatement prep = conn.prepareStatement("select sql from information_schema.indexes where id=?"); prep.setInt(1, indexId); ResultSet rs = prep.executeQuery(); if (rs.next()) { return rs.getString(1); } return ""; } PreparedStatement prep = conn.prepareStatement( "select column_name from information_schema.indexes where id=? and ordinal_position=?"); prep.setInt(1, indexId); prep.setInt(2, ordinalPosition.intValue()); ResultSet rs = prep.executeQuery(); if (rs.next()) { return rs.getString(1); } return ""; }
// in src/main/org/h2/server/pg/PgServer.java
public static String getCurrentSchema(Connection conn) throws SQLException { ResultSet rs = conn.createStatement().executeQuery("call schema()"); rs.next(); return rs.getString(1); }
// in src/main/org/h2/server/pg/PgServer.java
public static int getOid(Connection conn, String tableName) throws SQLException { if (tableName.startsWith("\"") && tableName.endsWith("\"")) { tableName = tableName.substring(1, tableName.length() - 1); } PreparedStatement prep = conn.prepareStatement("select oid from pg_class where relName = ?"); prep.setString(1, tableName); ResultSet rs = prep.executeQuery(); if (!rs.next()) { return 0; } return rs.getInt(1); }
// in src/main/org/h2/server/pg/PgServer.java
public static String getUserById(Connection conn, int id) throws SQLException { PreparedStatement prep = conn.prepareStatement("SELECT NAME FROM INFORMATION_SCHEMA.USERS WHERE ID=?"); prep.setInt(1, id); ResultSet rs = prep.executeQuery(); if (rs.next()) { return rs.getString(1); } return null; }
// in src/main/org/h2/server/pg/PgServerThread.java
private void setParameter(PreparedStatement prep, int i, byte[] d2, int[] formatCodes) throws SQLException { boolean text = (i >= formatCodes.length) || (formatCodes[i] == 0); String s; try { if (text) { s = new String(d2, getEncoding()); } else { server.trace("Binary format not supported"); s = new String(d2, getEncoding()); } } catch (Exception e) { server.traceError(e); s = null; } // if(server.getLog()) { // server.log(" " + i + ": " + s); // } prep.setString(i + 1, s); }
// in src/main/org/h2/server/pg/PgServerThread.java
private void initDb() throws SQLException { Statement stat = null; ResultSet rs = null; try { synchronized (server) { // better would be: set the database to exclusive mode rs = conn.getMetaData().getTables(null, "PG_CATALOG", "PG_VERSION", null); boolean tableFound = rs.next(); stat = conn.createStatement(); if (!tableFound) { installPgCatalog(stat); } rs = stat.executeQuery("SELECT * FROM PG_CATALOG.PG_VERSION"); if (!rs.next() || rs.getInt(1) < 2) { // installation incomplete, or old version installPgCatalog(stat); } else { // version 2 or newer: check the read version int versionRead = rs.getInt(2); if (versionRead > 2) { throw DbException.throwInternalError("Incompatible PG_VERSION"); } } } stat.execute("set search_path = PUBLIC, pg_catalog"); HashSet<Integer> typeSet = server.getTypeSet(); if (typeSet.size() == 0) { rs = stat.executeQuery("SELECT OID FROM PG_CATALOG.PG_TYPE"); while (rs.next()) { typeSet.add(rs.getInt(1)); } } } finally { JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(rs); } }
// in src/main/org/h2/server/pg/PgServerThread.java
private static void installPgCatalog(Statement stat) throws SQLException { Reader r = null; try { r = new InputStreamReader(new ByteArrayInputStream(Utils .getResource("/org/h2/server/pg/pg_catalog.sql"))); ScriptReader reader = new ScriptReader(r); while (true) { String sql = reader.readStatement(); if (sql == null) { break; } stat.execute(sql); } reader.close(); } catch (IOException e) { throw DbException.convertIOException(e, "Can not read pg_catalog resource"); } finally { IOUtils.closeSilently(r); } }
// in src/main/org/h2/server/web/DbSchema.java
void readTables(DatabaseMetaData meta, String[] tableTypes) throws SQLException { ResultSet rs = meta.getTables(null, name, null, tableTypes); ArrayList<DbTableOrView> list = New.arrayList(); while (rs.next()) { DbTableOrView table = new DbTableOrView(this, rs); if (contents.isOracle && table.name.indexOf('$') > 0) { continue; } list.add(table); } rs.close(); tables = new DbTableOrView[list.size()]; list.toArray(tables); if (tables.length < MAX_TABLES_LIST_COLUMNS) { for (DbTableOrView tab : tables) { tab.readColumns(meta); } } }
// in src/main/org/h2/server/web/DbContents.java
synchronized void readContents(DatabaseMetaData meta) throws SQLException { String prod = StringUtils.toLowerEnglish(meta.getDatabaseProductName()); isSQLite = prod.indexOf("sqlite") >= 0; String url = meta.getURL(); if (url != null) { isH2 = url.startsWith("jdbc:h2:"); if (isH2) { Statement stat = meta.getConnection().createStatement(); ResultSet rs = stat.executeQuery( "SELECT UPPER(VALUE) FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME='MODE'"); rs.next(); if ("MYSQL".equals(rs.getString(1))) { isH2ModeMySQL = true; } rs.close(); stat.close(); } isOracle = url.startsWith("jdbc:oracle:"); isPostgreSQL = url.startsWith("jdbc:postgresql:"); // isHSQLDB = url.startsWith("jdbc:hsqldb:"); isMySQL = url.startsWith("jdbc:mysql:"); isDerby = url.startsWith("jdbc:derby:"); isFirebird = url.startsWith("jdbc:firebirdsql:"); isMSSQLServer = url.startsWith("jdbc:sqlserver:"); } storedUpperCaseIdentifiers = meta.storesUpperCaseIdentifiers(); String defaultSchemaName = getDefaultSchemaName(meta); String[] schemaNames = getSchemaNames(meta); schemas = new DbSchema[schemaNames.length]; for (int i = 0; i < schemaNames.length; i++) { String schemaName = schemaNames[i]; boolean isDefault = defaultSchemaName == null || defaultSchemaName.equals(schemaName); DbSchema schema = new DbSchema(this, schemaName, isDefault); if (schema.isDefault) { defaultSchema = schema; } schemas[i] = schema; String[] tableTypes = { "TABLE", "SYSTEM TABLE", "VIEW", "SYSTEM VIEW", "TABLE LINK", "SYNONYM" }; schema.readTables(meta, tableTypes); } if (defaultSchema == null) { String best = null; for (DbSchema schema : schemas) { if ("dbo".equals(schema.name)) { // MS SQL Server defaultSchema = schema; break; } if (defaultSchema == null || best == null || schema.name.length() < best.length()) { best = schema.name; defaultSchema = schema; } } } }
// in src/main/org/h2/server/web/DbContents.java
private String[] getSchemaNames(DatabaseMetaData meta) throws SQLException { if (isMySQL || isSQLite) { return new String[] { "" }; } else if (isFirebird) { return new String[] { null }; } ResultSet rs = meta.getSchemas(); ArrayList<String> schemaList = New.arrayList(); while (rs.next()) { String schema = rs.getString(findColumn(rs, "TABLE_SCHEM", 1)); if (isOracle) { for (String ignore : new String[] { "CTXSYS", "DIP", "DBSNMP", "DMSYS", "EXFSYS", "FLOWS_020100", "FLOWS_FILES", "MDDATA", "MDSYS", "MGMT_VIEW", "OLAPSYS", "ORDSYS", "ORDPLUGINS", "OUTLN", "SI_INFORMTN_SCHEMA", "SYS", "SYSMAN", "SYSTEM", "TSMSYS", "WMSYS", "XDB" }) { if (ignore.equals(schema)) { schema = null; break; } } } else if (isMSSQLServer) { for (String ignore : new String[] { "sys", "db_accessadmin", "db_backupoperator", "db_datareader", "db_datawriter", "db_ddladmin", "db_denydatareader", "db_denydatawriter", "db_owner", "db_securityadmin" }) { if (ignore.equals(schema)) { schema = null; break; } } } if (schema == null) { continue; } schemaList.add(schema); } rs.close(); String[] list = new String[schemaList.size()]; schemaList.toArray(list); return list; }
// in src/main/org/h2/server/web/WebApp.java
private static int addIndexes(boolean mainSchema, DatabaseMetaData meta, String table, String schema, StringBuilder buff, int treeIndex) throws SQLException { ResultSet rs; try { rs = meta.getIndexInfo(null, schema, table, false, true); } catch (SQLException e) { // SQLite return treeIndex; } HashMap<String, IndexInfo> indexMap = New.hashMap(); while (rs.next()) { String name = rs.getString("INDEX_NAME"); IndexInfo info = indexMap.get(name); if (info == null) { int t = rs.getInt("TYPE"); String type; if (t == DatabaseMetaData.tableIndexClustered) { type = ""; } else if (t == DatabaseMetaData.tableIndexHashed) { type = " (${text.tree.hashed})"; } else if (t == DatabaseMetaData.tableIndexOther) { type = ""; } else { type = null; } if (name != null && type != null) { info = new IndexInfo(); info.name = name; type = (rs.getBoolean("NON_UNIQUE") ? "${text.tree.nonUnique}" : "${text.tree.unique}") + type; info.type = type; info.columns = rs.getString("COLUMN_NAME"); indexMap.put(name, info); } } else { info.columns += ", " + rs.getString("COLUMN_NAME"); } } rs.close(); if (indexMap.size() > 0) { String level = mainSchema ? ", 1, 1" : ", 2, 1"; String levelIndex = mainSchema ? ", 2, 1" : ", 3, 1"; String levelColumnType = mainSchema ? ", 3, 2" : ", 4, 2"; buff.append("setNode(" + treeIndex + level + ", 'index_az', '${text.tree.indexes}', null);\n"); treeIndex++; for (IndexInfo info : indexMap.values()) { buff.append("setNode(" + treeIndex + levelIndex + ", 'index', '" + PageParser.escapeJavaScript(info.name) + "', null);\n"); treeIndex++; buff.append("setNode(" + treeIndex + levelColumnType + ", 'type', '" + info.type + "', null);\n"); treeIndex++; buff.append("setNode(" + treeIndex + levelColumnType + ", 'type', '" + PageParser.escapeJavaScript(info.columns) + "', null);\n"); treeIndex++; } } return treeIndex; }
// in src/main/org/h2/server/web/WebApp.java
private int addTablesAndViews(DbSchema schema, boolean mainSchema, StringBuilder buff, int treeIndex) throws SQLException { if (schema == null) { return treeIndex; } Connection conn = session.getConnection(); DatabaseMetaData meta = session.getMetaData(); int level = mainSchema ? 0 : 1; boolean showColumns = mainSchema || !schema.isSystem; String indentation = ", " + level + ", " + (showColumns ? "1" : "2") + ", "; String indentNode = ", " + (level + 1) + ", 2, "; DbTableOrView[] tables = schema.tables; if (tables == null) { return treeIndex; } boolean isOracle = schema.contents.isOracle; boolean notManyTables = tables.length < DbSchema.MAX_TABLES_LIST_INDEXES; for (DbTableOrView table : tables) { if (table.isView) { continue; } int tableId = treeIndex; String tab = table.quotedName; if (!mainSchema) { tab = schema.quotedName + "." + tab; } tab = escapeIdentifier(tab); buff.append("setNode(" + treeIndex + indentation + " 'table', '" + PageParser.escapeJavaScript(table.name) + "', 'javascript:ins(\\'" + tab + "\\',true)');\n"); treeIndex++; if (mainSchema || showColumns) { StringBuilder columnsBuffer = new StringBuilder(); treeIndex = addColumns(mainSchema, table, buff, treeIndex, notManyTables, columnsBuffer); if (!isOracle && notManyTables) { treeIndex = addIndexes(mainSchema, meta, table.name, schema.name, buff, treeIndex); } buff.append("addTable('" + PageParser.escapeJavaScript(table.name) + "', '" + PageParser.escapeJavaScript(columnsBuffer.toString()) + "', " + tableId + ");\n"); } } tables = schema.tables; for (DbTableOrView view : tables) { if (!view.isView) { continue; } int tableId = treeIndex; String tab = view.quotedName; if (!mainSchema) { tab = view.schema.quotedName + "." + tab; } tab = escapeIdentifier(tab); buff.append("setNode(" + treeIndex + indentation + " 'view', '" + PageParser.escapeJavaScript(view.name) + "', 'javascript:ins(\\'" + tab + "\\',true)');\n"); treeIndex++; if (mainSchema) { StringBuilder columnsBuffer = new StringBuilder(); treeIndex = addColumns(mainSchema, view, buff, treeIndex, notManyTables, columnsBuffer); if (schema.contents.isH2) { PreparedStatement prep = null; try { prep = conn.prepareStatement("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME=?"); prep.setString(1, view.name); ResultSet rs = prep.executeQuery(); if (rs.next()) { String sql = rs.getString("SQL"); buff.append("setNode(" + treeIndex + indentNode + " 'type', '" + PageParser.escapeJavaScript(sql) + "', null);\n"); treeIndex++; } rs.close(); } finally { JdbcUtils.closeSilently(prep); } } buff.append("addTable('" + PageParser.escapeJavaScript(view.name) + "', '" + PageParser.escapeJavaScript(columnsBuffer.toString()) + "', " + tableId + ");\n"); } } return treeIndex; }
// in src/main/org/h2/server/web/WebApp.java
private ResultSet getMetaResultSet(Connection conn, String sql) throws SQLException { DatabaseMetaData meta = conn.getMetaData(); if (isBuiltIn(sql, "@best_row_identifier")) { String[] p = split(sql); int scale = p[4] == null ? 0 : Integer.parseInt(p[4]); boolean nullable = p[5] == null ? false : Boolean.valueOf(p[5]).booleanValue(); return meta.getBestRowIdentifier(p[1], p[2], p[3], scale, nullable); } else if (isBuiltIn(sql, "@catalogs")) { return meta.getCatalogs(); } else if (isBuiltIn(sql, "@columns")) { String[] p = split(sql); return meta.getColumns(p[1], p[2], p[3], p[4]); } else if (isBuiltIn(sql, "@column_privileges")) { String[] p = split(sql); return meta.getColumnPrivileges(p[1], p[2], p[3], p[4]); } else if (isBuiltIn(sql, "@cross_references")) { String[] p = split(sql); return meta.getCrossReference(p[1], p[2], p[3], p[4], p[5], p[6]); } else if (isBuiltIn(sql, "@exported_keys")) { String[] p = split(sql); return meta.getExportedKeys(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@imported_keys")) { String[] p = split(sql); return meta.getImportedKeys(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@index_info")) { String[] p = split(sql); boolean unique = p[4] == null ? false : Boolean.valueOf(p[4]).booleanValue(); boolean approx = p[5] == null ? false : Boolean.valueOf(p[5]).booleanValue(); return meta.getIndexInfo(p[1], p[2], p[3], unique, approx); } else if (isBuiltIn(sql, "@primary_keys")) { String[] p = split(sql); return meta.getPrimaryKeys(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@procedures")) { String[] p = split(sql); return meta.getProcedures(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@procedure_columns")) { String[] p = split(sql); return meta.getProcedureColumns(p[1], p[2], p[3], p[4]); } else if (isBuiltIn(sql, "@schemas")) { return meta.getSchemas(); } else if (isBuiltIn(sql, "@tables")) { String[] p = split(sql); String[] types = p[4] == null ? null : StringUtils.arraySplit(p[4], ',', false); return meta.getTables(p[1], p[2], p[3], types); } else if (isBuiltIn(sql, "@table_privileges")) { String[] p = split(sql); return meta.getTablePrivileges(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@table_types")) { return meta.getTableTypes(); } else if (isBuiltIn(sql, "@type_info")) { return meta.getTypeInfo(); } else if (isBuiltIn(sql, "@udts")) { String[] p = split(sql); int[] types; if (p[4] == null) { types = null; } else { String[] t = StringUtils.arraySplit(p[4], ',', false); types = new int[t.length]; for (int i = 0; i < t.length; i++) { types[i] = Integer.parseInt(t[i]); } } return meta.getUDTs(p[1], p[2], p[3], types); } else if (isBuiltIn(sql, "@version_columns")) { String[] p = split(sql); return meta.getVersionColumns(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@memory")) { SimpleResultSet rs = new SimpleResultSet(); rs.addColumn("Type", Types.VARCHAR, 0, 0); rs.addColumn("KB", Types.VARCHAR, 0, 0); rs.addRow("Used Memory", "" + Utils.getMemoryUsed()); rs.addRow("Free Memory", "" + Utils.getMemoryFree()); return rs; } else if (isBuiltIn(sql, "@info")) { SimpleResultSet rs = new SimpleResultSet(); rs.addColumn("KEY", Types.VARCHAR, 0, 0); rs.addColumn("VALUE", Types.VARCHAR, 0, 0); rs.addRow("conn.getCatalog", conn.getCatalog()); rs.addRow("conn.getAutoCommit", "" + conn.getAutoCommit()); rs.addRow("conn.getTransactionIsolation", "" + conn.getTransactionIsolation()); rs.addRow("conn.getWarnings", "" + conn.getWarnings()); String map; try { map = "" + conn.getTypeMap(); } catch (SQLException e) { map = e.toString(); } rs.addRow("conn.getTypeMap", "" + map); rs.addRow("conn.isReadOnly", "" + conn.isReadOnly()); rs.addRow("conn.getHoldability", "" + conn.getHoldability()); addDatabaseMetaData(rs, meta); return rs; } else if (isBuiltIn(sql, "@attributes")) { String[] p = split(sql); return meta.getAttributes(p[1], p[2], p[3], p[4]); } else if (isBuiltIn(sql, "@super_tables")) { String[] p = split(sql); return meta.getSuperTables(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@super_types")) { String[] p = split(sql); return meta.getSuperTypes(p[1], p[2], p[3]); } else if (isBuiltIn(sql, "@prof_stop")) { if (profiler != null) { profiler.stopCollecting(); SimpleResultSet rs = new SimpleResultSet(); rs.addColumn("Top Stack Trace(s)", Types.VARCHAR, 0, 0); rs.addRow(profiler.getTop(3)); profiler = null; return rs; } } return null; }
// in src/main/org/h2/server/web/WebApp.java
private String executeLoop(Connection conn, int count, String sql) throws SQLException { ArrayList<Integer> params = New.arrayList(); int idx = 0; while (!stop) { idx = sql.indexOf('?', idx); if (idx < 0) { break; } if (isBuiltIn(sql.substring(idx), "?/*rnd*/")) { params.add(1); sql = sql.substring(0, idx) + "?" + sql.substring(idx + "/*rnd*/".length() + 1); } else { params.add(0); } idx++; } boolean prepared; Random random = new Random(1); long time = System.currentTimeMillis(); if (isBuiltIn(sql, "@statement")) { sql = sql.substring("@statement".length()).trim(); prepared = false; Statement stat = conn.createStatement(); for (int i = 0; !stop && i < count; i++) { String s = sql; for (Integer type : params) { idx = s.indexOf('?'); if (type.intValue() == 1) { s = s.substring(0, idx) + random.nextInt(count) + s.substring(idx + 1); } else { s = s.substring(0, idx) + i + s.substring(idx + 1); } } if (stat.execute(s)) { ResultSet rs = stat.getResultSet(); while (!stop && rs.next()) { // maybe get the data as well } rs.close(); } } } else { prepared = true; PreparedStatement prep = conn.prepareStatement(sql); for (int i = 0; !stop && i < count; i++) { for (int j = 0; j < params.size(); j++) { Integer type = params.get(j); if (type.intValue() == 1) { prep.setInt(j + 1, random.nextInt(count)); } else { prep.setInt(j + 1, i); } } if (session.getContents().isSQLite) { // SQLite currently throws an exception on prep.execute() prep.executeUpdate(); } else { if (prep.execute()) { ResultSet rs = prep.getResultSet(); while (!stop && rs.next()) { // maybe get the data as well } rs.close(); } } } } time = System.currentTimeMillis() - time; StatementBuilder buff = new StatementBuilder(); buff.append(time).append(" ms: ").append(count).append(" * "); if (prepared) { buff.append("(Prepared) "); } else { buff.append("(Statement) "); } buff.append('('); for (int p : params) { buff.appendExceptFirst(", "); buff.append(p == 0 ? "i" : "rnd"); } return buff.append(") ").append(sql).toString(); }
// in src/main/org/h2/server/web/WebApp.java
private static String getParameterResultSet(ParameterMetaData meta) throws SQLException { StringBuilder buff = new StringBuilder(); if (meta == null) { return "No parameter meta data"; } buff.append("<table cellspacing=0 cellpadding=0>"). append("<tr><th>className</th><th>mode</th><th>type</th>"). append("<th>typeName</th><th>precision</th><th>scale</th></tr>"); for (int i = 0; i < meta.getParameterCount(); i++) { buff.append("</tr><td>"). append(meta.getParameterClassName(i + 1)). append("</td><td>"). append(meta.getParameterMode(i + 1)). append("</td><td>"). append(meta.getParameterType(i + 1)). append("</td><td>"). append(meta.getParameterTypeName(i + 1)). append("</td><td>"). append(meta.getPrecision(i + 1)). append("</td><td>"). append(meta.getScale(i + 1)). append("</td></tr>"); } buff.append("</table>"); return buff.toString(); }
// in src/main/org/h2/server/web/WebApp.java
private String getResultSet(String sql, ResultSet rs, boolean metadata, boolean list, boolean edit, long time, boolean allowEdit) throws SQLException { int maxrows = getMaxrows(); time = System.currentTimeMillis() - time; StringBuilder buff = new StringBuilder(); if (edit) { buff.append("<form id=\"editing\" name=\"editing\" method=\"post\" " + "action=\"editResult.do?jsessionid=${sessionId}\" id=\"mainForm\" target=\"h2result\">" + "<input type=\"hidden\" name=\"op\" value=\"1\" />" + "<input type=\"hidden\" name=\"row\" value=\"\" />" + "<table cellspacing=0 cellpadding=0 id=\"editTable\">"); } else { buff.append("<table cellspacing=0 cellpadding=0>"); } if (metadata) { SimpleResultSet r = new SimpleResultSet(); r.addColumn("#", Types.INTEGER, 0, 0); r.addColumn("label", Types.VARCHAR, 0, 0); r.addColumn("catalog", Types.VARCHAR, 0, 0); r.addColumn("schema", Types.VARCHAR, 0, 0); r.addColumn("table", Types.VARCHAR, 0, 0); r.addColumn("column", Types.VARCHAR, 0, 0); r.addColumn("type", Types.INTEGER, 0, 0); r.addColumn("typeName", Types.VARCHAR, 0, 0); r.addColumn("class", Types.VARCHAR, 0, 0); r.addColumn("precision", Types.INTEGER, 0, 0); r.addColumn("scale", Types.INTEGER, 0, 0); r.addColumn("displaySize", Types.INTEGER, 0, 0); r.addColumn("autoIncrement", Types.BOOLEAN, 0, 0); r.addColumn("caseSensitive", Types.BOOLEAN, 0, 0); r.addColumn("currency", Types.BOOLEAN, 0, 0); r.addColumn("nullable", Types.INTEGER, 0, 0); r.addColumn("readOnly", Types.BOOLEAN, 0, 0); r.addColumn("searchable", Types.BOOLEAN, 0, 0); r.addColumn("signed", Types.BOOLEAN, 0, 0); r.addColumn("writable", Types.BOOLEAN, 0, 0); r.addColumn("definitelyWritable", Types.BOOLEAN, 0, 0); ResultSetMetaData m = rs.getMetaData(); for (int i = 1; i <= m.getColumnCount(); i++) { r.addRow(i, m.getColumnLabel(i), m.getCatalogName(i), m.getSchemaName(i), m.getTableName(i), m.getColumnName(i), m.getColumnType(i), m.getColumnTypeName(i), m.getColumnClassName(i), m.getPrecision(i), m.getScale(i), m.getColumnDisplaySize(i), m.isAutoIncrement(i), m.isCaseSensitive(i), m.isCurrency(i), m.isNullable(i), m.isReadOnly(i), m.isSearchable(i), m.isSigned(i), m.isWritable(i), m.isDefinitelyWritable(i)); } rs = r; } ResultSetMetaData meta = rs.getMetaData(); int columns = meta.getColumnCount(); int rows = 0; if (list) { buff.append("<tr><th>Column</th><th>Data</th></tr><tr>"); while (rs.next()) { if (maxrows > 0 && rows >= maxrows) { break; } rows++; buff.append("<tr><td>Row #</td><td>"). append(rows).append("</tr>"); for (int i = 0; i < columns; i++) { buff.append("<tr><td>"). append(PageParser.escapeHtml(meta.getColumnLabel(i + 1))). append("</td><td>"). append(escapeData(rs, i + 1)). append("</td></tr>"); } } } else { buff.append("<tr>"); if (edit) { buff.append("<th>${text.resultEdit.action}</th>"); } for (int i = 0; i < columns; i++) { buff.append("<th>"). append(PageParser.escapeHtml(meta.getColumnLabel(i + 1))). append("</th>"); } buff.append("</tr>"); while (rs.next()) { if (maxrows > 0 && rows >= maxrows) { break; } rows++; buff.append("<tr>"); if (edit) { buff.append("<td>"). append("<img onclick=\"javascript:editRow("). append(rs.getRow()). append(",'${sessionId}', '${text.resultEdit.save}', '${text.resultEdit.cancel}'"). append(")\" width=16 height=16 src=\"ico_write.gif\" " + "onmouseover = \"this.className ='icon_hover'\" " + "onmouseout = \"this.className ='icon'\" " + "class=\"icon\" alt=\"${text.resultEdit.edit}\" " + "title=\"${text.resultEdit.edit}\" border=\"1\"/>"). append("<a href=\"editResult.do?op=2&row="). append(rs.getRow()). append("&jsessionid=${sessionId}\" target=\"h2result\" >" + "<img width=16 height=16 src=\"ico_remove.gif\" " + "onmouseover = \"this.className ='icon_hover'\" " + "onmouseout = \"this.className ='icon'\" " + "class=\"icon\" alt=\"${text.resultEdit.delete}\" " + "title=\"${text.resultEdit.delete}\" border=\"1\" /></a>"). append("</td>"); } for (int i = 0; i < columns; i++) { buff.append("<td>"). append(escapeData(rs, i + 1)). append("</td>"); } buff.append("</tr>"); } } boolean isUpdatable = false; try { isUpdatable = rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE && rs.getType() != ResultSet.TYPE_FORWARD_ONLY; } catch (NullPointerException e) { // ignore // workaround for a JDBC-ODBC bridge problem } if (edit) { ResultSet old = session.result; if (old != null) { old.close(); } session.result = rs; } else { rs.close(); } if (edit) { buff.append("<tr><td>"). append("<img onclick=\"javascript:editRow(-1, '${sessionId}', '${text.resultEdit.save}', '${text.resultEdit.cancel}'"). append(")\" width=16 height=16 src=\"ico_add.gif\" " + "onmouseover = \"this.className ='icon_hover'\" " + "onmouseout = \"this.className ='icon'\" " + "class=\"icon\" alt=\"${text.resultEdit.add}\" " + "title=\"${text.resultEdit.add}\" border=\"1\"/>"). append("</td>"); for (int i = 0; i < columns; i++) { buff.append("<td></td>"); } buff.append("</tr>"); } buff.append("</table>"); if (edit) { buff.append("</form>"); } if (rows == 0) { buff.append("(${text.result.noRows}"); } else if (rows == 1) { buff.append("(${text.result.1row}"); } else { buff.append('(').append(rows).append(" ${text.result.rows}"); } buff.append(", "); time = System.currentTimeMillis() - time; buff.append(time).append(" ms)"); if (!edit && isUpdatable && allowEdit) { buff.append("<br /><br />" + "<form name=\"editResult\" method=\"post\" " + "action=\"query.do?jsessionid=${sessionId}\" target=\"h2result\">" + "<input type=\"submit\" class=\"button\" value=\"${text.resultEdit.editResult}\" />" + "<input type=\"hidden\" name=\"sql\" value=\"@edit "). append(PageParser.escapeHtmlData(sql)). append("\" /></form>"); } return buff.toString(); }
// in src/main/org/h2/server/web/WebApp.java
private static String escapeData(ResultSet rs, int columnIndex) throws SQLException { String d = rs.getString(columnIndex); if (d == null) { return "<i>null</i>"; } else if (d.length() > 100000) { String s; if (isBinary(rs.getMetaData().getColumnType(columnIndex))) { s = PageParser.escapeHtml(d.substring(0, 6)) + "... (" + (d.length() / 2) + " ${text.result.bytes})"; } else { s = PageParser.escapeHtml(d.substring(0, 100)) + "... (" + d.length() + " ${text.result.characters})"; } return "<div style='display: none'>=+</div>" + s; } else if (d.equals("null") || d.startsWith("= ") || d.startsWith("=+")) { return "<div style='display: none'>= </div>" + PageParser.escapeHtml(d); } else if (d.equals("")) { // PageParser.escapeHtml replaces "" with a non-breaking space return ""; } return PageParser.escapeHtml(d); }
// in src/main/org/h2/server/web/WebApp.java
private void unescapeData(String x, ResultSet rs, int columnIndex) throws SQLException { if (x.equals("null")) { rs.updateNull(columnIndex); return; } else if (x.startsWith("=+")) { // don't update return; } else if (x.equals("=*")) { // set an appropriate default value int type = rs.getMetaData().getColumnType(columnIndex); switch (type) { case Types.TIME: rs.updateString(columnIndex, "12:00:00"); break; case Types.TIMESTAMP: case Types.DATE: rs.updateString(columnIndex, "2001-01-01"); break; default: rs.updateString(columnIndex, "1"); break; } return; } else if (x.startsWith("= ")) { x = x.substring(2); } ResultSetMetaData meta = rs.getMetaData(); int type = meta.getColumnType(columnIndex); if (session.getContents().isH2) { rs.updateString(columnIndex, x); return; } switch (type) { case Types.BIGINT: rs.updateLong(columnIndex, Long.decode(x)); break; case Types.DECIMAL: rs.updateBigDecimal(columnIndex, new BigDecimal(x)); break; case Types.DOUBLE: case Types.FLOAT: rs.updateDouble(columnIndex, Double.parseDouble(x)); break; case Types.REAL: rs.updateFloat(columnIndex, Float.parseFloat(x)); break; case Types.INTEGER: rs.updateInt(columnIndex, Integer.decode(x)); break; case Types.TINYINT: rs.updateShort(columnIndex, Short.decode(x)); break; default: rs.updateString(columnIndex, x); } }
// in src/main/org/h2/server/web/DbTableOrView.java
void readColumns(DatabaseMetaData meta) throws SQLException { ResultSet rs = meta.getColumns(null, schema.name, name, null); ArrayList<DbColumn> list = New.arrayList(); while (rs.next()) { DbColumn column = new DbColumn(schema.contents, rs); list.add(column); } rs.close(); columns = new DbColumn[list.size()]; list.toArray(columns); }
// in src/main/org/h2/server/web/WebServer.java
Connection getConnection(String driver, String databaseUrl, String user, String password) throws SQLException { driver = driver.trim(); databaseUrl = databaseUrl.trim(); org.h2.Driver.load(); Properties p = new Properties(); p.setProperty("user", user.trim()); // do not trim the password, otherwise an // encrypted H2 database with empty user password doesn't work p.setProperty("password", password); if (databaseUrl.startsWith("jdbc:h2:")) { if (ifExists) { databaseUrl += ";IFEXISTS=TRUE"; } // PostgreSQL would throw a NullPointerException // if it is loaded before the H2 driver // because it can't deal with non-String objects in the connection Properties return org.h2.Driver.load().connect(databaseUrl, p); } // try { // Driver dr = (Driver) urlClassLoader. // loadClass(driver).newInstance(); // return dr.connect(url, p); // } catch(ClassNotFoundException e2) { // throw e2; // } return JdbcUtils.getConnection(driver, databaseUrl, p); }
// in src/main/org/h2/server/web/WebServer.java
public String addSession(Connection conn) throws SQLException { WebSession session = createNewSession("local"); session.setShutdownServerOnDisconnect(); session.setConnection(conn); session.put("url", conn.getMetaData().getURL()); String s = (String) session.get("sessionId"); return url + "/frame.jsp?jsessionid=" + s; }
// in src/main/org/h2/server/web/WebSession.java
void setConnection(Connection conn) throws SQLException { this.conn = conn; if (conn == null) { meta = null; } else { meta = conn.getMetaData(); } contents = new DbContents(); }
// in src/main/org/h2/table/TableLink.java
private void readMetaData() throws SQLException { DatabaseMetaData meta = conn.getConnection().getMetaData(); storesLowerCase = meta.storesLowerCaseIdentifiers(); storesMixedCase = meta.storesMixedCaseIdentifiers(); storesMixedCaseQuoted = meta.storesMixedCaseQuotedIdentifiers(); supportsMixedCaseIdentifiers = meta.supportsMixedCaseIdentifiers(); ResultSet rs = meta.getTables(null, originalSchema, originalTable, null); if (rs.next() && rs.next()) { throw DbException.get(ErrorCode.SCHEMA_NAME_MUST_MATCH, originalTable); } rs.close(); rs = meta.getColumns(null, originalSchema, originalTable, null); int i = 0; ArrayList<Column> columnList = New.arrayList(); HashMap<String, Column> columnMap = New.hashMap(); String catalog = null, schema = null; while (rs.next()) { String thisCatalog = rs.getString("TABLE_CAT"); if (catalog == null) { catalog = thisCatalog; } String thisSchema = rs.getString("TABLE_SCHEM"); if (schema == null) { schema = thisSchema; } if (!StringUtils.equals(catalog, thisCatalog) || !StringUtils.equals(schema, thisSchema)) { // if the table exists in multiple schemas or tables, // use the alternative solution columnMap.clear(); columnList.clear(); break; } String n = rs.getString("COLUMN_NAME"); n = convertColumnName(n); int sqlType = rs.getInt("DATA_TYPE"); long precision = rs.getInt("COLUMN_SIZE"); precision = convertPrecision(sqlType, precision); int scale = rs.getInt("DECIMAL_DIGITS"); scale = convertScale(sqlType, scale); int displaySize = MathUtils.convertLongToInt(precision); int type = DataType.convertSQLTypeToValueType(sqlType); Column col = new Column(n, type, precision, scale, displaySize); col.setTable(this, i++); columnList.add(col); columnMap.put(n, col); } rs.close(); if (originalTable.indexOf('.') < 0 && !StringUtils.isNullOrEmpty(schema)) { qualifiedTableName = schema + "." + originalTable; } else { qualifiedTableName = originalTable; } // check if the table is accessible Statement stat = null; try { stat = conn.getConnection().createStatement(); rs = stat.executeQuery("SELECT * FROM " + qualifiedTableName + " T WHERE 1=0"); if (columnList.size() == 0) { // alternative solution ResultSetMetaData rsMeta = rs.getMetaData(); for (i = 0; i < rsMeta.getColumnCount();) { String n = rsMeta.getColumnName(i + 1); n = convertColumnName(n); int sqlType = rsMeta.getColumnType(i + 1); long precision = rsMeta.getPrecision(i + 1); precision = convertPrecision(sqlType, precision); int scale = rsMeta.getScale(i + 1); scale = convertScale(sqlType, scale); int displaySize = rsMeta.getColumnDisplaySize(i + 1); int type = DataType.convertSQLTypeToValueType(sqlType); Column col = new Column(n, type, precision, scale, displaySize); col.setTable(this, i++); columnList.add(col); columnMap.put(n, col); } } rs.close(); } catch (Exception e) { throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, e, originalTable + "(" + e.toString() + ")"); } finally { JdbcUtils.closeSilently(stat); } Column[] cols = new Column[columnList.size()]; columnList.toArray(cols); setColumns(cols); int id = getId(); linkedIndex = new LinkedIndex(this, id, IndexColumn.wrap(cols), IndexType.createNonUnique(false)); indexes.add(linkedIndex); try { rs = meta.getPrimaryKeys(null, originalSchema, originalTable); } catch (Exception e) { // Some ODBC bridge drivers don't support it: // some combinations of "DataDirect SequeLink(R) for JDBC" // http://www.datadirect.com/index.ssp rs = null; } String pkName = ""; ArrayList<Column> list; if (rs != null && rs.next()) { // the problem is, the rows are not sorted by KEY_SEQ list = New.arrayList(); do { int idx = rs.getInt("KEY_SEQ"); if (pkName == null) { pkName = rs.getString("PK_NAME"); } while (list.size() < idx) { list.add(null); } String col = rs.getString("COLUMN_NAME"); col = convertColumnName(col); Column column = columnMap.get(col); if (idx == 0) { // workaround for a bug in the SQLite JDBC driver list.add(column); } else { list.set(idx - 1, column); } } while (rs.next()); addIndex(list, IndexType.createPrimaryKey(false, false)); rs.close(); } try { rs = meta.getIndexInfo(null, originalSchema, originalTable, false, true); } catch (Exception e) { // Oracle throws an exception if the table is not found or is a // SYNONYM rs = null; } String indexName = null; list = New.arrayList(); IndexType indexType = null; if (rs != null) { while (rs.next()) { if (rs.getShort("TYPE") == DatabaseMetaData.tableIndexStatistic) { // ignore index statistics continue; } String newIndex = rs.getString("INDEX_NAME"); if (pkName.equals(newIndex)) { continue; } if (indexName != null && !indexName.equals(newIndex)) { addIndex(list, indexType); indexName = null; } if (indexName == null) { indexName = newIndex; list.clear(); } boolean unique = !rs.getBoolean("NON_UNIQUE"); indexType = unique ? IndexType.createUnique(false, false) : IndexType.createNonUnique(false); String col = rs.getString("COLUMN_NAME"); col = convertColumnName(col); Column column = columnMap.get(col); list.add(column); } rs.close(); } if (indexName != null) { addIndex(list, indexType); } }
// in src/main/org/h2/fulltext/FullTextLucene.java
public static void init(Connection conn) throws SQLException { Statement stat = conn.createStatement(); stat.execute("CREATE SCHEMA IF NOT EXISTS " + SCHEMA); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".INDEXES(SCHEMA VARCHAR, TABLE VARCHAR, COLUMNS VARCHAR, PRIMARY KEY(SCHEMA, TABLE))"); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_CREATE_INDEX FOR \"" + FullTextLucene.class.getName() + ".createIndex\""); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_SEARCH FOR \"" + FullTextLucene.class.getName() + ".search\""); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_SEARCH_DATA FOR \"" + FullTextLucene.class.getName() + ".searchData\""); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_REINDEX FOR \"" + FullTextLucene.class.getName() + ".reindex\""); stat.execute("CREATE ALIAS IF NOT EXISTS FTL_DROP_ALL FOR \"" + FullTextLucene.class.getName() + ".dropAll\""); try { getIndexAccess(conn); } catch (SQLException e) { throw convertException(e); } }
// in src/main/org/h2/fulltext/FullTextLucene.java
public static void createIndex(Connection conn, String schema, String table, String columnList) throws SQLException { init(conn); PreparedStatement prep = conn.prepareStatement("INSERT INTO " + SCHEMA + ".INDEXES(SCHEMA, TABLE, COLUMNS) VALUES(?, ?, ?)"); prep.setString(1, schema); prep.setString(2, table); prep.setString(3, columnList); prep.execute(); createTrigger(conn, schema, table); indexExistingRows(conn, schema, table); }
// in src/main/org/h2/fulltext/FullTextLucene.java
public static void reindex(Connection conn) throws SQLException { init(conn); removeAllTriggers(conn, TRIGGER_PREFIX); removeIndexFiles(conn); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("SELECT * FROM " + SCHEMA + ".INDEXES"); while (rs.next()) { String schema = rs.getString("SCHEMA"); String table = rs.getString("TABLE"); createTrigger(conn, schema, table); indexExistingRows(conn, schema, table); } }
// in src/main/org/h2/fulltext/FullTextLucene.java
public static void dropAll(Connection conn) throws SQLException { Statement stat = conn.createStatement(); stat.execute("DROP SCHEMA IF EXISTS " + SCHEMA); removeAllTriggers(conn, TRIGGER_PREFIX); removeIndexFiles(conn); }
// in src/main/org/h2/fulltext/FullTextLucene.java
public static ResultSet search(Connection conn, String text, int limit, int offset) throws SQLException { return search(conn, text, limit, offset, false); }
// in src/main/org/h2/fulltext/FullTextLucene.java
public static ResultSet searchData(Connection conn, String text, int limit, int offset) throws SQLException { return search(conn, text, limit, offset, true); }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected static void createTrigger(Connection conn, String schema, String table) throws SQLException { Statement stat = conn.createStatement(); String trigger = StringUtils.quoteIdentifier(schema) + "." + StringUtils.quoteIdentifier(TRIGGER_PREFIX + table); stat.execute("DROP TRIGGER IF EXISTS " + trigger); StringBuilder buff = new StringBuilder("CREATE TRIGGER IF NOT EXISTS "); // the trigger is also called on rollback because transaction rollback // will not undo the changes in the Lucene index buff.append(trigger). append(" AFTER INSERT, UPDATE, DELETE, ROLLBACK ON "). append(StringUtils.quoteIdentifier(schema)). append('.'). append(StringUtils.quoteIdentifier(table)). append(" FOR EACH ROW CALL \""). append(FullTextLucene.FullTextTrigger.class.getName()). append('\"'); stat.execute(buff.toString()); }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected static IndexAccess getIndexAccess(Connection conn) throws SQLException { String path = getIndexPath(conn); synchronized (INDEX_ACCESS) { IndexAccess access = INDEX_ACCESS.get(path); if (access == null) { try { /*## LUCENE2 ## boolean recreate = !IndexReader.indexExists(path); Analyzer analyzer = new StandardAnalyzer(); access = new IndexAccess(); access.modifier = new IndexModifier(path, analyzer, recreate); //*/ //## LUCENE3 ## File f = new File(path); Directory indexDir = FSDirectory.open(f); boolean recreate = !IndexReader.indexExists(indexDir); Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30); IndexWriter writer = new IndexWriter(indexDir, analyzer, recreate, IndexWriter.MaxFieldLength.UNLIMITED); //see http://wiki.apache.org/lucene-java/NearRealtimeSearch IndexReader reader = writer.getReader(); access = new IndexAccess(); access.writer = writer; access.reader = reader; access.searcher = new IndexSearcher(reader); //*/ } catch (IOException e) { throw convertException(e); } INDEX_ACCESS.put(path, access); } return access; } }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected static String getIndexPath(Connection conn) throws SQLException { Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("CALL DATABASE_PATH()"); rs.next(); String path = rs.getString(1); if (path == null) { throw throwException("Fulltext search for in-memory databases is not supported."); } int index = path.lastIndexOf(':'); // position 1 means a windows drive letter is used, ignore that if (index > 1) { path = path.substring(index + 1); } rs.close(); return path; }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected static void indexExistingRows(Connection conn, String schema, String table) throws SQLException { FullTextLucene.FullTextTrigger existing = new FullTextLucene.FullTextTrigger(); existing.init(conn, schema, null, table, false, Trigger.INSERT); String sql = "SELECT * FROM " + StringUtils.quoteIdentifier(schema) + "." + StringUtils.quoteIdentifier(table); ResultSet rs = conn.createStatement().executeQuery(sql); int columnCount = rs.getMetaData().getColumnCount(); while (rs.next()) { Object[] row = new Object[columnCount]; for (int i = 0; i < columnCount; i++) { row[i] = rs.getObject(i + 1); } existing.insert(row, false); } existing.commitIndex(); }
// in src/main/org/h2/fulltext/FullTextLucene.java
private static void removeIndexFiles(Connection conn) throws SQLException { String path = getIndexPath(conn); IndexAccess access = INDEX_ACCESS.get(path); if (access != null) { removeIndexAccess(access, path); } FileUtils.deleteRecursive(path, false); }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected static void removeIndexAccess(IndexAccess access, String indexPath) throws SQLException { synchronized (INDEX_ACCESS) { try { INDEX_ACCESS.remove(indexPath); /*## LUCENE2 ## access.modifier.flush(); access.modifier.close(); //*/ //## LUCENE3 ## access.searcher.close(); access.reader.close(); access.writer.close(); //*/ } catch (Exception e) { throw convertException(e); } } }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected static ResultSet search(Connection conn, String text, int limit, int offset, boolean data) throws SQLException { SimpleResultSet result = createResultSet(data); if (conn.getMetaData().getURL().startsWith("jdbc:columnlist:")) { // this is just to query the result set columns return result; } if (text == null || text.trim().length() == 0) { return result; } try { IndexAccess access = getIndexAccess(conn); /*## LUCENE2 ## access.modifier.flush(); String path = getIndexPath(conn); IndexReader reader = IndexReader.open(path); Analyzer analyzer = new StandardAnalyzer(); Searcher searcher = new IndexSearcher(reader); QueryParser parser = new QueryParser(LUCENE_FIELD_DATA, analyzer); Query query = parser.parse(text); Hits hits = searcher.search(query); int max = hits.length(); if (limit == 0) { limit = max; } for (int i = 0; i < limit && i + offset < max; i++) { Document doc = hits.doc(i + offset); float score = hits.score(i + offset); //*/ //## LUCENE3 ## // take a reference as the searcher may change Searcher searcher = access.searcher; // reuse the same analyzer; it's thread-safe; // also allows subclasses to control the analyzer used. Analyzer analyzer = access.writer.getAnalyzer(); QueryParser parser = new QueryParser(Version.LUCENE_30, LUCENE_FIELD_DATA, analyzer); Query query = parser.parse(text); // Lucene 3 insists on a hard limit and will not provide // a total hits value. Take at least 100 which is // an optimal limit for Lucene as any more // will trigger writing results to disk. int maxResults = (limit == 0 ? 100 : limit) + offset; TopDocs docs = searcher.search(query, maxResults); if (limit == 0) { limit = docs.totalHits; } for (int i = 0, len = docs.scoreDocs.length; i < limit && i + offset < docs.totalHits && i + offset < len; i++) { ScoreDoc sd = docs.scoreDocs[i + offset]; Document doc = searcher.doc(sd.doc); float score = sd.score; //*/ String q = doc.get(LUCENE_FIELD_QUERY); if (data) { int idx = q.indexOf(" WHERE "); JdbcConnection c = (JdbcConnection) conn; Session session = (Session) c.getSession(); Parser p = new Parser(session); String tab = q.substring(0, idx); ExpressionColumn expr = (ExpressionColumn) p.parseExpression(tab); String schemaName = expr.getOriginalTableAliasName(); String tableName = expr.getColumnName(); q = q.substring(idx + " WHERE ".length()); Object[][] columnData = parseKey(conn, q); result.addRow( schemaName, tableName, columnData[0], columnData[1], score); } else { result.addRow(q, score); } } /*## LUCENE2 ## // TODO keep it open if possible reader.close(); //*/ } catch (Exception e) { throw convertException(e); } return result; }
// in src/main/org/h2/fulltext/FullTextLucene.java
public void init(Connection conn, String schemaName, String triggerName, String tableName, boolean before, int type) throws SQLException { this.schema = schemaName; this.table = tableName; this.indexPath = getIndexPath(conn); this.indexAccess = getIndexAccess(conn); ArrayList<String> keyList = New.arrayList(); DatabaseMetaData meta = conn.getMetaData(); ResultSet rs = meta.getColumns(null, JdbcUtils.escapeMetaDataPattern(schemaName), JdbcUtils.escapeMetaDataPattern(tableName), null); ArrayList<String> columnList = New.arrayList(); while (rs.next()) { columnList.add(rs.getString("COLUMN_NAME")); } columnTypes = new int[columnList.size()]; columns = new String[columnList.size()]; columnList.toArray(columns); rs = meta.getColumns(null, JdbcUtils.escapeMetaDataPattern(schemaName), JdbcUtils.escapeMetaDataPattern(tableName), null); for (int i = 0; rs.next(); i++) { columnTypes[i] = rs.getInt("DATA_TYPE"); } if (keyList.size() == 0) { rs = meta.getPrimaryKeys(null, JdbcUtils.escapeMetaDataPattern(schemaName), tableName); while (rs.next()) { keyList.add(rs.getString("COLUMN_NAME")); } } if (keyList.size() == 0) { throw throwException("No primary key for table " + tableName); } ArrayList<String> indexList = New.arrayList(); PreparedStatement prep = conn.prepareStatement( "SELECT COLUMNS FROM " + SCHEMA + ".INDEXES WHERE SCHEMA=? AND TABLE=?"); prep.setString(1, schemaName); prep.setString(2, tableName); rs = prep.executeQuery(); if (rs.next()) { String cols = rs.getString(1); if (cols != null) { for (String s : StringUtils.arraySplit(cols, ',', true)) { indexList.add(s); } } } if (indexList.size() == 0) { indexList.addAll(columnList); } keys = new int[keyList.size()]; setColumns(keys, keyList, columnList); indexColumns = new int[indexList.size()]; setColumns(indexColumns, indexList, columnList); }
// in src/main/org/h2/fulltext/FullTextLucene.java
public void fire(Connection conn, Object[] oldRow, Object[] newRow) throws SQLException { if (oldRow != null) { if (newRow != null) { // update if (hasChanged(oldRow, newRow, indexColumns)) { delete(oldRow); insert(newRow, true); } } else { // delete delete(oldRow); } } else if (newRow != null) { // insert insert(newRow, true); } }
// in src/main/org/h2/fulltext/FullTextLucene.java
public void close() throws SQLException { if (indexAccess != null) { removeIndexAccess(indexAccess, indexPath); indexAccess = null; } }
// in src/main/org/h2/fulltext/FullTextLucene.java
void commitIndex() throws SQLException { try { indexAccess.writer.commit(); // recreate Searcher with the IndexWriter's reader. indexAccess.searcher.close(); indexAccess.reader.close(); IndexReader reader = indexAccess.writer.getReader(); indexAccess.reader = reader; indexAccess.searcher = new IndexSearcher(reader); } catch (IOException e) { throw convertException(e); } }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected void insert(Object[] row, boolean commitIndex) throws SQLException { /*## LUCENE2 ## String query = getQuery(row); Document doc = new Document(); doc.add(new Field(LUCENE_FIELD_QUERY, query, Field.Store.YES, Field.Index.UN_TOKENIZED)); long time = System.currentTimeMillis(); doc.add(new Field(LUCENE_FIELD_MODIFIED, DateTools.timeToString(time, DateTools.Resolution.SECOND), Field.Store.YES, Field.Index.UN_TOKENIZED)); StatementBuilder buff = new StatementBuilder(); for (int index : indexColumns) { String columnName = columns[index]; String data = asString(row[index], columnTypes[index]); // column names that start with _ must be escaped to avoid conflicts // with internal field names (_DATA, _QUERY, _modified) if (columnName.startsWith(LUCENE_FIELD_COLUMN_PREFIX)) { columnName = LUCENE_FIELD_COLUMN_PREFIX + columnName; } doc.add(new Field(columnName, data, Field.Store.NO, Field.Index.TOKENIZED)); buff.appendExceptFirst(" "); buff.append(data); } Field.Store storeText = STORE_DOCUMENT_TEXT_IN_INDEX ? Field.Store.YES : Field.Store.NO; doc.add(new Field(LUCENE_FIELD_DATA, buff.toString(), storeText, Field.Index.TOKENIZED)); try { indexAccess.modifier.addDocument(doc); } catch (IOException e) { throw convertException(e); } //*/ //## LUCENE3 ## String query = getQuery(row); Document doc = new Document(); doc.add(new Field(LUCENE_FIELD_QUERY, query, Field.Store.YES, Field.Index.NOT_ANALYZED)); long time = System.currentTimeMillis(); doc.add(new Field(LUCENE_FIELD_MODIFIED, DateTools.timeToString(time, DateTools.Resolution.SECOND), Field.Store.YES, Field.Index.NOT_ANALYZED)); StatementBuilder buff = new StatementBuilder(); for (int index : indexColumns) { String columnName = columns[index]; String data = asString(row[index], columnTypes[index]); // column names that start with _ // must be escaped to avoid conflicts // with internal field names (_DATA, _QUERY, _modified) if (columnName.startsWith(LUCENE_FIELD_COLUMN_PREFIX)) { columnName = LUCENE_FIELD_COLUMN_PREFIX + columnName; } doc.add(new Field(columnName, data, Field.Store.NO, Field.Index.ANALYZED)); buff.appendExceptFirst(" "); buff.append(data); } Field.Store storeText = STORE_DOCUMENT_TEXT_IN_INDEX ? Field.Store.YES : Field.Store.NO; doc.add(new Field(LUCENE_FIELD_DATA, buff.toString(), storeText, Field.Index.ANALYZED)); try { indexAccess.writer.addDocument(doc); if (commitIndex) { indexAccess.writer.commit(); // recreate Searcher with the IndexWriter's reader. indexAccess.searcher.close(); indexAccess.reader.close(); IndexReader reader = indexAccess.writer.getReader(); indexAccess.reader = reader; indexAccess.searcher = new IndexSearcher(reader); } } catch (IOException e) { throw convertException(e); } //*/ }
// in src/main/org/h2/fulltext/FullTextLucene.java
protected void delete(Object[] row) throws SQLException { String query = getQuery(row); try { Term term = new Term(LUCENE_FIELD_QUERY, query); /*## LUCENE2 ## indexAccess.modifier.deleteDocuments(term); //*/ //## LUCENE3 ## indexAccess.writer.deleteDocuments(term); //*/ } catch (IOException e) { throw convertException(e); } }
// in src/main/org/h2/fulltext/FullTextLucene.java
private String getQuery(Object[] row) throws SQLException { StatementBuilder buff = new StatementBuilder(); if (schema != null) { buff.append(StringUtils.quoteIdentifier(schema)).append('.'); } buff.append(StringUtils.quoteIdentifier(table)).append(" WHERE "); for (int columnIndex : keys) { buff.appendExceptFirst(" AND "); buff.append(StringUtils.quoteIdentifier(columns[columnIndex])); Object o = row[columnIndex]; if (o == null) { buff.append(" IS NULL"); } else { buff.append('=').append(FullText.quoteSQL(o, columnTypes[columnIndex])); } } return buff.toString(); }
// in src/main/org/h2/fulltext/FullText.java
public static void init(Connection conn) throws SQLException { Statement stat = conn.createStatement(); stat.execute("CREATE SCHEMA IF NOT EXISTS " + SCHEMA); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".INDEXES(ID INT AUTO_INCREMENT PRIMARY KEY, SCHEMA VARCHAR, TABLE VARCHAR, COLUMNS VARCHAR, UNIQUE(SCHEMA, TABLE))"); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".WORDS(ID INT AUTO_INCREMENT PRIMARY KEY, NAME VARCHAR, UNIQUE(NAME))"); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".ROWS(ID IDENTITY, HASH INT, INDEXID INT, KEY VARCHAR, UNIQUE(HASH, INDEXID, KEY))"); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".MAP(ROWID INT, WORDID INT, PRIMARY KEY(WORDID, ROWID))"); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".IGNORELIST(LIST VARCHAR)"); stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".SETTINGS(KEY VARCHAR PRIMARY KEY, VALUE VARCHAR)"); stat.execute("CREATE ALIAS IF NOT EXISTS FT_CREATE_INDEX FOR \"" + FullText.class.getName() + ".createIndex\""); stat.execute("CREATE ALIAS IF NOT EXISTS FT_DROP_INDEX FOR \"" + FullText.class.getName() + ".dropIndex\""); stat.execute("CREATE ALIAS IF NOT EXISTS FT_SEARCH FOR \"" + FullText.class.getName() + ".search\""); stat.execute("CREATE ALIAS IF NOT EXISTS FT_SEARCH_DATA FOR \"" + FullText.class.getName() + ".searchData\""); stat.execute("CREATE ALIAS IF NOT EXISTS FT_REINDEX FOR \"" + FullText.class.getName() + ".reindex\""); stat.execute("CREATE ALIAS IF NOT EXISTS FT_DROP_ALL FOR \"" + FullText.class.getName() + ".dropAll\""); FullTextSettings setting = FullTextSettings.getInstance(conn); ResultSet rs = stat.executeQuery("SELECT * FROM " + SCHEMA + ".IGNORELIST"); while (rs.next()) { String commaSeparatedList = rs.getString(1); setIgnoreList(setting, commaSeparatedList); } rs = stat.executeQuery("SELECT * FROM " + SCHEMA + ".SETTINGS"); while (rs.next()) { String key = rs.getString(1); if ("whitespaceChars".equals(key)) { String value = rs.getString(2); setting.setWhitespaceChars(value); } } rs = stat.executeQuery("SELECT * FROM " + SCHEMA + ".WORDS"); HashMap<String, Integer> map = setting.getWordList(); while (rs.next()) { String word = rs.getString("NAME"); int id = rs.getInt("ID"); word = setting.convertWord(word); if (word != null) { map.put(word, id); } } setting.setInitialized(true); }
// in src/main/org/h2/fulltext/FullText.java
public static void createIndex(Connection conn, String schema, String table, String columnList) throws SQLException { init(conn); PreparedStatement prep = conn.prepareStatement("INSERT INTO " + SCHEMA + ".INDEXES(SCHEMA, TABLE, COLUMNS) VALUES(?, ?, ?)"); prep.setString(1, schema); prep.setString(2, table); prep.setString(3, columnList); prep.execute(); createTrigger(conn, schema, table); indexExistingRows(conn, schema, table); }
// in src/main/org/h2/fulltext/FullText.java
public static void reindex(Connection conn) throws SQLException { init(conn); removeAllTriggers(conn, TRIGGER_PREFIX); FullTextSettings setting = FullTextSettings.getInstance(conn); setting.getWordList().clear(); Statement stat = conn.createStatement(); stat.execute("TRUNCATE TABLE " + SCHEMA + ".WORDS"); stat.execute("TRUNCATE TABLE " + SCHEMA + ".ROWS"); stat.execute("TRUNCATE TABLE " + SCHEMA + ".MAP"); ResultSet rs = stat.executeQuery("SELECT * FROM " + SCHEMA + ".INDEXES"); while (rs.next()) { String schema = rs.getString("SCHEMA"); String table = rs.getString("TABLE"); createTrigger(conn, schema, table); indexExistingRows(conn, schema, table); } }
// in src/main/org/h2/fulltext/FullText.java
public static void dropIndex(Connection conn, String schema, String table) throws SQLException { init(conn); PreparedStatement prep = conn.prepareStatement("SELECT ID FROM " + SCHEMA + ".INDEXES WHERE SCHEMA=? AND TABLE=?"); prep.setString(1, schema); prep.setString(2, table); ResultSet rs = prep.executeQuery(); if (!rs.next()) { return; } int indexId = rs.getInt(1); prep = conn.prepareStatement("DELETE FROM " + SCHEMA + ".INDEXES WHERE ID=?"); prep.setInt(1, indexId); prep.execute(); createOrDropTrigger(conn, schema, table, false); prep = conn.prepareStatement("DELETE FROM " + SCHEMA + ".ROWS WHERE INDEXID=? AND ROWNUM<10000"); while (true) { prep.setInt(1, indexId); int deleted = prep.executeUpdate(); if (deleted == 0) { break; } } prep = conn.prepareStatement("DELETE FROM " + SCHEMA + ".MAP M " + "WHERE NOT EXISTS (SELECT * FROM " + SCHEMA + ".ROWS R WHERE R.ID=M.ROWID) AND ROWID<10000"); while (true) { int deleted = prep.executeUpdate(); if (deleted == 0) { break; } } }
// in src/main/org/h2/fulltext/FullText.java
public static void dropAll(Connection conn) throws SQLException { init(conn); Statement stat = conn.createStatement(); stat.execute("DROP SCHEMA IF EXISTS " + SCHEMA); removeAllTriggers(conn, TRIGGER_PREFIX); FullTextSettings setting = FullTextSettings.getInstance(conn); setting.removeAllIndexes(); setting.getIgnoreList().clear(); setting.getWordList().clear(); }
// in src/main/org/h2/fulltext/FullText.java
public static ResultSet search(Connection conn, String text, int limit, int offset) throws SQLException { try { return search(conn, text, limit, offset, false); } catch (DbException e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/fulltext/FullText.java
public static ResultSet searchData(Connection conn, String text, int limit, int offset) throws SQLException { try { return search(conn, text, limit, offset, true); } catch (DbException e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/fulltext/FullText.java
public static void setIgnoreList(Connection conn, String commaSeparatedList) throws SQLException { try { init(conn); FullTextSettings setting = FullTextSettings.getInstance(conn); setIgnoreList(setting, commaSeparatedList); Statement stat = conn.createStatement(); stat.execute("TRUNCATE TABLE " + SCHEMA + ".IGNORELIST"); PreparedStatement prep = conn.prepareStatement("INSERT INTO " + SCHEMA + ".IGNORELIST VALUES(?)"); prep.setString(1, commaSeparatedList); prep.execute(); } catch (DbException e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/fulltext/FullText.java
public static void setWhitespaceChars(Connection conn, String whitespaceChars) throws SQLException { try { init(conn); FullTextSettings setting = FullTextSettings.getInstance(conn); setting.setWhitespaceChars(whitespaceChars); PreparedStatement prep = conn.prepareStatement("MERGE INTO " + SCHEMA + ".SETTINGS VALUES(?, ?)"); prep.setString(1, "whitespaceChars"); prep.setString(2, whitespaceChars); prep.execute(); } catch (DbException e) { throw DbException.toSQLException(e); } }
// in src/main/org/h2/fulltext/FullText.java
protected static String asString(Object data, int type) throws SQLException { if (data == null) { return "NULL"; } switch (type) { case Types.BIT: case Types.BOOLEAN: case Types.INTEGER: case Types.BIGINT: case Types.DECIMAL: case Types.DOUBLE: case Types.FLOAT: case Types.NUMERIC: case Types.REAL: case Types.SMALLINT: case Types.TINYINT: case Types.DATE: case Types.TIME: case Types.TIMESTAMP: case Types.LONGVARCHAR: case Types.CHAR: case Types.VARCHAR: return data.toString(); case Types.CLOB: try { if (data instanceof Clob) { data = ((Clob) data).getCharacterStream(); } return IOUtils.readStringAndClose((Reader) data, -1); } catch (IOException e) { throw DbException.toSQLException(e); } case Types.VARBINARY: case Types.LONGVARBINARY: case Types.BINARY: case Types.JAVA_OBJECT: case Types.OTHER: case Types.BLOB: case Types.STRUCT: case Types.REF: case Types.NULL: case Types.ARRAY: case Types.DATALINK: case Types.DISTINCT: throw throwException("Unsupported column data type: " + type); default: return ""; } }
// in src/main/org/h2/fulltext/FullText.java
protected static String quoteSQL(Object data, int type) throws SQLException { if (data == null) { return "NULL"; } switch (type) { case Types.BIT: case Types.BOOLEAN: case Types.INTEGER: case Types.BIGINT: case Types.DECIMAL: case Types.DOUBLE: case Types.FLOAT: case Types.NUMERIC: case Types.REAL: case Types.SMALLINT: case Types.TINYINT: return data.toString(); case Types.DATE: case Types.TIME: case Types.TIMESTAMP: case Types.LONGVARCHAR: case Types.CHAR: case Types.VARCHAR: return quoteString(data.toString()); case Types.VARBINARY: case Types.LONGVARBINARY: case Types.BINARY: return "'" + StringUtils.convertBytesToHex((byte[]) data) + "'"; case Types.CLOB: case Types.JAVA_OBJECT: case Types.OTHER: case Types.BLOB: case Types.STRUCT: case Types.REF: case Types.NULL: case Types.ARRAY: case Types.DATALINK: case Types.DISTINCT: throw throwException("Unsupported key data type: " + type); default: return ""; } }
// in src/main/org/h2/fulltext/FullText.java
protected static void removeAllTriggers(Connection conn, String prefix) throws SQLException { Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("SELECT * FROM INFORMATION_SCHEMA.TRIGGERS"); Statement stat2 = conn.createStatement(); while (rs.next()) { String schema = rs.getString("TRIGGER_SCHEMA"); String name = rs.getString("TRIGGER_NAME"); if (name.startsWith(prefix)) { name = StringUtils.quoteIdentifier(schema) + "." + StringUtils.quoteIdentifier(name); stat2.execute("DROP TRIGGER " + name); } } }
// in src/main/org/h2/fulltext/FullText.java
protected static void setColumns(int[] index, ArrayList<String> keys, ArrayList<String> columns) throws SQLException { for (int i = 0, keySize = keys.size(); i < keySize; i++) { String key = keys.get(i); int found = -1; int columnsSize = columns.size(); for (int j = 0; found == -1 && j < columnsSize; j++) { String column = columns.get(j); if (column.equals(key)) { found = j; } } if (found < 0) { throw throwException("Column not found: " + key); } index[i] = found; } }
// in src/main/org/h2/fulltext/FullText.java
protected static ResultSet search(Connection conn, String text, int limit, int offset, boolean data) throws SQLException { SimpleResultSet result = createResultSet(data); if (conn.getMetaData().getURL().startsWith("jdbc:columnlist:")) { // this is just to query the result set columns return result; } if (text == null || text.trim().length() == 0) { return result; } FullTextSettings setting = FullTextSettings.getInstance(conn); if (!setting.isInitialized()) { init(conn); } HashSet<String> words = New.hashSet(); addWords(setting, words, text); HashSet<Integer> rIds = null, lastRowIds = null; HashMap<String, Integer> allWords = setting.getWordList(); PreparedStatement prepSelectMapByWordId = setting.prepare(conn, SELECT_MAP_BY_WORD_ID); for (String word : words) { lastRowIds = rIds; rIds = New.hashSet(); Integer wId = allWords.get(word); if (wId == null) { continue; } prepSelectMapByWordId.setInt(1, wId.intValue()); ResultSet rs = prepSelectMapByWordId.executeQuery(); while (rs.next()) { Integer rId = rs.getInt(1); if (lastRowIds == null || lastRowIds.contains(rId)) { rIds.add(rId); } } } if (rIds == null || rIds.size() == 0) { return result; } PreparedStatement prepSelectRowById = setting.prepare(conn, SELECT_ROW_BY_ID); int rowCount = 0; for (int rowId : rIds) { prepSelectRowById.setInt(1, rowId); ResultSet rs = prepSelectRowById.executeQuery(); if (!rs.next()) { continue; } if (offset > 0) { offset--; } else { String key = rs.getString(1); int indexId = rs.getInt(2); IndexInfo index = setting.getIndexInfo(indexId); if (data) { Object[][] columnData = parseKey(conn, key); result.addRow( index.schema, index.table, columnData[0], columnData[1], 1.0); } else { String query = StringUtils.quoteIdentifier(index.schema) + "." + StringUtils.quoteIdentifier(index.table) + " WHERE " + key; result.addRow(query, 1.0); } rowCount++; if (limit > 0 && rowCount >= limit) { break; } } } return result; }
// in src/main/org/h2/fulltext/FullText.java
protected static void createTrigger(Connection conn, String schema, String table) throws SQLException { createOrDropTrigger(conn, schema, table, true); }
// in src/main/org/h2/fulltext/FullText.java
private static void createOrDropTrigger(Connection conn, String schema, String table, boolean create) throws SQLException { Statement stat = conn.createStatement(); String trigger = StringUtils.quoteIdentifier(schema) + "." + StringUtils.quoteIdentifier(TRIGGER_PREFIX + table); stat.execute("DROP TRIGGER IF EXISTS " + trigger); if (create) { StringBuilder buff = new StringBuilder("CREATE TRIGGER IF NOT EXISTS "); // needs to be called on rollback as well, because we use the init connection // do to changes in the index (not the user connection) buff.append(trigger). append(" AFTER INSERT, UPDATE, DELETE, ROLLBACK ON "). append(StringUtils.quoteIdentifier(schema)). append('.'). append(StringUtils.quoteIdentifier(table)). append(" FOR EACH ROW CALL \""). append(FullText.FullTextTrigger.class.getName()). append('\"'); stat.execute(buff.toString()); } }
// in src/main/org/h2/fulltext/FullText.java
protected static void indexExistingRows(Connection conn, String schema, String table) throws SQLException { FullText.FullTextTrigger existing = new FullText.FullTextTrigger(); existing.init(conn, schema, null, table, false, Trigger.INSERT); String sql = "SELECT * FROM " + StringUtils.quoteIdentifier(schema) + "." + StringUtils.quoteIdentifier(table); ResultSet rs = conn.createStatement().executeQuery(sql); int columnCount = rs.getMetaData().getColumnCount(); while (rs.next()) { Object[] row = new Object[columnCount]; for (int i = 0; i < columnCount; i++) { row[i] = rs.getObject(i + 1); } existing.fire(conn, null, row); } }
// in src/main/org/h2/fulltext/FullText.java
public void init(Connection conn, String schemaName, String triggerName, String tableName, boolean before, int type) throws SQLException { setting = FullTextSettings.getInstance(conn); if (!setting.isInitialized()) { FullText.init(conn); } ArrayList<String> keyList = New.arrayList(); DatabaseMetaData meta = conn.getMetaData(); ResultSet rs = meta.getColumns(null, JdbcUtils.escapeMetaDataPattern(schemaName), JdbcUtils.escapeMetaDataPattern(tableName), null); ArrayList<String> columnList = New.arrayList(); while (rs.next()) { columnList.add(rs.getString("COLUMN_NAME")); } columnTypes = new int[columnList.size()]; index = new IndexInfo(); index.schema = schemaName; index.table = tableName; index.columns = new String[columnList.size()]; columnList.toArray(index.columns); rs = meta.getColumns(null, JdbcUtils.escapeMetaDataPattern(schemaName), JdbcUtils.escapeMetaDataPattern(tableName), null); for (int i = 0; rs.next(); i++) { columnTypes[i] = rs.getInt("DATA_TYPE"); } if (keyList.size() == 0) { rs = meta.getPrimaryKeys(null, JdbcUtils.escapeMetaDataPattern(schemaName), tableName); while (rs.next()) { keyList.add(rs.getString("COLUMN_NAME")); } } if (keyList.size() == 0) { throw throwException("No primary key for table " + tableName); } ArrayList<String> indexList = New.arrayList(); PreparedStatement prep = conn.prepareStatement( "SELECT ID, COLUMNS FROM " + SCHEMA + ".INDEXES WHERE SCHEMA=? AND TABLE=?"); prep.setString(1, schemaName); prep.setString(2, tableName); rs = prep.executeQuery(); if (rs.next()) { index.id = rs.getInt(1); String columns = rs.getString(2); if (columns != null) { for (String s : StringUtils.arraySplit(columns, ',', true)) { indexList.add(s); } } } if (indexList.size() == 0) { indexList.addAll(columnList); } index.keys = new int[keyList.size()]; setColumns(index.keys, keyList, columnList); index.indexColumns = new int[indexList.size()]; setColumns(index.indexColumns, indexList, columnList); setting.addIndexInfo(index); prepInsertWord = conn.prepareStatement( "INSERT INTO " + SCHEMA + ".WORDS(NAME) VALUES(?)"); prepInsertRow = conn.prepareStatement( "INSERT INTO " + SCHEMA + ".ROWS(HASH, INDEXID, KEY) VALUES(?, ?, ?)"); prepInsertMap = conn.prepareStatement( "INSERT INTO " + SCHEMA + ".MAP(ROWID, WORDID) VALUES(?, ?)"); prepDeleteRow = conn.prepareStatement( "DELETE FROM " + SCHEMA + ".ROWS WHERE HASH=? AND INDEXID=? AND KEY=?"); prepDeleteMap = conn.prepareStatement( "DELETE FROM " + SCHEMA + ".MAP WHERE ROWID=? AND WORDID=?"); prepSelectRow = conn.prepareStatement( "SELECT ID FROM " + SCHEMA + ".ROWS WHERE HASH=? AND INDEXID=? AND KEY=?"); }
// in src/main/org/h2/fulltext/FullText.java
public void fire(Connection conn, Object[] oldRow, Object[] newRow) throws SQLException { if (oldRow != null) { if (newRow != null) { // update if (hasChanged(oldRow, newRow, index.indexColumns)) { delete(oldRow); insert(newRow); } } else { // delete delete(oldRow); } } else if (newRow != null) { // insert insert(newRow); } }
// in src/main/org/h2/fulltext/FullText.java
protected void insert(Object[] row) throws SQLException { String key = getKey(row); int hash = key.hashCode(); prepInsertRow.setInt(1, hash); prepInsertRow.setInt(2, index.id); prepInsertRow.setString(3, key); prepInsertRow.execute(); ResultSet rs = prepInsertRow.getGeneratedKeys(); rs.next(); int rowId = rs.getInt(1); prepInsertMap.setInt(1, rowId); int[] wordIds = getWordIds(row); for (int id : wordIds) { prepInsertMap.setInt(2, id); prepInsertMap.execute(); } }
// in src/main/org/h2/fulltext/FullText.java
protected void delete(Object[] row) throws SQLException { String key = getKey(row); int hash = key.hashCode(); prepSelectRow.setInt(1, hash); prepSelectRow.setInt(2, index.id); prepSelectRow.setString(3, key); ResultSet rs = prepSelectRow.executeQuery(); if (rs.next()) { int rowId = rs.getInt(1); prepDeleteMap.setInt(1, rowId); int[] wordIds = getWordIds(row); for (int id : wordIds) { prepDeleteMap.setInt(2, id); prepDeleteMap.executeUpdate(); } prepDeleteRow.setInt(1, hash); prepDeleteRow.setInt(2, index.id); prepDeleteRow.setString(3, key); prepDeleteRow.executeUpdate(); } }
// in src/main/org/h2/fulltext/FullText.java
private int[] getWordIds(Object[] row) throws SQLException { HashSet<String> words = New.hashSet(); for (int idx : index.indexColumns) { int type = columnTypes[idx]; Object data = row[idx]; if (type == Types.CLOB && data != null) { Reader reader; if (data instanceof Reader) { reader = (Reader) data; } else { reader = ((Clob) data).getCharacterStream(); } addWords(setting, words, reader); } else { String string = asString(data, type); addWords(setting, words, string); } } HashMap<String, Integer> allWords = setting.getWordList(); int[] wordIds = new int[words.size()]; Iterator<String> it = words.iterator(); for (int i = 0; it.hasNext(); i++) { String word = it.next(); Integer wId = allWords.get(word); int wordId; if (wId == null) { prepInsertWord.setString(1, word); prepInsertWord.execute(); ResultSet rs = prepInsertWord.getGeneratedKeys(); rs.next(); wordId = rs.getInt(1); allWords.put(word, wordId); } else { wordId = wId.intValue(); } wordIds[i] = wordId; } Arrays.sort(wordIds); return wordIds; }
// in src/main/org/h2/fulltext/FullText.java
private String getKey(Object[] row) throws SQLException { StatementBuilder buff = new StatementBuilder(); for (int columnIndex : index.keys) { buff.appendExceptFirst(" AND "); buff.append(StringUtils.quoteIdentifier(index.columns[columnIndex])); Object o = row[columnIndex]; if (o == null) { buff.append(" IS NULL"); } else { buff.append('=').append(quoteSQL(o, columnTypes[columnIndex])); } } return buff.toString(); }
// in src/main/org/h2/fulltext/FullText.java
protected static SQLException throwException(String message) throws SQLException { throw new SQLException(message, "FULLTEXT"); }
// in src/main/org/h2/fulltext/FullTextSettings.java
protected static FullTextSettings getInstance(Connection conn) throws SQLException { String path = getIndexPath(conn); FullTextSettings setting = SETTINGS.get(path); if (setting == null) { setting = new FullTextSettings(); SETTINGS.put(path, setting); } return setting; }
// in src/main/org/h2/fulltext/FullTextSettings.java
protected static String getIndexPath(Connection conn) throws SQLException { Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("CALL IFNULL(DATABASE_PATH(), 'MEM:' || DATABASE())"); rs.next(); String path = rs.getString(1); if ("MEM:UNNAMED".equals(path)) { throw FullText.throwException("Fulltext search for private (unnamed) in-memory databases is not supported."); } rs.close(); return path; }
// in src/main/org/h2/fulltext/FullTextSettings.java
protected synchronized PreparedStatement prepare(Connection conn, String sql) throws SQLException { SoftHashMap<String, PreparedStatement> c = cache.get(conn); if (c == null) { c = new SoftHashMap<String, PreparedStatement>(); cache.put(conn, c); } PreparedStatement prep = c.get(sql); if (prep != null && prep.getConnection().isClosed()) { prep = null; } if (prep == null) { prep = conn.prepareStatement(sql); c.put(sql, prep); } return prep; }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
public static void main(String... args) throws SQLException { new FtpServer().runTool(args); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
public void runTool(String... args) throws SQLException { for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg == null) { continue; } else if ("-?".equals(arg) || "-help".equals(arg)) { showUsage(); return; } else if (arg.startsWith("-ftp")) { if ("-ftpPort".equals(arg)) { i++; } else if ("-ftpDir".equals(arg)) { i++; } else if ("-ftpRead".equals(arg)) { i++; } else if ("-ftpWrite".equals(arg)) { i++; } else if ("-ftpWritePassword".equals(arg)) { i++; } else if ("-ftpTask".equals(arg)) { // no parameters } else { showUsageAndThrowUnsupportedOption(arg); } } else if ("-trace".equals(arg)) { // no parameters } else { showUsageAndThrowUnsupportedOption(arg); } } Server server = new Server(this, args); server.start(); out.println(server.getStatus()); }
// in src/tools/org/h2/dev/ftp/server/FtpServer.java
public static Server createFtpServer(String... args) throws SQLException { return new Server(new FtpServer(), args); }
// in src/tools/org/h2/dev/fs/FileShell.java
public static void main(String... args) throws SQLException { new FileShell().runTool(args); }
// in src/tools/org/h2/dev/fs/FileShell.java
public void runTool(String... args) throws SQLException { try { currentWorkingDirectory = new File(".").getCanonicalPath(); } catch (IOException e) { throw DbException.convertIOException(e, "cwd"); } for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-run")) { try { execute(args[++i]); } catch (Exception e) { throw DbException.convert(e); } } else if (arg.equals("-verbose")) { verbose = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } promptLoop(); }
// in src/tools/org/h2/dev/util/FileViewer.java
public static void main(String... args) throws SQLException { new FileViewer().runTool(args); }
// in src/tools/org/h2/dev/util/FileViewer.java
public void runTool(String... args) throws SQLException { String file = null; String find = null; boolean head = false, tail = false; int lines = 30; boolean quiet = false; long start = 0; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-file")) { file = args[++i]; } else if (arg.equals("-find")) { find = args[++i]; } else if (arg.equals("-start")) { start = Long.decode(args[++i]).longValue(); } else if (arg.equals("-head")) { head = true; } else if (arg.equals("-tail")) { tail = true; } else if (arg.equals("-lines")) { lines = Integer.decode(args[++i]).intValue(); } else if (arg.equals("-quiet")) { quiet = true; } else if (arg.equals("-help") || arg.equals("-?")) { showUsage(); return; } else { showUsageAndThrowUnsupportedOption(arg); } } if (file == null) { showUsage(); return; } if (!head && !tail && find == null) { head = true; } try { process(file, find, head, tail, start, lines, quiet); } catch (IOException e) { throw DbException.toSQLException(e); } }
// in src/tools/org/h2/mode/FunctionsMySQL.java
public static void register(Connection conn) throws SQLException { String[] init = { "UNIX_TIMESTAMP", "unixTimestamp", "FROM_UNIXTIME", "fromUnixTime", "DATE", "date", }; Statement stat = conn.createStatement(); for (int i = 0; i < init.length; i += 2) { String alias = init[i], method = init[i + 1]; stat.execute( "CREATE ALIAS IF NOT EXISTS " + alias + " FOR \"" + FunctionsMySQL.class.getName() + "." + method + "\""); } }
// in src/tools/org/h2/jaqu/TableInspector.java
void read(DatabaseMetaData metaData) throws SQLException { ResultSet rs = null; // primary keys try { rs = metaData.getPrimaryKeys(null, schema, table); while (rs.next()) { String c = rs.getString("COLUMN_NAME"); primaryKeys.add(c); } JdbcUtils.closeSilently(rs); // indexes rs = metaData.getIndexInfo(null, schema, table, false, true); indexes = New.hashMap(); while (rs.next()) { IndexInspector info = new IndexInspector(rs); if (info.type.equals(IndexType.UNIQUE) && info.name.toLowerCase().startsWith("primary")) { // skip primary key indexes continue; } if (indexes.containsKey(info.name)) { indexes.get(info.name).addColumn(rs); } else { indexes.put(info.name, info); } } JdbcUtils.closeSilently(rs); // columns rs = metaData.getColumns(null, schema, table, null); columns = New.hashMap(); while (rs.next()) { ColumnInspector col = new ColumnInspector(); col.name = rs.getString("COLUMN_NAME"); col.type = rs.getString("TYPE_NAME"); col.clazz = ModelUtils.getClassForSqlType(col.type, dateTimeClass); col.size = rs.getInt("COLUMN_SIZE"); col.allowNull = rs.getInt("NULLABLE") == DatabaseMetaData.columnNullable; col.isAutoIncrement = rs.getBoolean("IS_AUTOINCREMENT"); if (primaryKeys.size() == 1) { if (col.name.equalsIgnoreCase(primaryKeys.get(0))) { col.isPrimaryKey = true; } } if (!col.isAutoIncrement) { col.defaultValue = rs.getString("COLUMN_DEF"); } columns.put(col.name, col); } } finally { JdbcUtils.closeSilently(rs); } }
// in src/tools/org/h2/jaqu/TableInspector.java
public void addColumn(ResultSet rs) throws SQLException { columns.add(rs.getString("COLUMN_NAME")); }
// in src/tools/org/h2/jaqu/DbInspector.java
private DatabaseMetaData getMetaData() throws SQLException { if (metaData == null) { metaData = db.getConnection().getMetaData(); } return metaData; }
// in src/tools/org/h2/jaqu/DbInspector.java
private <T> TableInspector getTable(T model) throws SQLException { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) model.getClass(); TableDefinition<T> def = db.define(clazz); boolean forceUpperCase = getMetaData().storesUpperCaseIdentifiers(); String schema = (forceUpperCase && def.schemaName != null) ? def.schemaName.toUpperCase() : def.schemaName; String table = forceUpperCase ? def.tableName.toUpperCase() : def.tableName; List<TableInspector> tables = getTables(schema, table); return tables.get(0); }
// in src/tools/org/h2/jaqu/DbInspector.java
private List<TableInspector> getTables(String schema, String table) throws SQLException { ResultSet rs = null; try { rs = getMetaData().getSchemas(); ArrayList<String> schemaList = New.arrayList(); while (rs.next()) { schemaList.add(rs.getString("TABLE_SCHEM")); } JdbcUtils.closeSilently(rs); String jaquTables = DbVersion.class.getAnnotation(JQTable.class).name(); List<TableInspector> tables = New.arrayList(); if (schemaList.size() == 0) { schemaList.add(null); } for (String s : schemaList) { rs = getMetaData().getTables(null, s, null, new String[] { "TABLE" }); while (rs.next()) { String t = rs.getString("TABLE_NAME"); if (!t.equalsIgnoreCase(jaquTables)) { tables.add(new TableInspector(s, t, getMetaData().storesUpperCaseIdentifiers(), dateTimeClass)); } } } if (StringUtils.isNullOrEmpty(schema) && StringUtils.isNullOrEmpty(table)) { // all schemas and tables return tables; } // schema subset OR table subset OR exact match List<TableInspector> matches = New.arrayList(); for (TableInspector t : tables) { if (t.matches(schema, table)) { matches.add(t); } } if (matches.size() == 0) { throw new RuntimeException( MessageFormat.format("Failed to find schema={0} table={1}", schema == null ? "" : schema, table == null ? "" : table)); } return matches; } finally { JdbcUtils.closeSilently(rs); } }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
public static void main(String... args) throws SQLException { new GenerateModels().runTool(args); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
public void runTool(String... args) throws SQLException { String url = null; String user = "sa"; String password = ""; String schema = null; String table = null; String packageName = ""; String folder = null; boolean annotateSchema = true; boolean trimStrings = false; for (int i = 0; args != null && i < args.length; i++) { String arg = args[i]; if (arg.equals("-url")) { url = args[++i]; } else if (arg.equals("-user")) { user = args[++i]; } else if (arg.equals("-password")) { password = args[++i]; } else if (arg.equals("-schema")) { schema = args[++i]; } else if (arg.equals("-table")) { table = args[++i]; } else if (arg.equals("-package")) { packageName = args[++i]; } else if (arg.equals("-folder")) { folder = args[++i]; } else if (arg.equals("-annotateSchema")) { try { annotateSchema = Boolean.parseBoolean(args[++i]); } catch (Throwable t) { throw new SQLException("Can not parse -annotateSchema value"); } } else if (arg.equals("-trimStrings")) { try { trimStrings = Boolean.parseBoolean(args[++i]); } catch (Throwable t) { throw new SQLException("Can not parse -trimStrings value"); } } else { throwUnsupportedOption(arg); } } if (url == null) { throw new SQLException("URL not set"); } execute(url, user, password, schema, table, packageName, folder, annotateSchema, trimStrings); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
public static void execute(String url, String user, String password, String schema, String table, String packageName, String folder, boolean annotateSchema, boolean trimStrings) throws SQLException { Connection conn = null; try { org.h2.Driver.load(); conn = DriverManager.getConnection(url, user, password); Db db = Db.open(url, user, password.toCharArray()); DbInspector inspector = new DbInspector(db); List<String> models = inspector.generateModel(schema, table, packageName, annotateSchema, trimStrings); File parentFile; if (StringUtils.isNullOrEmpty(folder)) { parentFile = new File(System.getProperty("user.dir")); } else { parentFile = new File(folder); } parentFile.mkdirs(); Pattern p = Pattern.compile("class ([a-zA-Z0-9]+)"); for (String model : models) { Matcher m = p.matcher(model); if (m.find()) { String className = m.group().substring("class".length()).trim(); File classFile = new File(parentFile, className + ".java"); Writer o = new FileWriter(classFile, false); PrintWriter writer = new PrintWriter(new BufferedWriter(o)); writer.write(model); writer.close(); System.out.println("Generated " + classFile.getAbsolutePath()); } } } catch (IOException io) { throw DbException.convertIOException(io, "could not generate model").getSQLException(); } finally { JdbcUtils.closeSilently(conn); } }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
protected SQLException throwUnsupportedOption(String option) throws SQLException { showUsage(); throw new SQLException("Unsupported option: " + option); }
92
            
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { XAException xa = new XAException(XAException.XAER_RMERR); xa.initCause(e); throw xa; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { // ignore }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
catch (SQLException e) { // ignore }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
catch (SQLException e) { if (logWriter != null) { e.printStackTrace(logWriter); } }
// in src/main/org/h2/tools/CreateCluster.java
catch (SQLException e) { if (e.getErrorCode() == ErrorCode.DATABASE_NOT_FOUND_1) { // database does not exists yet - ok exists = false; } else { throw e; } }
// in src/main/org/h2/tools/Server.java
catch (SQLException e) { stopAll(); throw e; }
// in src/main/org/h2/tools/Console.java
catch (SQLException e) { printProblem(e, web); startException = e; }
// in src/main/org/h2/tools/Console.java
catch (SQLException e) { printProblem(e, tcp); if (startException == null) { startException = e; } }
// in src/main/org/h2/tools/Console.java
catch (SQLException e) { printProblem(e, pg); if (startException == null) { startException = e; } }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("SQL Exception: " + e.getMessage()); statement = null; }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("SQL Exception: " + e.getMessage()); e.printStackTrace(err); }
// in src/main/org/h2/tools/Shell.java
catch (SQLException e) { println("Error: " + e.toString()); if (listMode) { e.printStackTrace(err); } return; }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/Transfer.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/value/ValueResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/ValueResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/result/LocalResult.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Expression.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/RecoverTester.java
catch (SQLException e) { // ignore }
// in src/main/org/h2/store/Data.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/Data.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/LinkedCursor.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/FunctionCursorResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/FunctionCursorResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/Driver.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/Driver.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/engine/Database.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (SQLException e) { trace.error(e, "close"); }
// in src/main/org/h2/util/JdbcUtils.java
catch (SQLException e) { // ignore }
// in src/main/org/h2/util/JdbcUtils.java
catch (SQLException e) { // ignore }
// in src/main/org/h2/util/JdbcUtils.java
catch (SQLException e) { // ignore }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { if (force) { // ignore } else { if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } } }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { if (i == 1) { throw e; } }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (SQLException e) { sendErrorResponse(e); break; }
// in src/main/org/h2/server/pg/PgServerThread.java
catch (SQLException e) { // failed transaction block c = 'E'; }
// in src/main/org/h2/server/web/DbContents.java
catch (SQLException e) { return defaultColumnIndex; }
// in src/main/org/h2/server/web/DbContents.java
catch (SQLException e) { // IS_DEFAULT not found }
// in src/main/org/h2/server/web/WebApp.java
catch (SQLException e) { // SQLite return treeIndex; }
// in src/main/org/h2/server/web/WebApp.java
catch (SQLException e) { map = e.toString(); }
// in src/main/org/h2/server/web/WebSession.java
catch (SQLException e) { TraceSystem.traceThrowable(e); }
// in src/main/org/h2/table/LinkSchema.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/table/FunctionTable.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (SQLException e) { if (retry >= MAX_RETRY) { throw DbException.convert(e); } conn.close(true); connect(); }
// in src/main/org/h2/table/TableLinkConnection.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (SQLException e) { throw convertException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
66
            
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { XAException xa = new XAException(XAException.XAER_RMERR); xa.initCause(e); throw xa; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
catch (SQLException e) { throw convertException(e); }
// in src/main/org/h2/tools/CreateCluster.java
catch (SQLException e) { if (e.getErrorCode() == ErrorCode.DATABASE_NOT_FOUND_1) { // database does not exists yet - ok exists = false; } else { throw e; } }
// in src/main/org/h2/tools/Server.java
catch (SQLException e) { stopAll(); throw e; }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/DataType.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/Transfer.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/value/ValueResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/value/ValueResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/result/LocalResult.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/schema/TriggerObject.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Function.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/JavaAggregate.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/expression/Expression.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/LobStorage.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/Data.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/store/Data.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/LinkedCursor.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/FunctionCursorResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/index/FunctionCursorResultSet.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/command/dml/ScriptCommand.java
catch (SQLException e) { throw DbException.convertToIOException(e); }
// in src/main/org/h2/engine/Database.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { if (force) { // ignore } else { if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e; } } }
// in src/main/org/h2/server/TcpServer.java
catch (SQLException e) { if (i == 1) { throw e; } }
// in src/main/org/h2/table/LinkSchema.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/table/FunctionTable.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/table/TableLink.java
catch (SQLException e) { if (retry >= MAX_RETRY) { throw DbException.convert(e); } conn.close(true); connect(); }
// in src/main/org/h2/table/TableLinkConnection.java
catch (SQLException e) { throw DbException.convert(e); }
// in src/main/org/h2/fulltext/FullTextLucene.java
catch (SQLException e) { throw convertException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Query.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/DbInspector.java
catch (SQLException s) { throw new RuntimeException(s); }
// in src/tools/org/h2/jaqu/TableDefinition.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw convert(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/Db.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/SQLStatement.java
catch (SQLException e) { throw new RuntimeException(e); }
14
unknown (Lib) SecurityException 0 0 0 4
            
// in src/main/org/h2/engine/Database.java
catch (SecurityException e) { // applets may not do that - ignore // Google App Engine doesn't allow // to instantiate classes that extend Thread }
// in src/main/org/h2/engine/Database.java
catch (SecurityException e) { // applets may not do that - ignore }
// in src/main/org/h2/util/Utils.java
catch (SecurityException se) { return defaultValue; }
// in src/main/org/h2/util/MathUtils.java
catch (SecurityException e) { // workaround for the Google App Engine: don't use a thread runnable.run(); generateAlternativeSeed(); }
0 0
checked (Lib) Throwable 0 0 0 42
            
// in src/main/org/h2/message/TraceSystem.java
catch (Throwable e) { e = DbException.get(ErrorCode.CLASS_NOT_FOUND_1, e, adapterClass); write(ERROR, Trace.DATABASE, adapterClass, e); return; }
// in src/main/org/h2/tools/Recover.java
catch (Throwable e) { // this is usually not a problem, because we try both compressed and // uncompressed }
// in src/main/org/h2/tools/Recover.java
catch (Throwable e) { writeError(writer, e); }
// in src/main/org/h2/tools/Recover.java
catch (Throwable e) { writeDataError(writer, "exception " + e, s.getBytes()); continue; }
// in src/main/org/h2/tools/Recover.java
catch (Throwable e) { writeDataError(writer, "exception " + e, s.getBytes()); continue; }
// in src/main/org/h2/tools/Recover.java
catch (Throwable t) { writeError(writer, t); }
// in src/main/org/h2/tools/Console.java
catch (Throwable t) { // ignore // some systems don't support this method, for example IKVM // however it still works }
// in src/main/org/h2/tools/Console.java
catch (Throwable t) { // ignore }
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { // try again later triggerCallback = null; throw DbException.get(ErrorCode.ERROR_CREATING_TRIGGER_OBJECT_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_EXECUTING_TRIGGER_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/store/fs/FilePathNioMapped.java
catch (Throwable e) { // useSystemGc is already true }
// in src/main/org/h2/store/fs/FilePathDisk.java
catch (Throwable e) { // sometimes this throws a NullPointerException // at java.io.DeleteOnExitHook.add(DeleteOnExitHook.java:33) // we can ignore it }
// in src/main/org/h2/command/Command.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/command/Command.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { if (e instanceof OutOfMemoryError) { e.fillInStackTrace(); } if (traceSystem != null) { if (e instanceof SQLException) { SQLException e2 = (SQLException) e; if (e2.getErrorCode() != ErrorCode.DATABASE_ALREADY_OPEN_1) { // only write if the database is not already in use trace.error(e, "opening {0}", databaseName); } } traceSystem.close(); } closeOpenFilesAndUnlock(false); throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Throwable t) { if (SysProperties.CHECK2) { t.printStackTrace(); } trace.error(t, "close"); }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_SETTING_DATABASE_EVENT_LISTENER_2, e, className, e.toString()); }
// in src/main/org/h2/engine/DatabaseCloser.java
catch (Throwable e) { // ignore }
// in src/main/org/h2/engine/SessionRemote.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.SERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.DESERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/util/MathUtils.java
catch (Throwable e) { // on some system, InetAddress is not supported // on some system, InetAddress.getLocalHost() doesn't work // for some reason (incorrect configuration) }
// in src/main/org/h2/util/Profiler.java
catch (Throwable t) { break; }
// in src/main/org/h2/server/TcpServer.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Throwable e) { sendError(e); stop = true; }
// in src/main/org/h2/server/TcpServerThread.java
catch (Throwable e) { sendError(e); }
// in src/main/org/h2/server/TcpServerThread.java
catch (Throwable e) { server.traceError(e); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { server.traceError(e); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable t) { return s; }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { session.put("result", getStackTrace(0, e, session.getContents().isH2)); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { result = "<br />" + getStackTrace(0, e, session.getContents().isH2); error = formatAsError(e.getMessage()); }
// in src/main/org/h2/server/web/WebApp.java
catch (Throwable e) { // throwable: including OutOfMemoryError and so on return getStackTrace(id, e, session.getContents().isH2); }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
// in src/tools/org/h2/dev/ftp/server/FtpControl.java
catch (Throwable t) { server.traceError(t); }
// in src/tools/org/h2/dev/net/PgTcpRedirect.java
catch (Throwable e) { e.printStackTrace(); }
// in src/tools/org/h2/build/BuildBase.java
catch (Throwable e) { throw new RuntimeException(e); }
// in src/tools/org/h2/build/Build.java
catch (Throwable t) { t.printStackTrace(); }
// in src/tools/org/h2/build/Build.java
catch (Throwable t) { t.printStackTrace(); }
// in src/tools/org/h2/jaqu/ModelUtils.java
catch (Throwable t) { }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -annotateSchema value"); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -trimStrings value"); }
18
            
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { // try again later triggerCallback = null; throw DbException.get(ErrorCode.ERROR_CREATING_TRIGGER_OBJECT_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/schema/TriggerObject.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_EXECUTING_TRIGGER_3, e, getName(), triggerClassName, e.toString()); }
// in src/main/org/h2/command/Command.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/command/Command.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { if (e instanceof OutOfMemoryError) { e.fillInStackTrace(); } if (traceSystem != null) { if (e instanceof SQLException) { SQLException e2 = (SQLException) e; if (e2.getErrorCode() != ErrorCode.DATABASE_ALREADY_OPEN_1) { // only write if the database is not already in use trace.error(e, "opening {0}", databaseName); } } traceSystem.close(); } closeOpenFilesAndUnlock(false); throw DbException.convert(e); }
// in src/main/org/h2/engine/Database.java
catch (Throwable e) { throw DbException.get(ErrorCode.ERROR_SETTING_DATABASE_EVENT_LISTENER_2, e, className, e.toString()); }
// in src/main/org/h2/engine/SessionRemote.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.SERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/util/Utils.java
catch (Throwable e) { throw DbException.get(ErrorCode.DESERIALIZATION_FAILED_1, e, e.toString()); }
// in src/main/org/h2/server/TcpServer.java
catch (Throwable e) { throw DbException.convert(e); }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (--i >= 0) { Index index = indexes.get(i); index.remove(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (int j = 0; j < indexes.size(); j++) { Index index = indexes.get(j); if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; }
// in src/main/org/h2/table/RegularTable.java
catch (Throwable e) { try { while (++i < indexes.size()) { Index index = indexes.get(i); index.add(session, row); checkRowCount(session, index, 0); } } catch (DbException e2) { // this could happen, for example on failure in the storage // but if that is not the case it means there is something wrong // with the database trace.error(e2, "could not undo operation"); throw e2; } throw DbException.convert(e); }
// in src/tools/org/h2/build/BuildBase.java
catch (Throwable e) { throw new RuntimeException(e); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -annotateSchema value"); }
// in src/tools/org/h2/jaqu/util/GenerateModels.java
catch (Throwable t) { throw new SQLException("Can not parse -trimStrings value"); }
1
unknown (Lib) UnknownHostException 0 0 2
            
// in src/main/org/h2/util/NetUtils.java
private static InetAddress getBindAddress() throws UnknownHostException { String host = SysProperties.BIND_ADDRESS; if (host == null || host.length() == 0) { return null; } synchronized (NetUtils.class) { if (cachedBindAddress == null) { cachedBindAddress = InetAddress.getByName(host); } }
// in src/main/org/h2/util/NetUtils.java
public static boolean isLocalAddress(Socket socket) throws UnknownHostException { InetAddress test = socket.getInetAddress(); if (test.isLoopbackAddress()) { return true; } InetAddress localhost = InetAddress.getLocalHost(); // localhost.getCanonicalHostName() is very very slow String host = localhost.getHostAddress(); for (InetAddress addr : InetAddress.getAllByName(host)) { if (test.equals(addr)) { return true; } } return false; }
7
            
// in src/main/org/h2/store/FileLock.java
catch (UnknownHostException e) { throw getExceptionFatal("Unknown host " + ip, e); }
// in src/main/org/h2/util/NetUtils.java
catch (UnknownHostException e) { // ignore }
// in src/main/org/h2/util/NetUtils.java
catch (UnknownHostException e) { throw DbException.convert(e); }
// in src/main/org/h2/server/TcpServer.java
catch (UnknownHostException e) { traceError(e); return false; }
// in src/main/org/h2/server/pg/PgServer.java
catch (UnknownHostException e) { traceError(e); return false; }
// in src/main/org/h2/server/web/WebThread.java
catch (UnknownHostException e) { server.traceError(e); return false; }
// in src/main/org/h2/server/web/WebServlet.java
catch (UnknownHostException e) { return false; }
2
            
// in src/main/org/h2/store/FileLock.java
catch (UnknownHostException e) { throw getExceptionFatal("Unknown host " + ip, e); }
// in src/main/org/h2/util/NetUtils.java
catch (UnknownHostException e) { throw DbException.convert(e); }
0
unknown (Lib) UnsupportedEncodingException 0 0 0 1
            
// in src/tools/org/h2/dev/util/ReaderInputStream.java
catch (UnsupportedEncodingException e) { throw DbException.convert(e); }
1
            
// in src/tools/org/h2/dev/util/ReaderInputStream.java
catch (UnsupportedEncodingException e) { throw DbException.convert(e); }
0
runtime (Lib) UnsupportedOperationException 20
            
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void addStatementEventListener(StatementEventListener listener) { throw new UnsupportedOperationException(); }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void removeStatementEventListener(StatementEventListener listener) { throw new UnsupportedOperationException(); }
// in src/main/org/h2/jdbcx/JdbcConnectionPool.java
public Connection getConnection(String user, String password) { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public FileLock lock(long position, long size, boolean shared) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public MappedByteBuffer map(MapMode mode, long position, long size) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public int read(ByteBuffer dst, long position) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long transferFrom(ReadableByteChannel src, long position, long count) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long transferTo(long position, long count, WritableByteChannel target) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public FileLock tryLock(long position, long size, boolean shared) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public int write(ByteBuffer src, long position) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/store/fs/FileBase.java
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException { throw new UnsupportedOperationException(); }
// in src/main/org/h2/util/SoftHashMap.java
public Set<Entry<K, V>> entrySet() { throw new UnsupportedOperationException(); }
// in src/main/org/h2/server/web/WebApp.java
public void remove() { throw new UnsupportedOperationException(); }
// in src/tools/org/h2/dev/store/tree/StoredMap.java
public void remove() { throw new UnsupportedOperationException(); }
// in src/tools/org/h2/dev/store/btree/BtreeMap.java
public void remove() { throw new UnsupportedOperationException(); }
// in src/tools/org/h2/jaqu/util/WeakIdentityHashMap.java
public Set<java.util.Map.Entry<K, V>> entrySet() { throw new UnsupportedOperationException(); }
// in src/tools/org/h2/jaqu/util/WeakIdentityHashMap.java
public Set<K> keySet() { throw new UnsupportedOperationException(); }
// in src/tools/org/h2/jaqu/util/WeakIdentityHashMap.java
public void putAll(Map<? extends K, ? extends V> m) { throw new UnsupportedOperationException(); }
// in src/tools/org/h2/jaqu/util/WeakIdentityHashMap.java
public Collection<V> values() { throw new UnsupportedOperationException(); }
0 0 0 0 0
unknown (Lib) XAException 5
            
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public int prepare(Xid xid) throws XAException { if (isDebugEnabled()) { debugCode("prepare("+JdbcXid.toString(xid)+");"); } checkOpen(); if (!currentTransaction.equals(xid)) { throw new XAException(XAException.XAER_INVAL); } Statement stat = null; try { stat = physicalConn.createStatement(); stat.execute("PREPARE COMMIT " + JdbcXid.toString(xid)); prepared = true; } catch (SQLException e) { throw convertException(e); } finally { JdbcUtils.closeSilently(stat); } return XA_OK; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void end(Xid xid, int flags) throws XAException { if (isDebugEnabled()) { debugCode("end("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");"); } // TODO transaction end: implement this method if (flags == TMSUSPEND) { return; } if (!currentTransaction.equals(xid)) { throw new XAException(XAException.XAER_OUTSIDE); } prepared = false; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void start(Xid xid, int flags) throws XAException { if (isDebugEnabled()) { debugCode("start("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");"); } if (flags == TMRESUME) { return; } if (flags == TMJOIN) { if (currentTransaction != null && !currentTransaction.equals(xid)) { throw new XAException(XAException.XAER_RMERR); } } else if (currentTransaction != null) { throw new XAException(XAException.XAER_NOTA); } try { physicalConn.setAutoCommit(false); } catch (SQLException e) { throw convertException(e); } currentTransaction = xid; prepared = false; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
private void checkOpen() throws XAException { if (physicalConn == null) { throw new XAException(XAException.XAER_RMERR); } }
0 7
            
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public Xid[] recover(int flag) throws XAException { debugCodeCall("recover", quoteFlags(flag)); checkOpen(); Statement stat = null; try { stat = physicalConn.createStatement(); ResultSet rs = stat.executeQuery("SELECT * FROM INFORMATION_SCHEMA.IN_DOUBT ORDER BY TRANSACTION"); ArrayList<Xid> list = New.arrayList(); while (rs.next()) { String tid = rs.getString("TRANSACTION"); int id = getNextId(XID); Xid xid = new JdbcXid(factory, id, tid); list.add(xid); } rs.close(); Xid[] result = new Xid[list.size()]; list.toArray(result); if (list.size() > 0) { prepared = true; } return result; } catch (SQLException e) { XAException xa = new XAException(XAException.XAER_RMERR); xa.initCause(e); throw xa; } finally { JdbcUtils.closeSilently(stat); } }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public int prepare(Xid xid) throws XAException { if (isDebugEnabled()) { debugCode("prepare("+JdbcXid.toString(xid)+");"); } checkOpen(); if (!currentTransaction.equals(xid)) { throw new XAException(XAException.XAER_INVAL); } Statement stat = null; try { stat = physicalConn.createStatement(); stat.execute("PREPARE COMMIT " + JdbcXid.toString(xid)); prepared = true; } catch (SQLException e) { throw convertException(e); } finally { JdbcUtils.closeSilently(stat); } return XA_OK; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void rollback(Xid xid) throws XAException { if (isDebugEnabled()) { debugCode("rollback("+JdbcXid.toString(xid)+");"); } try { physicalConn.rollback(); physicalConn.setAutoCommit(true); if (prepared) { Statement stat = null; try { stat = physicalConn.createStatement(); stat.execute("ROLLBACK TRANSACTION " + JdbcXid.toString(xid)); } finally { JdbcUtils.closeSilently(stat); } prepared = false; } } catch (SQLException e) { throw convertException(e); } currentTransaction = null; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void end(Xid xid, int flags) throws XAException { if (isDebugEnabled()) { debugCode("end("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");"); } // TODO transaction end: implement this method if (flags == TMSUSPEND) { return; } if (!currentTransaction.equals(xid)) { throw new XAException(XAException.XAER_OUTSIDE); } prepared = false; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void start(Xid xid, int flags) throws XAException { if (isDebugEnabled()) { debugCode("start("+JdbcXid.toString(xid)+", "+quoteFlags(flags)+");"); } if (flags == TMRESUME) { return; } if (flags == TMJOIN) { if (currentTransaction != null && !currentTransaction.equals(xid)) { throw new XAException(XAException.XAER_RMERR); } } else if (currentTransaction != null) { throw new XAException(XAException.XAER_NOTA); } try { physicalConn.setAutoCommit(false); } catch (SQLException e) { throw convertException(e); } currentTransaction = xid; prepared = false; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
public void commit(Xid xid, boolean onePhase) throws XAException { if (isDebugEnabled()) { debugCode("commit("+JdbcXid.toString(xid)+", "+onePhase+");"); } Statement stat = null; try { if (onePhase) { physicalConn.commit(); } else { stat = physicalConn.createStatement(); stat.execute("COMMIT TRANSACTION " + JdbcXid.toString(xid)); prepared = false; } physicalConn.setAutoCommit(true); } catch (SQLException e) { throw convertException(e); } finally { JdbcUtils.closeSilently(stat); } currentTransaction = null; }
// in src/main/org/h2/jdbcx/JdbcXAConnection.java
private void checkOpen() throws XAException { if (physicalConn == null) { throw new XAException(XAException.XAER_RMERR); } }
0 0 0

Miscellanous Metrics

nF = Number of Finally 179
nF = Number of Try-Finally (without catch) 121
Number of Methods with Finally (nMF) 173 / 8548 (2%)
Number of Finally with a Continue 0
Number of Finally with a Return 0
Number of Finally with a Throw 0
Number of Finally with a Break 0
Number of different exception types thrown 18
Number of Domain exception types thrown 3
Number of different exception types caught 32
Number of Domain exception types caught 2
Number of exception declarations in signatures 1517
Number of different exceptions types declared in method signatures 18
Number of library exceptions types declared in method signatures 16
Number of Domain exceptions types declared in method signatures 2
Number of Catch with a continue 4
Number of Catch with a return 61
Number of Catch with a Break 9
nbIf = Number of If 8983
nbFor = Number of For 1455
Number of Method with an if 2958 / 8548
Number of Methods with a for 968 / 8548
Number of Method starting with a try 543 / 8548 (6.4%)
Number of Expressions 102853
Number of Expressions in try 15812 (15.4%)