Home
Calling the Java class in PowerBuilder is no longer supported
Description
The rule states that "Calling the Java class in PowerBuilder is no longer supported in PowerBuilder 2022", this means that developers can no longer use these objects in their PowerBuilder 2022 applications, and any existing applications that were built with these objects will need to be updated to use other methods. The EJBConnection, EJBTransaction, and JavaVM objects are no longer supported. Also The CreateJavaVM function is no longer supported. This change reflects the changing landscape of application development and the need for developers to use more modern methods and technologies.
Key Benefits
- Faster development: By not having to call the Java class, developers can focus on the more important tasks, such as debugging and testing, and complete projects faster.
- Less complexity: Without having to call the Java class, developers can reduce the complexity of their projects and avoid potential issues.
- Improved security: By not having to call the Java class, developers can reduce the risk of security vulnerabilities and protect their applications.
- Reduced maintenance: Without having to call the Java class, developers can reduce the amount of time spent on maintenance and focus on other tasks.
Non-compliant Code Example
global function void ejbconnectionSample3 ();
JavaVM l_jvm //Non compliant code
EJBConnection l_ejbconn //Non compliant code
EJBTransaction trans //Non compliant code
java_integer val
l_jvm = CREATE JavaVM //Non compliant code
l_EJBConn = CREATE EJBConnection //Non compliant code
TRY
IF l_jvm.createJavaVM("", false) >= 0 THEN //Non compliant code
string ls_props[]
ls_props[1] = "javax.naming.Context.INITIAL_CONTEXT_FACTORY=
weblogic.jndi.WLInitialContextFactory"
ls_props[2] ="javax.naming.Context.PROVIDER_URL=t3://svr1:7001"
ls_props[3] = "javax.naming.Context.SECURITY_PRINCIPAL=myid"
ls_props[4] = "javax.naming.Context.SECURITY_CREDENTIALS=mypass"
l_EJBConn.connectToServer(ls_props) //Non compliant code
l_EJBConn.createJavaInstance(val, "java_integer") //Non compliant code
val.java_integer(17)
trans = conn.GetEjbTransaction //Non compliant code
trans.begin() //Non compliant code
MessageBox("The value is", val.IntValue())
ELSE
MessageBox("createJavaVM", "Failed", StopSign!)
END IF
CATCH (Throwable g)
MessageBox("Exception in createJavaInstance", g.getMessage())
END TRY
end function
