[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

Jonathan Halliday (JIRA) jira-events at lists.jboss.org
Wed May 6 05:14:46 EDT 2009


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

Jonathan Halliday commented on JBTM-419:
----------------------------------------

> Once determined, it's obvious that it won't call JDBC4 methods over a JDBC3 implementation!! 

Umm, not so. In a strongly typed language if something 'implements SomeInterface' then code can reasonably call methods on that interface. That's what interface declarations are for. Adding a requirement that you call some method to determine if the claim of 'implements SomeInterface' is actually true or not is missing the point of the type system. We may as well use a dynamically typed language.  You may be able to carefully write code that uses only JDBC3, but it requires programmer awareness and attention which should be better focused on the business problems. The reason to choose a strongly typed language is so that the tools (compiler, classloader, runtime) can take some of the load off the programmer's concentration.  I accept that the design of the type system in java has some advantages, but for my personal taste I'd prefer this situation to be caught at classload time rather than method invocation time. IMO it should be illegal to load a class that claims to implement an interface but does not.

> hard-coded version check "== 1.5" would have better been ">= 1.5" 

So basically the behaviour you want is, 'load the most recent version of the driver' regardless of the version of the runtime you are executing on?

> 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