Use BufferedReader to read version

This commit is contained in:
Florian Schmaus 2014-06-22 23:14:11 +02:00
parent 1d21285d24
commit 1f6d0fa415
1 changed files with 9 additions and 4 deletions

View File

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