[jbossts-issues] [JBoss JIRA] Commented: (JBTM-419) Hardcoded "1.5" java version check in com\arjuna\ats\internal\jdbc\ConnectionManager.java won't work on Java 1.6

Mauro Molinari (JIRA) jira-events at lists.jboss.org
Wed May 6 04:56:46 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBTM-419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12465944#action_12465944 ] 

Mauro Molinari commented on JBTM-419:
-------------------------------------

Well, I agree with you that the extension of JDBC interfaces introduced by Sun in Java 6 is questionable and undesirable. However I do not agree on the fact that using JDBC3 drivers at runtime using Java6 is an "exploit of a weakness in the type checking system". JDBC defines a way to declare an implementation version through metadata: a correctly coded client can use that information to know if a driver is JDBC3 or JDBC4. Once determined, it's obvious that it won't call JDBC4 methods over a JDBC3 implementation!!

Our application is designed to work under both Java 5 and Java 6, so we are not using JDBC4 features, and our application is working perfectly with JDBC3 driver implementations (and, fortunately, with JDBC2 driver implementations too), either under JRE5 or JRE6. Please note we're using a JTA-XA infrastructure managed by Spring.

This said, I think this bug report was to say that the hard-coded version check "== 1.5" would have better been ">= 1.5" because in that way the JBossTS TransactionalDriver would have perfectly worked as a JDBC3 implementation in any application that supported JDBC3, even if the underlying runtime environment were a Java6 JRE.

Obviously, making the TransactionalDriver JDBC4 compliant is the best choice, however I think this was not the starting point here.

> Hardcoded "1.5" java version check in com\arjuna\ats\internal\jdbc\ConnectionManager.java won't work on Java 1.6
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: JBTM-419
>                 URL: https://jira.jboss.org/jira/browse/JBTM-419
>             Project: JBoss Transaction Manager
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: JTA
>    Affects Versions: 4.4.0.GA
>         Environment: Sun's J2SE DevKit 1.6u10
>            Reporter: Sergey Proskurnya
>            Assignee: Jonathan Halliday
>            Priority: Minor
>             Fix For: 4.7.0
>
>
> There is a hard-coded version check in com.arjuna.ats.internal.jdbc.ConnectionManager in "create (String dbUrl, Properties info)" method:
> --------------------------------------------------------------------------------------------------------------------------
> ...
> line 116:
> if(System.getProperty("java.specification.version").equals("1.5"))
> 	{
> 		// the 1.5 (JDBC3) wrapper version is loaded dynamically because classloading
> 		// it on earlier versions of the platform is not possible.
>         ....
> }
> --------------------------------------------------------------------------------------------------------------------------
> That piece of code will not work correctly on Java 1.6, because System.getProperty("java.specification.version") returns "1.6" on Java 1.6.
> It is needed to parse the result of System.getProperty("java.specification.version") and compare major and minor versions separately.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jbossts-issues mailing list