Made TransportException a subclass of IOException
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006 the original author or authors.
|
||||
* Copyright 2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,20 +16,17 @@
|
||||
|
||||
package org.springframework.ws.transport;
|
||||
|
||||
import org.springframework.ws.WebServiceException;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Abstract base class for exceptions related to the transport layer.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
public abstract class TransportException extends WebServiceException {
|
||||
public abstract class TransportException extends IOException {
|
||||
|
||||
protected TransportException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
protected TransportException(String msg, Throwable ex) {
|
||||
super(msg, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.io.InputStream;
|
||||
import java.util.Iterator;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.ws.transport.TransportException;
|
||||
import org.springframework.ws.transport.TransportInputStream;
|
||||
import org.springframework.ws.transport.support.EnumerationIterator;
|
||||
|
||||
@@ -55,11 +54,11 @@ public class HttpServletTransportInputStream extends TransportInputStream {
|
||||
return httpServletRequest;
|
||||
}
|
||||
|
||||
public Iterator getHeaderNames() throws TransportException {
|
||||
public Iterator getHeaderNames() {
|
||||
return new EnumerationIterator(httpServletRequest.getHeaderNames());
|
||||
}
|
||||
|
||||
public Iterator getHeaders(String name) throws TransportException {
|
||||
public Iterator getHeaders(String name) {
|
||||
return new EnumerationIterator(httpServletRequest.getHeaders(name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,7 @@ import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Private static class that adapts a header enumeration provided by the HttpServletRequest and provides it as an
|
||||
* iterator.
|
||||
* Adapts an {@link Enumeration} to follow the interface of {@link Iterator}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2007 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.transport.jms;
|
||||
|
||||
import javax.jms.JMSException;
|
||||
|
||||
import org.springframework.ws.transport.TransportException;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
public class JmsTransportException extends TransportException {
|
||||
|
||||
public JmsTransportException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public JmsTransportException(String msg, JMSException ex) {
|
||||
super(msg + ": " + ex.getMessage());
|
||||
}
|
||||
|
||||
public JmsTransportException(JMSException ex) {
|
||||
super(ex.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class JmsTransportInputStream extends TransportInputStream {
|
||||
return new EnumerationIterator(message.getPropertyNames());
|
||||
}
|
||||
catch (JMSException ex) {
|
||||
throw new IOException("Could not get property names: " + ex.getMessage());
|
||||
throw new JmsTransportException("Could not get property names", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class JmsTransportInputStream extends TransportInputStream {
|
||||
return Collections.singletonList(value).iterator();
|
||||
}
|
||||
catch (JMSException ex) {
|
||||
throw new IOException("Could not get property value: " + ex.getMessage());
|
||||
throw new JmsTransportException("Could not get property value", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class JmsTransportInputStream extends TransportInputStream {
|
||||
return message.readBytes(b);
|
||||
}
|
||||
catch (JMSException ex) {
|
||||
throw new IOException(ex.getMessage());
|
||||
throw new JmsTransportException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class JmsTransportInputStream extends TransportInputStream {
|
||||
return message.readBytes(b, len);
|
||||
}
|
||||
catch (JMSException ex) {
|
||||
throw new IOException(ex.getMessage());
|
||||
throw new JmsTransportException(ex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -116,7 +116,7 @@ public class JmsTransportInputStream extends TransportInputStream {
|
||||
return -1;
|
||||
}
|
||||
catch (JMSException ex) {
|
||||
throw new IOException(ex.getMessage());
|
||||
throw new JmsTransportException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class JmsTransportOutputStream extends TransportOutputStream {
|
||||
}
|
||||
}
|
||||
catch (JMSException ex) {
|
||||
throw new IOException("Could not create message: " + ex.getMessage());
|
||||
throw new JmsTransportException("Could not create message", ex);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
@@ -99,7 +99,7 @@ public class JmsTransportOutputStream extends TransportOutputStream {
|
||||
getMessage().setStringProperty(name, value);
|
||||
}
|
||||
catch (JMSException ex) {
|
||||
throw new IOException("Could not set property " + ex.getMessage());
|
||||
throw new JmsTransportException("Could not set property", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public class JmsTransportOutputStream extends TransportOutputStream {
|
||||
getMessage().writeBytes(b);
|
||||
}
|
||||
catch (JMSException ex) {
|
||||
throw new IOException(ex.getMessage());
|
||||
throw new JmsTransportException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class JmsTransportOutputStream extends TransportOutputStream {
|
||||
getMessage().writeBytes(b, off, len);
|
||||
}
|
||||
catch (JMSException ex) {
|
||||
throw new IOException(ex.getMessage());
|
||||
throw new JmsTransportException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class JmsTransportOutputStream extends TransportOutputStream {
|
||||
getMessage().writeByte((byte) b);
|
||||
}
|
||||
catch (JMSException ex) {
|
||||
throw new IOException(ex.getMessage());
|
||||
throw new JmsTransportException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user