提交 990ce638 编写于 作者: S Serge Rider

DBUtils fix


Former-commit-id: e925d1c9
上级 4fd9989a
......@@ -634,20 +634,20 @@ public class GeneralUtils {
return null;
}
if (adapter.isInstance(sourceObject)) {
return (T) sourceObject;
return adapter.cast(sourceObject);
}
if (sourceObject instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) sourceObject;
Object result = adaptable.getAdapter(adapter);
T result = adaptable.getAdapter(adapter);
if (result != null) {
// Sanity-check
if (!adapter.isInstance(result)) {
throw new AssertionFailedException(adaptable.getClass().getName() + ".getAdapter(" + adapter.getName() + ".class) returned " //$NON-NLS-1$//$NON-NLS-2$
+ result.getClass().getName() + " that is not an instance the requested type"); //$NON-NLS-1$
}
return (T) result;
return result;
}
}
......@@ -676,7 +676,7 @@ public class GeneralUtils {
return adapt(sourceObject, adapter, true);
}
private static Object queryAdapterManager(Object sourceObject, String adapterId, boolean allowActivation) {
public static Object queryAdapterManager(Object sourceObject, String adapterId, boolean allowActivation) {
Object result;
if (allowActivation) {
result = AdapterManager.getDefault().loadAdapter(sourceObject, adapterId);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册