mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Update upload to debug the content if incorrect properly.
This commit is contained in:
parent
165614efe9
commit
af951ac11c
1 changed files with 7 additions and 16 deletions
|
@ -81,6 +81,7 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Scanner;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
|
@ -222,22 +223,12 @@ public class MainUtil {
|
|||
writer.append(CRLF).flush();
|
||||
writer.append("--" + boundary + "--").append(CRLF).flush();
|
||||
}
|
||||
try (Reader response = new InputStreamReader(con.getInputStream(),
|
||||
StandardCharsets.UTF_8)) {
|
||||
final char[] buffer = new char[256];
|
||||
final StringBuilder result = new StringBuilder();
|
||||
while (true) {
|
||||
final int r = response.read(buffer);
|
||||
if (r < 0) {
|
||||
break;
|
||||
String content;
|
||||
try (Scanner scanner = new Scanner(con.getInputStream()).useDelimiter("\\A")) {
|
||||
content = scanner.next().trim();
|
||||
}
|
||||
result.append(buffer, 0, r);
|
||||
}
|
||||
if (!result.toString().startsWith("Success")) {
|
||||
PlotSquared.debug(result);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if (!content.startsWith("<")) {
|
||||
PlotSquared.debug(content);
|
||||
}
|
||||
int responseCode = ((HttpURLConnection) con).getResponseCode();
|
||||
if (responseCode == 200) {
|
||||
|
|
Loading…
Reference in a new issue