Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

FINERACT-2421: Simplify InputStream to String conversion using Java 11+ API - #5267

Merged
galovics merged 1 commit into
apache:developfrom
airajena:FINERACT-2421/simplify-input-stream
Dec 29, 2025
Merged

galovics merged 1 commit into
apache:developfrom
airajena:FINERACT-2421/simplify-input-stream

Conversation

@airajena

Copy link
Copy Markdown
Contributor

JIRA Ticket

https://issues.apache.org/jira/browse/FINERACT-2421

Description

This PR simplifies the getStringFromInputStream() method in TemplateMergeService.java by replacing manual BufferedReader-based conversion with Java 11+ InputStream.readAllBytes().

Changes

  • Replace manual InputStream to String conversion with InputStream.readAllBytes()
  • Remove unused imports: BufferedReader, InputStreamReader
  • Reduces code from 15 lines to 8 lines

Why This Approach

Java 11+ provides native InputStream.readAllBytes() which is:

  • Cleaner and more readable
  • Part of the standard library (no external dependency)
  • Properly handles UTF-8 encoding

Testing

  • ✅ ./gradlew :fineract-provider:compileJava passes
  • ✅ ./gradlew :fineract-provider:compileTestJava passes

private final FineractProperties fineractProperties;

// TODO Replace this with appropriate alternative available in Guava
// Simplified using Java 11+ InputStream.readAllBytes() instead of manual buffering

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code seems ok, and remove this comment, TODO,FIXME should be removed after fixing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the feedback! I've removed the comment. The code is now self-explanatory.

@Aman-Mittal Aman-Mittal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, When the TODO is completed and code is self explanatory the comment can be removed entirely

@airajena
airajena force-pushed the FINERACT-2421/simplify-input-stream branch from 89f42c0 to 55affcf Compare December 28, 2025 04:25
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