SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye
Issue Details (XML | Word | Printable)

Key: CMP-347
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Shay Banon
Reporter: Ismael Juma
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Compass

[Patch] Compiler errors under JDK 6.

Created: 03/Jan/07 12:50 AM   Updated: 19/Feb/10 11:27 AM
Component/s: Compass::Core
Affects Version/s: 1.1 M3
Fix Version/s: 2.0.0 M2

File Attachments: 1. File jdk6compile.diff (3 kB)

Environment: JDK 6.


 Description  « Hide
There are a few compiler errors when compass is compiled with JDK 6. Most of them are due to the fact that PreparedStatement#setBlob(2, null) (as an example) is now an ambiguous statement. A possible solution is replacing those calls with PreparedStatement#setBlob(2, (Blob) null).

The other issue is that the Blob interface got two additional methods and as such InputStreamBlob fails to compile. I think it's safe to throw an UnsupportedOperationException (for now at least), but there's probably a better solution.

I am attaching a patch that implements what has been described above.

P.S. After these changes, I still get a compiler error under eclipse. For some reason, eclipse can't find the class Library in LibraryTests (line 77). Any idea why?



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Ismael Juma added a comment - 03/Jan/07 12:53 AM
Fixes compiler errors in JDK 6 by:

1) Removing ambiguity in overloaded methods with explicit casting.
2) Adding two methods to InputStreamBlob.java that throw UnsupportedOperationException to comply with newly added methods in Blob interface.


Shay Banon added a comment - 03/Jan/07 01:38 PM
This will solve some compilation problems. I had another problem with changes to DataSource in JDK 6 that I had no time to investigate how they should be implemented. Did you encounter them as well?

Ismael Juma added a comment - 03/Jan/07 03:24 PM
I updated from SVN and the compiler errors for issue 1) are now gone. Thanks. Issue 2) is still an issue.

Regarding the DataSource problems, I did not encounter them at first. After you mentioned, however, I investigated and the reason why I wasn't seeing them was that the jdbc2_0-stdext.jar is above the JRE in the export order of the eclipse .classpath file. This means that the DataSource from there is used during the compilation. After I put that jar below the JRE and I can also see those errors. The issue seems to be that the DataSource interface now extends a Wrapper interface that adds two methods. I am also not sure about the implementation required for those two methods.


Ismael Juma added a comment - 03/Jan/07 03:37 PM
http://weblogs.java.net/blog/lancea/archive/2006/02/jdbc_40_wrapper.html has an explanation (with a usage example) of the Wrapper interface.

Ismael Juma added a comment - 29/May/07 03:47 PM
Even though this is a minor issue, I noticed that Spring 2.1M1 has changed its code to compile with JDBC 4.0. The AbstractDataSource code looks like:

public Object unwrap(Class iface) throws SQLException {

Assert.notNull(iface, "Interface argument must not be null");

if (!DataSource.class.equals(iface)) { throw new SQLException("DataSource of type [" + getClass().getName() + "] can only be unwrapped as [javax.sql.DataSource], not as [" + iface.getName()); }

return this;

}

public boolean isWrapperFor(Class iface) throws SQLException { return DataSource.class.equals(iface); }

The DelegatingDataSource (which is similar to the TransactionAwareDataSourceProxy in Compass in some sense) looks like:

public Object unwrap(Class iface) throws SQLException { return getTargetDataSource().unwrap(iface); }

public boolean isWrapperFor(Class iface) throws SQLException { return getTargetDataSource().isWrapperFor(iface); }

Maybe this is helpful.


Ismael Juma added a comment - 23/Feb/08 09:31 PM
This seems to be fixed in trunk (checked revision 2883).

Shay Banon added a comment - 24/Feb/08 04:40 AM
Actually, I went through the process and everything seems to be fine now with 6.0. Just forgot to close the issue. Thanks for checking!.