jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-556) Refactoring of the BackupTool
Date Thu, 22 Feb 2007 14:59:05 GMT

    [ https://issues.apache.org/jira/browse/JCR-556?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12475037
] 

Stefan Guggisberg commented on JCR-556:
---------------------------------------

nicolas,
there are still some issues. streams and result sets are not properly closed.
there are also some minor issues like inaccurate exception msg & inline 
comments that don't seem to make sense..

here's my slightly revised suggestion:

    /**
     * {@inheritDoc}
     */
    public void accept(ItemStateVisitor visitor) throws ItemStateException {
        ResultSet rs = null;
        InputStream in = null;
        try {
            // visit node states
            Statement stmt = executeStmt(nodeStateSelectAllSQL, new Object[0]);
            rs = stmt.getResultSet();
            while (rs.next()) {
                String id = rs.getString(1);
                NodeState state = createNew(NodeId.valueOf(id));
                in = rs.getBinaryStream(2);
                Serializer.deserialize(state, in);
                visitor.visit(state);
                closeStream(in);
                in = null;
            }
            closeResultSet(rs);
            rs = null;

            // visit property states
            stmt = executeStmt(propertyStateSelectAllSQL, new Object[0]);
            rs = stmt.getResultSet();
            while (rs.next()) {
                String id = rs.getString(1);
                PropertyState state = createNew(PropertyId.valueOf(id));
                in = rs.getBinaryStream(2);
                Serializer.deserialize(state, in, blobStore);
                visitor.visit(state);
                closeStream(in);
                in = null;
            }
        } catch (Exception e) {
            String msg = "failed to visit item states";
            log.error(msg, e);
            throw new ItemStateException(msg, e);
        } finally {
            closeStream(in);
            closeResultSet(rs);
        }
    }



> Refactoring of the BackupTool
> -----------------------------
>
>                 Key: JCR-556
>                 URL: https://issues.apache.org/jira/browse/JCR-556
>             Project: Jackrabbit
>          Issue Type: Improvement
>            Reporter: Nicolas Toper
>            Priority: Minor
>         Attachments: BIO.patch, patch-backup-040906.txt, patch-jr-010906-NodeVersionHistoriesUpdatableStateManager.txt,
patch-jr-010906-PropInfo.txt, patch-jr-010906-RepositoryImpl.txt, patch-jr-010906-SysViewImporter.txt,
patch-jr-010906-VersionManagerImpl.txt, PropInfo.patch, VisitorPattern200207.patch, VisitorPattern22022007-2.patch,
VisitorPattern22022007-3.patch, VisitorPattern22022007.patch
>
>
> The BackupTool has still some refactoring to perform. I will propose the patch on this
new issue since we cannot change the JCR-442 (Google wants to see a place where all the Google
SoC work is).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message