Procházet zdrojové kódy

minor changes according to static analyzer

Kirill Vainer před 10 roky
rodič
revize
1575e2a1d3

+ 2 - 2
jme3-core/src/main/java/com/jme3/light/PointLight.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;
         }

+ 2 - 0
jme3-core/src/main/java/com/jme3/system/AppSettings.java

@@ -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);
 
     /**

+ 10 - 5
jme3-core/src/main/java/com/jme3/util/BufferUtils.java

@@ -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);
+        }
     }
 
     /**

+ 1 - 3
jme3-core/src/main/java/com/jme3/util/LittleEndien.java

@@ -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 {