mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 08:12:05 +01:00
Use BufferedReader to read version
This commit is contained in:
parent
1d21285d24
commit
1f6d0fa415
1 changed files with 9 additions and 4 deletions
|
@ -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";
|
||||||
|
|
Loading…
Reference in a new issue