Skip to content

Commit 0a8261b

Browse files
authored
Corrected Build Issues on Windows (OpenFeign#906)
A number of new changes introduced do not build on Windows machines. This PR corrects the following issues: * Java11 POM Parent * BOM Plugin Template Paths for Windows and Unix/Linux/Mac * SOAP Default encoding is now set to UTF-8 by default, not System default.
1 parent 11c6dd8 commit 0a8261b

File tree

5 files changed

+56
-42
lines changed

5 files changed

+56
-42
lines changed

.travis.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ script:
2222

2323
cache:
2424
directories:
25-
- $HOME/.m2
25+
- $HOME/.m2
2626

27-
#matrix:
28-
# include:
29-
# - os: linux
30-
# jdk: oraclejdk8
31-
# addons:
32-
# apt:
33-
# packages:
34-
# - oracle-java8-installer
35-
#- os: linux
36-
# jdk: openjdk8
37-
#- os: linux
38-
# jdk: openjdk11
27+
matrix:
28+
include:
29+
- os: linux
30+
jdk: oraclejdk8
31+
addons:
32+
apt:
33+
packages:
34+
- oracle-java8-installer
35+
- os: linux
36+
jdk: openjdk8
37+
- os: linux
38+
jdk: openjdk11
3939

4040
# Don't build release tags. This avoids publish conflicts because the version commit exists both on master and the release tag.
4141
# See https://github.com/travis-ci/travis-ci/issues/1532
@@ -45,18 +45,18 @@ branches:
4545

4646
env:
4747
global:
48-
# Ex. travis encrypt BINTRAY_USER=your_github_account
49-
- secure: "VeTOgXwhZLf8uwlnYpB9tuY+NV6kiooRN0FMDoWCXuPPSz/tX2mqmshBXDYsJu0EcRtZb21MkbQwbdJ8Th9K/bvj4sGNK1PrBm9Hmz6e2AvAcxn3ROv86GMTkd7O25OsipTT+/qWrbR3s3lHQxYo5WMsrlEmJ/EF5y5Go5wx90c="
50-
# Ex. travis encrypt BINTRAY_KEY=xxx-https://bintray.com/profile/edit-xxx --add
51-
- secure: "WND+fjAqpdHArSbXAK7l0dpQLrX0hL/XymV02rhe0pVT1g0J1V32ncqDCVnn/73wTiECTen6y3o1vq3ByIdT9tUErt3o8oEROQsI/cVX9IhvJ/DtcW1lqafXKmQZwDQsifVxhKroW1VuZQbGrKnqVUzfqx5OzxgoNVWpkkxhf50="
52-
# Ex. travis encrypt GH_USER_EMAIL=for_github@domain.com --add
53-
- secure: "dG1Qt8bqe3TsmLOmYpWYsI55N0zLWCsupdpS7zMOedpM2q0laac56uc2gGV6qQIPdJQdCWzr9CE/h1nG4lJdJfreC13reQ3PDF79Yh8tMvdO1iwrSeIQ7eeRY6hs72GUtdIhfwetUgwCgIJpmBHS7O3yJhxQAOmu5twAuABiuSE="
54-
# Ex. travis encrypt GH_USER=your_github_account --add
55-
- secure: "DY28uU8wadasLCWSpl6KJyilGAAjSKzr3VPQ8by02eLDaAgCVq5KeYM0tjM804Rzhq3bjcXofaldj9QpWNTYC5SL6IIN5I5W+dWIZ8JzZ/rjOZgtJMMr4zcjOc5set9MsTUirB694m3c8bzhQZkah9YwUa/OuX1D8Ym/806igsE="
56-
# Ex. travis encrypt GH_TOKEN=XXX-https://github.com/settings/tokens-XXX --add
57-
- secure: "NmydUhuJLZ/Eg0cpCz6eZiYvsLHtSYrLIAOT2VHfUdzl/Q3PGXoodTpTqRkW7Uuj5lSYYw6cQnhiTly2dvomQYj+es5hSfIzFLvlF0x7L+aFX2IySJhn2Cg8tp5H0hn2UL8t6jDfmdJrLwGKT6EsiXYIgt4dPWJ7ZZ1SRDFp2Cg="
58-
# Ex. travis encrypt SONATYPE_USER=your_sonatype_account
59-
- secure: "ONAU76S0WBGcQGf0mr7KxKQjFvhhu73GNuQG8j47pxhJojNlNpWBbu+EGkgaInWKMtO89iBtpicVlXZc06HtbSqv7L93gbMo+xgp5daLlQg4gocDixjB1I2oPPITFFoztu76nOA1IBWRLTKu+w+Y2tKOmzWm+5v2UKD6fz7SYoo="
60-
# Ex. travis encrypt SONATYPE_PASSWORD=your_sonatype_password
61-
- secure: "UaVTxnw8klS36WLAdcmubqrHIgS4o5NcIqQMPIihk0tv3VEvCJSGvc2b7EPyQZMvm5TR3mXq5IJUAHp8j3seAHfYWmLIZWzvn7Y5mLRw8Kh9up7GzXl8Idui0AEHAAL2mfvE9smlOKPS5D13LKc6tOGFER66itHW3Jg1QoijDmQ="
48+
# Ex. travis encrypt BINTRAY_USER=your_github_account
49+
- secure: "VeTOgXwhZLf8uwlnYpB9tuY+NV6kiooRN0FMDoWCXuPPSz/tX2mqmshBXDYsJu0EcRtZb21MkbQwbdJ8Th9K/bvj4sGNK1PrBm9Hmz6e2AvAcxn3ROv86GMTkd7O25OsipTT+/qWrbR3s3lHQxYo5WMsrlEmJ/EF5y5Go5wx90c="
50+
# Ex. travis encrypt BINTRAY_KEY=xxx-https://bintray.com/profile/edit-xxx --add
51+
- secure: "WND+fjAqpdHArSbXAK7l0dpQLrX0hL/XymV02rhe0pVT1g0J1V32ncqDCVnn/73wTiECTen6y3o1vq3ByIdT9tUErt3o8oEROQsI/cVX9IhvJ/DtcW1lqafXKmQZwDQsifVxhKroW1VuZQbGrKnqVUzfqx5OzxgoNVWpkkxhf50="
52+
# Ex. travis encrypt GH_USER_EMAIL=for_github@domain.com --add
53+
- secure: "dG1Qt8bqe3TsmLOmYpWYsI55N0zLWCsupdpS7zMOedpM2q0laac56uc2gGV6qQIPdJQdCWzr9CE/h1nG4lJdJfreC13reQ3PDF79Yh8tMvdO1iwrSeIQ7eeRY6hs72GUtdIhfwetUgwCgIJpmBHS7O3yJhxQAOmu5twAuABiuSE="
54+
# Ex. travis encrypt GH_USER=your_github_account --add
55+
- secure: "DY28uU8wadasLCWSpl6KJyilGAAjSKzr3VPQ8by02eLDaAgCVq5KeYM0tjM804Rzhq3bjcXofaldj9QpWNTYC5SL6IIN5I5W+dWIZ8JzZ/rjOZgtJMMr4zcjOc5set9MsTUirB694m3c8bzhQZkah9YwUa/OuX1D8Ym/806igsE="
56+
# Ex. travis encrypt GH_TOKEN=XXX-https://github.com/settings/tokens-XXX --add
57+
- secure: "NmydUhuJLZ/Eg0cpCz6eZiYvsLHtSYrLIAOT2VHfUdzl/Q3PGXoodTpTqRkW7Uuj5lSYYw6cQnhiTly2dvomQYj+es5hSfIzFLvlF0x7L+aFX2IySJhn2Cg8tp5H0hn2UL8t6jDfmdJrLwGKT6EsiXYIgt4dPWJ7ZZ1SRDFp2Cg="
58+
# Ex. travis encrypt SONATYPE_USER=your_sonatype_account
59+
- secure: "ONAU76S0WBGcQGf0mr7KxKQjFvhhu73GNuQG8j47pxhJojNlNpWBbu+EGkgaInWKMtO89iBtpicVlXZc06HtbSqv7L93gbMo+xgp5daLlQg4gocDixjB1I2oPPITFFoztu76nOA1IBWRLTKu+w+Y2tKOmzWm+5v2UKD6fz7SYoo="
60+
# Ex. travis encrypt SONATYPE_PASSWORD=your_sonatype_password
61+
- secure: "UaVTxnw8klS36WLAdcmubqrHIgS4o5NcIqQMPIihk0tv3VEvCJSGvc2b7EPyQZMvm5TR3mXq5IJUAHp8j3seAHfYWmLIZWzvn7Y5mLRw8Kh9up7GzXl8Idui0AEHAAL2mfvE9smlOKPS5D13LKc6tOGFER66itHW3Jg1QoijDmQ="
6262

java11/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<parent>
2020
<groupId>io.github.openfeign</groupId>
2121
<artifactId>parent</artifactId>
22-
<version>10.2.0-SNAPSHOT</version>
22+
<version>10.2.1-SNAPSHOT</version>
2323
</parent>
2424

2525
<artifactId>feign-java11</artifactId>

pom.xml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
<centralsync-maven-plugin.version>0.1.0</centralsync-maven-plugin.version>
8888
<maven-surefire-plugin.version>2.22.0</maven-surefire-plugin.version>
8989
<bom-generator.version>0.14.3</bom-generator.version>
90+
<bom.template.file.path>file://${project.basedir}/src/config/bom.xml</bom.template.file.path>
9091
</properties>
9192
<url>https://github.com/openfeign/feign</url>
9293
<inceptionYear>2012</inceptionYear>
@@ -547,14 +548,13 @@
547548
</execution>
548549
</executions>
549550
</plugin>
550-
551551
<plugin>
552552
<groupId>io.sundr</groupId>
553553
<artifactId>sundr-maven-plugin</artifactId>
554554
<version>${bom-generator.version}</version>
555555
<inherited>false</inherited>
556556
<configuration>
557-
<bomTemplateUrl>file://${project.basedir}/src/config/bom.xml</bomTemplateUrl>
557+
<bomTemplateUrl>${bom.template.file.path}</bomTemplateUrl>
558558
<boms>
559559
<bom>
560560
<artifactId>feign-bom</artifactId>
@@ -601,6 +601,17 @@
601601
</build>
602602

603603
<profiles>
604+
<profile>
605+
<id>windows</id>
606+
<activation>
607+
<os>
608+
<family>Windows</family>
609+
</os>
610+
</activation>
611+
<properties>
612+
<bom.template.file.path>file:///${project.basedir}/src/config/bom.xml</bom.template.file.path>
613+
</properties>
614+
</profile>
604615
<profile>
605616
<id>java11</id>
606617
<activation>

soap/src/main/java/feign/soap/SOAPEncoder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.io.IOException;
1818
import java.lang.reflect.Type;
1919
import java.nio.charset.Charset;
20+
import java.nio.charset.StandardCharsets;
2021
import javax.xml.bind.JAXBException;
2122
import javax.xml.bind.Marshaller;
2223
import javax.xml.parsers.DocumentBuilderFactory;
@@ -104,7 +105,7 @@ public SOAPEncoder(JAXBContextFactory jaxbContextFactory) {
104105
this.jaxbContextFactory = jaxbContextFactory;
105106
this.writeXmlDeclaration = true;
106107
this.formattedOutput = false;
107-
this.charsetEncoding = Charset.defaultCharset();
108+
this.charsetEncoding = StandardCharsets.UTF_8;
108109
this.soapProtocol = DEFAULT_SOAP_PROTOCOL;
109110
}
110111

@@ -147,7 +148,7 @@ public static class Builder {
147148
private JAXBContextFactory jaxbContextFactory;
148149
public boolean formattedOutput = false;
149150
private boolean writeXmlDeclaration = true;
150-
private Charset charsetEncoding = Charset.defaultCharset();
151+
private Charset charsetEncoding = StandardCharsets.UTF_8;
151152
private String soapProtocol = DEFAULT_SOAP_PROTOCOL;
152153

153154
/** The {@link JAXBContextFactory} for body part. */

soap/src/test/java/feign/soap/SOAPCodecTest.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,18 @@ public void encodesSoapWithCustomJAXBFormattedOuput() throws Exception {
189189
RequestTemplate template = new RequestTemplate();
190190
encoder.encode(mock, GetPrice.class, template);
191191

192-
assertThat(template).hasBody("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
193-
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
194-
" <SOAP-ENV:Header/>\n" +
195-
" <SOAP-ENV:Body>\n" +
196-
" <GetPrice>\n" +
197-
" <Item>Apples</Item>\n" +
198-
" </GetPrice>\n" +
199-
" </SOAP-ENV:Body>\n" +
200-
"</SOAP-ENV:Envelope>\n" +
201-
"");
192+
assertThat(template).hasBody(
193+
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + System.lineSeparator() +
194+
"<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">"
195+
+ System.lineSeparator() +
196+
" <SOAP-ENV:Header/>" + System.lineSeparator() +
197+
" <SOAP-ENV:Body>" + System.lineSeparator() +
198+
" <GetPrice>" + System.lineSeparator() +
199+
" <Item>Apples</Item>" + System.lineSeparator() +
200+
" </GetPrice>" + System.lineSeparator() +
201+
" </SOAP-ENV:Body>" + System.lineSeparator() +
202+
"</SOAP-ENV:Envelope>" + System.lineSeparator() +
203+
"");
202204
}
203205

204206
@Test

0 commit comments

Comments
 (0)