View Javadoc
1   /*
2     (C) Copyright IBM Corp. 2005, 2009
3   
4     THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
5     ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
6     CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
7   
8     You can obtain a current copy of the Eclipse Public License from
9     http://www.opensource.org/licenses/eclipse-1.0.php
10  
11    @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com
12   * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com
13   * 
14   * 
15   * Change History
16   * Flag       Date        Prog         Description
17   *------------------------------------------------------------------------------- 
18   * 1535756    2006-08-07  lupusalex    Make code warning free
19   * 1565892    2006-11-28  lupusalex    Make SBLIM client JSR48 compliant
20   * 2003590    2008-06-30  blaschke-oss Change licensing from CPL to EPL
21   * 2524131    2009-01-21  raman_arora  Upgrade client to JDK 1.5 (Phase 1)
22   */
23  
24  package org.metricshub.wbem.sblim.cimclient.internal.http;
25  
26  /*-
27   * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
28   * WBEM Java Client
29   * ჻჻჻჻჻჻
30   * Copyright 2023 - 2025 MetricsHub
31   * ჻჻჻჻჻჻
32   * Licensed under the Apache License, Version 2.0 (the "License");
33   * you may not use this file except in compliance with the License.
34   * You may obtain a copy of the License at
35   *
36   *      http://www.apache.org/licenses/LICENSE-2.0
37   *
38   * Unless required by applicable law or agreed to in writing, software
39   * distributed under the License is distributed on an "AS IS" BASIS,
40   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41   * See the License for the specific language governing permissions and
42   * limitations under the License.
43   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
44   */
45  
46  import java.io.IOException;
47  
48  /**
49   * Class HttpException represents HTTP related problems
50   *
51   */
52  public class HttpException extends IOException {
53  	private static final long serialVersionUID = 934925248736106630L;
54  
55  	int iStatus;
56  
57  	/**
58  	 * Ctor. Equivalent to <code>HttpException(-1, null, null)</code>
59  	 */
60  	public HttpException() {
61  		this(-1, null, null);
62  	}
63  
64  	/**
65  	 * Ctor. Equivalent to <code>HttpException(-1, reason, null)</code>
66  	 *
67  	 * @param reason
68  	 *            The reason
69  	 */
70  	public HttpException(String reason) {
71  		this(-1, reason, null);
72  	}
73  
74  	/**
75  	 * Ctor. Equivalent to <code>HttpException(-1, reason, null)</code>
76  	 *
77  	 * @param status
78  	 *            The status
79  	 * @param reason
80  	 *            The reason
81  	 */
82  	public HttpException(int status, String reason) {
83  		this(status, reason, null);
84  	}
85  
86  	/**
87  	 * Ctor. Equivalent to <code>HttpException(-1, reason, null)</code>
88  	 *
89  	 * @param status
90  	 *            The status
91  	 * @param reason
92  	 *            The reason
93  	 * @param cimError
94  	 *            The CIM error
95  	 */
96  	public HttpException(int status, String reason, String cimError) {
97  		super(reason);
98  		this.iStatus = status;
99  	}
100 
101 	/**
102 	 * Returns the status
103 	 *
104 	 * @return The status
105 	 */
106 	public int getStatus() {
107 		return this.iStatus;
108 	}
109 
110 	@Override
111 	public String toString() {
112 		return super.toString() + "(status:" + this.iStatus + ")";
113 	}
114 }