Example #1
0
 public void run() {
   boolean exceptionInTest = false;
   try {
     try {
       setUp();
       invoke();
     } catch (InvocationTargetException x) {
       exceptionInTest = true;
       throw new TestException(x.getTargetException());
     } catch (Exception x) {
       exceptionInTest = true;
       throw new TestException(x);
     }
   } finally {
     try {
       tearDown();
     } catch (RuntimeException exc) {
       if (!exceptionInTest) {
         throw exc;
       }
       exc.printStackTrace();
     }
   }
 }
Example #2
0
  public void execute(FacesContext context) throws FacesException {
    boolean isFiner = log.isLoggable(Level.FINER);

    if (context.getResponseComplete() || context.getRenderResponse()) return;

    beforePhase(context, PhaseId.RESTORE_VIEW);

    try {
      if (isFiner) log.finer("JSF[] before restore view");

      restoreView(context);
    } finally {
      afterPhase(context, PhaseId.RESTORE_VIEW);
    }

    if (context.getResponseComplete() || context.getRenderResponse()) return;

    UIViewRoot viewRoot = context.getViewRoot();

    beforePhase(context, PhaseId.APPLY_REQUEST_VALUES);

    try {
      if (isFiner) log.finer(context.getViewRoot() + " before process decodes");

      viewRoot.processDecodes(context);
    } catch (RuntimeException e) {
      log.log(Level.WARNING, e.toString(), e);
    } finally {
      afterPhase(context, PhaseId.APPLY_REQUEST_VALUES);
    }

    //
    // Process Validations (processValidators)
    //

    if (context.getResponseComplete() || context.getRenderResponse()) return;

    beforePhase(context, PhaseId.PROCESS_VALIDATIONS);

    try {
      if (isFiner) log.finer(context.getViewRoot() + " before process validators");

      viewRoot.processValidators(context);
    } finally {
      afterPhase(context, PhaseId.PROCESS_VALIDATIONS);
    }

    //
    // Update Model Values (processUpdates)
    //

    if (context.getResponseComplete() || context.getRenderResponse()) return;

    beforePhase(context, PhaseId.UPDATE_MODEL_VALUES);

    try {
      if (isFiner) log.finer(context.getViewRoot() + " before process updates");

      viewRoot.processUpdates(context);
    } catch (RuntimeException e) {
      if (sendError(context, "processUpdates", e)) return;
    } finally {
      afterPhase(context, PhaseId.UPDATE_MODEL_VALUES);
    }

    //
    // Invoke Application (processApplication)
    //

    if (context.getResponseComplete() || context.getRenderResponse()) return;

    beforePhase(context, PhaseId.INVOKE_APPLICATION);

    try {
      if (isFiner) log.finer(context.getViewRoot() + " before process application");

      viewRoot.processApplication(context);
    } finally {
      afterPhase(context, PhaseId.INVOKE_APPLICATION);
    }
  }