/** @tests java.lang.NoSuchMethodException#NoSuchMethodException() */
 @TestTargetNew(
     level = TestLevel.COMPLETE,
     notes = "",
     method = "NoSuchMethodException",
     args = {})
 public void test_Constructor() {
   NoSuchMethodException e = new NoSuchMethodException();
   assertNull(e.getMessage());
   assertNull(e.getLocalizedMessage());
   assertNull(e.getCause());
 }
예제 #2
0
 private void init(Context context) {
   this.context = context;
   fileManager = (FileManager) context;
   initDragWindowParams();
   this.setSmoothScrollbarEnabled(true);
   if (SDK8) {
     try {
       Class c = this.getClass();
       method = c.getMethod("smoothScrollToPosition", int.class);
     } catch (SecurityException e) {
       // TODO Auto-generated catch block
       FileManager.error("SecurityException:\n" + e.getLocalizedMessage());
       method = null;
     } catch (NoSuchMethodException e) {
       // TODO Auto-generated catch block
       FileManager.error("NoSuchMethodException:\n" + e.getLocalizedMessage());
       method = null;
     }
   }
   // ROLL_HEIGHT = ROLL_HEIGHT_DP * (int)fileManager.getDensity();
 }
    /**
     * Determine the transaction attribute for this method invocation.
     *
     * <p>Defaults to the class's transaction attribute if no method attribute is found.
     *
     * @param method the method for the current invocation (never <code>null</code>)
     * @param targetClass the target class for this invocation (may be <code>null</code>)
     * @return TransactionAttribute for this method, or <code>null</code> if the method is not
     *     transactional
     */
    public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass) {
      // First, see if we have a cached value.
      Object cacheKey = getCacheKey(method, targetClass);
      Object cached = this.attributeCache.get(cacheKey);
      if (cached != null) {
        // Value will either be canonical value indicating there is no transaction attribute,
        // or an actual transaction attribute.
        if (cached == NULL_TRANSACTION_ATTRIBUTE) {
          return null;
        } else {
          return (TransactionAttribute) cached;
        }
      } else {
        TransactionAttribute txAtt = NULL_TRANSACTION_ATTRIBUTE;

        // We need to work it out.
        // add by carvin.. jade method adapter.
        boolean isSQLQuery = false, isSQLAnnotation = false;
        if ((isSQLQuery = isSQLQuery(method)) || (isSQLAnnotation = isSQLAnnotation(method))) {
          SQLType sqlType = SQLType.READ;
          if (isSQLQuery) {
            String sql = sqlQueries.getQuery(getMethodName(method));
            sqlType = getSqlType(sql);
          } else {
            SQL sqlAnnotation = method.getAnnotation(SQL.class);
            String sql = sqlAnnotation.value();
            sqlType = sqlAnnotation.type();
            if (sqlType == SQLType.AUTO_DETECT) {
              sqlType = getSqlType(sql);
            }
          }
          try {
            Class<DataAccessImpl> tempClass = DataAccessImpl.class;
            Method tempMethod = null;
            if (sqlType == SQLType.WRITE) {
              tempMethod =
                  tempClass.getDeclaredMethod(
                      "update", String.class, Object[].class, KeyHolder.class);
            } else if (sqlType == SQLType.PROCEDURE) {
              tempMethod =
                  tempClass.getDeclaredMethod(
                      "call", String.class, Object[].class, KeyHolder.class);
            } else {
              tempMethod =
                  tempClass.getDeclaredMethod(
                      "select", String.class, Object[].class, RowMapper.class);
            }
            txAtt = computeTransactionAttribute(tempMethod, tempClass);
          } catch (NoSuchMethodException e) {
            logger.warn(
                "no [update] method adapter. exception messager is : " + e.getLocalizedMessage());
            txAtt = NULL_TRANSACTION_ATTRIBUTE;
          }
        } else {
          txAtt = computeTransactionAttribute(method, targetClass);
        }

        // Put it in the cache.
        if (txAtt == null) {
          this.attributeCache.put(cacheKey, NULL_TRANSACTION_ATTRIBUTE);
        } else {
          if (logger.isDebugEnabled()) {
            logger.debug(
                "Adding transactional method '" + method.getName() + "' with attribute: " + txAtt);
          }
          this.attributeCache.put(cacheKey, txAtt);
        }
        return txAtt;
      }
    }