Skip to content

Commit ae28815

Browse files
committed
Polishing
1 parent 75fc0f8 commit ae28815

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

spring-core/src/main/java/org/springframework/util/xml/AbstractXMLEventReader.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@
2727

2828
/**
2929
* Abstract base class for {@code XMLEventReader}s.
30+
*
3031
* @author Arjen Poutsma
3132
* @since 5.0
3233
*/
3334
abstract class AbstractXMLEventReader implements XMLEventReader {
3435

3536
private boolean closed;
3637

38+
3739
@Override
3840
public Object next() {
3941
try {
@@ -113,12 +115,17 @@ public Object getProperty(String name) throws IllegalArgumentException {
113115
throw new IllegalArgumentException("Property not supported: [" + name + "]");
114116
}
115117

118+
@Override
119+
public void close() {
120+
this.closed = true;
121+
}
122+
116123
/**
117124
* Returns {@code true} if closed; {@code false} otherwise.
118125
* @see #close()
119126
*/
120127
protected boolean isClosed() {
121-
return closed;
128+
return this.closed;
122129
}
123130

124131
/**
@@ -133,8 +140,4 @@ protected void checkIfClosed() throws XMLStreamException {
133140
}
134141
}
135142

136-
@Override
137-
public void close() {
138-
closed = true;
139-
}
140143
}

spring-core/src/main/java/org/springframework/util/xml/ListBasedXMLEventReader.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,22 @@ class ListBasedXMLEventReader extends AbstractXMLEventReader {
3535

3636
private int cursor = 0;
3737

38+
3839
public ListBasedXMLEventReader(List<XMLEvent> events) {
3940
Assert.notNull(events, "'events' must not be null");
4041
this.events = Collections.unmodifiableList(events);
4142
}
4243

44+
4345
@Override
4446
public boolean hasNext() {
45-
return cursor != events.size();
47+
return (this.cursor != this.events.size());
4648
}
4749

4850
@Override
4951
public XMLEvent nextEvent() {
50-
if (cursor < events.size()) {
51-
return events.get(cursor++);
52+
if (this.cursor < this.events.size()) {
53+
return this.events.get(this.cursor++);
5254
}
5355
else {
5456
throw new NoSuchElementException();
@@ -57,8 +59,8 @@ public XMLEvent nextEvent() {
5759

5860
@Override
5961
public XMLEvent peek() {
60-
if (cursor < events.size()) {
61-
return events.get(cursor);
62+
if (this.cursor < this.events.size()) {
63+
return this.events.get(this.cursor);
6264
}
6365
else {
6466
return null;
@@ -70,4 +72,5 @@ public void close() {
7072
super.close();
7173
this.events.clear();
7274
}
75+
7376
}

spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.transaction.interceptor;
1818

1919
import java.lang.reflect.Method;
20+
import java.util.Map;
2021
import java.util.Properties;
2122
import java.util.concurrent.ConcurrentHashMap;
2223

@@ -85,7 +86,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
8586
new NamedThreadLocal<>("Current aspect-driven transaction");
8687

8788

88-
private final ConcurrentHashMap<Object, PlatformTransactionManager> transactionManagerCache =
89+
private final Map<Object, PlatformTransactionManager> transactionManagerCache =
8990
new ConcurrentHashMap<>();
9091

9192
/**
@@ -243,7 +244,7 @@ protected final BeanFactory getBeanFactory() {
243244
public void afterPropertiesSet() {
244245
if (getTransactionManager() == null && this.beanFactory == null) {
245246
throw new IllegalStateException(
246-
"Setting the property 'transactionManager' or running in a ListableBeanFactory is required");
247+
"Setting the property 'transactionManager' or running in a BeanFactory is required");
247248
}
248249
if (this.transactionAttributeSource == null) {
249250
throw new IllegalStateException(
@@ -449,17 +450,16 @@ protected TransactionInfo prepareTransactionInfo(PlatformTransactionManager tm,
449450

450451
TransactionInfo txInfo = new TransactionInfo(tm, txAttr, joinpointIdentification);
451452
if (txAttr != null) {
452-
// We need a transaction for this method
453+
// We need a transaction for this method...
453454
if (logger.isTraceEnabled()) {
454455
logger.trace("Getting transaction for [" + txInfo.getJoinpointIdentification() + "]");
455456
}
456-
// The transaction manager will flag an error if an incompatible tx already exists
457+
// The transaction manager will flag an error if an incompatible tx already exists.
457458
txInfo.newTransactionStatus(status);
458459
}
459460
else {
460-
// The TransactionInfo.hasTransaction() method will return
461-
// false. We created it only to preserve the integrity of
462-
// the ThreadLocal stack maintained in this class.
461+
// The TransactionInfo.hasTransaction() method will return false. We created it only
462+
// to preserve the integrity of the ThreadLocal stack maintained in this class.
463463
if (logger.isTraceEnabled())
464464
logger.trace("Don't need to create transaction for [" + joinpointIdentification +
465465
"]: This method isn't transactional.");

0 commit comments

Comments
 (0)