Examples of RedmineApiHttpStatusException


Examples of net.sf.redmine_mylyn.api.exception.RedmineApiHttpStatusException

        if (statusHeader != null) {
          msg += " : " + statusHeader.getValue().replace(""+HttpStatus.SC_INTERNAL_SERVER_ERROR, "").trim(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }
       
        log.error(msg);
        throw new RedmineApiHttpStatusException(sc, msg);
      }
     
      //HTTP-Status 302 => login page
      if(sc==HttpStatus.SC_MOVED_TEMPORARILY) {
        Header respHeader = method.getResponseHeader(HEADER_REDIRECT);
        if (respHeader != null && (respHeader.getValue().endsWith(REDMINE_URL_LOGIN) || respHeader.getValue().contains(REDMINE_URL_LOGIN_CALLBACK))) {

          log.error(Messages.ERRMSG_REST_SERVICE_NOT_ENABLED_OR_INVALID_CGI);
          throw new RedmineApiHttpStatusException(sc, Messages.ERRMSG_REST_SERVICE_NOT_ENABLED_OR_INVALID_CGI);
        }   
      }

      if (parser!=null && expectedSC != null) {
        Arrays.sort(expectedSC);
        if(Arrays.binarySearch(expectedSC, sc)>=0) {
          InputStream input = WebUtil.getResponseBodyAsStream(method, monitor);
          try {
            response = parser.parseResponse(input, sc);
          } finally {
            input.close();
          }
        } else {
          Header statusHeader = method.getResponseHeader(HEADER_STATUS);
          String value = statusHeader==null ? ""+sc : statusHeader.getValue(); //$NON-NLS-1$

          log.error(Messages.ERRMSG_UNEXPECTED_HTTP_STATUS_X, value);
          throw new RedmineApiHttpStatusException(sc, Messages.ERRMSG_UNEXPECTED_HTTP_STATUS_X, value);
        }
      }
    } catch (IOException e) {
      //TODO
      log.error(e, Messages.ERRMSG_METHOD_EXECUTION_FAILED_X, e.getMessage());
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.