-
Notifications
You must be signed in to change notification settings - Fork 1
Fix Tee Filter #413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix Tee Filter #413
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 11 changed files in this pull request and generated 9 suggestions.
Files not reviewed (6)
- ecs-logging-access/build.gradle: Language not supported
- ecs-logging-okhttp3/build.gradle: Language not supported
- ecs-logging-okhttp3/src/test/groovy/com/raynigon/ecs/logging/okhttp3/EcsTransactionIdInterceptorSpec.groovy: Language not supported
- settings.gradle: Language not supported
- ecs-logging-okhttp3/src/main/java/com/raynigon/ecs/logging/okhttp3/EcsTransactionIdInterceptor.java: Evaluated as low risk
- ecs-logging-access/src/main/java/com/raynigon/ecs/logging/access/server/TeeHttpServletRequest.java: Evaluated as low risk
Comments skipped due to low confidence (2)
ecs-logging-access/src/main/java/com/raynigon/ecs/logging/access/server/TeeHttpServletResponse.java:51
- The getOutputBuffer method should return an empty byte array instead of null to avoid potential NullPointerExceptions.
return null;
ecs-logging-access/src/main/java/com/raynigon/ecs/logging/access/server/TeeHttpServletResponse.java:0
- The new behavior introduced in TeeHttpServletResponse should be covered by tests to ensure it behaves as expected.
class TeeHttpServletResponse extends HttpServletResponseWrapper {
| public static boolean computeActivation(String hostname, String includeListAsStr, String excludeListAsStr) { | ||
| List<String> includeList = extractNameList(includeListAsStr); | ||
| List<String> excludeList = extractNameList(excludeListAsStr); | ||
| boolean inIncludesList = mathesIncludesList(hostname, includeList); |
Copilot
AI
Nov 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method name 'mathesIncludesList' is misspelled. It should be 'matchesIncludesList'.
| boolean inIncludesList = mathesIncludesList(hostname, includeList); | |
| boolean inIncludesList = matchesIncludesList(hostname, includeList); |
| List<String> includeList = extractNameList(includeListAsStr); | ||
| List<String> excludeList = extractNameList(excludeListAsStr); | ||
| boolean inIncludesList = mathesIncludesList(hostname, includeList); | ||
| boolean inExcludesList = mathesExcludesList(hostname, excludeList); |
Copilot
AI
Nov 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method name 'mathesExcludesList' is misspelled. It should be 'matchesExcludesList'.
| boolean inExcludesList = mathesExcludesList(hostname, excludeList); | |
| boolean inExcludesList = matchesExcludesList(hostname, excludeList); |
|
|
||
| @Override | ||
| public boolean isReady() { | ||
| throw new RuntimeException("Not yet implemented"); |
Copilot
AI
Nov 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method isReady should not throw a RuntimeException with the message 'Not yet implemented'. This can cause unexpected crashes. Implement the method or handle it appropriately.
| throw new RuntimeException("Not yet implemented"); | |
| return underlyingStream.isReady(); |
|
|
||
| @Override | ||
| public void setWriteListener(WriteListener listener) { | ||
| throw new RuntimeException("Not yet implemented"); |
Copilot
AI
Nov 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method setWriteListener should not throw a RuntimeException with the message 'Not yet implemented'. This can cause unexpected crashes. Implement the method or handle it appropriately.
|
|
||
| @Override | ||
| public boolean isFinished() { | ||
| throw new RuntimeException("Not yet implemented"); |
Copilot
AI
Nov 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method isFinished should not throw a RuntimeException. It should be properly implemented or handled gracefully.
|
|
||
| @Override | ||
| public boolean isReady() { | ||
| throw new RuntimeException("Not yet implemented"); |
Copilot
AI
Nov 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method isReady should not throw a RuntimeException. It should be properly implemented or handled gracefully.
|
|
||
| @Override | ||
| public void setReadListener(ReadListener listener) { | ||
| throw new RuntimeException("Not yet implemented"); |
Copilot
AI
Nov 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method setReadListener should not throw a RuntimeException. It should be properly implemented or handled gracefully.
| content = IOUtils.toByteArray(request.getInputStream()); | ||
| in = new ByteArrayInputStream(content); | ||
| } catch (IOException e) { | ||
| e.printStackTrace(); |
Copilot
AI
Nov 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catching IOException and calling e.printStackTrace() is not a good practice. Consider proper logging instead.
| e.printStackTrace(); | |
| LoggerFactory.getLogger(TeeServletInputStream.class).error("Error duplicating input stream", e); |
| } | ||
|
|
||
| @Override | ||
| public void flushBuffer() { |
Copilot
AI
Nov 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flushBuffer method should also flush the teeServletOutputStream if it is not null to ensure all data is properly flushed.
Grannath
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't actually see the fix here. It looks like a direct copy from the original. How does this fix the multipart message handling?
|
|
||
| active = computeActivation(localhostName, includeListAsStr, excludeListAsStr); | ||
| if (active) | ||
| System.out.println("TeeFilter will be ACTIVE on this host [" + localhostName + "]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a logging library, it seems reasonable to use a logger instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wont work, because its a logging library...
I will remove all the print statements.
No description provided.