minor changes according to static analyzer

experimental
Kirill Vainer 10 years ago
parent a855915358
commit 1575e2a1d3
  1. 4
      jme3-core/src/main/java/com/jme3/light/PointLight.java
  2. 2
      jme3-core/src/main/java/com/jme3/system/AppSettings.java
  3. 15
      jme3-core/src/main/java/com/jme3/util/BufferUtils.java
  4. 4
      jme3-core/src/main/java/com/jme3/util/LittleEndien.java

@ -120,8 +120,8 @@ public class PointLight extends Light {
throw new IllegalArgumentException("Light radius cannot be negative");
}
this.radius = radius;
if (radius != 0) {
this.invRadius = 1 / radius;
if (radius != 0f) {
this.invRadius = 1f / radius;
} else {
this.invRadius = 0;
}

@ -54,6 +54,8 @@ import java.util.prefs.Preferences;
*/
public final class AppSettings extends HashMap<String, Object> {
private static final long serialVersionUID = 1L;
private static final AppSettings defaults = new AppSettings(false);
/**

@ -36,6 +36,7 @@ import com.jme3.math.Quaternion;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.math.Vector4f;
import java.io.UnsupportedEncodingException;
import java.lang.ref.PhantomReference;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
@ -1010,11 +1011,15 @@ public final class BufferUtils {
}
public static ByteBuffer createByteBuffer(String data) {
byte[] bytes = data.getBytes();
ByteBuffer bb = createByteBuffer(bytes.length);
bb.put(bytes);
bb.flip();
return bb;
try {
byte[] bytes = data.getBytes("UTF-8");
ByteBuffer bb = createByteBuffer(bytes.length);
bb.put(bytes);
bb.flip();
return bb;
} catch (UnsupportedEncodingException ex) {
throw new UnsupportedOperationException(ex);
}
}
/**

@ -42,7 +42,6 @@ import java.io.*;
public class LittleEndien extends InputStream implements DataInput {
protected BufferedInputStream in;
protected BufferedReader inRead;
/**
* Creates a new LittleEndien reader from the given input stream. The
@ -51,7 +50,6 @@ public class LittleEndien extends InputStream implements DataInput {
*/
public LittleEndien(InputStream in) {
this.in = new BufferedInputStream(in);
inRead = new BufferedReader(new InputStreamReader(in));
}
public int read() throws IOException {
@ -141,7 +139,7 @@ public class LittleEndien extends InputStream implements DataInput {
}
public String readLine() throws IOException {
return inRead.readLine();
throw new IOException("Unsupported operation");
}
public String readUTF() throws IOException {

Loading…
Cancel
Save