Package org.springframework.dao

Examples of org.springframework.dao.DataRetrievalFailureException


  public CasAuthentication get(String serviceTicket) {
    Element element = null;
    try {
      element = cache.get(serviceTicket);
    } catch (CacheException cacheException) {
      throw new DataRetrievalFailureException("Cache failure: " + cacheException.getMessage());
    }

    if (logger.isDebugEnabled()) {
      logger.debug("Cache hit: " + (element != null) + "; service ticket: " + serviceTicket);
    }
View Full Code Here


    switch (err) {

    // 10 - semantic analysis
    case 10:
      return new DataRetrievalFailureException(cause, ex);
      // 11 - parse error
    case 11:
      return new BadSqlGrammarException("Hive query", "", new SQLException(cause, sqlState));
      // 12 - Internal error
    case 12:
      return new NonTransientDataAccessResourceException(cause, ex);
      // -10000 - another internal error
    case -10000:
      return new NonTransientDataAccessResourceException(cause, ex);
    }

    // look at the SQL code

    if ("08S01".equals(sqlState)) {
      // internal error
      return new NonTransientDataAccessResourceException(cause, ex);
    }
    // generic syntax error
    else if ("42000".equals(sqlState)) {
      return new BadSqlGrammarException("Hive query", "", new SQLException(cause, sqlState));
    }
    // not found/already exists
    else if ("42S02".equals(sqlState)) {
      return new InvalidDataAccessResourceUsageException(cause, ex);
    }
    // invalid argument
    else if ("21000".equals(sqlState)) {
      return new BadSqlGrammarException("Hive query", "", new SQLException(cause, sqlState));
    }

    // use the new Hive 0.10 codes
    // https://issues.apache.org/jira/browse/HIVE-3001

    // semantic analysis
    if (err >= 10000 && err <= 19999) {
      return new InvalidDataAccessResourceUsageException(cause, ex);
    }
    // non transient runtime errors
    else if (err >= 20000 && err <= 29999) {
      return new DataRetrievalFailureException(cause, ex);

    }
    // transient error - should retry
    else if (err >= 30000 && err <= 39999) {
      return new TransientDataAccessResourceException(cause, ex);
View Full Code Here

   * @param e the exception
   * @return Converted exception
   */
  protected DataAccessException convertException(Exception e) {
    // TODO: do better mapping for exceptions
    return new DataRetrievalFailureException(e.getMessage(), e);
  }
View Full Code Here

   * @param ex
   * @return
   */
  public static DataAccessException translateException(RepositoryException ex) {
    if (ex instanceof AccessDeniedException) {
      return new DataRetrievalFailureException("Access denied to this data", ex);
    }
    if (ex instanceof ConstraintViolationException) {
      return new DataIntegrityViolationException("Constraint has been violated", ex);
    }
    if (ex instanceof InvalidItemStateException) {
      return new ConcurrencyFailureException("Invalid item state", ex);
    }
    if (ex instanceof InvalidQueryException) {
      return new DataRetrievalFailureException("Invalid query", ex);
    }
    if (ex instanceof InvalidSerializedDataException) {
      return new DataRetrievalFailureException("Invalid serialized data", ex);
    }
    if (ex instanceof ItemExistsException) {
      return new DataIntegrityViolationException("An item already exists", ex);
    }
    if (ex instanceof ItemNotFoundException) {
      return new DataRetrievalFailureException("Item not found", ex);
    }
    if (ex instanceof LoginException) {
      return new DataAccessResourceFailureException("Bad login", ex);
    }
    if (ex instanceof LockException) {
      return new ConcurrencyFailureException("Item is locked", ex);
    }
    if (ex instanceof MergeException) {
      return new DataIntegrityViolationException("Merge failed", ex);
    }
    if (ex instanceof NamespaceException) {
      return new InvalidDataAccessApiUsageException("Namespace not registred", ex);
    }
    if (ex instanceof NoSuchNodeTypeException) {
      return new InvalidDataAccessApiUsageException("No such node type", ex);
    }
    if (ex instanceof NoSuchWorkspaceException) {
      return new DataAccessResourceFailureException("Workspace not found", ex);
    }
    if (ex instanceof PathNotFoundException) {
      return new DataRetrievalFailureException("Path not found", ex);
    }
    if (ex instanceof ReferentialIntegrityException) {
      return new DataIntegrityViolationException("Referential integrity violated", ex);
    }
    if (ex instanceof UnsupportedRepositoryOperationException) {
View Full Code Here

        String sql = ((Handle)target).toString(); // we really want the failing SQL statement here - is that possible??
        if (t instanceof SQLException) {
            throw exceptionTranslator.translate("DBI", sql, (SQLException)t);
        }
        else
            throw new DataRetrievalFailureException("DBI Exception:" + ex.getMessage(), t);
    }
View Full Code Here

        }
    }

    private class MockAuthenticationDaoSimulateBackendError implements UserDetailsService {
        public UserDetails loadUserByUsername(String username) {
            throw new DataRetrievalFailureException("This mock simulator is designed to fail");
        }
View Full Code Here

        PPolicyDecoder decoder = new NetscapeDecoder();

        try {
            decoder.decode();
        } catch (IOException e) {
            throw new DataRetrievalFailureException("Failed to parse control value", e);
        }
    }
View Full Code Here

                            return new BERInteger(stream, bytesRead);
                        }
                    }
                }

                throw new DataRetrievalFailureException("Unexpected tag " + tag);
            }
View Full Code Here

        try {
            Weblogger roller = WebloggerFactory.getWeblogger();
            UserManager umgr = roller.getUserManager();
            userData = umgr.getUserByUserName(userName, Boolean.TRUE);
        } catch (WebloggerException ex) {
            throw new DataRetrievalFailureException("ERROR in user lookup", ex);
        }
       
        if (userData == null) {
            throw new UsernameNotFoundException("ERROR no user: " + userName);
        }
View Full Code Here

        Element element = null;

        try {
            element = cache.get(userCert);
        } catch (CacheException cacheException) {
            throw new DataRetrievalFailureException("Cache failure: " + cacheException.getMessage());
        }

        if (logger.isDebugEnabled()) {
            String subjectDN = "unknown";
View Full Code Here

TOP

Related Classes of org.springframework.dao.DataRetrievalFailureException

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.