Skip to content
This repository was archived by the owner on Jul 7, 2021. It is now read-only.

Commit 823465b

Browse files
fix #362: Double escaping of query parameters (#372)
1 parent a322379 commit 823465b

28 files changed

+175
-170
lines changed

.idea/vcs.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/org/proshin/finapi/account/in/DailyBalancesCriteria.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.apache.http.NameValuePair;
2424
import org.proshin.finapi.primitives.StringOf;
2525
import org.proshin.finapi.primitives.pair.CommaSeparatedPair;
26-
import org.proshin.finapi.primitives.pair.QueryParamEncodedPair;
26+
import org.proshin.finapi.primitives.pair.PlainNameValuePair;
2727

2828
public final class DailyBalancesCriteria implements Iterable<NameValuePair> {
2929

@@ -38,34 +38,34 @@ public DailyBalancesCriteria(final List<NameValuePair> pairs) {
3838
}
3939

4040
public DailyBalancesCriteria withAccounts(final Iterable<Long> accounts) {
41-
this.pairs.add(new QueryParamEncodedPair(new CommaSeparatedPair<>("accountIds", accounts)));
41+
this.pairs.add(new CommaSeparatedPair<>("accountIds", accounts));
4242
return this;
4343
}
4444

4545
public DailyBalancesCriteria withStartDate(final OffsetDateTime startDate) {
46-
this.pairs.add(new QueryParamEncodedPair("startDate", new StringOf(startDate)));
46+
this.pairs.add(new PlainNameValuePair("startDate", new StringOf(startDate)));
4747
return this;
4848
}
4949

5050
public DailyBalancesCriteria withEndDate(final OffsetDateTime endDate) {
51-
this.pairs.add(new QueryParamEncodedPair("endDate", new StringOf(endDate)));
51+
this.pairs.add(new PlainNameValuePair("endDate", new StringOf(endDate)));
5252
return this;
5353
}
5454

5555
public DailyBalancesCriteria withoutProjection() {
56-
this.pairs.add(new QueryParamEncodedPair("withProjection", false));
56+
this.pairs.add(new PlainNameValuePair("withProjection", false));
5757
return this;
5858
}
5959

6060
public DailyBalancesCriteria withPage(final int page, final int perPage) {
61-
this.pairs.add(new QueryParamEncodedPair("page", page));
62-
this.pairs.add(new QueryParamEncodedPair("perPage", perPage));
61+
this.pairs.add(new PlainNameValuePair("page", page));
62+
this.pairs.add(new PlainNameValuePair("perPage", perPage));
6363
return this;
6464
}
6565

6666
public DailyBalancesCriteria orderBy(final String... orders) {
6767
for (final String order : orders) {
68-
this.pairs.add(new QueryParamEncodedPair("order", order));
68+
this.pairs.add(new PlainNameValuePair("order", order));
6969
}
7070
return this;
7171
}

src/main/java/org/proshin/finapi/account/in/FpQueryCriteria.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.proshin.finapi.account.Type;
2828
import org.proshin.finapi.primitives.StringOf;
2929
import org.proshin.finapi.primitives.pair.CommaSeparatedPair;
30-
import org.proshin.finapi.primitives.pair.QueryParamEncodedPair;
30+
import org.proshin.finapi.primitives.pair.PlainNameValuePair;
3131

3232
public final class FpQueryCriteria implements Iterable<NameValuePair> {
3333

@@ -42,18 +42,18 @@ public FpQueryCriteria(final List<NameValuePair> pairs) {
4242
}
4343

4444
public FpQueryCriteria withIds(final Iterable<Long> ids) {
45-
this.pairs.add(new QueryParamEncodedPair(new CommaSeparatedPair<>("ids", ids)));
45+
this.pairs.add(new PlainNameValuePair(new CommaSeparatedPair<>("ids", ids)));
4646
return this;
4747
}
4848

4949
public FpQueryCriteria withSearch(final String search) {
50-
this.pairs.add(new QueryParamEncodedPair("search", search));
50+
this.pairs.add(new PlainNameValuePair("search", search));
5151
return this;
5252
}
5353

5454
public FpQueryCriteria withTypes(final Type... types) {
5555
this.pairs.add(
56-
new QueryParamEncodedPair(
56+
new PlainNameValuePair(
5757
new CommaSeparatedPair<>(
5858
"accountTypes",
5959
Arrays.stream(types)
@@ -66,13 +66,13 @@ public FpQueryCriteria withTypes(final Type... types) {
6666
}
6767

6868
public FpQueryCriteria withBankConnections(final Iterable<Long> ids) {
69-
this.pairs.add(new QueryParamEncodedPair(new CommaSeparatedPair<>("bankConnectionIds", ids)));
69+
this.pairs.add(new PlainNameValuePair(new CommaSeparatedPair<>("bankConnectionIds", ids)));
7070
return this;
7171
}
7272

7373
public FpQueryCriteria withMinLastSuccessfulUpdate(final OffsetDateTime minLastSuccessfulUpdate) {
7474
this.pairs.add(
75-
new QueryParamEncodedPair(
75+
new PlainNameValuePair(
7676
"minLastSuccessfulUpdate",
7777
new StringOf(minLastSuccessfulUpdate)
7878
)
@@ -82,7 +82,7 @@ public FpQueryCriteria withMinLastSuccessfulUpdate(final OffsetDateTime minLastS
8282

8383
public FpQueryCriteria withMaxLastSuccessfulUpdate(final OffsetDateTime maxLastSuccessfulUpdate) {
8484
this.pairs.add(
85-
new QueryParamEncodedPair(
85+
new PlainNameValuePair(
8686
"maxLastSuccessfulUpdate",
8787
new StringOf(maxLastSuccessfulUpdate)
8888
)
@@ -91,12 +91,12 @@ public FpQueryCriteria withMaxLastSuccessfulUpdate(final OffsetDateTime maxLastS
9191
}
9292

9393
public FpQueryCriteria withMinBalance(final BigDecimal minBalance) {
94-
this.pairs.add(new QueryParamEncodedPair("minBalance", new StringOf(minBalance)));
94+
this.pairs.add(new PlainNameValuePair("minBalance", new StringOf(minBalance)));
9595
return this;
9696
}
9797

9898
public FpQueryCriteria withMaxBalance(final BigDecimal maxBalance) {
99-
this.pairs.add(new QueryParamEncodedPair("maxBalance", new StringOf(maxBalance)));
99+
this.pairs.add(new PlainNameValuePair("maxBalance", new StringOf(maxBalance)));
100100
return this;
101101
}
102102

src/main/java/org/proshin/finapi/bank/in/BanksCriteria.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.proshin.finapi.primitives.BankingInterface;
2525
import org.proshin.finapi.primitives.paging.PagingCriteria;
2626
import org.proshin.finapi.primitives.pair.CommaSeparatedPair;
27-
import org.proshin.finapi.primitives.pair.QueryParamEncodedPair;
27+
import org.proshin.finapi.primitives.pair.PlainNameValuePair;
2828

2929
public final class BanksCriteria implements Iterable<NameValuePair> {
3030

@@ -39,12 +39,12 @@ public BanksCriteria(final List<NameValuePair> pairs) {
3939
}
4040

4141
public BanksCriteria withIds(final Iterable<Long> ids) {
42-
this.pairs.add(new QueryParamEncodedPair(new CommaSeparatedPair<>("ids", ids)));
42+
this.pairs.add(new PlainNameValuePair(new CommaSeparatedPair<>("ids", ids)));
4343
return this;
4444
}
4545

4646
public BanksCriteria withSearch(final String search) {
47-
this.pairs.add(new QueryParamEncodedPair("search", search));
47+
this.pairs.add(new PlainNameValuePair("search", search));
4848
return this;
4949
}
5050

@@ -53,7 +53,7 @@ public BanksCriteria withSearch(final String search) {
5353
*/
5454
@Deprecated
5555
public BanksCriteria withSupporting(final boolean supporting) {
56-
this.pairs.add(new QueryParamEncodedPair("isSupported", supporting));
56+
this.pairs.add(new PlainNameValuePair("isSupported", supporting));
5757
return this;
5858
}
5959

@@ -62,7 +62,7 @@ public BanksCriteria withSupporting(final boolean supporting) {
6262
*/
6363
@Deprecated
6464
public BanksCriteria withPinsAreVolatile(final boolean pinsAreVolatile) {
65-
this.pairs.add(new QueryParamEncodedPair("pinsAreVolatile", pinsAreVolatile));
65+
this.pairs.add(new PlainNameValuePair("pinsAreVolatile", pinsAreVolatile));
6666
return this;
6767
}
6868

@@ -71,25 +71,25 @@ public BanksCriteria withPinsAreVolatile(final boolean pinsAreVolatile) {
7171
*/
7272
@Deprecated
7373
public BanksCriteria withSupportedDataSources(final Iterable<Bank.DataSource> supportedDataSources) {
74-
this.pairs.add(new QueryParamEncodedPair(new CommaSeparatedPair<>("supportedDataSources",
74+
this.pairs.add(new PlainNameValuePair(new CommaSeparatedPair<>("supportedDataSources",
7575
supportedDataSources
7676
)));
7777
return this;
7878
}
7979

8080
public BanksCriteria withSupportedInterfaces(final Iterable<BankingInterface> supportedInterfaces) {
81-
this.pairs.add(new QueryParamEncodedPair(new CommaSeparatedPair<>("supportedInterfaces", supportedInterfaces)));
81+
this.pairs.add(new PlainNameValuePair(new CommaSeparatedPair<>("supportedInterfaces", supportedInterfaces)));
8282
return this;
8383
}
8484

8585
public BanksCriteria withLocation(final Iterable<String> location) {
86-
this.pairs.add(new QueryParamEncodedPair(new CommaSeparatedPair<>("location", location)));
86+
this.pairs.add(new PlainNameValuePair(new CommaSeparatedPair<>("location", location)));
8787
return this;
8888
}
8989

9090
public BanksCriteria withTppAuthenticationGroups(final Iterable<Long> tppAuthenticationGroups) {
9191
this.pairs.add(
92-
new QueryParamEncodedPair(
92+
new PlainNameValuePair(
9393
new CommaSeparatedPair<>(
9494
"tppAuthenticationGroupIds",
9595
tppAuthenticationGroups
@@ -98,7 +98,7 @@ public BanksCriteria withTppAuthenticationGroups(final Iterable<Long> tppAuthent
9898
}
9999

100100
public BanksCriteria withTestBank(final boolean testBank) {
101-
this.pairs.add(new QueryParamEncodedPair("isTestBank", testBank));
101+
this.pairs.add(new PlainNameValuePair("isTestBank", testBank));
102102
return this;
103103
}
104104

src/main/java/org/proshin/finapi/category/in/CashFlowsCriteria.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import org.proshin.finapi.primitives.Direction;
2626
import org.proshin.finapi.primitives.StringOf;
2727
import org.proshin.finapi.primitives.pair.CommaSeparatedPair;
28-
import org.proshin.finapi.primitives.pair.QueryParamEncodedPair;
28+
import org.proshin.finapi.primitives.pair.PlainNameValuePair;
2929

3030
public final class CashFlowsCriteria implements Iterable<NameValuePair> {
3131

@@ -40,93 +40,93 @@ public CashFlowsCriteria(final List<NameValuePair> pairs) {
4040
}
4141

4242
public CashFlowsCriteria withSearch(final String search) {
43-
this.pairs.add(new QueryParamEncodedPair("search", search));
43+
this.pairs.add(new PlainNameValuePair("search", search));
4444
return this;
4545
}
4646

4747
public CashFlowsCriteria withCounterpart(final String counterpart) {
48-
this.pairs.add(new QueryParamEncodedPair("counterpart", counterpart));
48+
this.pairs.add(new PlainNameValuePair("counterpart", counterpart));
4949
return this;
5050
}
5151

5252
public CashFlowsCriteria withPurpose(final String purpose) {
53-
this.pairs.add(new QueryParamEncodedPair("purpose", purpose));
53+
this.pairs.add(new PlainNameValuePair("purpose", purpose));
5454
return this;
5555
}
5656

5757
public CashFlowsCriteria withAccounts(final Iterable<Long> accounts) {
58-
this.pairs.add(new QueryParamEncodedPair(new CommaSeparatedPair<>("accountIds", accounts)));
58+
this.pairs.add(new PlainNameValuePair(new CommaSeparatedPair<>("accountIds", accounts)));
5959
return this;
6060
}
6161

6262
public CashFlowsCriteria withMinBankBookingDate(final LocalDate minBankBookingDate) {
63-
this.pairs.add(new QueryParamEncodedPair("minBankBookingDate", new StringOf(minBankBookingDate)));
63+
this.pairs.add(new PlainNameValuePair("minBankBookingDate", new StringOf(minBankBookingDate)));
6464
return this;
6565
}
6666

6767
public CashFlowsCriteria withMaxBankBookingDate(final LocalDate maxBankBookingDate) {
68-
this.pairs.add(new QueryParamEncodedPair("maxBankBookingDate", new StringOf(maxBankBookingDate)));
68+
this.pairs.add(new PlainNameValuePair("maxBankBookingDate", new StringOf(maxBankBookingDate)));
6969
return this;
7070
}
7171

7272
public CashFlowsCriteria withMinFinapiBookingDate(final LocalDate minFinapiBookingDate) {
73-
this.pairs.add(new QueryParamEncodedPair("minFinapiBookingDate", new StringOf(minFinapiBookingDate)));
73+
this.pairs.add(new PlainNameValuePair("minFinapiBookingDate", new StringOf(minFinapiBookingDate)));
7474
return this;
7575
}
7676

7777
public CashFlowsCriteria withMaxFinapiBookingDate(final LocalDate maxFinapiBookingDate) {
78-
this.pairs.add(new QueryParamEncodedPair("maxFinapiBookingDate", new StringOf(maxFinapiBookingDate)));
78+
this.pairs.add(new PlainNameValuePair("maxFinapiBookingDate", new StringOf(maxFinapiBookingDate)));
7979
return this;
8080
}
8181

8282
public CashFlowsCriteria withMinAmount(final BigDecimal minAmount) {
83-
this.pairs.add(new QueryParamEncodedPair("minAmount", new StringOf(minAmount)));
83+
this.pairs.add(new PlainNameValuePair("minAmount", new StringOf(minAmount)));
8484
return this;
8585
}
8686

8787
public CashFlowsCriteria withMaxAmount(final BigDecimal maxAmount) {
88-
this.pairs.add(new QueryParamEncodedPair("maxAmount", new StringOf(maxAmount)));
88+
this.pairs.add(new PlainNameValuePair("maxAmount", new StringOf(maxAmount)));
8989
return this;
9090
}
9191

9292
public CashFlowsCriteria withDirection(final Direction direction) {
93-
this.pairs.add(new QueryParamEncodedPair("direction", direction.lowerCase()));
93+
this.pairs.add(new PlainNameValuePair("direction", direction.lowerCase()));
9494
return this;
9595
}
9696

9797
public CashFlowsCriteria withLabels(final Iterable<Long> labels) {
98-
this.pairs.add(new QueryParamEncodedPair(new CommaSeparatedPair<>("labelIds", labels)));
98+
this.pairs.add(new PlainNameValuePair(new CommaSeparatedPair<>("labelIds", labels)));
9999
return this;
100100
}
101101

102102
public CashFlowsCriteria withCategories(final Iterable<Long> categories) {
103-
this.pairs.add(new QueryParamEncodedPair(new CommaSeparatedPair<>("categoryIds", categories)));
103+
this.pairs.add(new PlainNameValuePair(new CommaSeparatedPair<>("categoryIds", categories)));
104104
return this;
105105
}
106106

107107
public CashFlowsCriteria withIsNew(final boolean isNew) {
108-
this.pairs.add(new QueryParamEncodedPair("isNew", isNew));
108+
this.pairs.add(new PlainNameValuePair("isNew", isNew));
109109
return this;
110110
}
111111

112112
public CashFlowsCriteria withMinImportDate(final LocalDate minImportDate) {
113-
this.pairs.add(new QueryParamEncodedPair("minImportDate", new StringOf(minImportDate)));
113+
this.pairs.add(new PlainNameValuePair("minImportDate", new StringOf(minImportDate)));
114114
return this;
115115
}
116116

117117
public CashFlowsCriteria withMaxImportDate(final LocalDate maxImportDate) {
118-
this.pairs.add(new QueryParamEncodedPair("maxImportDate", new StringOf(maxImportDate)));
118+
this.pairs.add(new PlainNameValuePair("maxImportDate", new StringOf(maxImportDate)));
119119
return this;
120120
}
121121

122122
public CashFlowsCriteria withoutSubCashFlows() {
123-
this.pairs.add(new QueryParamEncodedPair("includeSubCashFlows", false));
123+
this.pairs.add(new PlainNameValuePair("includeSubCashFlows", false));
124124
return this;
125125
}
126126

127127
public CashFlowsCriteria withOrdering(final String... orders) {
128128
for (final String order : orders) {
129-
this.pairs.add(new QueryParamEncodedPair("order", order));
129+
this.pairs.add(new PlainNameValuePair("order", order));
130130
}
131131
return this;
132132
}

src/main/java/org/proshin/finapi/category/in/CategoriesCriteria.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import javax.annotation.Nonnull;
2222
import org.apache.http.NameValuePair;
2323
import org.proshin.finapi.primitives.pair.CommaSeparatedPair;
24-
import org.proshin.finapi.primitives.pair.QueryParamEncodedPair;
24+
import org.proshin.finapi.primitives.pair.PlainNameValuePair;
2525

2626
public final class CategoriesCriteria implements Iterable<NameValuePair> {
2727

@@ -36,29 +36,29 @@ public CategoriesCriteria(final List<NameValuePair> pairs) {
3636
}
3737

3838
public CategoriesCriteria withIds(final Iterable<Long> ids) {
39-
this.pairs.add(new QueryParamEncodedPair(new CommaSeparatedPair<>("ids", ids)));
39+
this.pairs.add(new PlainNameValuePair(new CommaSeparatedPair<>("ids", ids)));
4040
return this;
4141
}
4242

4343
public CategoriesCriteria withSearch(final String search) {
44-
this.pairs.add(new QueryParamEncodedPair("search", search));
44+
this.pairs.add(new PlainNameValuePair("search", search));
4545
return this;
4646
}
4747

4848
public CategoriesCriteria withIsCustom(final boolean isCustom) {
49-
this.pairs.add(new QueryParamEncodedPair("isCustom", isCustom));
49+
this.pairs.add(new PlainNameValuePair("isCustom", isCustom));
5050
return this;
5151
}
5252

5353
public CategoriesCriteria withPage(final int page, final int perPage) {
54-
this.pairs.add(new QueryParamEncodedPair("page", page));
55-
this.pairs.add(new QueryParamEncodedPair("perPage", perPage));
54+
this.pairs.add(new PlainNameValuePair("page", page));
55+
this.pairs.add(new PlainNameValuePair("perPage", perPage));
5656
return this;
5757
}
5858

5959
public CategoriesCriteria orderBy(final String... orders) {
6060
for (final String order : orders) {
61-
this.pairs.add(new QueryParamEncodedPair("order", order));
61+
this.pairs.add(new PlainNameValuePair("order", order));
6262
}
6363
return this;
6464
}

0 commit comments

Comments
 (0)