Package com.ibatis.common.exception

Examples of com.ibatis.common.exception.NestedRuntimeException


      }

      parser.parse(reader);
      return vars.client;
    } catch (Exception e) {
      throw new NestedRuntimeException("Error occurred.  Cause: " + e, e);
    }
  }
View Full Code Here


            String statementName = (String) statementNames.next();
            MappedStatement statement = vars.client.getDelegate().getMappedStatement(statementName);
            if (statement != null) {
              statement.addExecuteListener(cacheModel);
            } else {
              throw new NestedRuntimeException("Could not find statement named '" + statementName + "' for use as a flush trigger for the cache model named '" + cacheName + "'.");
            }
          }
        }
      }
    });
View Full Code Here

            props = Resources.getResourceAsProperties(resource);
          } else if (url != null) {
            vars.errorCtx.setResource(url);
            props = Resources.getUrlAsProperties(url);
          } else {
            throw new NestedRuntimeException("The " + "properties" + " element requires either a resource or a url attribute.");
          }

          if (vars.properties == null) {
            vars.properties = props;
          } else {
            props.putAll(vars.properties);
            vars.properties = props;
          }
        } catch (Exception e) {
          throw new NestedRuntimeException("Error loading properties.  Cause: " + e);
        }
      }
    });
  }
View Full Code Here

          if (impl instanceof TypeHandlerCallback) {
            typeHandler = new CustomTypeHandler((TypeHandlerCallback) impl);
          } else if (impl instanceof TypeHandler) {
            typeHandler = (TypeHandler) impl;
          } else {
            throw new NestedRuntimeException ("The class '' is not a valid implementation of TypeHandler or TypeHandlerCallback");
          }

          vars.errorCtx.setMoreInfo("Check the javaType attribute '" + javaType + "' (must be a classname) or the jdbcType '" + jdbcType + "' (must be a JDBC type name).");
          if (jdbcType != null && jdbcType.length() > 0) {
            typeHandlerFactory.register(Resources.classForName(javaType), jdbcType, typeHandler);
View Full Code Here

  }

  private void initialize(Map props) {
    try {
      if (props == null) {
        throw new NestedRuntimeException("SimpleDataSource: The properties map passed to the initializer was null.");
      }

      if (!(props.containsKey(PROP_JDBC_DRIVER)
          && props.containsKey(PROP_JDBC_URL)
          && props.containsKey(PROP_JDBC_USERNAME)
          && props.containsKey(PROP_JDBC_PASSWORD))) {
        throw new NestedRuntimeException("SimpleDataSource: Some properties were not set.");
      } else {

        jdbcDriver = (String) props.get(PROP_JDBC_DRIVER);
        jdbcUrl = (String) props.get(PROP_JDBC_URL);
        jdbcUsername = (String) props.get(PROP_JDBC_USERNAME);
        jdbcPassword = (String) props.get(PROP_JDBC_PASSWORD);

        poolMaximumActiveConnections =
            props.containsKey(PROP_POOL_MAX_ACTIVE_CONN)
            ? Integer.parseInt((String) props.get(PROP_POOL_MAX_ACTIVE_CONN))
            : 10;

        poolMaximumIdleConnections =
            props.containsKey(PROP_POOL_MAX_IDLE_CONN)
            ? Integer.parseInt((String) props.get(PROP_POOL_MAX_IDLE_CONN))
            : 5;

        poolMaximumCheckoutTime =
            props.containsKey(PROP_POOL_MAX_CHECKOUT_TIME)
            ? Integer.parseInt((String) props.get(PROP_POOL_MAX_CHECKOUT_TIME))
            : 20000;

        poolTimeToWait =
            props.containsKey(PROP_POOL_TIME_TO_WAIT)
            ? Integer.parseInt((String) props.get(PROP_POOL_TIME_TO_WAIT))
            : 20000;

        poolPingEnabled =
            props.containsKey(PROP_POOL_PING_ENABLED)
            ? Boolean.valueOf((String) props.get(PROP_POOL_PING_ENABLED)).booleanValue()
            : false;

        poolPingQuery =
            props.containsKey(PROP_POOL_PING_QUERY)
            ? (String) props.get(PROP_POOL_PING_QUERY)
            : "NO PING QUERY SET";

        poolPingConnectionsOlderThan =
            props.containsKey(PROP_POOL_PING_CONN_OLDER_THAN)
            ? Integer.parseInt((String) props.get(PROP_POOL_PING_CONN_OLDER_THAN))
            : 0;

        poolPingConnectionsNotUsedFor =
            props.containsKey(PROP_POOL_PING_CONN_NOT_USED_FOR)
            ? Integer.parseInt((String) props.get(PROP_POOL_PING_CONN_NOT_USED_FOR))
            : 0;

        jdbcDefaultAutoCommit =
            props.containsKey(PROP_JDBC_DEFAULT_AUTOCOMMIT)
            ? Boolean.valueOf((String) props.get(PROP_JDBC_DEFAULT_AUTOCOMMIT)).booleanValue()
            : false;

        useDriverProps = false;
        Iterator propIter = props.keySet().iterator();
        driverProps = new Properties();
        driverProps.put("user", jdbcUsername);
        driverProps.put("password", jdbcPassword);
        while (propIter.hasNext()) {
          String name = (String) propIter.next();
          String value = (String) props.get(name);
          if (name.startsWith(ADD_DRIVER_PROPS_PREFIX)) {
            driverProps.put(name.substring(ADD_DRIVER_PROPS_PREFIX_LENGTH), value);
            useDriverProps = true;
          }
        }

        expectedConnectionTypeCode = assembleConnectionTypeCode(jdbcUrl, jdbcUsername, jdbcPassword);

        Resources.instantiate(jdbcDriver);
      }

    } catch (Exception e) {
      log.error("SimpleDataSource: Error while loading properties. Cause: " + e.toString(), e);
      throw new NestedRuntimeException("SimpleDataSource: Error while loading properties. Cause: " + e, e);
    }
  }
View Full Code Here

      Object value2 = PROBE.getObject(parameterObject, comparePropertyName);
      return compareValues(type, value1, value2);
    } else if (compareValue != null) {
      return compareValues(type, value1, compareValue);
    } else {
      throw new NestedRuntimeException("Error comparing in conditional fragment.  Uknown 'compare to' values.");
    }
  }
View Full Code Here

      return Boolean.valueOf(value);
    } else if (type == Date.class) {
      try {
        return DATE_FORMAT.parse(value);
      } catch (ParseException e) {
        throw new NestedRuntimeException("Error parsing date.  Cause: " + e, e);
      }
    } else if (type == BigInteger.class) {
      return new BigInteger(value);
    } else if (type == BigDecimal.class) {
      return new BigDecimal(value);
View Full Code Here

      return System.currentTimeMillis() - checkoutTimestamp;
    }

    private Connection getValidConnection() {
      if (!valid) {
        throw new NestedRuntimeException("Error accessing SimplePooledConnection.  Connection has been invalidated (probably released back to the pool).");
      }
      return realConnection;
    }
View Full Code Here

TOP

Related Classes of com.ibatis.common.exception.NestedRuntimeException

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.