Examples of ExceptionHandler


Examples of anvil.codec.ExceptionHandler

        "push", "(Lanvil/core/Any;)V"));

      _framelocal = code.addLocal();
      code.astore(_framelocal);

      ExceptionHandler handler = code.startExceptionHandler(true);
      _handler = handler;
      Target tostart = code.getTarget();
      if (_start != null) {
        _start.compile(context, Node.GET_BOOLEAN);
        Source istrue = code.if_ne();
        handler.callFinally();
        handler.jumpOut();
        istrue.bind();
      }
      if (_statement != null) {
        _statement.compile(context);
      }
      if (_end != null) {
        _end.compile(context, Node.GET_BOOLEAN);
        code.if_ne(tostart);
      }
      handler.endTry();
      if (_statement == null || !_statement.isBlocked()) {
        handler.callFinally();
        handler.jumpOut();
      }
      handler.endProtectedRegion();

      handler.startCatch(0);
      int thrown = code.addLocal();
      code.astore(thrown);
      handler.callFinally();
      code.aload(thrown);
      code.athrow();
      handler.endCatches();
       _handler = null;

      // finally
      handler.startFinally();
      int returnto = code.addLocal();
      code.astore(returnto);
      code.aload_first();
      code.invokevirtual(contextframe);
      code.invokevirtual(pool.addMethodRef("anvil/script/StackFrame",
        "pop", "()Lanvil/core/Any;"));
      code.pop();
      if (_release != null) {
        _release.compile(context, Node.GET);
        code.pop();
      }
      code.ret(returnto);
      handler.endFinally();
      handler.end();
     
      code.endLocal(_framelocal);
     
    } else {
      if (_init != null) {
View Full Code Here

Examples of anvil.codec.ExceptionHandler

    int lock = code.addLocal();
    _expression.compile(context, Expression.GET);
    code.astore(lock);
    code.aload(lock);
    code.monitorenter();
    ExceptionHandler handler = code.startExceptionHandler(true);
    _handler = handler;
    if (_statement == null) {
      code.nop();
    } else {
      _statement.compile(context);
    }
    handler.endTry();
    if (!_statement.isBlocked()) {
      handler.callFinally();
      handler.jumpOut();
    }
    handler.endProtectedRegion();
    handler.startCatch(0);
    int thrown = code.addLocal();
    code.astore(thrown);
    handler.callFinally();
    code.aload(thrown);
    code.athrow();
    handler.endCatches();
    _handler = null;

    handler.startFinally();
    int returnto = code.addLocal();
    code.astore(returnto);
    code.aload(lock);
    code.monitorexit();
    code.ret(returnto);
    handler.endFinally();

    handler.end();
    code.endLocal(lock);
  }
View Full Code Here

Examples of anvil.codec.ExceptionHandler

    boolean has_try = (_catches > 0) || (_finally != null);
    if (has_try) {
      Code code = context.getCode();

      // try
      ExceptionHandler handler = code.startExceptionHandler(_finally != null);
      _handler = handler;
      if (_statement == EMPTY) {
        code.nop();
      } else {
        _statement.compile(context);
      }
      handler.endTry();
      if (!_statement.isBlocked()) {
        handler.callFinally();
        handler.jumpOut();
      }

      // catch
      if (_catches > 0) {
        handler.startCatch(code.getPool().addClass("anvil/script/ScriptException"));
        int l_throwable = code.addLocal();
        int l_data = code.addLocal();
        code.astore(l_throwable);
        code.aload(l_throwable);
        code.invokevirtual(code.getPool().addMethodRef("anvil/script/ScriptException", "getData", "()Lanvil/core/Any;"));
        code.astore(l_data);
        for(int i=0; i<_catches; i++) {
          _catch[i].compile(context, handler, l_data);
        }
        code.aload(l_throwable);
        code.athrow();
      }

      handler.endProtectedRegion();

      if (_finally != null) {
        handler.startCatch(0);
        int thrown = code.addLocal();
        code.astore(thrown);
        handler.callFinally();
        code.aload(thrown);
        code.athrow();
      }
      handler.endCatches();
      _handler = null;

      // finally
      if (_finally != null) {
        handler.startFinally();
        int returnto = code.addLocal();
        code.astore(returnto);
        _finally.compile(context);
        if (!_finally.isBlocked()) {
          code.ret(returnto);
        }
        handler.endFinally();
      }
     
      handler.end();
     
    } else {
      _statement.compile(context);
    }
  }
View Full Code Here

Examples of com.asakusafw.runtime.util.cache.ConcurrentBatchFileCacheRepository.ExceptionHandler

                    new FileCacheRepository() {
                        @Override
                        public Path resolve(Path file) throws IOException, InterruptedException {
                            throw new IOException();
                        }
                    }, executor, new ExceptionHandler() {
                        @Override
                        public Path handle(Path path, IOException exception) throws IOException {
                            return path(alter);
                        }
                    });
View Full Code Here

Examples of com.asakusafw.runtime.util.cache.ConcurrentBatchFileCacheRepository.ExceptionHandler

                    new FileCacheRepository() {
                        @Override
                        public Path resolve(Path file) throws IOException, InterruptedException {
                            throw new IOException();
                        }
                    }, executor, new ExceptionHandler() {
                        @Override
                        public Path handle(Path path, IOException exception) throws IOException {
                            throw exception;
                        }
                    });
View Full Code Here

