Examples of ApplicationException


Examples of br.gov.frameworkdemoiselle.exception.ApplicationException

  private void handleException(final Exception cause) {
    Transaction transaction = getTransactionContext().getCurrentTransaction();

    if (!transaction.isMarkedRollback()) {
      boolean rollback = false;
      ApplicationException annotation = cause.getClass().getAnnotation(ApplicationException.class);

      if (annotation == null || annotation.rollback()) {
        rollback = true;
      }

      if (rollback) {
        transaction.setRollbackOnly();
View Full Code Here

Examples of com.esri.gpt.framework.context.ApplicationException

    }

    // get uuid of repository record
    String uuid = getCriteria().getActionCriteria().getUuid();
    if (!UuidUtil.isUuid(uuid)) {
      throw new ApplicationException();
    }

    // select and read repository record
    HrSelectRequest selectRepositoryRequest =
      new HrSelectRequest(context, uuid);
    selectRepositoryRequest.execute();
    HrRecords records = selectRepositoryRequest.getQueryResult().getRecords();

    // get harvest repository record
    HrRecord record = records.size() == 1 ? records.get(0) : null;
    if (record == null) {
      throw new ApplicationException();
    }

    // select and read harvest event record
    HeSelectRequest selectRequest =
      new HeSelectRequest(context, record, getCriteria(), getResult());
View Full Code Here

Examples of com.github.hakko.musiccabinet.exception.ApplicationException

  public void handlesArtistFailureDuringUpdate() throws ApplicationException {
    final String revName = reverse(artistName);
    submitFile(additionDao, getFile(revName, albumName, trackName));
   
    Mockito.when(service.artistQueryClient.get(revName)).thenThrow(
      new ApplicationException("Fail", new HttpResponseException(503, "Overloaded")));
   
    service.updateDiscography();
   
    List<MBAlbum> albums = service.getMissingAlbums(artistName, asList(TYPE_EP), null, -1, 0);
    Assert.assertEquals(2, albums.size());
View Full Code Here

Examples of com.github.hakko.musiccabinet.exception.ApplicationException

    public void updateSearchIndex() throws ApplicationException {
      setTotalOperations(TOTAL_CALCULATIONS);
      for (int i = 0; i < TOTAL_CALCULATIONS; i++) {
        // real work would go here
        if (i == FAIL_INDEX) {
          throw new ApplicationException("Failing at index " + FAIL_INDEX);
        }
        addFinishedOperation();
      }
    }
View Full Code Here

Examples of com.github.hakko.musiccabinet.exception.ApplicationException

   *
   * Otherwise, a general ApplicationException is thrown.
   */
  private void validateResponse() throws ApplicationException {
    if (responseBody == null || responseBody.isEmpty()) {
      throw new ApplicationException(
          "The response from Last.fm did not contain any data!");
    }
    if (responseBody.indexOf(RESPONSE_OK) != -1) {
      callSuccessful = true;
      return;
    }
    if (responseBody.indexOf(RESPONSE_FAILED) != -1) {
      parseErrorCodeAndMessage();
    } else {
      throw new ApplicationException(
          "The response from Last.fm wasn't wrapped as promised!");
    }
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.exception.ApplicationException

      }
    }
   
    if (errorCodeStart * errorCodeEnd * errorMsgStart * errorMsgEnd == 0) {
      LOG.info(responseBody);
      throw new ApplicationException("Response from Last.fm not properly formed!");
    }
   
    errorCode = toInt(responseBody.substring(errorCodeStart, errorCodeEnd));
    errorMessage = responseBody.substring(errorMsgStart, errorMsgEnd);
    errorRecoverable = isLastfmRecoverable(errorCode);
View Full Code Here

Examples of com.github.hakko.musiccabinet.exception.ApplicationException

      elapsedMs += currentTimeMillis();
      sleep(Math.max(INTERVAL_MS - elapsedMs, 0));
    } catch (HttpResponseException e) {
      LOG.warn(format("MusicBrainz internal error: %d, %s",
          e.getStatusCode(), e.getMessage()));
      throw new ApplicationException("MusicBrainz internal error!", e);
    } catch (IOException e) {
      throw new ApplicationException("MusicBrainz communication failed!", e);
    } catch (InterruptedException e) {
      LOG.warn("MusicBrainz sleep interrupted!", e);
    }
        webserviceHistoryService.logWebserviceInvocation(invocation);
        return response;
View Full Code Here

Examples of com.github.hakko.musiccabinet.exception.ApplicationException

      for (NameValuePair param : params) {
        uriBuilder.addParameter(param.getName(), param.getValue());
      }
      uri = uriBuilder.build();
    } catch (URISyntaxException e) {
      throw new ApplicationException("Could not create MusicBrainz URI!", e);
    }
    return uri;
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.exception.ApplicationException

    try {
      MessageDigest md = MessageDigest.getInstance("md5");
      params.add(new BasicNameValuePair(PARAM_API_SIG, new String(
          encodeHex(md.digest(sb.toString().getBytes(UTF8))))));
    } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
      throw new ApplicationException("Can not make authenticated call!", e);
    }
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.exception.ApplicationException

      for (NameValuePair param : params) {
        uriBuilder.addParameter(param.getName(), param.getValue());
      }
      uri = uriBuilder.build();
    } catch (URISyntaxException e) {
      throw new ApplicationException("Could not create Last.fm URI!", e);
    }
    return uri;
  }
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.