Avoid throws Exception where possible - Phase III

This commit is contained in:
Gary Russell
2019-03-07 16:53:48 -05:00
committed by Artem Bilan
parent b138ab80f8
commit 78199dca9b
42 changed files with 297 additions and 219 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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,6 +16,7 @@
package org.springframework.integration.ws;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@@ -59,7 +60,8 @@ public abstract class AbstractWebServiceInboundGateway extends MessagingGatewayS
return this.headerMapper;
}
public void invoke(MessageContext messageContext) throws Exception {
@Override
public void invoke(MessageContext messageContext) throws Exception { // NOSONAR - external interface
if (!isRunning()) {
throw new ServiceUnavailableException("503 Service Unavailable");
}
@@ -116,6 +118,6 @@ public abstract class AbstractWebServiceInboundGateway extends MessagingGatewayS
return this.activeCount.get();
}
protected abstract void doInvoke(MessageContext messageContext) throws Exception; // NOSONAR any exception
protected abstract void doInvoke(MessageContext messageContext) throws IOException;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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,6 +16,8 @@
package org.springframework.integration.ws;
import java.io.IOException;
import org.springframework.integration.support.AbstractIntegrationMessageBuilder;
import org.springframework.messaging.Message;
import org.springframework.oxm.Marshaller;
@@ -94,7 +96,7 @@ public class MarshallingWebServiceInboundGateway extends AbstractWebServiceInbou
}
@Override
protected void doInvoke(MessageContext messageContext) throws Exception {
protected void doInvoke(MessageContext messageContext) throws IOException {
WebServiceMessage request = messageContext.getRequest();
Assert.notNull(request, "Invalid message context: request was null.");
Object requestObject = MarshallingUtils.unmarshal(this.unmarshaller, request);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2019 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.
@@ -49,7 +49,7 @@ public class SimpleWebServiceInboundGateway extends AbstractWebServiceInboundGat
}
@Override
protected void doInvoke(MessageContext messageContext) throws Exception {
protected void doInvoke(MessageContext messageContext) {
WebServiceMessage request = messageContext.getRequest();
Assert.notNull(request, "Invalid message context: request was null.");
@@ -85,7 +85,12 @@ public class SimpleWebServiceInboundGateway extends AbstractWebServiceInboundGat
"The actual type was [" + replyPayload.getClass().getName() + "]");
}
WebServiceMessage response = messageContext.getResponse();
this.transformerSupportDelegate.transformSourceToResult(responseSource, response.getPayloadResult());
try {
this.transformerSupportDelegate.transformSourceToResult(responseSource, response.getPayloadResult());
}
catch (TransformerException e) {
throw new IllegalStateException(e);
}
toSoapHeaders(response, replyMessage);
}