File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
spring-core/src/main/java/org/springframework/util/xml Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2007 the original author or authors.
2
+ * Copyright 2002-2014 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -123,7 +123,7 @@ public int detectValidationMode(InputStream inputStream) throws IOException {
123
123
* Does the content contain the the DTD DOCTYPE declaration?
124
124
*/
125
125
private boolean hasDoctype (String content ) {
126
- return ( content .indexOf (DOCTYPE ) > - 1 );
126
+ return content .contains (DOCTYPE );
127
127
}
128
128
129
129
/**
@@ -136,7 +136,8 @@ private boolean hasOpeningTag(String content) {
136
136
return false ;
137
137
}
138
138
int openTagIndex = content .indexOf ('<' );
139
- return (openTagIndex > -1 && content .length () > openTagIndex && Character .isLetter (content .charAt (openTagIndex + 1 )));
139
+ return (openTagIndex > -1 && (content .length () > openTagIndex + 1 ) &&
140
+ Character .isLetter (content .charAt (openTagIndex + 1 )));
140
141
}
141
142
142
143
/**
@@ -146,7 +147,7 @@ private boolean hasOpeningTag(String content) {
146
147
* the DOCTYPE declaration or the root element of the document.
147
148
*/
148
149
private String consumeCommentTokens (String line ) {
149
- if (line .indexOf (START_COMMENT ) == - 1 && line .indexOf (END_COMMENT ) == - 1 ) {
150
+ if (! line .contains (START_COMMENT ) && ! line .contains (END_COMMENT )) {
150
151
return line ;
151
152
}
152
153
while ((line = consume (line )) != null ) {
You can’t perform that action at this time.
0 commit comments