Skip to content

Commit 3402628

Browse files
committed
Polishing
1 parent 148f8f0 commit 3402628

File tree

3 files changed

+65
-81
lines changed

3 files changed

+65
-81
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/BeanFactoryUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public static String[] beanNamesIncludingAncestors(ListableBeanFactory lbf) {
139139
* @param type the type that beans must match
140140
* @return the array of matching bean names, or an empty array if none
141141
*/
142-
public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, Class type) {
142+
public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lbf, Class<?> type) {
143143
Assert.notNull(lbf, "ListableBeanFactory must not be null");
144144
String[] result = lbf.getBeanNamesForType(type);
145145
if (lbf instanceof HierarchicalBeanFactory) {
@@ -181,7 +181,7 @@ public static String[] beanNamesForTypeIncludingAncestors(ListableBeanFactory lb
181181
* @return the array of matching bean names, or an empty array if none
182182
*/
183183
public static String[] beanNamesForTypeIncludingAncestors(
184-
ListableBeanFactory lbf, Class type, boolean includeNonSingletons, boolean allowEagerInit) {
184+
ListableBeanFactory lbf, Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
185185

186186
Assert.notNull(lbf, "ListableBeanFactory must not be null");
187187
String[] result = lbf.getBeanNamesForType(type, includeNonSingletons, allowEagerInit);

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

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,12 +51,12 @@
5151
* an {@code XMLEventReader}, and calls the corresponding methods on the SAX callback interfaces.
5252
*
5353
* @author Arjen Poutsma
54+
* @since 3.0
5455
* @see XMLEventReader
5556
* @see #setContentHandler(org.xml.sax.ContentHandler)
5657
* @see #setDTDHandler(org.xml.sax.DTDHandler)
5758
* @see #setEntityResolver(org.xml.sax.EntityResolver)
5859
* @see #setErrorHandler(org.xml.sax.ErrorHandler)
59-
* @since 3.0
6060
*/
6161
class StaxEventXMLReader extends AbstractStaxXMLReader {
6262

@@ -70,11 +70,11 @@ class StaxEventXMLReader extends AbstractStaxXMLReader {
7070

7171
private String encoding;
7272

73+
7374
/**
7475
* Constructs a new instance of the {@code StaxEventXmlReader} that reads from the given
7576
* {@code XMLEventReader}. The supplied event reader must be in {@code XMLStreamConstants.START_DOCUMENT} or
7677
* {@code XMLStreamConstants.START_ELEMENT} state.
77-
*
7878
* @param reader the {@code XMLEventReader} to read from
7979
* @throws IllegalStateException if the reader is not at the start of a document or element
8080
*/
@@ -89,17 +89,17 @@ class StaxEventXMLReader extends AbstractStaxXMLReader {
8989
catch (XMLStreamException ex) {
9090
throw new IllegalStateException("Could not read first element: " + ex.getMessage());
9191
}
92-
9392
this.reader = reader;
9493
}
9594

95+
9696
@Override
9797
protected void parseInternal() throws SAXException, XMLStreamException {
9898
boolean documentStarted = false;
9999
boolean documentEnded = false;
100100
int elementDepth = 0;
101-
while (reader.hasNext() && elementDepth >= 0) {
102-
XMLEvent event = reader.nextEvent();
101+
while (this.reader.hasNext() && elementDepth >= 0) {
102+
XMLEvent event = this.reader.nextEvent();
103103
if (!event.isStartDocument() && !event.isEndDocument() && !documentStarted) {
104104
handleStartDocument(event);
105105
documentStarted = true;
@@ -165,42 +165,34 @@ private void handleStartDocument(final XMLEvent event) throws SAXException {
165165
this.encoding = startDocument.getCharacterEncodingScheme();
166166
}
167167
}
168-
169168
if (getContentHandler() != null) {
170169
final Location location = event.getLocation();
171170
getContentHandler().setDocumentLocator(new Locator2() {
172-
173171
@Override
174172
public int getColumnNumber() {
175-
return location != null ? location.getColumnNumber() : -1;
173+
return (location != null ? location.getColumnNumber() : -1);
176174
}
177-
178175
@Override
179176
public int getLineNumber() {
180-
return location != null ? location.getLineNumber() : -1;
177+
return (location != null ? location.getLineNumber() : -1);
181178
}
182-
183179
@Override
184180
public String getPublicId() {
185-
return location != null ? location.getPublicId() : null;
181+
return (location != null ? location.getPublicId() : null);
186182
}
187-
188183
@Override
189184
public String getSystemId() {
190-
return location != null ? location.getSystemId() : null;
185+
return (location != null ? location.getSystemId() : null);
191186
}
192-
193187
@Override
194188
public String getXMLVersion() {
195189
return xmlVersion;
196190
}
197-
198191
@Override
199192
public String getEncoding() {
200193
return encoding;
201194
}
202195
});
203-
204196
getContentHandler().startDocument();
205197
}
206198
}
@@ -317,7 +309,6 @@ private void handleEntityReference(EntityReference reference) throws SAXExceptio
317309

318310
private Attributes getAttributes(StartElement event) {
319311
AttributesImpl attributes = new AttributesImpl();
320-
321312
for (Iterator i = event.getAttributes(); i.hasNext();) {
322313
Attribute attribute = (Attribute) i.next();
323314
QName qName = attribute.getName();
@@ -329,8 +320,7 @@ private Attributes getAttributes(StartElement event) {
329320
if (type == null) {
330321
type = "CDATA";
331322
}
332-
attributes
333-
.addAttribute(namespace, qName.getLocalPart(), toQualifiedName(qName), type, attribute.getValue());
323+
attributes.addAttribute(namespace, qName.getLocalPart(), toQualifiedName(qName), type, attribute.getValue());
334324
}
335325
if (hasNamespacePrefixesFeature()) {
336326
for (Iterator i = event.getNamespaces(); i.hasNext();) {

0 commit comments

Comments
 (0)