Package com.google.enterprise.connector.util.diffing

Examples of com.google.enterprise.connector.util.diffing.SnapshotRepositoryRuntimeException


    replay(repositoryHandler);
  }

  private void expectExecuteAndThrow() {
    expect(repositoryHandler.executeQueryAndAddDocs())
        .andThrow(new SnapshotRepositoryRuntimeException(
            "mock exception", new Exception("mock cause")))
        .once();
    replay(repositoryHandler);
  }
View Full Code Here


        writer.key(name).value(toJson(name, jsonObject.get(name)));
      }
      writer.endObject();
      return buffer.toString();
    } catch (IOException e) {
      throw new SnapshotRepositoryRuntimeException(
          "Error serializing document " + objectId, e);
    } catch (JSONException e) {
      throw new SnapshotRepositoryRuntimeException(
          "Error serializing document " + objectId, e);
    }
  }
View Full Code Here

    } catch (SnapshotRepositoryRuntimeException e) {
      LOG.info("Repository Unreachable. Resetting DB cursor to "
          + "start traversal from begining after recovery.");
      queryStrategy.resetCursor();
      LOG.warning("Unable to connect to the database\n" + e.toString());
      throw new SnapshotRepositoryRuntimeException(
          "Unable to connect to the database.", e);
    }
    if (rows.size() == 0) {
      queryStrategy.logComplete();
      LOG.info("Crawl cycle of database is complete. Resetting DB cursor to "
View Full Code Here

     */
    private String getPrimaryKeyColumn(Set<String> columnNames) {
      try {
        return dbContext.getPrimaryKeyColumns(columnNames).get(0);
      } catch (DBException e) {
        throw new SnapshotRepositoryRuntimeException(
            "Error getting the primary key column.", e);
      }
    }
View Full Code Here

      return sqlSessionFactory.openSession();
    } catch (RuntimeException e) {
      Throwable cause = (e.getCause() != null &&
          e.getCause() instanceof SQLException) ? e.getCause() : e;
      LOG.log(Level.WARNING, "Unable to connect to the database.", cause);
      throw new SnapshotRepositoryRuntimeException(
          "Unable to connect to the database.", cause);
    }
  }
View Full Code Here

    } else if (e.getCause() != null && e.getCause() instanceof SQLException) {
      sqlException = (SQLException) e.getCause();
    } else {
      // It is not even a SQLException. Something else is wrong, so propagate
      // the error.
      throw new SnapshotRepositoryRuntimeException(e.getMessage(), e);
    }
    String sqlState = sqlException.getSQLState();
    if (sqlState != null) {
      // Look for SQL syntax errors, both ISO style and XOpen style.
      if (sqlState.startsWith("42") || sqlState.startsWith("S0")
          || sqlState.startsWith("37")) {
        LOG.log(Level.WARNING, "Could not execute SQL query on the database.",
                sqlException);
        // Swallow the exception.
      } else if (sqlState.startsWith("08")) {    // Connection errors.
        LOG.log(Level.WARNING, "Unable to connect to the database.",
                sqlException);
        throw new SnapshotRepositoryRuntimeException(
            "Unable to connect to the database.", sqlException);
      } else {
        throw new SnapshotRepositoryRuntimeException(sqlException.getMessage(),
                                                     sqlException);
      }
    } else {
      // No SQLState to consider. Check connectivity with DB.
      Connection conn = null;
      try {
        conn = session.getConnection();
        LOG.log(Level.WARNING, "Could not execute SQL query on the database.",
                e);
        // Swallow the exception.
      } catch (RuntimeException e1) {
        Throwable cause = (e1.getCause() != null &&
            e1.getCause() instanceof SQLException) ? e1.getCause() : e1;
        LOG.log(Level.WARNING, "Unable to connect to the database", cause);
        throw new SnapshotRepositoryRuntimeException(
            "Unable to connect to the database.", cause);
      } finally {
        if (conn != null) {
          try {
            conn.close();
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.util.diffing.SnapshotRepositoryRuntimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.