Skip to content

Commit da71782

Browse files
authored
Merge pull request #1 from Jacky97s/claude/fix-safety-issues-O6f2h
2 parents b08e836 + e00b70e commit da71782

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

core/src/main/java/org/openapitools/openapidiff/core/output/ConsoleRender.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,9 @@ public String separator(char ch) {
358358
}
359359

360360
static int displayWidth(String text) {
361+
if (text == null) {
362+
return 0;
363+
}
361364
int width = 0;
362365
for (int i = 0; i < text.length(); i++) {
363366
char c = text.charAt(i);
@@ -385,6 +388,9 @@ static boolean isFullWidth(char c) {
385388
}
386389

387390
static String centerCjk(String text, int width) {
391+
if (text == null) {
392+
text = "";
393+
}
388394
int textWidth = displayWidth(text);
389395
if (textWidth >= width) {
390396
return text;

core/src/main/java/org/openapitools/openapidiff/core/output/I18n.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
public final class I18n {
1212

1313
private static final String BUNDLE_NAME = "i18n.messages";
14-
private static Locale currentLocale = Locale.ENGLISH;
15-
private static ResourceBundle bundle = loadBundle(currentLocale);
14+
private static volatile Locale currentLocale = Locale.ENGLISH;
15+
private static volatile ResourceBundle bundle = loadBundle(currentLocale);
1616

1717
private I18n() {}
1818

19-
public static void setLocale(Locale locale) {
20-
currentLocale = locale;
19+
public static synchronized void setLocale(Locale locale) {
2120
bundle = loadBundle(locale);
21+
currentLocale = locale;
2222
}
2323

2424
public static Locale getLocale() {

0 commit comments

Comments
 (0)