Skip to content

Commit b1be848

Browse files
authored
Merge pull request #433 from JavaMoney/1.4
1.4
2 parents 933d385 + cbc7452 commit b1be848

9 files changed

Lines changed: 135 additions & 110 deletions

File tree

moneta-convert/moneta-convert-ecb/src/main/java/org/javamoney/moneta/convert/ecb/ECBCurrentRateProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected LoadDataInformation getDefaultLoadData() {
7171
.withResourceId(getDataId())
7272
.withUpdatePolicy(LoaderService.UpdatePolicy.SCHEDULED)
7373
.withProperties(props)
74-
.withBackupResource(URI.create(ECB_CURRENT_FALLBACK_PATH))
74+
.withBackupResource(getResourceFromPath(ECB_CURRENT_FALLBACK_PATH, getClass()))
7575
.withResourceLocations(URI.create(ECB_CURRENT_URL))
7676
.withStartRemote(true)
7777
.build();

moneta-convert/moneta-convert-ecb/src/main/java/org/javamoney/moneta/convert/ecb/ECBHistoric90RateProvider.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2023, Werner Keil and others by the @author tag.
2+
* Copyright (c) 2012, 2025, Werner Keil and others by the @author tag.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
55
* use this file except in compliance with the License. You may obtain a copy of
@@ -23,6 +23,8 @@
2323
import javax.money.convert.ProviderContextBuilder;
2424
import javax.money.convert.RateType;
2525
import java.net.URI;
26+
import java.net.URISyntaxException;
27+
import java.net.URL;
2628
import java.util.HashMap;
2729
import java.util.Map;
2830

@@ -75,7 +77,7 @@ protected LoadDataInformation getDefaultLoadData() {
7577
.withResourceId(getDataId())
7678
.withUpdatePolicy(LoaderService.UpdatePolicy.SCHEDULED)
7779
.withProperties(props)
78-
.withBackupResource(URI.create(ECB_HIST90_FALLBACK_PATH))
80+
.withBackupResource(getResourceFromPath(ECB_HIST90_FALLBACK_PATH, getClass()))
7981
.withResourceLocations(URI.create(ECB_HIST90_URL))
8082
.withStartRemote(true)
8183
.build();

moneta-convert/moneta-convert-ecb/src/main/java/org/javamoney/moneta/convert/ecb/ECBHistoricRateProvider.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2023, Werner Keil and others by the @author tag.
2+
* Copyright (c) 2012, 2025, Werner Keil and others by the @author tag.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
55
* use this file except in compliance with the License. You may obtain a copy of
@@ -27,6 +27,7 @@
2727
import java.util.HashMap;
2828
import java.util.Map;
2929

30+
import static org.javamoney.moneta.convert.ecb.defaults.Defaults.ECB_HIST_FALLBACK_PATH;
3031
import static org.javamoney.moneta.convert.ecb.defaults.Defaults.ECB_HIST_URL;
3132

3233
/**
@@ -81,7 +82,7 @@ protected LoadDataInformation getDefaultLoadData() {
8182
.withResourceId(getDataId())
8283
.withUpdatePolicy(LoaderService.UpdatePolicy.SCHEDULED)
8384
.withProperties(props)
84-
.withBackupResource(URI.create("org/javamoney/moneta/convert/ecb/defaults/eurofxref-hist.xml"))
85+
.withBackupResource(getResourceFromPath(ECB_HIST_FALLBACK_PATH, getClass()))
8586
.withResourceLocations(URI.create(ECB_HIST_URL))
8687
.withStartRemote(false)
8788
.build();
@@ -95,8 +96,8 @@ protected LoadDataInformation getDefaultLoadData() {
9596
// .withProperties(Map.of("period", "24:00",
9697
// "delay", "01:00",
9798
// "at", "07:00"))
98-
// .withBackupResource(URI.create("org/javamoney/moneta/convert/ecb/defaults/eurofxref-hist.xml"))
99-
// .withResourceLocations(URI.create("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.xml"))
99+
// .withBackupResource(getResourceFromPath(ECB_HIST_FALLBACK_PATH, getClass()))
100+
// .withResourceLocations(URI.create(ECB_HIST_URL))
100101
// .withStartRemote(true)
101102
// .build();
102103
// }

moneta-convert/moneta-convert-ecb/src/main/java/org/javamoney/moneta/convert/ecb/defaults/Defaults.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Werner Keil and others by the @author tag.
2+
* Copyright (c) 2023-2025, Werner Keil and others by the @author tag.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
55
* use this file except in compliance with the License. You may obtain a copy of
@@ -20,11 +20,11 @@ public final class Defaults {
2020
private Defaults() {}
2121

2222
public static final String ECB_CURRENT_URL = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml";
23-
public static final String ECB_CURRENT_FALLBACK_PATH = "org/javamoney/moneta/convert/ecb/defaults/eurofxref-daily.xml";
23+
public static final String ECB_CURRENT_FALLBACK_PATH = "/org/javamoney/moneta/convert/ecb/defaults/eurofxref-daily.xml";
2424

2525
public static final String ECB_HIST90_URL = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml";
26-
27-
public static final String ECB_HIST90_FALLBACK_PATH = "org/javamoney/moneta/convert/ecb/defaults/eurofxref-hist-90d.xml";
26+
public static final String ECB_HIST90_FALLBACK_PATH = "/org/javamoney/moneta/convert/ecb/defaults/eurofxref-hist-90d.xml";
2827

2928
public static final String ECB_HIST_URL = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.xml";
29+
public static final String ECB_HIST_FALLBACK_PATH = "/org/javamoney/moneta/convert/ecb/defaults/eurofxref-hist.xml";
3030
}

moneta-convert/moneta-convert-ecb/src/main/resources/org/javamoney/moneta/convert/ecb/defaults/eurofxref-daily.xml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,37 @@
55
<gesmes:name>European Central Bank</gesmes:name>
66
</gesmes:Sender>
77
<Cube>
8-
<Cube time='2023-02-21'>
9-
<Cube currency='USD' rate='1.0664'/>
10-
<Cube currency='JPY' rate='143.76'/>
8+
<Cube time='2025-04-03'>
9+
<Cube currency='USD' rate='1.1097'/>
10+
<Cube currency='JPY' rate='162.17'/>
1111
<Cube currency='BGN' rate='1.9558'/>
12-
<Cube currency='CZK' rate='23.730'/>
13-
<Cube currency='DKK' rate='7.4456'/>
14-
<Cube currency='GBP' rate='0.87925'/>
15-
<Cube currency='HUF' rate='382.19'/>
16-
<Cube currency='PLN' rate='4.7478'/>
17-
<Cube currency='RON' rate='4.9188'/>
18-
<Cube currency='SEK' rate='11.0098'/>
19-
<Cube currency='CHF' rate='0.9853'/>
20-
<Cube currency='ISK' rate='154.10'/>
21-
<Cube currency='NOK' rate='10.9468'/>
22-
<Cube currency='TRY' rate='20.1223'/>
23-
<Cube currency='AUD' rate='1.5517'/>
24-
<Cube currency='BRL' rate='5.5110'/>
25-
<Cube currency='CAD' rate='1.4351'/>
26-
<Cube currency='CNY' rate='7.3372'/>
27-
<Cube currency='HKD' rate='8.3645'/>
28-
<Cube currency='IDR' rate='16194.81'/>
29-
<Cube currency='ILS' rate='3.8859'/>
30-
<Cube currency='INR' rate='88.2835'/>
31-
<Cube currency='KRW' rate='1387.03'/>
32-
<Cube currency='MXN' rate='19.6085'/>
33-
<Cube currency='MYR' rate='4.7268'/>
34-
<Cube currency='NZD' rate='1.7092'/>
35-
<Cube currency='PHP' rate='58.684'/>
36-
<Cube currency='SGD' rate='1.4272'/>
37-
<Cube currency='THB' rate='36.897'/>
38-
<Cube currency='ZAR' rate='19.4579'/>
12+
<Cube currency='CZK' rate='24.972'/>
13+
<Cube currency='DKK' rate='7.4613'/>
14+
<Cube currency='GBP' rate='0.84163'/>
15+
<Cube currency='HUF' rate='401.58'/>
16+
<Cube currency='PLN' rate='4.1960'/>
17+
<Cube currency='RON' rate='4.9774'/>
18+
<Cube currency='SEK' rate='10.7205'/>
19+
<Cube currency='CHF' rate='0.9538'/>
20+
<Cube currency='ISK' rate='144.70'/>
21+
<Cube currency='NOK' rate='11.4235'/>
22+
<Cube currency='TRY' rate='42.0970'/>
23+
<Cube currency='AUD' rate='1.7448'/>
24+
<Cube currency='BRL' rate='6.2411'/>
25+
<Cube currency='CAD' rate='1.5636'/>
26+
<Cube currency='CNY' rate='8.0919'/>
27+
<Cube currency='HKD' rate='8.6311'/>
28+
<Cube currency='IDR' rate='18547.91'/>
29+
<Cube currency='ILS' rate='4.0919'/>
30+
<Cube currency='INR' rate='94.6325'/>
31+
<Cube currency='KRW' rate='1615.11'/>
32+
<Cube currency='MXN' rate='22.2230'/>
33+
<Cube currency='MYR' rate='4.9293'/>
34+
<Cube currency='NZD' rate='1.9047'/>
35+
<Cube currency='PHP' rate='63.295'/>
36+
<Cube currency='SGD' rate='1.4804'/>
37+
<Cube currency='THB' rate='38.046'/>
38+
<Cube currency='ZAR' rate='20.9522'/>
3939
</Cube>
4040
</Cube>
4141
</gesmes:Envelope>

0 commit comments

Comments
 (0)