Skip to content

Commit 8b1280d

Browse files
committed
Checkstyle fix
1 parent ed96b0f commit 8b1280d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

ui/jetbrains/src/main/java/com/neueda/jetbrains/plugin/graphdb/jetbrains/ui/datasource/interactions/DataSourceDialog.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ private void connectionFailed(
117117
JComponent contentPanel) {
118118
hideLoading();
119119

120-
JLabel connectionFailed = new JLabel("Connection failed: " + truncateString(exception.getMessage(), SHORT_STRING_LENGTH), AllIcons.Process.State.RedExcl, JLabel.LEFT);
120+
JLabel connectionFailed = new JLabel("Connection failed: " +
121+
truncateString(exception.getMessage(), SHORT_STRING_LENGTH), AllIcons.Process.State.RedExcl, JLabel.LEFT);
121122

122123
JTextArea exceptionCauses = new JTextArea();
123124
exceptionCauses.setLineWrap(false);

ui/jetbrains/src/main/java/com/neueda/jetbrains/plugin/graphdb/jetbrains/util/ExceptionWrapper.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,28 @@
33
import org.apache.commons.lang.WordUtils;
44

55
public class ExceptionWrapper {
6-
private final static String NON_THIN_CHARS = "[^iIl1\\.,']";
7-
public final static int SHORT_STRING_LENGTH = 140;
6+
public static final int SHORT_STRING_LENGTH = 140;
7+
private static final String NON_THIN_CHARS = "[^iIl1\\.,']";
88

99
private static int textWidth(String str) {
1010
return str.length() - str.replaceAll(NON_THIN_CHARS, "").length() / 2;
1111
}
1212

1313
public static String truncateString(String text, int targetLength) {
14-
if (textWidth(text) <= targetLength)
14+
if (textWidth(text) <= targetLength) {
1515
return text;
16+
}
1617
int end = text.lastIndexOf(' ', targetLength - 3);
17-
if (end == -1)
18+
if (end == -1) {
1819
return text.substring(0, targetLength - 3) + "...";
20+
}
1921
int newEnd = end;
2022
do {
2123
end = newEnd;
2224
newEnd = text.indexOf(' ', end + 1);
23-
if (newEnd == -1)
25+
if (newEnd == -1) {
2426
newEnd = text.length();
27+
}
2528

2629
} while (textWidth(text.substring(0, newEnd) + "...") < targetLength);
2730

0 commit comments

Comments
 (0)