|
|
|
@ -22,6 +22,7 @@ import com.fr.design.i18n.Toolkit;
|
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
import com.fr.file.ConnectionService; |
|
|
|
|
import com.fr.license.exception.DataBaseNotSupportedException; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.rpc.ExceptionHandler; |
|
|
|
|
import com.fr.rpc.RPCInvokerExceptionInfo; |
|
|
|
@ -29,6 +30,8 @@ import com.fr.stable.ArrayUtils;
|
|
|
|
|
import com.fr.stable.EncodeConstants; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
import com.fr.workspace.rpc.exception.ServerInvokeException; |
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.BoxLayout; |
|
|
|
@ -475,7 +478,8 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
|
|
|
|
|
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); |
|
|
|
|
message.setText(Toolkit.i18nText("Fine-Design_Basic_Connection_Failed")); |
|
|
|
|
Connection database = DatabaseConnectionPane.this.updateBean(); |
|
|
|
|
SolutionProcessor select = ExceptionSolutionSelector.get().select(e, database); |
|
|
|
|
Throwable throwable = catchThrowable(e); |
|
|
|
|
SolutionProcessor select = ExceptionSolutionSelector.get().select(throwable, database); |
|
|
|
|
String detail = select.getResultException().getDetailMessage(); |
|
|
|
|
String solution = select.getResultException().getSolution(); |
|
|
|
|
if (select instanceof ClassNotFoundExceptionSolutionProcessor) { |
|
|
|
@ -486,6 +490,31 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
|
|
|
|
|
okButton.setEnabled(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 兼容一下 json 序列化后的异常逻辑,如果发现是 {@link ServerInvokeException} |
|
|
|
|
* 则尝试转化为对应的异常,然后传递下去。 |
|
|
|
|
* 否则还是返回原异常 |
|
|
|
|
* |
|
|
|
|
* @param e 异常 |
|
|
|
|
* @return 异常 |
|
|
|
|
*/ |
|
|
|
|
@NotNull |
|
|
|
|
private Throwable catchThrowable(ExecutionException e) { |
|
|
|
|
|
|
|
|
|
Throwable rootEx = e; |
|
|
|
|
while (rootEx.getCause() != null) { |
|
|
|
|
rootEx = rootEx.getCause(); |
|
|
|
|
} |
|
|
|
|
if (rootEx instanceof ServerInvokeException) { |
|
|
|
|
// 异常兼容处理
|
|
|
|
|
String errorCode = ((ServerInvokeException) rootEx).getErrorCode(); |
|
|
|
|
if (DataBaseNotSupportedException.DB_UNSUPPORTED_ERROR_CODE.equals(errorCode)) { |
|
|
|
|
return new DataBaseNotSupportedException(rootEx.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return e; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showClassNotFoundUI(String detailMessage, String solution) { |
|
|
|
|
JPanel gridJpanel = new JPanel(); |
|
|
|
|
gridJpanel.setLayout(new GridLayout(5, 1, 0, 5)); |
|
|
|
|