mirror of https://github.com/apache/lucene.git
SOLR-1245 DIH eats up SQL exception
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@788252 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e340bce86d
commit
57a2a11ac8
|
@ -17,6 +17,8 @@
|
|||
package org.apache.solr.handler.dataimport;
|
||||
|
||||
import org.apache.solr.common.SolrException;
|
||||
import static org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow;
|
||||
import static org.apache.solr.handler.dataimport.DataImportHandlerException.SEVERE;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -101,7 +103,7 @@ public class JdbcDataSource extends
|
|||
final String driver = initProps.getProperty(DRIVER);
|
||||
|
||||
if (url == null && jndiName == null)
|
||||
throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
|
||||
throw new DataImportHandlerException(SEVERE,
|
||||
"JDBC URL or JNDI name has to be specified");
|
||||
|
||||
if (driver != null) {
|
||||
|
@ -146,7 +148,7 @@ public class JdbcDataSource extends
|
|||
c = dataSource.getConnection(user, pass);
|
||||
}
|
||||
} else {
|
||||
throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
|
||||
throw new DataImportHandlerException(SEVERE,
|
||||
"the jndi name : '"+jndiName +"' is not a valid javax.sql.DataSource");
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +247,7 @@ public class JdbcDataSource extends
|
|||
+ (System.currentTimeMillis() - start));
|
||||
colNames = readFieldNames(resultSet.getMetaData());
|
||||
} catch (Exception e) {
|
||||
throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
|
||||
throw new DataImportHandlerException(SEVERE,
|
||||
"Unable to execute query: " + query, e);
|
||||
}
|
||||
if (resultSet == null) {
|
||||
|
@ -332,6 +334,7 @@ public class JdbcDataSource extends
|
|||
} catch (SQLException e) {
|
||||
logError("Error reading data ", e);
|
||||
close();
|
||||
wrapAndThrow(SEVERE,e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue