Skip to content

Commit

Permalink
[playframework#1099] Fix ProxiDriver in order to compile with JDK 1.7…
Browse files Browse the repository at this point in the history
… and JDK 1.6
  • Loading branch information
xael-fry authored and Notalifeform committed Aug 10, 2013
1 parent 867df52 commit 604735e
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions framework/src/play/db/DBPlugin.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package play.db;

import com.mchange.v2.c3p0.ConnectionCustomizer;

import java.sql.SQLFeatureNotSupportedException;

import play.Play;
import play.PlayPlugin;
import play.mvc.Http;
Expand Down Expand Up @@ -136,13 +139,6 @@ public static class ProxyDriver implements Driver {
this.driver = d;
}

/*
* JDK 7 compatibility
*/
public Logger getParentLogger() {
return null;
}

public boolean acceptsURL(String u) throws SQLException {
return this.driver.acceptsURL(u);
}
Expand All @@ -166,6 +162,17 @@ public DriverPropertyInfo[] getPropertyInfo(String u, Properties p) throws SQLEx
public boolean jdbcCompliant() {
return this.driver.jdbcCompliant();
}

// Method not annotated with @Override since getParentLogger() is a new method
// in the CommonDataSource interface starting with JDK7 and this annotation
// would cause compilation errors with JDK6.
public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException {
try {
return (java.util.logging.Logger) Driver.class.getDeclaredMethod("getParentLogger").invoke(this.driver);
} catch (Throwable e) {
return null;
}
}
}


Expand Down

0 comments on commit 604735e

Please sign in to comment.