Skip to content
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

Add support to compile with Java 17 #4014

Draft
wants to merge 12 commits into
base: 4.10.x
Choose a base branch
from

Conversation

madurangasiriwardena
Copy link
Member

No description provided.

@madurangasiriwardena madurangasiriwardena marked this pull request as draft June 25, 2024 15:26
* @throws UnsupportedOperationException if JTA is not supported
*/
UserTransaction getUserTransaction();
// TODO javax.transaction package is no longer available. Need to find a way to add this back
Copy link
Member Author

Choose a reason for hiding this comment

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

javax.transaction is not available with JDK 17. Since this seems to be not used, removed. But need to validate the functionality.

touch();
return null; //To change body of implemented methods use File | Settings | File Templates.
}
// @Override
Copy link
Member Author

Choose a reason for hiding this comment

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

javax.transaction is not available with JDK 17. Since this seems to be not used, removed. But need to validate the functionality.

@@ -55,6 +56,7 @@
* This class stores the configuration of the Carbon Server.
*/
@SuppressWarnings("unused")
//@Component(service = ServerConfigurationService.class)
Copy link
Member Author

Choose a reason for hiding this comment

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

Remove this.

@@ -50,7 +50,7 @@ public void setSecurityManager() {
String resourcePath = resourceURL.getPath();
resourcePath = resourcePath + "policy-test.policy";
System.setProperty("java.security.policy", resourcePath);
System.setSecurityManager(new SecurityManager());
// System.setSecurityManager(new SecurityManager());
Copy link
Member Author

Choose a reason for hiding this comment

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

Security manager not working properly with Java 17. Hence need to get rid of security manager.

<class name="org.wso2.carbon.base.CarbonBaseUtilsTest" />
<!-- <class name="org.wso2.carbon.base.CarbonBaseUtilsWithIncorrectSecPolicy" />-->
<class name="org.wso2.carbon.base.CarbonContextHolderBaseTest" />
<!-- <class name="org.wso2.carbon.base.ServerConfigurationTest" />-->
Copy link
Member Author

Choose a reason for hiding this comment

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

This test was working incorrectly before. Due to a new validation added in Files API, this is failing now.

<classes>
<class name="org.wso2.carbon.base.CarbonApplicationContextHolderBaseTest" />
<class name="org.wso2.carbon.base.CarbonBaseUtilsTest" />
<!-- <class name="org.wso2.carbon.base.CarbonBaseUtilsWithIncorrectSecPolicy" />-->
Copy link
Member Author

Choose a reason for hiding this comment

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

Security manager related functionality is not working with JDK 17.

@@ -32,7 +27,11 @@
*/
public class CarbonSecurityManager extends SecurityManager {
Copy link
Member Author

Choose a reason for hiding this comment

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

Possibly need to remove this.

@@ -170,6 +168,11 @@
org.wso2.carbon.crypto:org.wso2.carbon.crypto.provider:${carbon.crypto.version}
</bundleDef>
<bundleDef>org.wso2.orbit.sun.xml.bind:jaxb:${version.org.wso2.orbit.javax.xml.bind.jaxb}</bundleDef>
<!-- TODO previously javax.activation package has come from org.eclipse.osgi_3.14.0.v20190517-1309 -->
<bundleDef>org.wso2.orbit.javax.activation:activation:1.1.1.wso2v4</bundleDef>
Copy link
Member Author

Choose a reason for hiding this comment

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

Check if this is the best component to add javax.activation. Based on this, update the import packages as well.

<bundleDef>org.wso2.orbit.javax.activation:activation:1.1.1.wso2v4</bundleDef>
<!-- TODO previously javax.transaction package has come from org.eclipse.osgi_3.14.0.v20190517-1309 -->
<!-- TODO previously javax.xml.soap was provided by org.eclipse.osgi_3.14.0.v20190517-1309 -->
<bundleDef>javax.xml.soap:javax.xml.soap-api:1.4.0</bundleDef>
Copy link
Member Author

Choose a reason for hiding this comment

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

Check if this is the best component to add javax.xml.soap. Based on this, update the import packages as well.

@@ -170,6 +168,11 @@
org.wso2.carbon.crypto:org.wso2.carbon.crypto.provider:${carbon.crypto.version}
</bundleDef>
<bundleDef>org.wso2.orbit.sun.xml.bind:jaxb:${version.org.wso2.orbit.javax.xml.bind.jaxb}</bundleDef>
<!-- TODO previously javax.activation package has come from org.eclipse.osgi_3.14.0.v20190517-1309 -->
<bundleDef>org.wso2.orbit.javax.activation:activation:1.1.1.wso2v4</bundleDef>
<!-- TODO previously javax.transaction package has come from org.eclipse.osgi_3.14.0.v20190517-1309 -->
Copy link
Member Author

Choose a reason for hiding this comment

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

Temporarily removed the javax.transaction usages. Validate if this is actually required add a suitable dependency back.

@@ -80,6 +81,9 @@
<featureArtifactDef>
org.wso2.ciphertool:org.wso2.ciphertool.feature:${version.ciphertool}
</featureArtifactDef>
<!-- <featureArtifactDef>-->
Copy link
Member Author

Choose a reason for hiding this comment

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

remove commented code.

@@ -113,7 +113,7 @@
<module>org.wso2.carbon.registry.api</module>
<module>org.wso2.carbon.user.api</module>
<module>org.wso2.carbon.osgi.security</module>
<module>org.wso2.carbon.registry.xboot</module>
<!-- <module>org.wso2.carbon.registry.xboot</module>-->
Copy link
Member Author

Choose a reason for hiding this comment

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

Remove commented code.

</init-param>-->
<load-on-startup>0</load-on-startup>
</servlet>
<!-- <servlet>-->
Copy link
Member Author

Choose a reason for hiding this comment

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

Remove commented code.

@@ -262,6 +255,9 @@ public void start(BundleContext context) throws Exception {
//Registering filedownload servlet
Servlet fileDownloadServlet = new ContextPathServletAdaptor(new FileDownloadServlet(
context, getConfigurationContextService()), "/filedownload");
// Dictionary<String, Object> fileDownloadServletProperties = new Hashtable<>();
Copy link
Member Author

Choose a reason for hiding this comment

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

Will have to migrate the filedownload and fileupload services to Whiteboard pattern.

@@ -425,6 +427,18 @@ public void registerServlet(Servlet servlet, String urlPattern, Dictionary param
httpService.registerServlet(urlPattern,
new FilterServletAdaptor(associatedFilter, null, adaptedJspServlet), params, httpContext);
}
// Dictionary<String, Object> properties = new Hashtable<>();
Copy link
Member Author

Choose a reason for hiding this comment

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

Remove commented code.

public TilesJspServlet(Bundle bundle, UIResourceRegistry uiResourceRegistry) {
super(bundle, uiResourceRegistry);
}

//TODO check if this is needed
@Override
public void init() throws ServletException {
Copy link
Member Author

Choose a reason for hiding this comment

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

This seems to be not needed. Validate and remove.

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class FilterServletAdaptor implements Servlet {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is copied from http helper component. Try to get rid of this.

return new CustomTilesInitializer();
}

// @Override
Copy link
Member Author

Choose a reason for hiding this comment

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

remove commented code.

@@ -161,9 +161,9 @@ protected static boolean saveOriginalUrl(CarbonUIAuthenticator authenticator,
}
} else {
if (skipLoginPage) {
response.sendRedirect(contextPath + "/carbon/admin/login_action.jsp");
Copy link
Member Author

Choose a reason for hiding this comment

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

redirection after management console login is still not working properly. /carbon/ part is added twice sometimes.

@@ -62,6 +73,17 @@
</exclusion>
</exclusions>
</dependency>
<!-- &lt;!&ndash; Adding temporarily to compile &ndash;&gt;-->
Copy link
Member Author

Choose a reason for hiding this comment

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

remove commented code.

@@ -71,6 +70,7 @@
* @see EmbeddedRegistry
* @see UserRegistry
*/
//@Component(service = RegistryService.class)
Copy link
Member Author

Choose a reason for hiding this comment

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

remove commented code.

<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.http.helper</artifactId>
</dependency>
<!-- <dependency>-->
Copy link
Member Author

Choose a reason for hiding this comment

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

remove commented code.

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.

1 participant