From fd83813ecf2fa7cdfcb9e1ac137a1a7e6d303072 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Wed, 13 Jul 2022 14:44:46 +0200 Subject: [PATCH] fix resource loading --- .../tudbut/tryumph/server/BrowserContext.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/de/tudbut/tryumph/server/BrowserContext.java b/src/de/tudbut/tryumph/server/BrowserContext.java index 392fa6a..5eed747 100644 --- a/src/de/tudbut/tryumph/server/BrowserContext.java +++ b/src/de/tudbut/tryumph/server/BrowserContext.java @@ -148,13 +148,14 @@ public class BrowserContext { return builder.toString(); } stream = new FileInputStream(file); - int i = 0; - while((i = stream.read()) != -1) { - builder.append((char) i); - } - - stream.close(); } + + int i = 0; + while((i = stream.read()) != -1) { + builder.append((char) i); + } + + stream.close(); if(!TryConfig.nocache) cache.put(file, builder.toString()); @@ -183,17 +184,18 @@ public class BrowserContext { return builder.toString(); } stream = new FileInputStream(file); - ByteArrayOutputStream s = new ByteArrayOutputStream(); - - int i = 0; - while((i = stream.read()) != -1) { - s.write(i); - } - - stream.close(); - s.close(); - st = new String(s.toByteArray()); } + + ByteArrayOutputStream s = new ByteArrayOutputStream(); + + int i = 0; + while((i = stream.read()) != -1) { + s.write(i); + } + + stream.close(); + s.close(); + st = new String(s.toByteArray()); if(!TryConfig.nocache) cache.put(file, st); } catch (IOException e) {