View Javadoc
1   /*
2     (C) Copyright IBM Corp. 2006, 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 : Endre Bak, ebak@de.ibm.com
12   * 
13   * Flag       Date        Prog         Description
14   * -------------------------------------------------------------------------------
15   * 1688273    2007-04-16  ebak         Full support of HTTP trailers
16   * 2003590    2008-06-30  blaschke-oss Change licensing from CPL to EPL
17   * 2524131    2009-01-21  raman_arora  Upgrade client to JDK 1.5 (Phase 1)
18   */
19  
20  package org.metricshub.wbem.sblim.cimclient.internal.http.io;
21  
22  /*-
23   * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
24   * WBEM Java Client
25   * ჻჻჻჻჻჻
26   * Copyright 2023 - 2025 MetricsHub
27   * ჻჻჻჻჻჻
28   * Licensed under the Apache License, Version 2.0 (the "License");
29   * you may not use this file except in compliance with the License.
30   * You may obtain a copy of the License at
31   *
32   *      http://www.apache.org/licenses/LICENSE-2.0
33   *
34   * Unless required by applicable law or agreed to in writing, software
35   * distributed under the License is distributed on an "AS IS" BASIS,
36   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37   * See the License for the specific language governing permissions and
38   * limitations under the License.
39   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
40   */
41  
42  import org.metricshub.wbem.javax.wbem.WBEMException;
43  import org.metricshub.wbem.sblim.cimclient.internal.util.WBEMConstants;
44  
45  /**
46   * TrailerException is thrown by ChunkedInputStream when it receives a http
47   * trailer which contains the following entries: CIMStatusCode,
48   * CIMStatusCodeDescription. These http trailer entries are known to be used by
49   * Pegasus CIMOM.
50   */
51  public class TrailerException extends RuntimeException {
52  	private static final long serialVersionUID = 4355341648542585509L;
53  
54  	private WBEMException iWBEMException;
55  
56  	/**
57  	 * Ctor.
58  	 *
59  	 * @param pException
60  	 *            The contained WBEMException
61  	 */
62  	public TrailerException(WBEMException pException) {
63  		super(
64  			WBEMConstants.HTTP_TRAILER_STATUS_CODE +
65  			":" +
66  			pException.getID() +
67  			" " +
68  			WBEMConstants.HTTP_TRAILER_STATUS_DESCRIPTION +
69  			":" +
70  			pException.getMessage()
71  		);
72  		this.iWBEMException = pException;
73  	}
74  
75  	/**
76  	 * getWBEMException
77  	 *
78  	 * @return WBEMException
79  	 */
80  	public WBEMException getWBEMException() {
81  		return this.iWBEMException;
82  	}
83  }