java-commons-dbcp-fix-abstract.patch
1 | From d233bf30337e3a48074839dd256bca000277c57d Mon Sep 17 00:00:00 2001 |
2 | From: Julien Lepiller <julien@lepiller.eu> |
3 | Date: Tue, 15 Aug 2017 22:55:38 +0200 |
4 | Subject: [PATCH] Fix abstract methods |
5 | |
6 | --- |
7 | .../org/apache/commons/dbcp/BasicDataSource.java | 7 +++ |
8 | .../apache/commons/dbcp/DelegatingConnection.java | 59 ++++++++++++++++++ |
9 | .../commons/dbcp/DelegatingDatabaseMetaData.java | 12 ++++ |
10 | .../apache/commons/dbcp/DelegatingResultSet.java | 27 ++++++++ |
11 | .../apache/commons/dbcp/DelegatingStatement.java | 21 +++++++ |
12 | .../commons/dbcp/PoolableCallableStatement.java | 26 ++++++++ |
13 | .../org/apache/commons/dbcp/PoolingConnection.java | 72 ++++++++++++++++++++++ |
14 | .../org/apache/commons/dbcp/PoolingDataSource.java | 7 +++ |
15 | .../org/apache/commons/dbcp/PoolingDriver.java | 7 +++ |
16 | .../dbcp/cpdsadapter/DriverAdapterCPDS.java | 7 +++ |
17 | .../dbcp/datasources/PerUserPoolDataSource.java | 7 +++ |
18 | .../dbcp/datasources/SharedPoolDataSource.java | 7 +++ |
19 | 12 files changed, 259 insertions(+) |
20 | |
21 | diff --git a/src/java/org/apache/commons/dbcp/BasicDataSource.java b/src/java/org/apache/commons/dbcp/BasicDataSource.java |
22 | index 2688fd8..8fcf2d4 100644 |
23 | --- a/src/java/org/apache/commons/dbcp/BasicDataSource.java |
24 | +++ b/src/java/org/apache/commons/dbcp/BasicDataSource.java |
25 | @@ -24,10 +24,12 @@ import java.util.List; |
26 | import java.util.ArrayList; |
27 | import java.util.Iterator; |
28 | import java.util.Collections; |
29 | +import java.util.logging.Logger; |
30 | import java.sql.Connection; |
31 | import java.sql.Driver; |
32 | import java.sql.DriverManager; |
33 | import java.sql.SQLException; |
34 | +import java.sql.SQLFeatureNotSupportedException; |
35 | import javax.sql.DataSource; |
36 | |
37 | import org.apache.commons.pool.KeyedObjectPoolFactory; |
38 | @@ -1579,4 +1581,9 @@ public class BasicDataSource implements DataSource { |
39 | logWriter.println(message); |
40 | } |
41 | } |
42 | + |
43 | + @Override |
44 | + public Logger getParentLogger() throws SQLFeatureNotSupportedException { |
45 | + throw new SQLFeatureNotSupportedException(); |
46 | + } |
47 | } |
48 | diff --git a/src/java/org/apache/commons/dbcp/DelegatingConnection.java b/src/java/org/apache/commons/dbcp/DelegatingConnection.java |
49 | index 93cff0e..75f5c62 100644 |
50 | --- a/src/java/org/apache/commons/dbcp/DelegatingConnection.java |
51 | +++ b/src/java/org/apache/commons/dbcp/DelegatingConnection.java |
52 | @@ -39,6 +39,7 @@ import java.sql.SQLXML; |
53 | import java.sql.Struct; |
54 | import java.util.Collections; |
55 | import java.util.Properties; |
56 | +import java.util.concurrent.Executor; |
57 | /* JDBC_4_ANT_KEY_END */ |
58 | |
59 | /** |
60 | @@ -679,4 +680,62 @@ public class DelegatingConnection extends AbandonedTrace |
61 | } |
62 | } |
63 | /* JDBC_4_ANT_KEY_END */ |
64 | + |
65 | + @Override |
66 | + public void setSchema(String schema) throws SQLException { |
67 | + checkOpen(); |
68 | + try { |
69 | + _conn.setSchema(schema); |
70 | + } |
71 | + catch (SQLException e) { |
72 | + handleException(e); |
73 | + } |
74 | + } |
75 | + |
76 | + @Override |
77 | + public String getSchema() throws SQLException { |
78 | + checkOpen(); |
79 | + try { |
80 | + return _conn.getSchema(); |
81 | + } |
82 | + catch (SQLException e) { |
83 | + handleException(e); |
84 | + return null; |
85 | + } |
86 | + } |
87 | + |
88 | + @Override |
89 | + public void abort(Executor executor) throws SQLException { |
90 | + checkOpen(); |
91 | + try { |
92 | + _conn.abort(executor); |
93 | + } |
94 | + catch (SQLException e) { |
95 | + handleException(e); |
96 | + } |
97 | + } |
98 | + |
99 | + @Override |
100 | + public void setNetworkTimeout(Executor executor, int milliseconds) |
101 | + throws SQLException { |
102 | + checkOpen(); |
103 | + try { |
104 | + _conn.setNetworkTimeout(executor, milliseconds); |
105 | + } |
106 | + catch (SQLException e) { |
107 | + handleException(e); |
108 | + } |
109 | + } |
110 | + |
111 | + @Override |
112 | + public int getNetworkTimeout() throws SQLException { |
113 | + checkOpen(); |
114 | + try { |
115 | + return _conn.getNetworkTimeout(); |
116 | + } |
117 | + catch (SQLException e) { |
118 | + handleException(e); |
119 | + return 0; |
120 | + } |
121 | + } |
122 | } |
123 | diff --git a/src/java/org/apache/commons/dbcp/DelegatingDatabaseMetaData.java b/src/java/org/apache/commons/dbcp/DelegatingDatabaseMetaData.java |
124 | index df88046..22ba48c 100644 |
125 | --- a/src/java/org/apache/commons/dbcp/DelegatingDatabaseMetaData.java |
126 | +++ b/src/java/org/apache/commons/dbcp/DelegatingDatabaseMetaData.java |
127 | @@ -1208,4 +1208,16 @@ public class DelegatingDatabaseMetaData extends AbandonedTrace |
128 | |
129 | /* JDBC_4_ANT_KEY_END */ |
130 | |
131 | + @Override |
132 | + public boolean generatedKeyAlwaysReturned() throws SQLException { |
133 | + _conn.checkOpen(); |
134 | + try { |
135 | + return _meta.generatedKeyAlwaysReturned(); |
136 | + } |
137 | + catch (SQLException e) { |
138 | + handleException(e); |
139 | + return false; |
140 | + } |
141 | + } |
142 | + |
143 | } |
144 | diff --git a/src/java/org/apache/commons/dbcp/DelegatingResultSet.java b/src/java/org/apache/commons/dbcp/DelegatingResultSet.java |
145 | index f77328f..a0bd6bc 100644 |
146 | --- a/src/java/org/apache/commons/dbcp/DelegatingResultSet.java |
147 | +++ b/src/java/org/apache/commons/dbcp/DelegatingResultSet.java |
148 | @@ -34,6 +34,7 @@ import java.sql.Ref; |
149 | import java.sql.Blob; |
150 | import java.sql.Clob; |
151 | import java.sql.Array; |
152 | +import java.sql.CallableStatement; |
153 | import java.util.Calendar; |
154 | /* JDBC_4_ANT_KEY_BEGIN */ |
155 | import java.sql.NClob; |
156 | @@ -1078,5 +1079,31 @@ public class DelegatingResultSet extends AbandonedTrace implements ResultSet { |
157 | handleException(e); |
158 | } |
159 | } |
160 | + |
161 | + @Override |
162 | + public <T> T getObject(int parameterIndex, Class<T> type) |
163 | + throws SQLException { |
164 | + checkOpen(); |
165 | + try { |
166 | + return ((CallableStatement)getDelegate()).getObject(parameterIndex, type); |
167 | +} |
168 | + catch (SQLException e) { |
169 | + handleException(e); |
170 | + return null; |
171 | + } |
172 | + } |
173 | + |
174 | + @Override |
175 | + public <T> T getObject(String parameterName, Class<T> type) |
176 | + throws SQLException { |
177 | + checkOpen(); |
178 | + try { |
179 | + return ((CallableStatement)getDelegate()).getObject(parameterName, type); |
180 | + } |
181 | + catch (SQLException e) { |
182 | + handleException(e); |
183 | + return null; |
184 | + } |
185 | + } |
186 | /* JDBC_4_ANT_KEY_END */ |
187 | } |
188 | diff --git a/src/java/org/apache/commons/dbcp/DelegatingStatement.java b/src/java/org/apache/commons/dbcp/DelegatingStatement.java |
189 | index d944c6a..eb765ed 100644 |
190 | --- a/src/java/org/apache/commons/dbcp/DelegatingStatement.java |
191 | +++ b/src/java/org/apache/commons/dbcp/DelegatingStatement.java |
192 | @@ -349,6 +349,27 @@ public class DelegatingStatement extends AbandonedTrace implements Statement { |
193 | return _closed; |
194 | } |
195 | |
196 | + @Override |
197 | + public void closeOnCompletion() throws SQLException { |
198 | + checkOpen(); |
199 | + try { |
200 | + _stmt.closeOnCompletion(); |
201 | + } catch(SQLException e) { |
202 | + handleException(e); |
203 | + } |
204 | + } |
205 | + |
206 | + @Override |
207 | + public boolean isCloseOnCompletion() throws SQLException { |
208 | + checkOpen(); |
209 | + try { |
210 | + _stmt.closeOnCompletion(); |
211 | + } catch(SQLException e) { |
212 | + handleException(e); |
213 | + return false; |
214 | + } |
215 | + } |
216 | + |
217 | /* JDBC_4_ANT_KEY_BEGIN */ |
218 | |
219 | public boolean isWrapperFor(Class<?> iface) throws SQLException { |
220 | diff --git a/src/java/org/apache/commons/dbcp/PoolableCallableStatement.java b/src/java/org/apache/commons/dbcp/PoolableCallableStatement.java |
221 | index 108a7f5..1afadf1 100644 |
222 | --- a/src/java/org/apache/commons/dbcp/PoolableCallableStatement.java |
223 | +++ b/src/java/org/apache/commons/dbcp/PoolableCallableStatement.java |
224 | @@ -123,4 +123,30 @@ public class PoolableCallableStatement extends DelegatingCallableStatement imple |
225 | super.passivate(); |
226 | } |
227 | |
228 | + @Override |
229 | + public <T> T getObject(int parameterIndex, Class<T> type) |
230 | + throws SQLException { |
231 | + checkOpen(); |
232 | + try { |
233 | + return ((CallableStatement)getDelegate()).getObject(parameterIndex, type); |
234 | +} |
235 | + catch (SQLException e) { |
236 | + handleException(e); |
237 | + return null; |
238 | + } |
239 | + } |
240 | + |
241 | + @Override |
242 | + public <T> T getObject(String parameterName, Class<T> type) |
243 | + throws SQLException { |
244 | + checkOpen(); |
245 | + try { |
246 | + return ((CallableStatement)getDelegate()).getObject(parameterName, type); |
247 | + } |
248 | + catch (SQLException e) { |
249 | + handleException(e); |
250 | + return null; |
251 | + } |
252 | + } |
253 | + |
254 | } |
255 | diff --git a/src/java/org/apache/commons/dbcp/PoolingConnection.java b/src/java/org/apache/commons/dbcp/PoolingConnection.java |
256 | index 04f4519..0d49d4a 100644 |
257 | --- a/src/java/org/apache/commons/dbcp/PoolingConnection.java |
258 | +++ b/src/java/org/apache/commons/dbcp/PoolingConnection.java |
259 | @@ -26,6 +26,7 @@ import java.util.NoSuchElementException; |
260 | |
261 | import org.apache.commons.pool.KeyedObjectPool; |
262 | import org.apache.commons.pool.KeyedPoolableObjectFactory; |
263 | +import java.util.concurrent.Executor; |
264 | |
265 | /** |
266 | * A {@link DelegatingConnection} that pools {@link PreparedStatement}s. |
267 | @@ -455,4 +456,75 @@ public class PoolingConnection extends DelegatingConnection implements Connectio |
268 | return buf.toString(); |
269 | } |
270 | } |
271 | + |
272 | + @Override |
273 | + public String getClientInfo(String name) throws SQLException { |
274 | + checkOpen(); |
275 | + try { |
276 | + return _conn.getClientInfo(name); |
277 | + } |
278 | + catch (SQLException e) { |
279 | + handleException(e); |
280 | + return null; |
281 | + } |
282 | + } |
283 | + |
284 | + @Override |
285 | + public void setSchema(String schema) throws SQLException { |
286 | + checkOpen(); |
287 | + try { |
288 | + _conn.setSchema(schema); |
289 | + } |
290 | + catch (SQLException e) { |
291 | + handleException(e); |
292 | + } |
293 | + } |
294 | + |
295 | + @Override |
296 | + public String getSchema() throws SQLException { |
297 | + checkOpen(); |
298 | + try { |
299 | + return _conn.getSchema(); |
300 | + } |
301 | + catch (SQLException e) { |
302 | + handleException(e); |
303 | + return null; |
304 | + } |
305 | + } |
306 | + |
307 | + @Override |
308 | + public void abort(Executor executor) throws SQLException { |
309 | + checkOpen(); |
310 | + try { |
311 | + _conn.abort(executor); |
312 | + } |
313 | + catch (SQLException e) { |
314 | + handleException(e); |
315 | + } |
316 | + } |
317 | + |
318 | + @Override |
319 | + public void setNetworkTimeout(Executor executor, int milliseconds) |
320 | + throws SQLException { |
321 | + checkOpen(); |
322 | + try { |
323 | + _conn.setNetworkTimeout(executor, milliseconds); |
324 | + } |
325 | + catch (SQLException e) { |
326 | + handleException(e); |
327 | + } |
328 | + } |
329 | + |
330 | + |
331 | + @Override |
332 | + public int getNetworkTimeout() throws SQLException { |
333 | + checkOpen(); |
334 | + try { |
335 | + return _conn.getNetworkTimeout(); |
336 | + } |
337 | + catch (SQLException e) { |
338 | + handleException(e); |
339 | + return 0; |
340 | + } |
341 | + } |
342 | } |
343 | diff --git a/src/java/org/apache/commons/dbcp/PoolingDataSource.java b/src/java/org/apache/commons/dbcp/PoolingDataSource.java |
344 | index 122a7e6..80381be 100644 |
345 | --- a/src/java/org/apache/commons/dbcp/PoolingDataSource.java |
346 | +++ b/src/java/org/apache/commons/dbcp/PoolingDataSource.java |
347 | @@ -23,8 +23,10 @@ import java.sql.Connection; |
348 | import java.sql.DatabaseMetaData; |
349 | import java.sql.PreparedStatement; |
350 | import java.sql.SQLException; |
351 | +import java.sql.SQLFeatureNotSupportedException; |
352 | import java.sql.SQLWarning; |
353 | import java.sql.Statement; |
354 | +import java.util.logging.Logger; |
355 | import java.util.Map; |
356 | import java.util.NoSuchElementException; |
357 | |
358 | @@ -167,6 +169,11 @@ public class PoolingDataSource implements DataSource { |
359 | |
360 | protected ObjectPool _pool = null; |
361 | |
362 | + @Override |
363 | + public Logger getParentLogger() throws SQLFeatureNotSupportedException { |
364 | + throw new SQLFeatureNotSupportedException(); |
365 | + } |
366 | + |
367 | /** |
368 | * PoolGuardConnectionWrapper is a Connection wrapper that makes sure a |
369 | * closed connection cannot be used anymore. |
370 | diff --git a/src/java/org/apache/commons/dbcp/PoolingDriver.java b/src/java/org/apache/commons/dbcp/PoolingDriver.java |
371 | index 4c82b02..b146d83 100644 |
372 | --- a/src/java/org/apache/commons/dbcp/PoolingDriver.java |
373 | +++ b/src/java/org/apache/commons/dbcp/PoolingDriver.java |
374 | @@ -27,8 +27,10 @@ import java.sql.DriverManager; |
375 | import java.sql.DriverPropertyInfo; |
376 | import java.sql.PreparedStatement; |
377 | import java.sql.SQLException; |
378 | +import java.sql.SQLFeatureNotSupportedException; |
379 | import java.sql.SQLWarning; |
380 | import java.sql.Statement; |
381 | +import java.util.logging.Logger; |
382 | import java.util.HashMap; |
383 | import java.util.Map; |
384 | import java.util.NoSuchElementException; |
385 | @@ -496,4 +498,9 @@ public class PoolingDriver implements Driver { |
386 | } |
387 | } |
388 | } |
389 | + |
390 | + @Override |
391 | + public Logger getParentLogger() throws SQLFeatureNotSupportedException { |
392 | + throw new SQLFeatureNotSupportedException(); |
393 | + } |
394 | } |
395 | diff --git a/src/java/org/apache/commons/dbcp/cpdsadapter/DriverAdapterCPDS.java b/src/java/org/apache/commons/dbcp/cpdsadapter/DriverAdapterCPDS.java |
396 | index 21087ed..0ff331e 100644 |
397 | --- a/src/java/org/apache/commons/dbcp/cpdsadapter/DriverAdapterCPDS.java |
398 | +++ b/src/java/org/apache/commons/dbcp/cpdsadapter/DriverAdapterCPDS.java |
399 | @@ -19,10 +19,12 @@ package org.apache.commons.dbcp.cpdsadapter; |
400 | |
401 | import java.util.Hashtable; |
402 | import java.util.Properties; |
403 | +import java.util.logging.Logger; |
404 | import java.io.PrintWriter; |
405 | import java.io.Serializable; |
406 | import java.sql.DriverManager; |
407 | import java.sql.SQLException; |
408 | +import java.sql.SQLFeatureNotSupportedException; |
409 | import javax.sql.PooledConnection; |
410 | import javax.sql.ConnectionPoolDataSource; |
411 | import javax.naming.Name; |
412 | @@ -719,4 +721,9 @@ public class DriverAdapterCPDS |
413 | { |
414 | _maxPreparedStatements = maxPreparedStatements; |
415 | } |
416 | + |
417 | + @Override |
418 | + public Logger getParentLogger() throws SQLFeatureNotSupportedException { |
419 | + throw new SQLFeatureNotSupportedException(); |
420 | + } |
421 | } |
422 | diff --git a/src/java/org/apache/commons/dbcp/datasources/PerUserPoolDataSource.java b/src/java/org/apache/commons/dbcp/datasources/PerUserPoolDataSource.java |
423 | index 9638953..9af4298 100644 |
424 | --- a/src/java/org/apache/commons/dbcp/datasources/PerUserPoolDataSource.java |
425 | +++ b/src/java/org/apache/commons/dbcp/datasources/PerUserPoolDataSource.java |
426 | @@ -21,10 +21,12 @@ import java.io.IOException; |
427 | import java.io.ObjectInputStream; |
428 | import java.sql.Connection; |
429 | import java.sql.SQLException; |
430 | +import java.sql.SQLFeatureNotSupportedException; |
431 | import java.util.HashMap; |
432 | import java.util.Iterator; |
433 | import java.util.Map; |
434 | import java.util.NoSuchElementException; |
435 | +import java.util.logging.Logger; |
436 | |
437 | import javax.naming.NamingException; |
438 | import javax.naming.Reference; |
439 | @@ -561,4 +563,9 @@ public class PerUserPoolDataSource |
440 | CPDSConnectionFactory mgr = (CPDSConnectionFactory) managers.get(key); |
441 | return mgr == null ? null : (GenericObjectPool) mgr.getPool(); |
442 | } |
443 | + |
444 | + @Override |
445 | + public Logger getParentLogger() throws SQLFeatureNotSupportedException { |
446 | + throw new SQLFeatureNotSupportedException(); |
447 | + } |
448 | } |
449 | diff --git a/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java b/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java |
450 | index e4bd04e..48c6d93 100644 |
451 | --- a/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java |
452 | +++ b/src/java/org/apache/commons/dbcp/datasources/SharedPoolDataSource.java |
453 | @@ -21,6 +21,8 @@ import java.io.IOException; |
454 | import java.io.ObjectInputStream; |
455 | import java.sql.Connection; |
456 | import java.sql.SQLException; |
457 | +import java.sql.SQLFeatureNotSupportedException; |
458 | +import java.util.logging.Logger; |
459 | |
460 | import javax.naming.NamingException; |
461 | import javax.naming.Reference; |
462 | @@ -269,5 +271,10 @@ public class SharedPoolDataSource |
463 | throw new IOException("NamingException: " + e); |
464 | } |
465 | } |
466 | + |
467 | + @Override |
468 | + public Logger getParentLogger() throws SQLFeatureNotSupportedException { |
469 | + throw new SQLFeatureNotSupportedException(); |
470 | + } |
471 | } |
472 | |
473 | -- |
474 | 2.13.4 |
475 | |
476 |