Merge pull request #921 from ExpDev07/1.6.x

Removed duplicate/unnececary code in DiscUtil.
This commit is contained in:
Trent Hensler 2017-12-19 00:18:15 -08:00 committed by GitHub
commit 190908b181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,7 +59,6 @@ public class DiscUtil {
private static HashMap<String, Lock> locks = new HashMap<String, Lock>(); private static HashMap<String, Lock> locks = new HashMap<String, Lock>();
public static boolean writeCatch(final File file, final String content, boolean sync) { public static boolean writeCatch(final File file, final String content, boolean sync) {
final byte[] bytes = utf8(content);
String name = file.getName(); String name = file.getName();
final Lock lock; final Lock lock;
@ -75,9 +74,7 @@ public class DiscUtil {
if (sync) { if (sync) {
lock.lock(); lock.lock();
try { try {
FileOutputStream out = new FileOutputStream(file); write(file, content);
out.write(bytes);
out.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
@ -89,9 +86,7 @@ public class DiscUtil {
public void run() { public void run() {
lock.lock(); lock.lock();
try { try {
FileOutputStream out = new FileOutputStream(file); write(file, content);
out.write(bytes);
out.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {