Skip to content

Commit f9c8aa4

Browse files
committed
fix .ConcurrentModificationException
1 parent 584732e commit f9c8aa4

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

src/main/java/org/maxgamer/quickshop/localization/text/TextMapper.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* This file is a part of project QuickShop, the name is TextMapper.java
3+
* Copyright (C) PotatoCraft Studio and contributors
4+
*
5+
* This program is free software: you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License as published by the
7+
* Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful, but WITHOUT
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13+
* for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*
18+
*/
19+
120
package org.maxgamer.quickshop.localization.text;
221

322
import com.dumptruckman.bukkit.configuration.json.JsonConfiguration;
@@ -7,10 +26,11 @@
726
import java.util.Collections;
827
import java.util.HashMap;
928
import java.util.Map;
29+
import java.util.concurrent.ConcurrentHashMap;
1030

1131
public class TextMapper {
12-
private final Map<String, Map<String, JsonConfiguration>> locale2ContentMapping = new HashMap<>();
13-
private final Map<String, JsonConfiguration> bundledFile2ContentMapping = new HashMap<>();
32+
private final Map<String, Map<String, JsonConfiguration>> locale2ContentMapping = new ConcurrentHashMap<>();
33+
private final Map<String, JsonConfiguration> bundledFile2ContentMapping = new ConcurrentHashMap<>();
1434

1535
/**
1636
* Reset TextMapper

src/main/java/org/maxgamer/quickshop/localization/text/distributions/crowdin/CrowdinOTA.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* This file is a part of project QuickShop, the name is CrowdinOTA.java
3+
* Copyright (C) PotatoCraft Studio and contributors
4+
*
5+
* This program is free software: you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License as published by the
7+
* Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful, but WITHOUT
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13+
* for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*
18+
*/
19+
120
package org.maxgamer.quickshop.localization.text.distributions.crowdin;
221

322
import com.google.common.cache.Cache;
@@ -177,7 +196,8 @@ public String getFile(String fileCrowdinPath, String crowdinLocale, boolean forc
177196
// force flush required OR local cache not exists OR outdated
178197
if (forceFlush || data == null || localeTimestamp != manifest.getTimestamp()) {
179198
String url = CROWDIN_OTA_HOST + "content" + fileCrowdinPath.replace("%locale%", crowdinLocale);
180-
Util.debugLog("Reading data from remote server: " + url);
199+
//Util.debugLog("Reading data from remote server: " + url);
200+
plugin.getLogger().info("Downloading translation " + crowdinLocale + " from: " + url);
181201
try (Response response = HttpUtil.create().getClient().newCall(new Request.Builder().get().url(url).build()).execute()) {
182202
val body = response.body();
183203
if (body == null) {

0 commit comments

Comments
 (0)