1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 22:32:06 +01:00

Use BufferedReader to read version

This commit is contained in:
Florian Schmaus 2014-06-22 23:14:11 +02:00
parent 1d21285d24
commit 1f6d0fa415

View file

@ -17,8 +17,10 @@
package org.jivesoftware.smack; package org.jivesoftware.smack;
import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -95,10 +97,13 @@ public final class SmackConfiguration {
static { static {
String smackVersion; String smackVersion;
try { try {
InputStream is = FileUtils.getStreamForUrl("classpath:org.jivesoftware.smack/version", null); BufferedReader reader = new BufferedReader(new InputStreamReader(FileUtils.getStreamForUrl("classpath:org.jivesoftware.smack/version", null)));
byte[] buf = new byte[1024]; smackVersion = reader.readLine();
is.read(buf); try {
smackVersion = new String(buf, "UTF-8"); reader.close();
} catch (IOException e) {
LOGGER.log(Level.WARNING, "IOException closing stream", e);
}
} catch(Exception e) { } catch(Exception e) {
LOGGER.log(Level.SEVERE, "Could not determine Smack version", e); LOGGER.log(Level.SEVERE, "Could not determine Smack version", e);
smackVersion = "unkown"; smackVersion = "unkown";