Permalink
Browse files

Merge branch 'master' of ee-git.groupinfra.com:RIA/digidoc4j

  • Loading branch information...
Indrek Jentson
Indrek Jentson committed Jun 29, 2017
2 parents 9fb8bea + da3988c commit e42463eb0cbaf8e2de62197179e75e9e10055688
@@ -106,8 +106,12 @@ private void validateOpenedContainerExceptions(ArrayList<DigiDocException> openC
private DigiDocException getFatalError(List<DigiDocException> openContainerExceptions) {
DigiDocException exception = null;
for (DigiDocException openContainerException : openContainerExceptions) {
if (openContainerException.getCode() == DigiDocException.ERR_PARSE_XML) {
if (openContainerException.getCode() == DigiDocException.ERR_PARSE_XML
&& openContainerException.getMessage() != null
&& openContainerException.getMessage().contains("Invalid xml file")) {
exception = new DigiDocException(DigiDocException.ERR_PARSE_XML, "Invalid input file format.", openContainerException.getNestedException());
}else{
exception = openContainerException;
}
}
return exception;
@@ -82,4 +82,42 @@ public void testErrorTextDDOCInvalidFileFormat(){
assertTrue( e.getMessage().contains("Invalid input file format."));
}
}
}
@Test
public void testErrorText75NotChanged(){
try {
Container container = ContainerBuilder.
aContainer().
fromExistingFile("testFiles/invalid-containers/23181_SignedInfo_topelt_D1_lisatud.ddoc").
build();
} catch (DigiDoc4JException e){
assertTrue( e.getMessage().contains("Multiple elements: SignatureValue not allowed under: Signature"));
}
}
@Test
public void testErrorText75ChangedAndNullPointer(){
try {
Container container = ContainerBuilder.
aContainer().
fromExistingFile("testFiles/invalid-containers/23133_ddoc-12.ddoc").
build();
} catch (DigiDoc4JException e){
assertTrue( e.getMessage().contains("Invalid input file format."));
}
}
@Test
public void testErrorText75NotChangedInvalidXmlElement(){
try {
Container container = ContainerBuilder.
aContainer().
fromExistingFile("testFiles/invalid-containers/BOF.ddoc").
build();
} catch (DigiDoc4JException e){
assertTrue( e.getMessage().contains("Invalid xml element"));
}
}
}
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<SignedDoc format="DIGIDOC-XML" version="1.3" xmlns="http://www.sk.ee/DigiDoc/v1.3.0#">
<DataFile ContentType="EMBEDDED_BASE64" Filename="secret.txt" Id="D0" MimeType="application/octet-stream" Size="0" xmlns="http://www.sk.ee/DigiDoc/v1.3.0#"></DataFile>
<Signature Id="S0" xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">
</CanonicalizationMethod>
<SignatureMethod>
</SignatureMethod>
<Reference>
<DigestMethod>
</DigestMethod>
<DigestValue></DigestValue>
</Reference>
<Reference>
<DigestMethod>
</DigestMethod>
<DigestValue>
</DigestValue>
</Reference>
</SignedInfo>
</Signature>
</SignedDoc>
Oops, something went wrong.

0 comments on commit e42463e

Please sign in to comment.