Skip to content

Conversation

@XingY
Copy link
Contributor

@XingY XingY commented Sep 18, 2025

Rationale

Related Pull Requests

Changes

  • Use DOCUMENT_BUILDER_FACTORY
  • Update file constructor to use FileLike

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR consolidates XML parsing and FileLike usage across the LabKey platform by standardizing XML document builder creation and migrating from File to FileLike objects for better virtual file system support.

  • Replace custom DocumentBuilderFactory instantiation with centralized XmlBeansUtil.DOCUMENT_BUILDER_FACTORY
  • Migrate File-based operations to FileLike for improved virtual file system compatibility
  • Update zip extraction and file handling to use FileLike APIs consistently

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
protein/src/org/labkey/protein/ProteinServiceImpl.java Replaces local DocumentBuilderFactory with XmlBeansUtil.DOCUMENT_BUILDER_FACTORY
flow/src/org/labkey/flow/controllers/WorkspaceData.java Migrates File to FileLike for temporary directory handling
flow/enginesrc/org/labkey/flow/persist/AnalysisSerializer.java Updates extractArchive method to use FileLike for zip extraction operations
flow/enginesrc/org/labkey/flow/analysis/model/CompensationMatrix.java Consolidates XML document builder creation using XmlBeansUtil
flow/enginesrc/org/labkey/flow/Main.java Migrates zip extraction logic from File to FileLike

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 134 to 135
// TODO: with `setNamespaceAware(true)`, is the following still needed?
// DocumentBuilderFactory.setFeature(Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE, true)
Copy link

Copilot AI Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TODO comment should be properly formatted as a Javadoc comment or regular comment block, and the question should be resolved or tracked in a proper issue tracker rather than left as inline code comments.

Suggested change
// TODO: with `setNamespaceAware(true)`, is the following still needed?
// DocumentBuilderFactory.setFeature(Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE, true)
/*
* The following line was previously used to enable namespace awareness:
* DocumentBuilderFactory.setFeature(Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE, true)
* If you need to revisit namespace handling, see the relevant documentation or issue tracker.
*/

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my quick analysis, seems like setNamespaceAware() is sufficient and will stomp over the setFeature() value anyway

}

public static File extractArchive(File file, File tempDir)
public static File extractArchive(File file, FileLike tempDir)
Copy link

Copilot AI Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method signature is inconsistent - it accepts a File parameter but returns a File while using FileLike for tempDir. Consider updating the return type to FileLike or the input parameter to FileLike for API consistency.

Copilot uses AI. Check for mistakes.
Comment on lines 134 to 135
// TODO: with `setNamespaceAware(true)`, is the following still needed?
// DocumentBuilderFactory.setFeature(Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE, true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my quick analysis, seems like setNamespaceAware() is sufficient and will stomp over the setFeature() value anyway

@XingY XingY merged commit 6880bd1 into develop Sep 20, 2025
4 of 6 checks passed
@XingY XingY deleted the fb_fileLikeAndXML branch September 20, 2025 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants