Skip to content

Commit

Permalink
fixup! fixup! Too big error message JabRef#4827 (updating controlsfx,…
Browse files Browse the repository at this point in the history
… setting maxWidth and reverting off the temporary fix)
  • Loading branch information
dpolishc committed May 18, 2019
1 parent 09564f5 commit d0f93bf
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 83 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ dependencies {
compile 'com.jfoenix:jfoenix:8.0.8'

// Cannot be updated to 9.*.* until Jabref works with Java 9
compile 'org.controlsfx:controlsfx:8.40.15-SNAPSHOT'
compile 'org.controlsfx:controlsfx:8.40.16-SNAPSHOT'

compile 'org.jsoup:jsoup:1.11.3'
compile 'com.mashape.unirest:unirest-java:1.4.9'
Expand Down
45 changes: 19 additions & 26 deletions src/main/java/org/jabref/gui/JabRefDialogService.java
Original file line number Diff line number Diff line change
@@ -1,51 +1,43 @@
package org.jabref.gui;

import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import com.jfoenix.controls.JFXSnackbar;
import com.jfoenix.controls.JFXSnackbar.SnackbarEvent;
import com.jfoenix.controls.JFXSnackbarLayout;
import javafx.concurrent.Task;
import javafx.print.PrinterJob;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceDialog;
import javafx.scene.control.DialogPane;
import javafx.scene.control.TextInputDialog;
import javafx.scene.control.*;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import javafx.stage.Window;
import javafx.util.Duration;

import org.controlsfx.dialog.ExceptionDialog;
import org.controlsfx.dialog.ProgressDialog;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.util.DirectoryDialogConfiguration;
import org.jabref.gui.util.FileDialogConfiguration;
import org.jabref.gui.util.ZipFileChooser;
import org.jabref.logic.l10n.Localization;

import com.jfoenix.controls.JFXSnackbar;
import com.jfoenix.controls.JFXSnackbar.SnackbarEvent;
import com.jfoenix.controls.JFXSnackbarLayout;
import org.controlsfx.dialog.ExceptionDialog;
import org.controlsfx.dialog.ProgressDialog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;

/**
* This class provides methods to create default
* JavaFX dialogs which will also work on top of Swing
Expand Down Expand Up @@ -165,6 +157,7 @@ public void showErrorDialogAndWait(String title, String content) {
@Override
public void showErrorDialogAndWait(String message, Throwable exception) {
ExceptionDialog exceptionDialog = new ExceptionDialog(exception);
exceptionDialog.getDialogPane().setMaxWidth(mainWindow.getWidth() / 2);
exceptionDialog.setHeaderText(message);
exceptionDialog.showAndWait();
}
Expand Down
17 changes: 7 additions & 10 deletions src/main/java/org/jabref/logic/shared/DBMSConnection.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
package org.jabref.logic.shared;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.Set;

import org.jabref.logic.l10n.Localization;
import org.jabref.logic.shared.exception.InvalidDBMSConnectionPropertiesException;
import org.jabref.logic.util.strings.StringFormatter;
import org.jabref.model.database.shared.DBMSType;
import org.jabref.model.database.shared.DatabaseConnection;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.Set;

public class DBMSConnection implements DatabaseConnection {

private static final Logger LOGGER = LoggerFactory.getLogger(DBMSConnection.class);
Expand All @@ -40,8 +38,7 @@ public DBMSConnection(DBMSConnectionProperties connectionProperties) throws SQLE
// Some systems like PostgreSQL retrieves 0 to every exception.
// Therefore a stable error determination is not possible.
LOGGER.error("Could not connect to database: " + e.getMessage() + " - Error code: " + e.getErrorCode());
String formattedErrorMessage = new StringFormatter().formatErrorMessage(e);
throw new SQLException(formattedErrorMessage, e);
throw e;
}
}

Expand Down
18 changes: 0 additions & 18 deletions src/main/java/org/jabref/logic/util/strings/StringFormatter.java

This file was deleted.

This file was deleted.

0 comments on commit d0f93bf

Please sign in to comment.