Exemple #1
0
 public static boolean isCancelled(Throwable t) {
   if (t == null) {
     return false;
   }
   if (handler == null) {
     handler = (CancelHandler) DIContainerUtil.getComponentNoException(CancelHandler.class);
     if (handler == null) {
       return false;
     }
   }
   final List candidates = handler.getCancellableExceptions();
   for (Iterator itr = candidates.iterator(); itr.hasNext(); ) {
     Class tc = (Class) itr.next();
     if (t.getClass() == tc) {
       logger.log("WTDA0206", new Object[] {t});
       return true;
     }
   }
   final List nameCandidates = handler.getCancellableExceptionNames();
   for (Iterator itr = nameCandidates.iterator(); itr.hasNext(); ) {
     final String name = (String) itr.next();
     if (t.getClass().getName().endsWith(name)) {
       logger.log("WTDA0206", new Object[] {t});
       return true;
     }
   }
   return false;
 }
Exemple #2
0
  public static Converter findConverter(final FacesContext context, final UIOutput component) {

    Converter converter = component.getConverter();
    if (converter != null) {
      return converter;
    }
    ValueBinding vb = component.getValueBinding("value");
    if (vb != null) {
      String expression = vb.getExpressionString();
      converter = ConverterResource.getConverter(expression);
      if (converter != null) {
        return converter;
      }
    }
    final Class valueType = getValueType(context, component);
    if (ComponentUtil_.isPerformNoConversion(valueType)) {
      return null;
    }
    try {
      return context.getApplication().createConverter(valueType);
    } catch (final FacesException ex) {
      logger.log(ex);
      return null;
    }
  }
 public void setRollbackOnly() {
   try {
     if (userTransaction.getStatus() == STATUS_ACTIVE) {
       userTransaction.setRollbackOnly();
     }
   } catch (final Exception e) {
     logger.log("ESSR0017", new Object[] {e.getMessage()}, e);
   }
 }
 /** ステートメントをクローズします。 */
 protected void closeStatements() {
   if (statement != null) {
     try {
       statement.close();
     } catch (SQLException ignore) {
       logger.log(ignore);
     }
     statement = null;
   }
   if (preparedStatement != null) {
     try {
       preparedStatement.close();
     } catch (SQLException ignore) {
       logger.log(ignore);
     }
     preparedStatement = null;
   }
 }
 /** コネクションをクローズします。 */
 protected void closeConnection() {
   if (connection != null) {
     try {
       connection.close();
     } catch (SQLException ignore) {
       logger.log(ignore);
     }
     connection = null;
   }
 }
 /**
  * 引数を返します。
  *
  * @param argTypes
  * @return 引数
  */
 protected Object[] getArgs(Class[] argTypes) {
   Object[] args = new Object[argTypes.length];
   for (int i = 0; i < argTypes.length; ++i) {
     try {
       args[i] = getComponentDef().getContainer().getComponent(argTypes[i]);
     } catch (ComponentNotFoundRuntimeException ex) {
       logger.log(
           "WSSR0007",
           new Object[] {getComponentDef().getComponentClass().getName(), ex.getComponentKey()});
       args[i] = null;
     }
   }
   return args;
 }
 /**
  * 指定されたExcelを読みデータセットとして返します。
  *
  * @param path Excelのパス
  * @param trimString 文字列に含まれる空白を取り除く場合<code>true</code>
  * @return Excel内のデータのデータセット表現
  */
 protected DataSet readXls(final String path, final boolean trimString) {
   if (logger.isDebugEnabled()) {
     logger.log("DSSR0104", new Object[] {path});
   }
   return dataAccessor.readXls(path, trimString);
 }