Skip to content
Snippets Groups Projects
Commit 5b4ca162 authored by felmer's avatar felmer
Browse files

SP-724, BIS-428: Fixing bug in IdentifierAttributeMappingManager for mapping...

SP-724, BIS-428: Fixing bug in IdentifierAttributeMappingManager for mapping file lines having only empty spaces. Test extended.

SVN: 29426
parent 8952026a
No related branches found
No related tags found
No related merge requests found
...@@ -108,6 +108,10 @@ public class IdentifierAttributeMappingManager ...@@ -108,6 +108,10 @@ public class IdentifierAttributeMappingManager
while (reader.readRecord()) while (reader.readRecord())
{ {
String[] row = reader.getValues(); String[] row = reader.getValues();
if (isEmptyRow(row))
{
continue;
}
if (row.length != 3) if (row.length != 3)
{ {
throw new IllegalArgumentException("Invalid number of row elements in mapping file '" throw new IllegalArgumentException("Invalid number of row elements in mapping file '"
...@@ -136,6 +140,18 @@ public class IdentifierAttributeMappingManager ...@@ -136,6 +140,18 @@ public class IdentifierAttributeMappingManager
} }
} }
private boolean isEmptyRow(String[] row)
{
for (String cell : row)
{
if (cell.length() > 0)
{
return false;
}
}
return true;
}
private List<String> getShareIds(String identifier, String[] row) private List<String> getShareIds(String identifier, String[] row)
{ {
String idsAttribute = row[1]; String idsAttribute = row[1];
......
...@@ -86,6 +86,11 @@ public class IdentifierAttributeMappingManagerTest extends AbstractFileSystemTes ...@@ -86,6 +86,11 @@ public class IdentifierAttributeMappingManagerTest extends AbstractFileSystemTes
+ "/S1/P1/E1\t2\t" + as1 + "\n" + "/S1/P1/E1\t2\t" + as1 + "\n"
+ "/S1/P1/E2\t2\t" + as2 + "\n" + "/S1/P1/E2\t2\t" + as2 + "\n"
+ "/S1/P1\t2\t" + as2 + "\n" + "/S1/P1\t2\t" + as2 + "\n"
+ "\n"
+ " \n"
+ "\t \n"
+ "\t\t\n"
+ "\t\t\t \n"
+ "/S1\t2\t" + as2 + "\n"); + "/S1\t2\t" + as2 + "\n");
as1.mkdirs(); as1.mkdirs();
as2.mkdirs(); as2.mkdirs();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment