From 9962df65272e6208676b1e5cdd944dcfa974fe31 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 28 Feb 2018 00:09:15 +0100 Subject: [PATCH] Polishing --- .../annotation/AspectJProxyFactory.java | 9 +-- .../beans/BeanWrapperImpl.java | 10 +-- .../beans/DirectFieldAccessor.java | 5 +- .../AbstractAutowireCapableBeanFactory.java | 4 +- .../beans/propertyeditors/PathEditor.java | 8 +- ...AbstractMessageListenerContainerTests.java | 43 ---------- .../DefaultMessageListenerContainerTests.java | 13 ++- .../SimpleMessageListenerContainerTests.java | 80 +++++++++---------- .../messaging/simp/stomp/StompSession.java | 3 +- .../jta/JtaTransactionManager.java | 3 +- .../web/method/annotation/ModelFactory.java | 6 +- .../commons/CommonsMultipartFile.java | 6 +- 12 files changed, 69 insertions(+), 121 deletions(-) delete mode 100644 spring-jms/src/test/java/org/springframework/jms/listener/AbstractMessageListenerContainerTests.java diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJProxyFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJProxyFactory.java index 46ba0f50ba..5c4fe918c1 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJProxyFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJProxyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -170,11 +170,10 @@ public class AspectJProxyFactory extends ProxyCreatorSupport { synchronized (aspectCache) { // To be safe, check within full lock now... instance = aspectCache.get(aspectClass); - if (instance != null) { - return instance; + if (instance == null) { + instance = new SimpleAspectInstanceFactory(aspectClass).getAspectInstance(); + aspectCache.put(aspectClass, instance); } - instance = new SimpleAspectInstanceFactory(aspectClass).getAspectInstance(); - aspectCache.put(aspectClass, instance); } } return instance; diff --git a/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java b/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java index 9ead0e79ed..7aaf0d470d 100644 --- a/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java +++ b/spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -228,10 +228,7 @@ public class BeanWrapperImpl extends AbstractNestablePropertyAccessor implements @Nullable protected BeanPropertyHandler getLocalPropertyHandler(String propertyName) { PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(propertyName); - if (pd != null) { - return new BeanPropertyHandler(pd); - } - return null; + return (pd != null ? new BeanPropertyHandler(pd) : null); } @Override @@ -242,8 +239,7 @@ public class BeanWrapperImpl extends AbstractNestablePropertyAccessor implements @Override protected NotWritablePropertyException createNotWritablePropertyException(String propertyName) { PropertyMatches matches = PropertyMatches.forProperty(propertyName, getRootClass()); - throw new NotWritablePropertyException( - getRootClass(), getNestedPath() + propertyName, + throw new NotWritablePropertyException(getRootClass(), getNestedPath() + propertyName, matches.buildErrorMessage(), matches.getPossibleMatches()); } diff --git a/spring-beans/src/main/java/org/springframework/beans/DirectFieldAccessor.java b/spring-beans/src/main/java/org/springframework/beans/DirectFieldAccessor.java index bffe0eec2d..0ea48a8e31 100644 --- a/spring-beans/src/main/java/org/springframework/beans/DirectFieldAccessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/DirectFieldAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -71,14 +71,15 @@ public class DirectFieldAccessor extends AbstractNestablePropertyAccessor { @Override + @Nullable protected FieldPropertyHandler getLocalPropertyHandler(String propertyName) { FieldPropertyHandler propertyHandler = this.fieldMap.get(propertyName); if (propertyHandler == null) { Field field = ReflectionUtils.findField(getWrappedClass(), propertyName); if (field != null) { propertyHandler = new FieldPropertyHandler(field); + this.fieldMap.put(propertyName, propertyHandler); } - this.fieldMap.put(propertyName, propertyHandler); } return propertyHandler; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java index b32cfc6005..02ca3d3adb 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java @@ -505,8 +505,8 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac return beanInstance; } catch (BeanCreationException | ImplicitlyAppearedSingletonException ex) { - // A previously detected exception with proper bean creation context already... - // An IllegalStateException to be communicated up to DefaultSingletonBeanRegistry... + // A previously detected exception with proper bean creation context already, + // or illegal singleton state to be communicated up to DefaultSingletonBeanRegistry. throw ex; } catch (Throwable ex) { diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/PathEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/PathEditor.java index c115ff1472..130940268b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/PathEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/PathEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -86,9 +86,9 @@ public class PathEditor extends PropertyEditorSupport { } } catch (URISyntaxException | FileSystemNotFoundException ex) { - // Not a valid URI: Let's try as Spring resource location. - // URI scheme not registered for NIO: - // Let's try URL protocol handlers via Spring's resource mechanism. + // Not a valid URI (let's try as Spring resource location), + // or a URI scheme not registered for NIO (let's try URL + // protocol handlers via Spring's resource mechanism). } } diff --git a/spring-jms/src/test/java/org/springframework/jms/listener/AbstractMessageListenerContainerTests.java b/spring-jms/src/test/java/org/springframework/jms/listener/AbstractMessageListenerContainerTests.java deleted file mode 100644 index 55ae906807..0000000000 --- a/spring-jms/src/test/java/org/springframework/jms/listener/AbstractMessageListenerContainerTests.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2002-2012 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.jms.listener; - -import org.junit.Assert; -import org.junit.Test; - -/** - * Unit tests for the {@link AbstractMessageListenerContainer} class. - * - * @author Rick Evans - * @author Chris Beams - */ -public abstract class AbstractMessageListenerContainerTests { - - protected abstract AbstractMessageListenerContainer getContainer(); - - - public void testSettingMessageListenerToANullType() { - getContainer().setMessageListener(null); - Assert.assertNull(getContainer().getMessageListener()); - } - - @Test(expected = IllegalArgumentException.class) - public void testSettingMessageListenerToAnUnsupportedType() throws Exception { - getContainer().setMessageListener("Bingo"); - } - -} diff --git a/spring-jms/src/test/java/org/springframework/jms/listener/DefaultMessageListenerContainerTests.java b/spring-jms/src/test/java/org/springframework/jms/listener/DefaultMessageListenerContainerTests.java index aa24fcd04f..08fade6b0d 100644 --- a/spring-jms/src/test/java/org/springframework/jms/listener/DefaultMessageListenerContainerTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/listener/DefaultMessageListenerContainerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -78,7 +78,7 @@ public class DefaultMessageListenerContainerTests { public void recoverResetBackOff() { BackOff backOff = mock(BackOff.class); BackOffExecution execution = mock(BackOffExecution.class); - given(execution.nextBackOff()).willReturn(50L, 50L, 50L); // 3 attempts max + given(execution.nextBackOff()).willReturn(50L, 50L, 50L); // 3 attempts max given(backOff.start()).willReturn(execution); DefaultMessageListenerContainer container = createContainer(createRecoverableContainerFactory(1)); @@ -88,7 +88,7 @@ public class DefaultMessageListenerContainerTests { assertEquals(true, container.isRunning()); verify(backOff).start(); - verify(execution, times(1)).nextBackOff(); // only on attempt as the second one lead to a recovery + verify(execution, times(1)).nextBackOff(); // only on attempt as the second one lead to a recovery } @Test @@ -123,11 +123,8 @@ public class DefaultMessageListenerContainerTests { private ConnectionFactory createFailingContainerFactory() { try { ConnectionFactory connectionFactory = mock(ConnectionFactory.class); - given(connectionFactory.createConnection()).will(new Answer() { - @Override - public Object answer(InvocationOnMock invocation) throws Throwable { - throw new JMSException("Test exception"); - } + given(connectionFactory.createConnection()).will(invocation -> { + throw new JMSException("Test exception"); }); return connectionFactory; } diff --git a/spring-jms/src/test/java/org/springframework/jms/listener/SimpleMessageListenerContainerTests.java b/spring-jms/src/test/java/org/springframework/jms/listener/SimpleMessageListenerContainerTests.java index 9e3d555fb0..cf249ed399 100644 --- a/spring-jms/src/test/java/org/springframework/jms/listener/SimpleMessageListenerContainerTests.java +++ b/spring-jms/src/test/java/org/springframework/jms/listener/SimpleMessageListenerContainerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -27,7 +27,6 @@ import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.Session; -import org.junit.Before; import org.junit.Test; import org.springframework.context.support.GenericApplicationContext; @@ -45,7 +44,7 @@ import static org.mockito.BDDMockito.*; * @author Chris Beams * @author Mark Fisher */ -public class SimpleMessageListenerContainerTests extends AbstractMessageListenerContainerTests { +public class SimpleMessageListenerContainerTests { private static final String DESTINATION_NAME = "foo"; @@ -53,39 +52,38 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener private static final StubQueue QUEUE_DESTINATION = new StubQueue(); - - private SimpleMessageListenerContainer container; - - - @Before - public void setUp() throws Exception { - this.container = (SimpleMessageListenerContainer) getContainer(); - } - - @Override - protected AbstractMessageListenerContainer getContainer() { - return new SimpleMessageListenerContainer(); - } + private final SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); @Test - public void testSessionTransactedModeReallyDoesDefaultToFalse() throws Exception { + public void testSettingMessageListenerToANullType() { + this.container.setMessageListener(null); + assertNull(this.container.getMessageListener()); + } + + @Test(expected = IllegalArgumentException.class) + public void testSettingMessageListenerToAnUnsupportedType() { + this.container.setMessageListener("Bingo"); + } + + @Test + public void testSessionTransactedModeReallyDoesDefaultToFalse() { assertFalse("The [pubSubLocal] property of SimpleMessageListenerContainer " + "must default to false. Change this test (and the " + "attendant Javadoc) if you have changed the default.", - container.isPubSubNoLocal()); + this.container.isPubSubNoLocal()); } @Test(expected = IllegalArgumentException.class) - public void testSettingConcurrentConsumersToZeroIsNotAllowed() throws Exception { - container.setConcurrentConsumers(0); - container.afterPropertiesSet(); + public void testSettingConcurrentConsumersToZeroIsNotAllowed() { + this.container.setConcurrentConsumers(0); + this.container.afterPropertiesSet(); } @Test(expected = IllegalArgumentException.class) - public void testSettingConcurrentConsumersToANegativeValueIsNotAllowed() throws Exception { - container.setConcurrentConsumers(-198); - container.afterPropertiesSet(); + public void testSettingConcurrentConsumersToANegativeValueIsNotAllowed() { + this.container.setConcurrentConsumers(-198); + this.container.afterPropertiesSet(); } @Test @@ -95,7 +93,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener // Queue gets created in order to create MessageConsumer for that Destination... given(session.createQueue(DESTINATION_NAME)).willReturn(QUEUE_DESTINATION); // and then the MessageConsumer gets created... - given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... + given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... Connection connection = mock(Connection.class); // session gets created in order to register MessageListener... @@ -125,7 +123,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener // Queue gets created in order to create MessageConsumer for that Destination... given(session.createQueue(DESTINATION_NAME)).willReturn(QUEUE_DESTINATION); // and then the MessageConsumer gets created... - given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... + given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... Connection connection = mock(Connection.class); // session gets created in order to register MessageListener... @@ -157,7 +155,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener // Queue gets created in order to create MessageConsumer for that Destination... given(session.createQueue(DESTINATION_NAME)).willReturn(QUEUE_DESTINATION); // and then the MessageConsumer gets created... - given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... + given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... // an exception is thrown, so the rollback logic is being applied here... given(session.getTransacted()).willReturn(false); given(session.getAcknowledgeMode()).willReturn(Session.AUTO_ACKNOWLEDGE); @@ -208,7 +206,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener final Session session = mock(Session.class); given(session.createQueue(DESTINATION_NAME)).willReturn(QUEUE_DESTINATION); - given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... + given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... given(session.getTransacted()).willReturn(false); given(session.getAcknowledgeMode()).willReturn(Session.AUTO_ACKNOWLEDGE); @@ -254,7 +252,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener // Queue gets created in order to create MessageConsumer for that Destination... given(session.createQueue(DESTINATION_NAME)).willReturn(QUEUE_DESTINATION); // and then the MessageConsumer gets created... - given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... + given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... // an exception is thrown, so the rollback logic is being applied here... given(session.getTransacted()).willReturn(false); @@ -305,7 +303,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener // Queue gets created in order to create MessageConsumer for that Destination... given(session.createQueue(DESTINATION_NAME)).willReturn(QUEUE_DESTINATION); // and then the MessageConsumer gets created... - given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... + given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... // an exception is thrown, so the rollback logic is being applied here... given(session.getTransacted()).willReturn(false); @@ -352,7 +350,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener // Queue gets created in order to create MessageConsumer for that Destination... given(session.createQueue(DESTINATION_NAME)).willReturn(QUEUE_DESTINATION); // and then the MessageConsumer gets created... - given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... + given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... // an exception is thrown, so the rollback logic is being applied here... given(session.getTransacted()).willReturn(false); @@ -396,7 +394,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener // Queue gets created in order to create MessageConsumer for that Destination... given(session.createQueue(DESTINATION_NAME)).willReturn(QUEUE_DESTINATION); // and then the MessageConsumer gets created... - given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... + given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... // an exception is thrown, so the rollback logic is being applied here... given(session.getTransacted()).willReturn(true); @@ -439,7 +437,7 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener // Queue gets created in order to create MessageConsumer for that Destination... given(session.createQueue(DESTINATION_NAME)).willReturn(QUEUE_DESTINATION); // and then the MessageConsumer gets created... - given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... + given(session.createConsumer(QUEUE_DESTINATION, null)).willReturn(messageConsumer); // no MessageSelector... Connection connection = mock(Connection.class); // session gets created in order to register MessageListener... @@ -483,42 +481,42 @@ public class SimpleMessageListenerContainerTests extends AbstractMessageListener private MessageListener messageListener; - public void sendMessage(Message message) throws JMSException { + public void sendMessage(Message message) { this.messageListener.onMessage(message); } @Override - public String getMessageSelector() throws JMSException { + public String getMessageSelector() { throw new UnsupportedOperationException(); } @Override - public MessageListener getMessageListener() throws JMSException { + public MessageListener getMessageListener() { return this.messageListener; } @Override - public void setMessageListener(MessageListener messageListener) throws JMSException { + public void setMessageListener(MessageListener messageListener) { this.messageListener = messageListener; } @Override - public Message receive() throws JMSException { + public Message receive() { throw new UnsupportedOperationException(); } @Override - public Message receive(long l) throws JMSException { + public Message receive(long l) { throw new UnsupportedOperationException(); } @Override - public Message receiveNoWait() throws JMSException { + public Message receiveNoWait() { throw new UnsupportedOperationException(); } @Override - public void close() throws JMSException { + public void close() { throw new UnsupportedOperationException(); } } diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompSession.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompSession.java index 833e3980a9..7a6c6a0851 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompSession.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompSession.java @@ -171,9 +171,10 @@ public interface StompSession { * Alternative to {@link #unsubscribe()} with additional custom headers * to send to the server. *

Note: There is no need to set the subscription id. + * @param headers the custom headers, if any * @since 5.0 */ - void unsubscribe(@Nullable StompHeaders stompHeaders); + void unsubscribe(@Nullable StompHeaders headers); } } diff --git a/spring-tx/src/main/java/org/springframework/transaction/jta/JtaTransactionManager.java b/spring-tx/src/main/java/org/springframework/transaction/jta/JtaTransactionManager.java index f550669655..39ac106534 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/jta/JtaTransactionManager.java +++ b/spring-tx/src/main/java/org/springframework/transaction/jta/JtaTransactionManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -848,7 +848,6 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager doJtaBegin(txObject, definition); } catch (NotSupportedException | UnsupportedOperationException ex) { - // assume nested transaction not supported throw new NestedTransactionNotSupportedException( "JTA implementation does not support nested transactions", ex); } diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/ModelFactory.java b/spring-web/src/main/java/org/springframework/web/method/annotation/ModelFactory.java index 26a2547030..cd9c9d7409 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/ModelFactory.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/ModelFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -103,8 +103,8 @@ public final class ModelFactory { * @param handlerMethod the method for which the model is initialized * @throws Exception may arise from {@code @ModelAttribute} methods */ - public void initModel(NativeWebRequest request, ModelAndViewContainer container, - HandlerMethod handlerMethod) throws Exception { + public void initModel(NativeWebRequest request, ModelAndViewContainer container, HandlerMethod handlerMethod) + throws Exception { Map sessionAttributes = this.sessionAttributesHandler.retrieveAttributes(request); container.mergeAttributes(sessionAttributes); diff --git a/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartFile.java b/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartFile.java index 15b006eb0b..a483fe8507 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartFile.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsMultipartFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -176,8 +176,8 @@ public class CommonsMultipartFile implements MultipartFile, Serializable { throw new IllegalStateException(ex.getMessage(), ex); } catch (IllegalStateException | IOException ex) { - // Pass through when coming from FileItem directly - // From I/O operations within FileItem.write + // Pass through IllegalStateException when coming from FileItem directly, + // or propagate an exception from I/O operations within FileItem.write throw ex; } catch (Exception ex) {