/** * Verifies that Axis names are valid and unique. */ private void checkAxes(Iterable<Axis> newAxes) throws FormException { HashSet<String> axisNames = new HashSet<String>(); for (Axis a : newAxes) { final AxisDescriptor desc = a.getDescriptor(); FormValidation fv = desc.doCheckName(a.getName()); if (fv.kind!=Kind.OK) { final String msg = Messages.MatrixProject_InvalidAxisName(a.getName(), fv.getMessage()); throw new FormException(msg,fv,"axis.name"); } for (String value: a.getValues()) { fv = desc.checkValue(value); if (fv.kind!=Kind.OK) { final String msg = Messages.MatrixProject_InvalidAxisValue(value, fv.getMessage()); // This is done on wrong place, MatrixProject is not supposed // to know field names of arbitrary axis implementations throw new FormException(msg,fv,"axis.value"); } } if (axisNames.contains(a.getName())) throw new FormException(Messages.MatrixProject_DuplicateAxisName(),"axis.name"); axisNames.add(a.getName()); } }