Package com.taobao.eclipse.plugin.reviewboard.core.exception

Examples of com.taobao.eclipse.plugin.reviewboard.core.exception.ReviewboardException


                        new NullProgressMonitor());
                if( null != reviewRequest ){
                    reviewRequest.setDescription(txtDescription.getText().trim());
                }
            } catch (NumberFormatException e) {
                throw new ReviewboardException(e);
            } catch (ReviewboardException e){
                throw e;
            }
        }else{
            reviewRequest = new ModelReviewRequest();
View Full Code Here


        String resourceUploadDiffBaseSVNUrl = null;
        //有效的用于生成Diff文件的SVN基路径
        String resourceCreateDiffSVNUrl = null;
       
        if (null == resource) {
            throw new ReviewboardException(RbSubclipseMessages.getString("ERROR_NOSVNFILE"));
        }
       
        if (null == resource.getProject()) {
            throw new ReviewboardException("ERROR_NOT_IPROJECT");
        }

        //下面将找出project的baseSVNUrl。该baseSVNUrl在上传diff文件时会用到
        baseSVNUrl = getSVNUrlForProject( resource );
       
        //下面将找出resouce的url
        IResource resourceTmp = resource;
       
        while(true){
            try {
                resourceCreateDiffSVNUrl = getSVNUrlForResouce( resourceTmp );
            } catch (ReviewboardException e) {
                if( !isAllowResourceFileNotSVN ){
                    throw new ReviewboardException(MessageFormat.format(
                            RbSubclipseMessages.getString("ERROR_NOSVNPROPERTIES_2"),
                            new Object[]{ resourceTmp.getProjectRelativePath().toString() }));
                }
            }
            if( null != resourceCreateDiffSVNUrl
View Full Code Here

        String svnUrl = null;
       
        //获取Resource的SVN路径
        ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
        if ( null == svnResource ) {
            throw new ReviewboardException(MessageFormat.format(
                    RbSubclipseMessages.getString("ERROR_NOSVNPROPERTIES"),
                    new Object[]{ resource.getLocation().toString() }));
        } else {
            LocalResourceStatus status = null;
            try {
                status = svnResource.getStatus();
            } catch (SVNException e) {
            }
            if( null != status ){
                svnUrl = status.getUrlString() != null ? status.getUrlString() : EMPTY_STRING;
            }
            if ( null == status || !status.isManaged() || null == svnUrl || svnUrl.trim().isEmpty()) {
                throw new ReviewboardException(MessageFormat.format(
                        RbSubclipseMessages.getString("ERROR_NOSVNPROPERTIES"),
                        new Object[]{ resource.getLocation().toString() }));
            }
        }
       
View Full Code Here

       
        //获取Project的SVN路径
        SVNTeamProvider svnProviderBase = (SVNTeamProvider) RepositoryProvider.getProvider(resource.getProject(),
                SVNProviderPlugin.getTypeId());
        if (null == svnProviderBase) {
            throw new ReviewboardException(
                    MessageFormat.format(RbSubclipseMessages.getString("ERROR_NOSVNPROPERTIES"),
                    new Object[]{ resource.getProject().getName() }));
        }
        ISVNLocalResource svnResourceBase = SVNWorkspaceRoot.getSVNResourceFor(resource.getProject());
        if ( null == svnResourceBase) {
            throw new ReviewboardException(
                    MessageFormat.format(RbSubclipseMessages.getString("ERROR_NOSVNPROPERTIES"),
                    new Object[]{ resource.getProject().getName() }));
        }
        try {
            LocalResourceStatus statusBase = svnResourceBase.getStatus();
            if( null != statusBase ){
                svnUrl = statusBase.getUrlString() != null ? statusBase.getUrlString() : EMPTY_STRING;
            }
            if ( null == statusBase || !statusBase.isManaged() || null == svnUrl || svnUrl.trim().isEmpty()) {
                throw new ReviewboardException(
                        MessageFormat.format(RbSubclipseMessages.getString("ERROR_NOSVNPROPERTIES"),
                        new Object[]{ resource.getProject().getName() }));
            }
        } catch (Exception e) {
            throw new ReviewboardException("getSVNUrlForResouce(IResource resource , boolean isGetSVNUrlForProject), error.", e);
        }
       
        return svnUrl;
    }
View Full Code Here

        String repositoryRootUrl = null;
       
        //获取Resource的SVN路径
        ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
        if ( null == svnResource ) {
            throw new ReviewboardException(MessageFormat.format(RbSubclipseMessages.getString("ERROR_NOSVNPROPERTIES"),
                    new Object[]{ resource.getLocation().toString() }));
        } else {
            LocalResourceStatus status = null;
            try {
                status = svnResource.getStatus();
            } catch (SVNException e) {
            }
            if( null != status ){
                try {
                    repositoryRootUrl = status.getRepository().getRootFolder().getUrl().toString();
                } catch (Exception e) {
                    repositoryRootUrl = null;
                }
            }
            if ( null == status || !status.isManaged()
                    || null == repositoryRootUrl
                    || repositoryRootUrl.trim().isEmpty()) {
                throw new ReviewboardException(
                        MessageFormat.format(RbSubclipseMessages.getString("ERROR_NOSVNPROPERTIES"),
                        new Object[]{ resource.getLocation().toString() }));
            }
        }
       
View Full Code Here

            if( null == client ){
                return svnLogMessages;
            }
            svnLogMessages = client.getLogMessages(url, revisionStart, revisionEnd);
        } catch (SVNException e) {
            throw new ReviewboardException(e);
        } catch (SVNClientException e) {
            throw new ReviewboardException(e);
        }
        return svnLogMessages;
    }
