Skip to content

Commit d764d32

Browse files
committed
#865 Student-step import validation fails when certain characters exist
in the KC header columns The pattern in the Student-Step Import was invalid (missing ending paren).
1 parent c850072 commit d764d32

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

‎ImportStudentStep/source/edu/cmu/pslc/learnsphere/imports/studentstep/ImportStudentStepMain.java‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected void runComponent() {
5858
* @param inputFile the File
5959
* @throws failure to verify the file will throw an exception
6060
*/
61-
private void verifyInputFile(File inputFile)
61+
private void verifyInputFile(File inputFile)
6262
throws Exception
6363
{
6464
File shortFile = null;
@@ -96,7 +96,7 @@ private void verifyInputFile(File inputFile)
9696
/*
9797
* Regex for KCM names... the name will be in group(2).
9898
*/
99-
private static final Pattern KCM_PATTERN = Pattern.compile("(KC \\()(.*)\\)");
99+
private static final Pattern KCM_PATTERN = Pattern.compile("(?i)\\s*KC\\s*\\(.*\\)\\s*");
100100

101101
/**
102102
* Method to determine what KC models are present in the input file.
@@ -118,10 +118,9 @@ private List<String> getKCModelNames(File inputFile)
118118
String line = null;
119119
if ((line = br.readLine()) != null) {
120120
for (String header : line.split("\t")) {
121-
Matcher m = KCM_PATTERN.matcher(header);
122-
while (m.find()) {
123-
result.add(m.group(2));
124-
}
121+
String modelName = this.getOptionAsString("model")
122+
.replaceAll("(?i)\\s*KC\\s*\\((.*)\\)\\s*", "$1");
123+
result.add(modelName);
125124
}
126125
}
127126
} catch (Exception e) {

0 commit comments

Comments
 (0)