File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
backend/src/main/java/ch/xxx/aidoclibchat/adapter/client Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 1212 */
1313package ch .xxx .aidoclibchat .adapter .client ;
1414
15+ import java .io .IOException ;
1516import java .util .List ;
1617
1718import org .springframework .stereotype .Component ;
1819import org .springframework .web .client .RestClient ;
1920
2021import com .fasterxml .jackson .dataformat .csv .CsvMapper ;
22+ import com .fasterxml .jackson .dataformat .csv .CsvSchema ;
2123import com .fasterxml .jackson .datatype .jsr310 .JavaTimeModule ;
2224
2325import ch .xxx .aidoclibchat .domain .client .ImportClient ;
@@ -57,10 +59,14 @@ public List<Artist> importArtists() {
5759 }
5860
5961 private <T > List <T > mapString (String result , Class <T > myClass ) {
60- List <T > zipcodes = List .of ();
61- zipcodes = this .csvMapper .readerFor (myClass ).with (CsvSchema .builder ().setUseHeader (true ).build ())
62- .<T >readValues (result ).readAll ();
63- return zipcodes ;
62+ List <T > zipcodes = List .of ();
63+ try {
64+ zipcodes = this .csvMapper .readerFor (myClass ).with (CsvSchema .builder ().setUseHeader (true ).build ())
65+ .<T >readValues (result ).readAll ();
66+ } catch (IOException ex ) {
67+ throw new RuntimeException ("Error mapping CSV data" , ex );
68+ }
69+ return zipcodes ;
6470 }
6571
6672 @ Override
You can’t perform that action at this time.
0 commit comments