Simplify if statements and replace try-finally with try-with-resources
Closes gh-23445
This commit is contained in:
committed by
Sam Brannen
parent
fabdb07e53
commit
849bbf00b5
@@ -64,22 +64,19 @@ abstract class AbstractStaxXMLReader extends AbstractXMLReader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
|
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
|
||||||
if (NAMESPACES_FEATURE_NAME.equals(name)) {
|
switch (name) {
|
||||||
return this.namespacesFeature;
|
case NAMESPACES_FEATURE_NAME:
|
||||||
}
|
return this.namespacesFeature;
|
||||||
else if (NAMESPACE_PREFIXES_FEATURE_NAME.equals(name)) {
|
case NAMESPACE_PREFIXES_FEATURE_NAME:
|
||||||
return this.namespacePrefixesFeature;
|
return this.namespacePrefixesFeature;
|
||||||
}
|
case IS_STANDALONE_FEATURE_NAME:
|
||||||
else if (IS_STANDALONE_FEATURE_NAME.equals(name)) {
|
if (this.isStandalone != null) {
|
||||||
if (this.isStandalone != null) {
|
return this.isStandalone;
|
||||||
return this.isStandalone;
|
} else {
|
||||||
}
|
throw new SAXNotSupportedException("startDocument() callback not completed yet");
|
||||||
else {
|
}
|
||||||
throw new SAXNotSupportedException("startDocument() callback not completed yet");
|
default:
|
||||||
}
|
return super.getFeature(name);
|
||||||
}
|
|
||||||
else {
|
|
||||||
return super.getFeature(name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -408,13 +408,9 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
|
|||||||
throws SQLException {
|
throws SQLException {
|
||||||
|
|
||||||
if (isEnforceReadOnly() && definition.isReadOnly()) {
|
if (isEnforceReadOnly() && definition.isReadOnly()) {
|
||||||
Statement stmt = con.createStatement();
|
try (Statement stmt = con.createStatement()) {
|
||||||
try {
|
|
||||||
stmt.executeUpdate("SET TRANSACTION READ ONLY");
|
stmt.executeUpdate("SET TRANSACTION READ ONLY");
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
stmt.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user