Skip to content

Commit 950ae1f

Browse files
some methods of ExcelConnection no longer throw unsupported operation exception
1 parent 58126a5 commit 950ae1f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/com/inet/excel/ExcelConnection.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ public void setReadOnly( boolean readOnly ) throws SQLException {
193193
*/
194194
@Override
195195
public boolean isReadOnly() throws SQLException {
196-
ExcelDriver.throwExceptionAboutUnsupportedOperation();
197-
return false;
196+
throwIfAlreadyClosed();
197+
return true;
198198
}
199199

200200
/**
@@ -226,16 +226,16 @@ public void setTransactionIsolation( int level ) throws SQLException {
226226
*/
227227
@Override
228228
public int getTransactionIsolation() throws SQLException {
229-
ExcelDriver.throwExceptionAboutUnsupportedOperation();
230-
return 0;
229+
throwIfAlreadyClosed();
230+
return Connection.TRANSACTION_NONE;
231231
}
232232

233233
/**
234234
* {@inheritDoc}
235235
*/
236236
@Override
237237
public SQLWarning getWarnings() throws SQLException {
238-
ExcelDriver.throwExceptionAboutUnsupportedOperation();
238+
throwIfAlreadyClosed();
239239
return null;
240240
}
241241

@@ -244,7 +244,8 @@ public SQLWarning getWarnings() throws SQLException {
244244
*/
245245
@Override
246246
public void clearWarnings() throws SQLException {
247-
ExcelDriver.throwExceptionAboutUnsupportedOperation();
247+
throwIfAlreadyClosed();
248+
// nothing to do
248249
}
249250

250251
/**
@@ -437,8 +438,7 @@ public SQLXML createSQLXML() throws SQLException {
437438
*/
438439
@Override
439440
public boolean isValid( int timeout ) throws SQLException {
440-
ExcelDriver.throwExceptionAboutUnsupportedOperation();
441-
return false;
441+
return !isClosed();
442442
}
443443

444444
/**
@@ -506,6 +506,7 @@ public void setSchema( String schema ) throws SQLException {
506506
*/
507507
@Override
508508
public String getSchema() throws SQLException {
509+
throwIfAlreadyClosed();
509510
return null;
510511
}
511512

@@ -530,7 +531,7 @@ public void setNetworkTimeout( Executor executor, int milliseconds ) throws SQLE
530531
*/
531532
@Override
532533
public int getNetworkTimeout() throws SQLException {
533-
ExcelDriver.throwExceptionAboutUnsupportedOperation();
534+
throwIfAlreadyClosed();
534535
return 0;
535536
}
536537

0 commit comments

Comments
 (0)