Consistent formatting
This commit is contained in:
@@ -186,7 +186,9 @@ class PrecedenceTestAspect implements BeanNameAware, Ordered {
|
||||
try {
|
||||
ret = ((Integer)pjp.proceed()).intValue();
|
||||
}
|
||||
catch(Throwable t) { throw new RuntimeException(t); }
|
||||
catch (Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
this.collaborator.aroundAdviceOne(this.name);
|
||||
return ret;
|
||||
}
|
||||
@@ -197,7 +199,9 @@ class PrecedenceTestAspect implements BeanNameAware, Ordered {
|
||||
try {
|
||||
ret = ((Integer)pjp.proceed()).intValue();
|
||||
}
|
||||
catch(Throwable t) {throw new RuntimeException(t);}
|
||||
catch (Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
this.collaborator.aroundAdviceTwo(this.name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -513,11 +513,13 @@ class RetryAspect {
|
||||
try {
|
||||
o = jp.proceed();
|
||||
this.commitCalls++;
|
||||
} catch (RetryableException e) {
|
||||
this.rollbackCalls++;
|
||||
throw e;
|
||||
}
|
||||
} catch (RetryableException re) {
|
||||
catch (RetryableException re) {
|
||||
this.rollbackCalls++;
|
||||
throw re;
|
||||
}
|
||||
}
|
||||
catch (RetryableException re) {
|
||||
retry = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.aop.aspectj.autoproxy.spr3064;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -35,6 +36,7 @@ public final class SPR3064Tests {
|
||||
|
||||
private Service service;
|
||||
|
||||
|
||||
@Test
|
||||
public void testServiceIsAdvised() {
|
||||
ClassPathXmlApplicationContext ctx =
|
||||
@@ -46,7 +48,7 @@ public final class SPR3064Tests {
|
||||
this.service.serveMe();
|
||||
fail("service operation has not been advised by transaction interceptor");
|
||||
}
|
||||
catch(RuntimeException ex) {
|
||||
catch (RuntimeException ex) {
|
||||
assertEquals("advice invoked",ex.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -56,7 +58,6 @@ public final class SPR3064Tests {
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface Transaction {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -68,14 +69,12 @@ class TransactionInterceptor {
|
||||
throw new RuntimeException("advice invoked");
|
||||
//return pjp.proceed();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface Service {
|
||||
|
||||
void serveMe();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -85,5 +84,4 @@ class ServiceImpl implements Service {
|
||||
@Transaction
|
||||
public void serveMe() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -400,7 +400,8 @@ public abstract class AbstractAopProxyTests {
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
if (!context) {
|
||||
assertNoInvocationContext();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
assertNotNull("have context", ExposeInvocationInterceptor.currentInvocation());
|
||||
}
|
||||
return s;
|
||||
|
||||
@@ -354,7 +354,8 @@ public abstract class AbstractCacheAnnotationTests {
|
||||
try {
|
||||
service.throwCheckedSync(arg);
|
||||
fail("Excepted exception");
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
assertEquals("Wrong exception type", IOException.class, ex.getClass());
|
||||
assertEquals(arg, ex.getMessage());
|
||||
@@ -365,7 +366,8 @@ public abstract class AbstractCacheAnnotationTests {
|
||||
try {
|
||||
service.throwUncheckedSync(Long.valueOf(1));
|
||||
fail("Excepted exception");
|
||||
} catch (RuntimeException ex) {
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
assertEquals("Wrong exception type", UnsupportedOperationException.class, ex.getClass());
|
||||
assertEquals("1", ex.getMessage());
|
||||
}
|
||||
|
||||
@@ -35,7 +35,10 @@ public class CacheAdviceParserTests {
|
||||
try {
|
||||
new GenericXmlApplicationContext("/org/springframework/cache/config/cache-advice-invalid.xml");
|
||||
fail("Should have failed to load context, one advise define both a key and a key generator");
|
||||
} catch (BeanDefinitionStoreException e) { // TODO better exception handling
|
||||
}
|
||||
catch (BeanDefinitionStoreException ex) {
|
||||
// TODO better exception handling
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class PropertySourceAnnotationTests {
|
||||
do {
|
||||
name = iterator.next().getName();
|
||||
}
|
||||
while(iterator.hasNext());
|
||||
while (iterator.hasNext());
|
||||
|
||||
assertThat(name, is("p1"));
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class ConfigurationClassProcessingTests {
|
||||
BeanFactory factory = initBeanFactory(ConfigWithBeanWithAliases.class);
|
||||
assertSame(factory.getBean("name1"), ConfigWithBeanWithAliases.testBean);
|
||||
String[] aliases = factory.getAliases("name1");
|
||||
for(String alias : aliases)
|
||||
for (String alias : aliases)
|
||||
assertSame(factory.getBean(alias), ConfigWithBeanWithAliases.testBean);
|
||||
|
||||
// method name should not be registered
|
||||
|
||||
@@ -37,7 +37,7 @@ public class Spr10546Tests {
|
||||
|
||||
@After
|
||||
public void closeContext() {
|
||||
if(context != null) {
|
||||
if (context != null) {
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,8 @@ public class FactoryBeanAccessTests {
|
||||
try {
|
||||
assertEquals(Boat.class.getName(), expr.getValue(context));
|
||||
fail("Expected BeanIsNotAFactoryException");
|
||||
} catch (BeanIsNotAFactoryException binafe) {
|
||||
}
|
||||
catch (BeanIsNotAFactoryException binafe) {
|
||||
// success
|
||||
}
|
||||
|
||||
|
||||
@@ -85,9 +85,11 @@ public class SerializableBeanFactoryMemoryLeakTests {
|
||||
ctx.refresh();
|
||||
assertThat(serializableFactoryCount(), equalTo(1));
|
||||
ctx.close();
|
||||
} catch (BeanCreationException ex) {
|
||||
}
|
||||
catch (BeanCreationException ex) {
|
||||
// ignore - this is expected on refresh() for failure case tests
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
assertThat(serializableFactoryCount(), equalTo(0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,8 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
||||
// now start the connector
|
||||
try {
|
||||
connector.start();
|
||||
} catch (BindException ex) {
|
||||
}
|
||||
catch (BindException ex) {
|
||||
System.out.println("Skipping remainder of JMX LazyConnectionToRemote test because binding to local port ["
|
||||
+ port + "] failed: " + ex.getMessage());
|
||||
return;
|
||||
@@ -206,13 +207,15 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
||||
try {
|
||||
assertEquals("Rob Harrop", bean.getName());
|
||||
assertEquals(100, bean.getAge());
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
connector.stop();
|
||||
}
|
||||
|
||||
try {
|
||||
bean.getName();
|
||||
} catch (JmxException ex) {
|
||||
}
|
||||
catch (JmxException ex) {
|
||||
// expected
|
||||
}
|
||||
|
||||
@@ -223,7 +226,8 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
|
||||
try {
|
||||
assertEquals("Rob Harrop", bean.getName());
|
||||
assertEquals(100, bean.getAge());
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
connector.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ public class RemoteMBeanClientInterceptorTests extends MBeanClientInterceptorTes
|
||||
this.connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(getServiceUrl(), null, getServer());
|
||||
try {
|
||||
this.connectorServer.start();
|
||||
} catch (BindException ex) {
|
||||
}
|
||||
catch (BindException ex) {
|
||||
System.out.println("Skipping remote JMX tests because binding to local port ["
|
||||
+ SERVICE_PORT + "] failed: " + ex.getMessage());
|
||||
runTests = false;
|
||||
|
||||
@@ -172,7 +172,8 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
if (notification instanceof AttributeChangeNotification) {
|
||||
AttributeChangeNotification changeNotification = (AttributeChangeNotification) notification;
|
||||
return "Name".equals(changeNotification.getAttributeName());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -200,7 +201,8 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
try {
|
||||
new NotificationListenerBean().afterPropertiesSet();
|
||||
fail("Must have thrown an IllegalArgumentException (no NotificationListener supplied)");
|
||||
} catch (IllegalArgumentException expected) {
|
||||
}
|
||||
catch (IllegalArgumentException expected) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,7 +465,8 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
||||
if (currentCount != null) {
|
||||
int count = currentCount.intValue() + 1;
|
||||
this.attributeCounts.put(attributeName, new Integer(count));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.attributeCounts.put(attributeName, new Integer(1));
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@ public class ConnectorServerFactoryBeanTests extends AbstractMBeanServerTests {
|
||||
|
||||
try {
|
||||
checkServerConnection(getServer());
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
bean.destroy();
|
||||
}
|
||||
}
|
||||
@@ -84,7 +85,8 @@ public class ConnectorServerFactoryBeanTests extends AbstractMBeanServerTests {
|
||||
|
||||
try {
|
||||
checkServerConnection(getServer());
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
bean.destroy();
|
||||
}
|
||||
}
|
||||
@@ -102,7 +104,8 @@ public class ConnectorServerFactoryBeanTests extends AbstractMBeanServerTests {
|
||||
// Try to get the connector bean.
|
||||
ObjectInstance instance = getServer().getObjectInstance(ObjectName.getInstance(OBJECT_NAME));
|
||||
assertNotNull("ObjectInstance should not be null", instance);
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
bean.destroy();
|
||||
}
|
||||
}
|
||||
@@ -116,9 +119,11 @@ public class ConnectorServerFactoryBeanTests extends AbstractMBeanServerTests {
|
||||
// Try to get the connector bean.
|
||||
getServer().getObjectInstance(ObjectName.getInstance(OBJECT_NAME));
|
||||
fail("Instance should not be found");
|
||||
} catch (InstanceNotFoundException ex) {
|
||||
}
|
||||
catch (InstanceNotFoundException ex) {
|
||||
// expected
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
bean.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,10 +74,12 @@ public class MBeanServerConnectionFactoryBeanTests extends AbstractMBeanServerTe
|
||||
|
||||
// perform simple MBean count test
|
||||
assertEquals("MBean count should be the same", getServer().getMBeanCount(), connection.getMBeanCount());
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
bean.destroy();
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
connectorServer.stop();
|
||||
}
|
||||
}
|
||||
@@ -104,7 +106,8 @@ public class MBeanServerConnectionFactoryBeanTests extends AbstractMBeanServerTe
|
||||
connector = getConnectorServer();
|
||||
connector.start();
|
||||
assertEquals("Incorrect MBean count", getServer().getMBeanCount(), connection.getMBeanCount());
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
bean.destroy();
|
||||
if (connector != null) {
|
||||
connector.stop();
|
||||
|
||||
@@ -30,7 +30,6 @@ import java.rmi.UnknownHostException;
|
||||
import java.rmi.UnmarshalException;
|
||||
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.remoting.RemoteAccessException;
|
||||
@@ -342,7 +341,7 @@ public class RmiSupportTests {
|
||||
client.afterPropertiesSet();
|
||||
fail("url isn't set, expected IllegalArgumentException");
|
||||
}
|
||||
catch(IllegalArgumentException e){
|
||||
catch (IllegalArgumentException ex){
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,15 +41,19 @@ public class LazyScheduledTasksBeanDefinitionParserTests {
|
||||
while (!task.executed) {
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (Exception e) { /* Do Nothing */ }
|
||||
}
|
||||
catch (Exception ex) { /* Do Nothing */ }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class Task {
|
||||
|
||||
volatile boolean executed = false;
|
||||
|
||||
public void doWork() {
|
||||
executed = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,7 +58,8 @@ public final class AdvisedJRubyScriptFactoryTests {
|
||||
assertEquals(0, advice.getCalls());
|
||||
bean.getMessage();
|
||||
assertEquals(1, advice.getCalls());
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
ctx.close();
|
||||
}
|
||||
}
|
||||
@@ -76,7 +77,8 @@ public final class AdvisedJRubyScriptFactoryTests {
|
||||
assertEquals(0, advice.getCalls());
|
||||
bean.getMessage();
|
||||
assertEquals(1, advice.getCalls());
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
ctx.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user