Skip to content

Commit ffb06c0

Browse files
committed
Generalization tweaks. Still need to go in an excise references to VIVOTagLib data sources.
1 parent 8c50c9a commit ffb06c0

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

src/main/java/edu/uiowa/slis/graphtaglib/SiteIDIterator.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,19 @@ synchronized void init() throws NamingException, SQLException {
3636
if (siteHash != null)
3737
return;
3838
siteHash = new Hashtable<Integer, String>();
39-
DataSource theDataSource = (DataSource) new InitialContext().lookup("java:/comp/env/jdbc/VIVOTagLib");
40-
Connection conn = theDataSource.getConnection();
41-
PreparedStatement stmt = conn.prepareStatement("select id,site from vivo_aggregated.site order by id");
42-
ResultSet rs = stmt.executeQuery();
43-
while (rs.next()) {
44-
siteHash.put(rs.getInt(1), rs.getString(2));
39+
try {
40+
DataSource theDataSource = (DataSource) new InitialContext().lookup("java:/comp/env/jdbc/VIVOTagLib");
41+
Connection conn = theDataSource.getConnection();
42+
PreparedStatement stmt = conn.prepareStatement("select id,site from vivo_aggregated.site order by id");
43+
ResultSet rs = stmt.executeQuery();
44+
while (rs.next()) {
45+
siteHash.put(rs.getInt(1), rs.getString(2));
46+
}
47+
stmt.close();
48+
conn.close();
49+
} catch (javax.naming.NameNotFoundException e) {
50+
logger.error("SiteIDIterator dataSource lookup failed");
4551
}
46-
stmt.close();
47-
conn.close();
4852
}
4953

5054
public int doStartTag() throws JspException {

src/main/java/edu/uiowa/slis/graphtaglib/filters/EdgeLookup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public int doStartTag() throws JspException {
2828
try {
2929
this.cls = Class.forName(this.edgeLocator);
3030
Constructor<?> con = this.cls.getConstructor(String.class);
31-
this.edgeGen = (EdgePopulator) con.newInstance("java:/comp/env/jdbc/VIVOTagLib");
31+
this.edgeGen = (EdgePopulator) con.newInstance(dataSource);
3232
} catch (Exception e) {
3333
e.printStackTrace();
3434
}

0 commit comments

Comments
 (0)