com.atlassian.jira.imports.csv
Class CsvFieldNameValidator

java.lang.Object
  extended by com.atlassian.jira.imports.csv.CsvFieldNameValidator

public class CsvFieldNameValidator
extends Object

This class represents a validator that is used for field name validatio for CSV import data. This validator checks for presence of plus sign character ('+') which causes exception in webwork (see JRA-12887). This validator also checks for open round and square brackets without corresponding closing brackets. The errors are indicated via return set that contains CsvFieldNameValidator.Error objects if any errors are found.


Nested Class Summary
static class CsvFieldNameValidator.Error
          Simple class for representing errors reported by this validator.
 
Constructor Summary
CsvFieldNameValidator()
           
 
Method Summary
 Set check(String fieldName)
          Runs the result of the check over the given field name.
protected  boolean containsMatchingBrackets(String value)
          Check the given string for matching number of opening and closing round or square brackets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvFieldNameValidator

public CsvFieldNameValidator()
Method Detail

check

public Set check(String fieldName)
Runs the result of the check over the given field name. Returns a set of CsvFieldNameValidator.Error objects if any errors found.

Parameters:
fieldName - field name
Returns:
a set of CsvFieldNameValidator.Error objects, never null

containsMatchingBrackets

protected boolean containsMatchingBrackets(String value)
Check the given string for matching number of opening and closing round or square brackets. The brackets also need to be properly nested.

Parameters:
value - string to check, can be null
Returns:
true if string does not contain any brackets, or if brackets are matching and correctly nested


Copyright © 2002-2009 Atlassian. All Rights Reserved.