[Bug 69693] New: Improve readability and type safety by changing parsingRequestLinePhase to an enum in Http11InputBuffer

2025-05-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69693

Bug ID: 69693
   Summary: Improve readability and type safety by changing
parsingRequestLinePhase to an enum in
Http11InputBuffer
   Product: Tomcat 11
   Version: 11.0.0
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Connectors
  Assignee: dev@tomcat.apache.org
  Reporter: devjohnp...@gmail.com
  Target Milestone: ---

The Http11InputBuffer class in Apache Tomcat currently uses an int type for the
parsingRequestLinePhase field to track the state of request line parsing. While
this implementation is functionally sound, it has the following drawbacks:

* Readability: Integer values do not clearly convey the meaning of the state.
For example, it is not immediately obvious from the code alone that
parsingRequestLinePhase == 0 represents the "METHOD" state.
* Type Safety: The int type allows invalid values, such as negative numbers or
values outside the expected range, to be assigned, which could lead to runtime
errors.

To address these issues, we propose changing the type of
parsingRequestLinePhase from int to an enum called RequestLineParsePhase. This
enum defines explicit constants for each state (e.g., METHOD, URI, etc.),
improving code readability and leveraging Java's enum features to ensure only
valid states are assigned.

To maintain compatibility with existing code, the enum includes an int phase
field to preserve the integer representation of states. Additionally, the
public int getParsingRequestLinePhase() method has been modified to return this
integer value, ensuring no impact on external code.
This change enhances the maintainability and stability of the Http11InputBuffer
class without introducing functional changes. All existing tests have passed,
confirming the consistency of behavior.

* Future Intention: If this PR is merged, a potential follow-up task could be
to remove the getParsingRequestLinePhase() method and provide more specific,
intention-revealing methods for Http11Processor, further improving readability
and decoupling.

See
https://github.com/apache/tomcat/pull/855

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 69693] Improve readability and type safety by changing parsingRequestLinePhase to an enum in Http11InputBuffer

2025-05-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69693

Remy Maucherat  changed:

   What|Removed |Added

 Resolution|--- |WONTFIX
 Status|NEW |RESOLVED

--- Comment #1 from Remy Maucherat  ---
I don't find the change that compelling. Also it seems AI generated. We'll look
at the PR anyay, no need for an additional BZ.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 69693] Improve readability and type safety by changing parsingRequestLinePhase to an enum in Http11InputBuffer

2025-05-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=69693

--- Comment #2 from johnpark  ---
Only the comments using AI. Please refer to them.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: [PR] allow users to plug in a ProgressListener via some factory. [tomcat]

2025-05-18 Thread via GitHub


reiern70 commented on PR #856:
URL: https://github.com/apache/tomcat/pull/856#issuecomment-2889048692

   @ChristopherSchultz I have implemented 
   
   https://github.com/apache/wicket/pull/1167
   
   A way to get Wicket's support for upload with progress using work in this PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org