Examples of com.dragome.compiler.ast.ExceptionHandler

  {
    ExceptionHandlers handlers= new ExceptionHandlers(code);

    Iterator<ExceptionHandler> handleIterator= handlers.iterator();

    ExceptionHandler handle= handleIterator.hasNext() ? handleIterator.next() : null;
    while (handle != null)
    {
      boolean hasFinally= false;
      int start= handle.getStartPC();
      int end= handle.getEndPC();

      TryStatement tryStmt= new TryStatement();
      tryStmt.header= (TryHeaderNode) graph.createNode(TryHeaderNode.class);
      tryStmt.header.tryStmt= tryStmt;

      Block tryBlock= new Block(start, end);
      tryStmt.setTryBlock(tryBlock);

      // tryStmt.setBeginIndex(start);

      tryStatements.add(tryStmt);

      CatchClause cStmt= null;

      // Collect all non-default handlers. The range of each handler is
      // from the 'store'-instruction to the beginning of the next
      // handler.
      while (handle != null && !handle.isDefault() && handle.getStartPC() == start && handle.getEndPC() == end)
      {
        if (cStmt != null)
        {
          cStmt.setEndIndex(handle.getHandlerPC() - 1);
        }
        cStmt= createCatchClause(tryStmt, handle);
        handle= handleIterator.hasNext() ? handleIterator.next() : null;
      }

      int foo= -1;
      if (handle != null && handle.isDefault() && handle.getStartPC() == start)
      {
        // Collect first default handler.
        hasFinally= true;
        if (cStmt != null)
        {
          cStmt.setEndIndex(handle.getHandlerPC() - 1);
          tryStmt.setEndIndex(handle.getHandlerPC() - 1);
          // Warning: We only set a lower bound for the end index. The
          // correct index is set later
          // when the finally statement is analysed.
        }
        cStmt= createCatchClause(tryStmt, handle);
        foo= handle.getHandlerPC();
        handle= handleIterator.hasNext() ? handleIterator.next() : null;
      }

      // Last catch stmt has no endIndex, yet!

      while (handle != null && handle.isDefault() && (handle.getHandlerPC() == foo))
      {
        // Skip all remaining default handlers.
        throw new RuntimeException("remaining default handlers");
        // handle = handleIterator.hasNext()?handleIterator.next():null;
      }
View Full Code Here

Examples of com.github.dynamicextensionsalfresco.webscripts.annotations.ExceptionHandler

    });
    ReflectionUtils.doWithMethods(beanType, new ReflectionUtils.MethodCallback() {

      @Override
      public void doWith(final Method method) throws IllegalArgumentException, IllegalAccessException {
        final ExceptionHandler exceptionHandler = AnnotationUtils
            .findAnnotation(method, ExceptionHandler.class);
        if (exceptionHandler != null) {
          if (AnnotationUtils.findAnnotation(method, Attribute.class) != null
              || AnnotationUtils.findAnnotation(method, Before.class) != null
              || AnnotationUtils.findAnnotation(method, Uri.class) != null) {
            throw new RuntimeException(
                String.format(
                    "Cannot combine @Before, @Attribute @ExceptionHandler or @Uri on a single method. Method: %s",
                    ClassUtils.getQualifiedMethodName(method)));
          }
          handlerMethods.getExceptionHandlerMethods().add(
              new ExceptionHandlerMethod(exceptionHandler.value(), method));
        }
      }
    });
    final List<org.springframework.extensions.webscripts.WebScript> webScripts = new ArrayList<org.springframework.extensions.webscripts.WebScript>();
    ReflectionUtils.doWithMethods(beanType, new ReflectionUtils.MethodCallback() {
View Full Code Here

Examples of com.google.appengine.tools.cloudstorage.ExceptionHandler

  private void updateTask(final ShardedJobStateImpl<T> jobState,
      final IncrementalTaskState<T> taskState, /* Nullable */
      final ShardRetryState<T> shardRetryState, boolean aggresiveRetry) {
    taskState.setSequenceNumber(taskState.getSequenceNumber() + 1);
    taskState.getLockInfo().unlock();
    ExceptionHandler exceptionHandler =
        aggresiveRetry ? AGGRESIVE_EXCEPTION_HANDLER : EXCEPTION_HANDLER;
    RetryHelper.runWithRetries(callable(new Runnable() {
      @Override
      public void run() {
        Transaction tx = DATASTORE.beginTransaction();
View Full Code Here

Examples of com.hazelcast.util.FutureUtil.ExceptionHandler

        List<Future> futures = new ArrayList<Future>();
        for (int i = 0; i < 2; i++) {
            futures.add(executorService.submit(new TimeoutingTask(waitLock)));
        }

        returnWithDeadline(futures, 1, TimeUnit.SECONDS, new ExceptionHandler() {
            @Override
            public void handleException(Throwable throwable) {
                if (throwable instanceof TimeoutException) {
                    ExceptionUtil.sneakyThrow(throwable);
                }
View Full Code Here

Examples of com.jamieallen.sdisruptor.ExceptionHandler

    @Test
    public void shouldCallExceptionHandlerOnUncaughtException()
        throws Exception
    {
        final Exception ex = new Exception();
        final ExceptionHandler exceptionHandler = context.mock(ExceptionHandler.class);
        batchConsumer.exceptionHandler_(exceptionHandler);

        context.checking(new Expectations()
        {
            {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.