Index: doc/release-notes.xml =================================================================== RCS file: /scm/castor/castor/src/doc/release-notes.xml,v retrieving revision 1.117 diff -u -r1.117 release-notes.xml --- doc/release-notes.xml 7 Nov 2005 10:40:13 -0000 1.117 +++ doc/release-notes.xml 10 Nov 2005 09:56:40 -0000 @@ -81,6 +81,26 @@ + + + Refactored org.exolab.castor.jdo.Utils into org.castor.jdo.util.JDOUtils. + + + Ralf Joachim + ralf.joachim@syscon-world.de + + + Ralf Joachim + ralf.joachim@syscon-world.de + + + Ralf Joachim + ralf.joachim@syscon-world.de + + Enh. + JDO + 20051110 + Included new implementations of Base64Encoder/-Decoder with Index: etc/CHANGELOG =================================================================== RCS file: /scm/castor/castor/src/etc/CHANGELOG,v retrieving revision 1.276 diff -u -r1.276 CHANGELOG --- etc/CHANGELOG 7 Nov 2005 10:40:07 -0000 1.276 +++ etc/CHANGELOG 10 Nov 2005 09:57:00 -0000 @@ -7,6 +7,11 @@ Added non-trivial sample for usage of binding file +JDO: Fixed bug CASTOR-1259 using contribution from Ralf Joachim[ralf.joachim@syscon-world.de] + Refactored org.exolab.castor.jdo.Utils into org.castor.jdo.util.JDOUtils. + Details: http://jira.codehaus.org/browse/CASTOR-1259 + (Ralf - 20051110) + XML: Fixed bug CASTOR-1249 using contribution from Ralf Joachim[ralf.joachim@syscon-world.de] Included new implementations of Base64Encoder/-Decoder with castor-0.9.9-xml.jar. Details: http://jira.codehaus.org/browse/CASTOR-1249 Index: main/org/exolab/castor/jdo/Utils.java =================================================================== RCS file: /scm/castor/castor/src/main/org/exolab/castor/jdo/Utils.java,v retrieving revision 1.1 diff -u -r1.1 Utils.java --- main/org/exolab/castor/jdo/Utils.java 18 Aug 2004 19:49:18 -0000 1.1 +++ main/org/exolab/castor/jdo/Utils.java 10 Nov 2005 09:57:03 -0000 @@ -57,6 +57,8 @@ /** * Common static methods for Castor JDO * + * @deprecated Use org.castor.jdo.util.JDOUtils instead. + * * @author Stein M. Hugubakken * @version $Revision: 1.1 $ $Date: 2004/08/18 19:49:18 $ */ Index: main/org/castor/jdo/util/JDOUtils.java =================================================================== RCS file: main/org/castor/jdo/util/JDOUtils.java diff -N main/org/castor/jdo/util/JDOUtils.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ main/org/castor/jdo/util/JDOUtils.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,102 @@ +/* + * Copyright 2005 Stein M. Hugubakken + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.castor.jdo.util; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.exolab.castor.util.Messages; + +/** + * Common static methods for Castor JDO + * + * @author Stein M. Hugubakken + * @version $Revision: 1.1 $ $Date: 2004/08/18 19:49:18 $ + * @since 0.9.9.1 + */ +public final class JDOUtils { + //------------------------------------------------------------------------- + + /** + * The Jakarta Commons + * Logging instance used for all logging. + */ + private static final Log LOG = LogFactory.getLog(JDOUtils.class); + + //------------------------------------------------------------------------- + + /** + * Closes the Connection without throwing SQLException. A warning is added + * to the log if SQLException is thrown. + * + * @param conn The Connection to close + */ + public static void closeConnection(final Connection conn) { + if (conn != null) { + try { + if (!conn.isClosed()) { conn.close(); } + } catch (SQLException e) { + LOG.warn(Messages.message("persist.connClosingFailed"), e); + } + } + } + + /** + * Closes the ResultSet without throwing SQLException. A warning is added to + * the log if SQLException is thrown. + * + * @param rs The ResultSet to close + */ + public static void closeResultSet(final ResultSet rs) { + if (rs != null) { + try { + rs.close(); + } catch (SQLException e) { + LOG.warn(Messages.message("persist.rsClosingFailed"), e); + } + } + } + + /** + * Closes the Statement without throwing SQLException. A warning is added to + * the log if SQLException is thrown. + * + * @param stmt The Statement to close + */ + public static void closeStatement(final Statement stmt) { + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException e) { + LOG.warn(Messages.message("persist.stClosingFailed"), e); + } + } + } + + //------------------------------------------------------------------------- + + /** + * Hide default constructor of utility classes. + */ + private JDOUtils() { } + + //------------------------------------------------------------------------- +}