-
Notifications
You must be signed in to change notification settings - Fork 687
JDK21 compilation changes #4442
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: 4.9.x
Are you sure you want to change the base?
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| if (filterServiceReference != null) { | ||
| Filter filter = (Filter) bundleContext.getService(filterServiceReference); | ||
| httpService.registerServlet(servicePath, new FilterServletAdaptor(filter, null, carbonServlet), null, defaultHttpContext); | ||
| } else { | ||
| httpService.registerServlet(servicePath, carbonServlet, null, defaultHttpContext); | ||
| Dictionary<String, String> props = new Hashtable<>(); |
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.
Log Improvement Suggestion No: 1
| if (filterServiceReference != null) { | |
| Filter filter = (Filter) bundleContext.getService(filterServiceReference); | |
| httpService.registerServlet(servicePath, new FilterServletAdaptor(filter, null, carbonServlet), null, defaultHttpContext); | |
| } else { | |
| httpService.registerServlet(servicePath, carbonServlet, null, defaultHttpContext); | |
| Dictionary<String, String> props = new Hashtable<>(); | |
| if (filterServiceReference != null) { | |
| Filter filter = (Filter) bundleContext.getService(filterServiceReference); | |
| log.info("Registering Carbon filter with pattern: " + servicePath + "/*"); | |
| Dictionary<String, String> props = new Hashtable<>(); |
| // un-registering the carbonServlet | ||
| String servicePath = "/services"; // default path | ||
| String path = serverConfigContext.getServicePath(); | ||
| if (path != null) { | ||
| servicePath = path.trim(); | ||
| if (servletContextHelperServiceRegistration != null) { |
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.
Log Improvement Suggestion No: 2
| // un-registering the carbonServlet | |
| String servicePath = "/services"; // default path | |
| String path = serverConfigContext.getServicePath(); | |
| if (path != null) { | |
| servicePath = path.trim(); | |
| if (servletContextHelperServiceRegistration != null) { | |
| // un-registering the carbonServlet | |
| log.info("Unregistering Carbon servlet and associated services"); | |
| if (servletContextHelperServiceRegistration != null) { |
|
|
||
| public BundleEntryHttpContext(Bundle bundle) { | ||
| this.bundle = bundle; |
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.
Log Improvement Suggestion No: 3
| public BundleEntryHttpContext(Bundle bundle) { | |
| this.bundle = bundle; | |
| public BundleEntryHttpContext(Bundle bundle) { | |
| this.bundle = bundle; | |
| log.info("Initialized BundleEntryHttpContext for bundle: " + bundle.getSymbolicName()); | |
| } |
|
|
||
| public URL getResource(String resourceName) { | ||
| if (this.bundlePath != null) { | ||
| resourceName = this.bundlePath + resourceName; | ||
| } | ||
|
|
||
| int lastSlash = resourceName.lastIndexOf(47); | ||
| if (lastSlash == -1) { | ||
| return null; | ||
| } else { | ||
| String path = resourceName.substring(0, lastSlash); | ||
| if (path.length() == 0) { | ||
| path = "/"; | ||
| } | ||
|
|
||
| String file = this.sanitizeEntryName(resourceName.substring(lastSlash + 1)); | ||
| Enumeration entryPaths = this.bundle.findEntries(path, file, false); | ||
| return entryPaths != null && entryPaths.hasMoreElements() ? (URL)entryPaths.nextElement() : null; | ||
| } |
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.
Log Improvement Suggestion No: 4
| public URL getResource(String resourceName) { | |
| if (this.bundlePath != null) { | |
| resourceName = this.bundlePath + resourceName; | |
| } | |
| int lastSlash = resourceName.lastIndexOf(47); | |
| if (lastSlash == -1) { | |
| return null; | |
| } else { | |
| String path = resourceName.substring(0, lastSlash); | |
| if (path.length() == 0) { | |
| path = "/"; | |
| } | |
| String file = this.sanitizeEntryName(resourceName.substring(lastSlash + 1)); | |
| Enumeration entryPaths = this.bundle.findEntries(path, file, false); | |
| return entryPaths != null && entryPaths.hasMoreElements() ? (URL)entryPaths.nextElement() : null; | |
| } | |
| public URL getResource(String resourceName) { | |
| if (log.isDebugEnabled()) { | |
| log.debug("Attempting to get resource: " + resourceName); | |
| } | |
| if (this.bundlePath != null) { | |
| resourceName = this.bundlePath + resourceName; | |
| } | |
| int lastSlash = resourceName.lastIndexOf(47); | |
| if (lastSlash == -1) { | |
| log.warn("Invalid resource name format, no path separator found: " + resourceName); | |
| return null; | |
| } else { | |
| String path = resourceName.substring(0, lastSlash); | |
| if (path.length() == 0) { | |
| path = "/"; | |
| } | |
| String file = this.sanitizeEntryName(resourceName.substring(lastSlash + 1)); | |
| Enumeration entryPaths = this.bundle.findEntries(path, file, false); | |
| return entryPaths != null && entryPaths.hasMoreElements() ? (URL)entryPaths.nextElement() : null; | |
| } |
| } | ||
| AttributeContext attributeContext = container.startContext(request, response); | ||
| Request requestContext = new ServletRequest(container.getApplicationContext(), request, response); | ||
| AttributeContext attributeContext = container.startContext(requestContext); |
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.
Log Improvement Suggestion No: 5
| AttributeContext attributeContext = container.startContext(requestContext); | |
| AttributeContext attributeContext = container.startContext(requestContext); | |
| log.debug("Started tiles context for request: " + request.getRequestURI()); |
| container.render("main.layout", request, response); | ||
| container.endContext(request, response); | ||
| container.render("main.layout", requestContext); | ||
| container.endContext(requestContext); |
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.
Log Improvement Suggestion No: 6
| container.endContext(requestContext); | |
| container.endContext(requestContext); | |
| log.debug("Successfully rendered tiles layout for: " + actionUrl); |
| // Set the Context Selector (assuming the default Carbon UI context) | ||
| servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, | ||
| "(osgi.http.whiteboard.context.name=default)"); // Assuming default context // TODO check the context |
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.
Log Improvement Suggestion No: 7
| // Set the Context Selector (assuming the default Carbon UI context) | |
| servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, | |
| "(osgi.http.whiteboard.context.name=default)"); // Assuming default context // TODO check the context | |
| // Set the Context Selector (assuming the default Carbon UI context) | |
| servletProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, | |
| "(osgi.http.whiteboard.context.name=default)"); // Assuming default context // TODO check the context | |
| log.info("Registering servlet for URL pattern: " + urlPattern); |
| } | ||
| log.debug("Unregistered Servlet and Filter for URL " + urlPattern); | ||
| } | ||
|
|
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.
Log Improvement Suggestion No: 8
| } catch (Exception e) { | |
| log.error("Error occurred while processing servlet registration for URL: " + urlPattern + ". Error: " + e.getMessage()); |
|
|
||
| @Activate | ||
| protected void activate(ComponentContext ctxt) { |
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.
Log Improvement Suggestion No: 9
| @Activate | |
| protected void activate(ComponentContext ctxt) { | |
| @Activate | |
| protected void activate(ComponentContext ctxt) { | |
| log.info("Activating Carbon UI bundle"); | |
| bundleContext = ctxt.getBundleContext(); |
|
|
||
| try { | ||
| // For FileDownload/FileUpload, we register via Whiteboard pattern to solve the Adaptor issue. | ||
| ServiceRegistration<?> reg = bundleContext.registerService( | ||
| Servlet.class.getName(), servlet, props); | ||
| whiteboardRegistrations.put(pattern, reg); | ||
| log.debug("Registered Servlet via Whiteboard: " + pattern); | ||
| } catch (Exception e) { | ||
| log.error("Failed to register Whiteboard Servlet for pattern: " + pattern, e); |
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.
Log Improvement Suggestion No: 10
| try { | |
| // For FileDownload/FileUpload, we register via Whiteboard pattern to solve the Adaptor issue. | |
| ServiceRegistration<?> reg = bundleContext.registerService( | |
| Servlet.class.getName(), servlet, props); | |
| whiteboardRegistrations.put(pattern, reg); | |
| log.debug("Registered Servlet via Whiteboard: " + pattern); | |
| } catch (Exception e) { | |
| log.error("Failed to register Whiteboard Servlet for pattern: " + pattern, e); | |
| try { | |
| // For FileDownload/FileUpload, we register via Whiteboard pattern to solve the Adaptor issue. | |
| ServiceRegistration<?> reg = bundleContext.registerService( | |
| Servlet.class.getName(), servlet, props); | |
| whiteboardRegistrations.put(pattern, reg); | |
| log.info("Successfully registered Whiteboard Servlet for pattern: " + pattern); | |
| } catch (Exception e) { | |
| log.error("Failed to register Whiteboard Servlet for pattern: " + pattern + ", error: " + e.getMessage()); | |
| } |
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.
AI Agent Log Improvement Checklist
- The log-related comments and suggestions in this review were generated by an AI tool to assist with identifying potential improvements. Purpose of reviewing the code for log improvements is to improve the troubleshooting capabilities of our products.
- Please make sure to manually review and validate all suggestions before applying any changes. Not every code suggestion would make sense or add value to our purpose. Therefore, you have the freedom to decide which of the suggestions are helpful.
✅ Before merging this pull request:
- Review all AI-generated comments for accuracy and relevance.
- Complete and verify the table below. We need your feedback to measure the accuracy of these suggestions and the value they add. If you are rejecting a certain code suggestion, please mention the reason briefly in the suggestion for us to capture it.
No description provided.