findbug cleanups
git-svn-id: http://google-refine.googlecode.com/svn/trunk@599 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
1582836dca
commit
e6d36710ff
src/main/java/com/metaweb/gridworks
@ -78,9 +78,9 @@ public class GridworksServlet extends HttpServlet {
|
|||||||
static final protected Map<String, Command> _commands = new HashMap<String, Command>();
|
static final protected Map<String, Command> _commands = new HashMap<String, Command>();
|
||||||
|
|
||||||
// timer for periodically saving projects
|
// 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 {
|
static {
|
||||||
_commands.put("create-project-from-upload", new CreateProjectCommand());
|
_commands.put("create-project-from-upload", new CreateProjectCommand());
|
||||||
|
@ -463,6 +463,8 @@ public class ProjectManager {
|
|||||||
_projectsMetadata.clear();
|
_projectsMetadata.clear();
|
||||||
_expressions.clear();
|
_expressions.clear();
|
||||||
|
|
||||||
|
boolean found = false;
|
||||||
|
|
||||||
if (file.exists() || file.canRead()) {
|
if (file.exists() || file.canRead()) {
|
||||||
FileReader reader = null;
|
FileReader reader = null;
|
||||||
try {
|
try {
|
||||||
@ -482,7 +484,7 @@ public class ProjectManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JSONUtilities.getStringList(obj, "expressions", _expressions);
|
JSONUtilities.getStringList(obj, "expressions", _expressions);
|
||||||
return true;
|
found = true;
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
logger.warn("Error reading file", e);
|
logger.warn("Error reading file", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -496,6 +498,6 @@ public class ProjectManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ public class ScatterplotDrawingRowVisitor implements RowVisitor {
|
|||||||
|
|
||||||
int col_x;
|
int col_x;
|
||||||
int col_y;
|
int col_y;
|
||||||
int size;
|
|
||||||
int dim_x;
|
int dim_x;
|
||||||
int dim_y;
|
int dim_y;
|
||||||
int rotation;
|
int rotation;
|
||||||
@ -32,8 +31,6 @@ public class ScatterplotDrawingRowVisitor implements RowVisitor {
|
|||||||
double min_y;
|
double min_y;
|
||||||
double max_y;
|
double max_y;
|
||||||
|
|
||||||
Color color;
|
|
||||||
|
|
||||||
BufferedImage image;
|
BufferedImage image;
|
||||||
Graphics2D g2;
|
Graphics2D g2;
|
||||||
|
|
||||||
@ -47,9 +44,7 @@ public class ScatterplotDrawingRowVisitor implements RowVisitor {
|
|||||||
this.min_y = min_y;
|
this.min_y = min_y;
|
||||||
this.max_x = max_x;
|
this.max_x = max_x;
|
||||||
this.max_y = max_y;
|
this.max_y = max_y;
|
||||||
this.size = size;
|
|
||||||
this.dot = dot;
|
this.dot = dot;
|
||||||
this.color = color;
|
|
||||||
this.dim_x = dim_x;
|
this.dim_x = dim_x;
|
||||||
this.dim_y = dim_y;
|
this.dim_y = dim_y;
|
||||||
this.rotation = rotation;
|
this.rotation = rotation;
|
||||||
|
@ -181,7 +181,8 @@ public class CreateProjectCommand extends Command {
|
|||||||
// better than nothing
|
// better than nothing
|
||||||
HashMap<String,Integer> ext_map = new HashMap<String,Integer>();
|
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
|
// NOTE(SM): unfortunately, java.io does not provide any generalized class for
|
||||||
// archive-like input streams so while both TarInputStream and ZipInputStream
|
// archive-like input streams so while both TarInputStream and ZipInputStream
|
||||||
@ -209,6 +210,7 @@ public class CreateProjectCommand extends Command {
|
|||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
is.close();
|
is.close();
|
||||||
|
fis.close();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class Get implements Function {
|
|||||||
((Object[]) v)[start] :
|
((Object[]) v)[start] :
|
||||||
ExpressionUtils.toObjectList(v).get(start));
|
ExpressionUtils.toObjectList(v).get(start));
|
||||||
} else {
|
} else {
|
||||||
int end = (to != null && to instanceof Number) ? ((Number) to).intValue() : length;
|
int end = (to != null) ? ((Number) to).intValue() : length;
|
||||||
|
|
||||||
if (end < 0) {
|
if (end < 0) {
|
||||||
end = length + end;
|
end = length + end;
|
||||||
@ -70,7 +70,7 @@ public class Get implements Function {
|
|||||||
}
|
}
|
||||||
start = Math.min(s.length(), Math.max(0, start));
|
start = Math.min(s.length(), Math.max(0, start));
|
||||||
|
|
||||||
if (to != null && to instanceof Number) {
|
if (to != null) {
|
||||||
int end = ((Number) to).intValue();
|
int end = ((Number) to).intValue();
|
||||||
if (end < 0) {
|
if (end < 0) {
|
||||||
end = s.length() + end;
|
end = s.length() + end;
|
||||||
|
@ -24,7 +24,7 @@ public class Slice implements Function {
|
|||||||
ExpressionUtils.toObjectList(v).size();
|
ExpressionUtils.toObjectList(v).size();
|
||||||
|
|
||||||
int start = ((Number) from).intValue();
|
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) {
|
if (start < 0) {
|
||||||
start = length + start;
|
start = length + start;
|
||||||
@ -54,7 +54,7 @@ public class Slice implements Function {
|
|||||||
}
|
}
|
||||||
start = Math.min(s.length(), Math.max(0, start));
|
start = Math.min(s.length(), Math.max(0, start));
|
||||||
|
|
||||||
if (to != null && to instanceof Number) {
|
if (to != null) {
|
||||||
int end = ((Number) to).intValue();
|
int end = ((Number) to).intValue();
|
||||||
if (end < 0) {
|
if (end < 0) {
|
||||||
end = s.length() + end;
|
end = s.length() + end;
|
||||||
|
@ -216,7 +216,7 @@ public class ColumnSplitOperation extends EngineDependentOperation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected class ColumnSplitRowVisitor implements RowVisitor {
|
protected class ColumnSplitRowVisitor implements RowVisitor {
|
||||||
Project project;
|
|
||||||
int cellIndex;
|
int cellIndex;
|
||||||
List<String> columnNames;
|
List<String> columnNames;
|
||||||
List<Integer> rowIndices;
|
List<Integer> rowIndices;
|
||||||
@ -231,7 +231,6 @@ public class ColumnSplitOperation extends EngineDependentOperation {
|
|||||||
List<Integer> rowIndices,
|
List<Integer> rowIndices,
|
||||||
List<List<Serializable>> tuples
|
List<List<Serializable>> tuples
|
||||||
) {
|
) {
|
||||||
this.project = project;
|
|
||||||
this.cellIndex = cellIndex;
|
this.cellIndex = cellIndex;
|
||||||
this.columnNames = columnNames;
|
this.columnNames = columnNames;
|
||||||
this.rowIndices = rowIndices;
|
this.rowIndices = rowIndices;
|
||||||
|
Loading…
Reference in New Issue
Block a user