findbug cleanups

git-svn-id: http://google-refine.googlecode.com/svn/trunk@599 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-05-05 01:35:51 +00:00
parent 1582836dca
commit e6d36710ff
7 changed files with 14 additions and 16 deletions

View File

@ -78,9 +78,9 @@ public class GridworksServlet extends HttpServlet {
static final protected Map<String, Command> _commands = new HashMap<String, Command>();
// timer for periodically saving projects
static protected Timer _timer;
static private Timer _timer;
final Logger logger = LoggerFactory.getLogger("servlet");
final static Logger logger = LoggerFactory.getLogger("servlet");
static {
_commands.put("create-project-from-upload", new CreateProjectCommand());

View File

@ -463,6 +463,8 @@ public class ProjectManager {
_projectsMetadata.clear();
_expressions.clear();
boolean found = false;
if (file.exists() || file.canRead()) {
FileReader reader = null;
try {
@ -482,7 +484,7 @@ public class ProjectManager {
}
JSONUtilities.getStringList(obj, "expressions", _expressions);
return true;
found = true;
} catch (JSONException e) {
logger.warn("Error reading file", e);
} catch (IOException e) {
@ -496,6 +498,6 @@ public class ProjectManager {
}
}
return false;
return found;
}
}

View File

@ -19,7 +19,6 @@ public class ScatterplotDrawingRowVisitor implements RowVisitor {
int col_x;
int col_y;
int size;
int dim_x;
int dim_y;
int rotation;
@ -32,8 +31,6 @@ public class ScatterplotDrawingRowVisitor implements RowVisitor {
double min_y;
double max_y;
Color color;
BufferedImage image;
Graphics2D g2;
@ -47,9 +44,7 @@ public class ScatterplotDrawingRowVisitor implements RowVisitor {
this.min_y = min_y;
this.max_x = max_x;
this.max_y = max_y;
this.size = size;
this.dot = dot;
this.color = color;
this.dim_x = dim_x;
this.dim_y = dim_y;
this.rotation = rotation;

View File

@ -181,7 +181,8 @@ public class CreateProjectCommand extends Command {
// better than nothing
HashMap<String,Integer> ext_map = new HashMap<String,Integer>();
InputStream is = getStream(fileName, new FileInputStream(file));
FileInputStream fis = new FileInputStream(file);
InputStream is = getStream(fileName, fis);
// NOTE(SM): unfortunately, java.io does not provide any generalized class for
// archive-like input streams so while both TarInputStream and ZipInputStream
@ -209,6 +210,7 @@ public class CreateProjectCommand extends Command {
} finally {
try {
is.close();
fis.close();
} catch (IOException e) {}
}

View File

@ -42,7 +42,7 @@ public class Get implements Function {
((Object[]) v)[start] :
ExpressionUtils.toObjectList(v).get(start));
} else {
int end = (to != null && to instanceof Number) ? ((Number) to).intValue() : length;
int end = (to != null) ? ((Number) to).intValue() : length;
if (end < 0) {
end = length + end;
@ -70,7 +70,7 @@ public class Get implements Function {
}
start = Math.min(s.length(), Math.max(0, start));
if (to != null && to instanceof Number) {
if (to != null) {
int end = ((Number) to).intValue();
if (end < 0) {
end = s.length() + end;

View File

@ -24,7 +24,7 @@ public class Slice implements Function {
ExpressionUtils.toObjectList(v).size();
int start = ((Number) from).intValue();
int end = (to != null && to instanceof Number) ? ((Number) to).intValue() : length;
int end = (to != null) ? ((Number) to).intValue() : length;
if (start < 0) {
start = length + start;
@ -54,7 +54,7 @@ public class Slice implements Function {
}
start = Math.min(s.length(), Math.max(0, start));
if (to != null && to instanceof Number) {
if (to != null) {
int end = ((Number) to).intValue();
if (end < 0) {
end = s.length() + end;

View File

@ -216,7 +216,7 @@ public class ColumnSplitOperation extends EngineDependentOperation {
}
protected class ColumnSplitRowVisitor implements RowVisitor {
Project project;
int cellIndex;
List<String> columnNames;
List<Integer> rowIndices;
@ -231,7 +231,6 @@ public class ColumnSplitOperation extends EngineDependentOperation {
List<Integer> rowIndices,
List<List<Serializable>> tuples
) {
this.project = project;
this.cellIndex = cellIndex;
this.columnNames = columnNames;
this.rowIndices = rowIndices;