Browse Source

polishing

conversation
Juergen Hoeller 16 years ago
parent
commit
eef6086325
  1. 4
      org.springframework.jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/JndiDataSourceLookup.java
  2. 8
      org.springframework.jdbc/src/main/java/org/springframework/jdbc/support/xml/Jdbc4SqlXmlHandler.java
  3. 4
      org.springframework.jms/src/main/java/org/springframework/jms/support/destination/JndiDestinationResolver.java

4
org.springframework.jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/JndiDataSourceLookup.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -41,7 +41,7 @@ public class JndiDataSourceLookup extends JndiLocatorSupport implements DataSour
public DataSource getDataSource(String dataSourceName) throws DataSourceLookupFailureException { public DataSource getDataSource(String dataSourceName) throws DataSourceLookupFailureException {
try { try {
return (DataSource) lookup(dataSourceName, DataSource.class); return lookup(dataSourceName, DataSource.class);
} }
catch (NamingException ex) { catch (NamingException ex) {
throw new DataSourceLookupFailureException( throw new DataSourceLookupFailureException(

8
org.springframework.jdbc/src/main/java/org/springframework/jdbc/support/xml/Jdbc4SqlXmlHandler.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,7 +23,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.SQLXML; import java.sql.SQLXML;
import javax.xml.transform.Source; import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
@ -75,10 +74,12 @@ public class Jdbc4SqlXmlHandler implements SqlXmlHandler {
return rs.getSQLXML(columnIndex).getCharacterStream(); return rs.getSQLXML(columnIndex).getCharacterStream();
} }
@SuppressWarnings("unchecked")
public Source getXmlAsSource(ResultSet rs, String columnName, Class sourceClass) throws SQLException { public Source getXmlAsSource(ResultSet rs, String columnName, Class sourceClass) throws SQLException {
return rs.getSQLXML(columnName).getSource(sourceClass != null ? sourceClass : DOMSource.class); return rs.getSQLXML(columnName).getSource(sourceClass != null ? sourceClass : DOMSource.class);
} }
@SuppressWarnings("unchecked")
public Source getXmlAsSource(ResultSet rs, int columnIndex, Class sourceClass) throws SQLException { public Source getXmlAsSource(ResultSet rs, int columnIndex, Class sourceClass) throws SQLException {
return rs.getSQLXML(columnIndex).getSource(sourceClass != null ? sourceClass : DOMSource.class); return rs.getSQLXML(columnIndex).getSource(sourceClass != null ? sourceClass : DOMSource.class);
} }
@ -118,6 +119,7 @@ public class Jdbc4SqlXmlHandler implements SqlXmlHandler {
public SqlXmlValue newSqlXmlValue(final Class resultClass, final XmlResultProvider provider) { public SqlXmlValue newSqlXmlValue(final Class resultClass, final XmlResultProvider provider) {
return new AbstractJdbc4SqlXmlValue() { return new AbstractJdbc4SqlXmlValue() {
@Override @Override
@SuppressWarnings("unchecked")
protected void provideXml(SQLXML xmlObject) throws SQLException, IOException { protected void provideXml(SQLXML xmlObject) throws SQLException, IOException {
provider.provideXml(xmlObject.setResult(resultClass)); provider.provideXml(xmlObject.setResult(resultClass));
} }
@ -128,7 +130,7 @@ public class Jdbc4SqlXmlHandler implements SqlXmlHandler {
return new AbstractJdbc4SqlXmlValue() { return new AbstractJdbc4SqlXmlValue() {
@Override @Override
protected void provideXml(SQLXML xmlObject) throws SQLException, IOException { protected void provideXml(SQLXML xmlObject) throws SQLException, IOException {
((DOMResult) xmlObject.setResult(DOMResult.class)).setNode(document); xmlObject.setResult(DOMResult.class).setNode(document);
} }
}; };
} }

4
org.springframework.jms/src/main/java/org/springframework/jms/support/destination/JndiDestinationResolver.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -108,7 +108,7 @@ public class JndiDestinationResolver extends JndiLocatorSupport implements Cachi
} }
else { else {
try { try {
dest = (Destination) lookup(destinationName, Destination.class); dest = lookup(destinationName, Destination.class);
validateDestination(dest, destinationName, pubSubDomain); validateDestination(dest, destinationName, pubSubDomain);
} }
catch (NamingException ex) { catch (NamingException ex) {

Loading…
Cancel
Save