Skip to content

Commit

Permalink
Fix compilation error in java 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Primigenus committed Jan 28, 2015
1 parent 6272c06 commit 9d9145f
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions framework/src/play/db/DBPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
Expand Down Expand Up @@ -55,7 +56,7 @@ public boolean rawInvocation(Request request, Response response) throws Exceptio
if (!domain.equals("localhost")) {
serverOptions = new String[] {"-webAllowOthers"};
}

h2Server = org.h2.tools.Server.createWebServer(serverOptions);
h2Server.start();

Expand All @@ -78,7 +79,7 @@ public void onApplicationStart() {

boolean isJndiDatasource = false;
String datasourceName = p.getProperty("db", "");
// Identify datasource JNDI lookup name by 'jndi:' or 'java:' prefix
// Identify datasource JNDI lookup name by 'jndi:' or 'java:' prefix
if (datasourceName.startsWith("jndi:")) {
datasourceName = datasourceName.substring("jndi:".length());
isJndiDatasource = true;
Expand Down Expand Up @@ -129,13 +130,13 @@ public void onApplicationStart() {
ds.setMaxIdleTimeExcessConnections(Integer.parseInt(p.getProperty("db.pool.maxIdleTimeExcessConnections", "0")));
ds.setIdleConnectionTestPeriod(10);
ds.setTestConnectionOnCheckin(true);

// This check is not required, but here to make it clear that nothing changes for people
// that don't set this configuration property. It may be safely removed.
if(p.getProperty("db.isolation") != null) {
ds.setConnectionCustomizerClassName(play.db.DBPlugin.PlayConnectionCustomizer.class.getName());
}

DB.datasource = ds;
url = ds.getJdbcUrl();
Connection c = null;
Expand Down Expand Up @@ -225,7 +226,7 @@ private static boolean changed() {
}
boolean isJndiDatasource = false;
String datasourceName = p.getProperty("db", "");

if ((isJndiDatasource || datasourceName.startsWith("java:")) && p.getProperty("db.url") == null) {
if (DB.datasource == null) {
return true;
Expand All @@ -252,7 +253,7 @@ private static boolean changed() {
p.put("db.pass", password);
}
}

m = new jregex.Pattern("^postgres:(//)?(({user}[a-zA-Z0-9_]+)(:({pwd}[^@]+))?@)?(({host}[^/]+)/)?({name}[^\\s]+)$").matcher(p.getProperty("db", ""));
if (m.matches()) {
String user = m.group("user");
Expand All @@ -278,7 +279,7 @@ private static boolean changed() {
if ((p.getProperty("db.driver") == null) || (p.getProperty("db.url") == null)) {
return false;
}

if (DB.datasource == null) {
return true;
} else {
Expand Down Expand Up @@ -315,6 +316,13 @@ public static class ProxyDriver implements Driver {
this.driver = d;
}

@Override
public java.util.logging.Logger getParentLogger()
throws SQLFeatureNotSupportedException {
// TODO Auto-generated method stub
return null;
}

public boolean acceptsURL(String u) throws SQLException {
return this.driver.acceptsURL(u);
}
Expand Down

0 comments on commit 9d9145f

Please sign in to comment.