View Full Code Here

        IProgressMonitor monitor) throws ReviewboardException {
       
        this.cookie = "";
       
        if( null == username || username.trim().isEmpty() || null == password || password.trim().isEmpty()  ){
            throw new ReviewboardException("username and password is required.");
        }
      
        RestfulReviewboardReader reviewboardReader = new RestfulReviewboardReader();
       
        HttpMethodBase loginRequest = null;
        loginRequest = new GetMethod(serverUrl + URI_LOGIN);
        String authorizationKey   = "Authorization";
        String authorizationValue = "Basic " + ReviewboardUtil.convertStr2BASE64(username + ":" + password);
        //Set a HTTP Headers    WWW-Authenticate
        loginRequest.setRequestHeader(authorizationKey, authorizationValue );
       
        if(monitor == null){
            monitor = new NullProgressMonitor();
        }
       
        try {
            monitor.beginTask("Authorization checking...", IProgressMonitor.UNKNOWN);
            this.httpClient.getState().clear();
           
            if (executeRequest(loginRequest, monitor) == HttpStatus.SC_OK) {
                String response = getResponseBodyAsString(loginRequest, monitor);
                if (reviewboardReader.isStatOK(response)) {
                    Header header = loginRequest.getResponseHeader("Set-Cookie");
                    if(null != header){
                        cookie = header.getValue();
                    }
                } else {
                    throw new ReviewboardException(reviewboardReader.getErrorMessage(response));
                }
            } else {
                throw new ReviewboardException(RbCoreMessages.getString("ERROR_SERVER_NOT_CONFIFIGURED_0"));
            }
        } finally {
            loginRequest.releaseConnection();
            monitor.done();
        }
View Full Code Here

            for(String fileKey : fileParameters.keySet()){
                FilePart filePart = new FilePart(fileKey, fileParameters.get(fileKey));  
                params[ (null == parameters ? 0 : parameters.size()) + index++ ] = filePart;  
            }
        } catch (Exception e) {
            throw new ReviewboardException(e);
        }
       
        MultipartRequestEntity putRequestEntity = new MultipartRequestEntity(params, putRequest.getParams());  

        putRequest.setRequestEntity(putRequestEntity)
View Full Code Here

            for(String fileKey : fileParameters.keySet()){
                FilePart filePart = new FilePart(fileKey, fileParameters.get(fileKey));  
                params[ (null == parameters ? 0 : parameters.size()) + index++ ] = filePart;  
            }
        } catch (Exception e) {
            throw new ReviewboardException(e);
        }
       
        MultipartRequestEntity post = new MultipartRequestEntity(params, postRequest.getParams());  

        postRequest.setRequestEntity(post)
View Full Code Here

            int resultCode = executeRequest(request, monitor);
            if (resultCode == HttpStatus.SC_OK || resultCode == HttpStatus.SC_CREATED ) { 
                return getResponseBodyAsString(request, monitor);
            }else {  
                String error = "HttpClient excuteMethod Error HttpCode=" + resultCode;   
                throw new ReviewboardException(error);  
           
        } finally {
            request.releaseConnection();
            monitor.done();
        }
View Full Code Here

TOP

Related Classes of com.taobao.eclipse.plugin.reviewboard.core.exception.ReviewboardException

Copyright © 2018 www.massapicom. 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.