Merge pull request #92 from swsch/master
Byte order marks cause unit test failures with Java 1.8
This commit is contained in:
@@ -369,7 +369,7 @@ public class ZUGFeRDImporter {
|
|||||||
static String convertStreamToString(java.io.InputStream is) {
|
static String convertStreamToString(java.io.InputStream is) {
|
||||||
// source https://stackoverflow.com/questions/309424/how-do-i-read-convert-an-inputstream-into-a-string-in-java referring to
|
// source https://stackoverflow.com/questions/309424/how-do-i-read-convert-an-inputstream-into-a-string-in-java referring to
|
||||||
// https://community.oracle.com/blogs/pat/2004/10/23/stupid-scanner-tricks
|
// https://community.oracle.com/blogs/pat/2004/10/23/stupid-scanner-tricks
|
||||||
Scanner s = new Scanner(is).useDelimiter("\\A");
|
Scanner s = new Scanner(is, "UTF-8").useDelimiter("\\A");
|
||||||
return s.hasNext() ? s.next() : "";
|
return s.hasNext() ? s.next() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
|
|||||||
|
|
||||||
final byte[] UTF8ByteOrderMark = new byte[]{(byte) 0xef, (byte) 0xbb, (byte) 0xbf};
|
final byte[] UTF8ByteOrderMark = new byte[]{(byte) 0xef, (byte) 0xbb, (byte) 0xbf};
|
||||||
/* we have much more information than just in the basic profile (comfort or extended) but it's perfectly valid to provide more information, just not less. */
|
/* we have much more information than just in the basic profile (comfort or extended) but it's perfectly valid to provide more information, just not less. */
|
||||||
String ownZUGFeRDXML = new String(UTF8ByteOrderMark) + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
String ownZUGFeRDXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
||||||
"<rsm:CrossIndustryInvoice xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\">\n" +
|
"<rsm:CrossIndustryInvoice xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\">\n" +
|
||||||
" <rsm:ExchangedDocumentContext>\n" +
|
" <rsm:ExchangedDocumentContext>\n" +
|
||||||
" <ram:TestIndicator><udt:Indicator>false</udt:Indicator></ram:TestIndicator>\n" +
|
" <ram:TestIndicator><udt:Indicator>false</udt:Indicator></ram:TestIndicator>\n" +
|
||||||
|
|||||||
Reference in New Issue
Block a user