task 603: range check column move commands
http://code.google.com/p/google-refine/issues/detail?id=603 git-svn-id: http://google-refine.googlecode.com/svn/trunk@2534 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
202018fac4
commit
12a61b6ec6
@ -63,6 +63,10 @@ public class ColumnMoveChange extends ColumnChange {
|
||||
synchronized (project) {
|
||||
_oldColumnIndex = project.columnModel.getColumnIndexByName(_columnName);
|
||||
|
||||
if (_oldColumnIndex < 0 || _newColumnIndex < 0
|
||||
|| _newColumnIndex > project.columnModel.getMaxCellIndex()) {
|
||||
throw new RuntimeException("Column index out of range");
|
||||
}
|
||||
if (_oldColumnGroups == null) {
|
||||
_oldColumnGroups = new ArrayList<ColumnGroup>(project.columnModel.columnGroups);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
|
||||
Copyright 2010, Google Inc.
|
||||
Copyright 2010,2012. Google Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -88,6 +88,9 @@ public class ColumnMoveOperation extends AbstractOperation {
|
||||
if (project.columnModel.getColumnByName(_columnName) == null) {
|
||||
throw new Exception("No column named " + _columnName);
|
||||
}
|
||||
if (_index < 0 || _index >= project.columnModel.columns.size()) {
|
||||
throw new Exception("New column index out of range " + _index);
|
||||
}
|
||||
|
||||
Change change = new ColumnMoveChange(_columnName, _index);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user