提交 2bf4bab7 编写于 作者: J jurgen

DS config reading fix (skip unrecognized subtrees)

Former-commit-id: 2bb788a2
上级 8dc06105
......@@ -19,6 +19,8 @@
package org.jkiss.utils.xml;
import org.xml.sax.Attributes;
/**
SAX document listener
*/
......@@ -42,4 +44,24 @@ public interface SAXListener {
String localName)
throws XMLException;
/**
* Empty listener supposed to skip element subtrees
*/
public static class EmptyListener implements SAXListener {
@Override
public void saxStartElement(SAXReader reader, String namespaceURI, String localName, Attributes atts) throws XMLException {
}
@Override
public void saxText(SAXReader reader, String data) throws XMLException {
}
@Override
public void saxEndElement(SAXReader reader, String namespaceURI, String localName) throws XMLException {
}
}
public static final SAXListener EMPTY_LISTENER = new EmptyListener();
}
......@@ -27,6 +27,7 @@ import java.util.Map;
* SAX document reader
*/
public final class SAXReader implements org.xml.sax.ContentHandler {
public static final int DEFAULT_POOL_SIZE = 10;
private static javax.xml.parsers.SAXParserFactory saxParserFactory = null;
......
......@@ -28,6 +28,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.resource.StringConverter;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.core.DBeaverCore;
import org.jkiss.dbeaver.core.DBeaverUI;
......@@ -615,6 +616,7 @@ public class DataSourceRegistry implements DBPDataSourceRegistry
if (provider == null) {
log.warn("Can't find datasource provider " + providerId + " for datasource '" + name + "'");
curDataSource = null;
reader.setListener(EMPTY_LISTENER);
return;
}
String driverId = atts.getValue(RegistryConstants.ATTR_DRIVER);
......@@ -720,6 +722,7 @@ public class DataSourceRegistry implements DBPDataSourceRegistry
NetworkHandlerDescriptor handlerDescriptor = DBeaverCore.getInstance().getNetworkHandlerRegistry().getDescriptor(handlerId);
if (handlerDescriptor == null) {
log.warn("Can't find network handler '" + handlerId + "'");
reader.setListener(EMPTY_LISTENER);
return;
}
curNetworkHandler = new DBWHandlerConfiguration(handlerDescriptor, curDataSource.getDriver());
......@@ -786,6 +789,7 @@ public class DataSourceRegistry implements DBPDataSourceRegistry
isDescription = false;
}
@Nullable
private String decryptPassword(String encPassword)
{
if (!CommonUtils.isEmpty(encPassword)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册