KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > core > connection > CVSServerException


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.team.internal.ccvs.core.connection;
12
13
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.core.runtime.MultiStatus;
16 import org.eclipse.team.internal.ccvs.core.CVSException;
17 import org.eclipse.team.internal.ccvs.core.CVSStatus;
18
19 /**
20  * Client has received an error response from the server.
21  */

22 public class CVSServerException extends CVSException {
23     
24     private static final long serialVersionUID = 1L;
25
26     /**
27      * Return true if the exception from the cvs server is the no tag error, and false
28      * otherwise.
29      */

30     public boolean isNoTagException() {
31         IStatus status = getStatus();
32         if ( ! status.isMultiStatus())
33             return false;
34         IStatus[] children = ((MultiStatus)status).getChildren();
35         for (int i = 0; i < children.length; i++) {
36             if (children[i].getCode() == CVSStatus.NO_SUCH_TAG) {
37                 return true;
38             }
39         }
40         return false;
41     }
42     
43     /**
44      * Return true if the exceptions status contains any error status messages
45      */

46     public boolean containsErrors() {
47         IStatus status = getStatus();
48         if ( ! status.isMultiStatus())
49             return status.getSeverity() == IStatus.ERROR;
50         IStatus[] children = ((MultiStatus)status).getChildren();
51         for (int i=0;i<children.length;i++) {
52             if (children[i].getSeverity() == IStatus.ERROR)
53                 return true;
54         }
55         return false;
56     }
57     
58     /** The status should have a status code of CVSStatus.SERVER_ERROR
59      * @param status
60      */

61     public CVSServerException(IStatus status) {
62         super(status);
63     }
64 }
65
Popular Tags