Skip to content

Conversation

@rainer-prosi
Copy link
Contributor

some general cleanup + security

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 addresses general cleanup and security improvements in the JDFUtility codebase. The changes include refactoring URL path handling for security, updating copyright dates, and improving code formatting.

Key changes:

  • Enhanced URL path manipulation logic in MyResourceHandler to prevent potential path traversal vulnerabilities
  • Switched from HTML4 to HTML3 escaping for better compatibility
  • Added new test coverage for resource handler and file item list components

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/main/java/org/cip4/jdfutility/server/MyResourceHandler.java Improved URL path handling with JDFConstants.SLASH constant and fixed substring logic to prevent index out of bounds
src/main/java/org/cip4/jdfutility/GetFileServlet.java Changed HTML escape from escapeHtml4 to escapeHtml3 and reformatted imports
src/main/java/org/cip4/jdfutility/FileItemList.java Added FileCleaningTracker support for better resource cleanup
src/main/java/org/cip4/jdfutility/CheckJDFServlet.java Initialized FileCleaningTracker to null in constructor
src/test/java/org/cip4/jdfutility/server/MyResourceHandlerTest.java Added test cases for URL update functionality
src/test/java/org/cip4/jdfutility/server/JettyServerTest.java Added assertion for getJettyServer()
src/test/java/org/cip4/jdfutility/FileItemListTest.java Added test coverage for FileCleaningTracker getter/setter
src/main/java/org/cip4/jdfutility/server/JettyServer.java Added public getter for Jetty Server instance
src/main/java/org/cip4/jdflib/generator/JavaCoreStringUtil.java Added enum handling for Surface/Face attributes and code formatting improvements
src/main/java/org/cip4/jdflib/generator/gui/ComplexTypeList.java Added missing JDFAutoSurfaceMark.java entry
src/main/java/org/cip4/jdflib/generator/GeneratorStringUtil.java Updated copyright year to 2025
index.html Added new HTML landing page for JDF toolbox UI

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +222 to +224
catch (final Exception ignore)
{
// nop
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

Catching generic Exception instead of the specific IOException that was previously caught makes debugging harder. Consider catching only IOException or logging the exception rather than silently suppressing all exceptions.

Suggested change
catch (final Exception ignore)
{
// nop
catch (final IOException ioe)
{
System.err.println("Error reading form field '" + fi.getFieldName() + "': " + ioe.getMessage());

Copilot uses AI. Check for mistakes.
}

/**
* @return
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

The JavaDoc comment is incomplete. It should describe what the method returns, e.g., '@return the Jetty Server instance'.

Suggested change
* @return
* Gets the underlying Jetty Server instance.
* @return the Jetty Server instance

Copilot uses AI. Check for mistakes.
</div>
<div class="form-check">
<input type="radio" class="form-check-input" name="Version"
value="1.7" checked="checked" />
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

Two radio buttons have checked=\"checked\" attribute: both 'JDF 1.7' (line 245) and 'JDF 1.8' (line 250). Only one radio button in a group can be checked. Remove the checked attribute from line 245 or 250.

Suggested change
value="1.7" checked="checked" />
value="1.7" />

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants