Skip to content

Commit 67a02c5

Browse files
hportenbuchen
authored andcommitted
ScorePriority: fixed error message about invalid CUSIP length.
1.) Corrected placeholder value for error message 2.) Do what the comment says and reject all lengths other than 9 3.) Fixed typo in comment. It is questionable to match CUSIPS with "(?<wkn>.*)" btw. Particularly as the dot also matches whitespace that later has to be dropped with trim() again. \w would be better but without more test cases we have to guess whether it needs to be surrounded with \s.
1 parent 9e26899 commit 67a02c5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/scorepriorityinc/ScorePriorityIncPDFExtractorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ public void testAccountStatement04()
783783
.findFirst().orElseThrow(IllegalArgumentException::new);
784784

785785
assertThat(((AccountTransaction) cancellation.getSubject()).getType(), is(AccountTransaction.Type.FEES));
786-
assertThat(cancellation.getFailureMessage(), is(MessageFormat.format(Messages.MsgErrorInvalidWKN, "Tsvt")));
786+
assertThat(cancellation.getFailureMessage(), is(MessageFormat.format(Messages.MsgErrorInvalidWKN, "09609")));
787787

788788
assertThat(((Transaction) cancellation.getSubject()).getDateTime(),
789789
is(LocalDateTime.parse("2021-11-05T00:00")));

name.abuchen.portfolio/src/name/abuchen/portfolio/datatransfer/pdf/ScorePriorityIncPDFExtractor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ private void addAccountStatementTransaction()
225225
v.put("date", v.get("day") + " " + v.get("month") + " " + v.get("year"));
226226
v.put("currency", CurrencyUnit.USD);
227227

228-
// if CUSIP lenght != 9
229-
if (trim(v.get("wkn")).length() < 9)
230-
v.markAsFailure(MessageFormat.format(Messages.MsgErrorInvalidWKN, trim(v.get("name"))));
228+
// if CUSIP length != 9
229+
if (trim(v.get("wkn")).length() != 9)
230+
v.markAsFailure(MessageFormat.format(Messages.MsgErrorInvalidWKN, trim(v.get("wkn"))));
231231
else
232232
t.setSecurity(getOrCreateSecurity(v));
233233

0 commit comments

Comments
 (0)