jme3-core: fix minor issues pointed in static analysis

experimental
shadowislord 10 years ago
parent 1076b489ab
commit 400c09a633
  1. 2
      jme3-core/src/main/java/com/jme3/asset/AssetConfig.java
  2. 5
      jme3-core/src/main/java/com/jme3/asset/DesktopAssetManager.java
  3. 6
      jme3-core/src/main/java/com/jme3/asset/ImplHandler.java
  4. 2
      jme3-core/src/main/java/com/jme3/light/SpotLight.java
  5. 2
      jme3-core/src/main/java/com/jme3/scene/BatchNode.java
  6. 2
      jme3-core/src/main/java/com/jme3/scene/Node.java
  7. 2
      jme3-core/src/main/java/com/jme3/scene/instancing/InstancedNode.java
  8. 2
      jme3-core/src/main/java/com/jme3/shader/DefineList.java
  9. 7
      jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java
  10. 3
      jme3-core/src/main/java/com/jme3/util/IntMap.java
  11. 18
      jme3-core/src/main/java/com/jme3/util/TangentBinormalGenerator.java
  12. 2
      jme3-core/src/main/java/com/jme3/util/blockparser/BlockLanguageParser.java
  13. 2
      jme3-core/src/plugins/java/com/jme3/audio/plugins/WAVLoader.java
  14. 4
      jme3-core/src/plugins/java/com/jme3/export/binary/BinaryImporter.java

@ -69,7 +69,7 @@ public final class AssetConfig {
public static void loadText(AssetManager assetManager, URL configUrl) throws IOException{
InputStream in = configUrl.openStream();
try {
Scanner scan = new Scanner(in);
Scanner scan = new Scanner(in, "UTF-8");
scan.useLocale(Locale.US); // Fix commas / periods ??
while (scan.hasNext()){
String cmd = scan.next();

@ -312,13 +312,12 @@ public class DesktopAssetManager implements AssetManager {
protected <T> T registerAndCloneSmartAsset(AssetKey<T> key, T obj, AssetProcessor proc, AssetCache cache) {
// object obj is the original asset
// create an instance for user
T clone = (T) obj;
if (proc == null) {
throw new IllegalStateException("Asset implements "
+ "CloneableSmartAsset but doesn't "
+ "have processor to handle cloning");
} else {
clone = (T) proc.createClone(obj);
T clone = (T) proc.createClone(obj);
if (cache != null && clone != obj) {
cache.registerAssetClone(key, clone);
} else {
@ -326,8 +325,8 @@ public class DesktopAssetManager implements AssetManager {
+ "CloneableSmartAsset but doesn't have cache or "
+ "was not cloned");
}
return clone;
}
return clone;
}
@Override

@ -47,7 +47,7 @@ import java.util.logging.Logger;
* This is done by keeping an instance of each asset loader and asset
* locator object in a thread local.
*/
public class ImplHandler {
final class ImplHandler {
private static final Logger logger = Logger.getLogger(ImplHandler.class.getName());
@ -75,7 +75,7 @@ public class ImplHandler {
this.assetManager = assetManager;
}
protected class ImplThreadLocal<T> extends ThreadLocal {
protected static class ImplThreadLocal<T> extends ThreadLocal {
private final Class<T> type;
private final String path;
@ -83,7 +83,7 @@ public class ImplHandler {
public ImplThreadLocal(Class<T> type, String[] extensions){
this.type = type;
this.extensions = extensions;
this.extensions = extensions.clone();
this.path = null;
}

@ -56,7 +56,7 @@ import java.io.IOException;
* the light intensity slowly decrease between the inner cone and the outer cone.
* @author Nehon
*/
public class SpotLight extends Light implements Savable {
public class SpotLight extends Light {
protected Vector3f position = new Vector3f();
protected Vector3f direction = new Vector3f(0,-1,0);

@ -64,7 +64,7 @@ import java.util.logging.Logger;
* TODO more automagic (batch when needed in the updateLogicalState)
* @author Nehon
*/
public class BatchNode extends GeometryGroupNode implements Savable {
public class BatchNode extends GeometryGroupNode {
private static final Logger logger = Logger.getLogger(BatchNode.class.getName());
/**

@ -58,7 +58,7 @@ import java.util.logging.Logger;
* @author Gregg Patton
* @author Joshua Slack
*/
public class Node extends Spatial implements Savable {
public class Node extends Spatial {
private static final Logger logger = Logger.getLogger(Node.class.getName());

@ -57,7 +57,7 @@ public class InstancedNode extends GeometryGroupNode {
setGeometryStartIndex(geom, startIndex);
}
private static class InstanceTypeKey implements Cloneable {
private static final class InstanceTypeKey implements Cloneable {
Mesh mesh;
Material material;

@ -40,7 +40,7 @@ import java.io.IOException;
import java.util.Map;
import java.util.TreeMap;
public class DefineList implements Savable, Cloneable {
public final class DefineList implements Savable, Cloneable {
private static final String ONE = "1";

@ -72,9 +72,10 @@ import java.util.ArrayList;
* @author Kirill Vainer
*/
public class FrameBuffer extends NativeObject {
public static int SLOT_UNDEF = -1;
public static int SLOT_DEPTH = -100;
public static int SLOT_DEPTH_STENCIL = -101;
public static final int SLOT_UNDEF = -1;
public static final int SLOT_DEPTH = -100;
public static final int SLOT_DEPTH_STENCIL = -101;
private int width = 0;
private int height = 0;

@ -34,6 +34,7 @@ package com.jme3.util;
import com.jme3.util.IntMap.Entry;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
/**
* Similar to a {@link Map} except that ints are used as keys.
@ -234,7 +235,7 @@ public final class IntMap<T> implements Iterable<Entry<T>>, Cloneable {
public Entry next() {
if (el >= size)
throw new IllegalStateException("No more elements!");
throw new NoSuchElementException("No more elements!");
if (cur != null){
Entry e = cur;

@ -274,11 +274,9 @@ public class TangentBinormalGenerator {
triData.setIndex(index);
triData.triangleOffset = i * 3 ;
}
if (triData != null) {
vertices.get(index[0]).triangles.add(triData);
vertices.get(index[1]).triangles.add(triData);
vertices.get(index[2]).triangles.add(triData);
}
vertices.get(index[0]).triangles.add(triData);
vertices.get(index[1]).triangles.add(triData);
vertices.get(index[2]).triangles.add(triData);
}
return vertices;
@ -483,7 +481,7 @@ public class TangentBinormalGenerator {
boolean isDegenerate = isDegenerateTriangle(v[0], v[1], v[2]);
TriangleData triData = processTriangle(index, v, t);
if (triData != null && !isDegenerate) {
if (!isDegenerate) {
vertices.get(index[0]).triangles.add(triData);
vertices.get(index[1]).triangles.add(triData);
vertices.get(index[2]).triangles.add(triData);
@ -529,11 +527,9 @@ public class TangentBinormalGenerator {
populateFromBuffer(t[2], textureBuffer, index[2]);
TriangleData triData = processTriangle(index, v, t);
if (triData != null) {
vertices.get(index[0]).triangles.add(triData);
vertices.get(index[1]).triangles.add(triData);
vertices.get(index[2]).triangles.add(triData);
}
vertices.get(index[0]).triangles.add(triData);
vertices.get(index[1]).triangles.add(triData);
vertices.get(index[2]).triangles.add(triData);
Vector3f vTemp = v[1];
v[1] = v[2];

@ -71,7 +71,7 @@ public class BlockLanguageParser {
private void load(InputStream in) throws IOException{
reset();
reader = new InputStreamReader(in);
reader = new InputStreamReader(in, "UTF-8");
StringBuilder buffer = new StringBuilder();
boolean insideComment = false;

@ -196,7 +196,7 @@ public class WAVLoader implements AssetLoader {
break;
case i_data:
// Compute duration based on data chunk size
duration = len / bytesPerSec;
duration = (float)(len / bytesPerSec);
if (readStream) {
readDataChunkForStream(inOffset, len);

@ -270,9 +270,7 @@ public final class BinaryImporter implements JmeImporter {
try {
return load(fis, listener);
} finally {
if (fis != null) {
fis.close();
}
fis.close();
}
}

Loading…
Cancel
Save