Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mime type exception when validating BDOC container #134

Open
hello96 opened this issue Jul 12, 2024 · 2 comments
Open

Mime type exception when validating BDOC container #134

hello96 opened this issue Jul 12, 2024 · 2 comments

Comments

@hello96
Copy link

hello96 commented Jul 12, 2024

Hi everyone!
I'm getting a strange error when trying to validate a BDOC container:

image

My code:

                Container container = ContainerBuilder.aContainer(DocumentType.BDOC)
				.fromExistingFile(bdocFileName)
				.build();
		
		// Validate the container
		ContainerValidationResult result = container.validate();

		// Check if the container is valid
		boolean isContainerValid = result.isValid();

		// Get the validation errors and warnings
		List<DigiDoc4JException> validationErrors = result.getErrors();
		List<DigiDoc4JException> validationWarnings = result.getWarnings();
		List<DigiDoc4JException> containerErrors = result.getContainerErrors();// Container format errors
		List<DigiDoc4JException> containerWarnings = result.getContainerWarnings();

		String validationReport = result.getReport();
		
		result.saveXmlReports(reportFileName));
		System.out.println(validationErrors);

I think that the issue might concern this function in the ContainerOpener.java class:

WhatsApp Image 2024-07-12 at 12 07 44

In fact, in the read() function at line 126 it crushes by throwing the mentioned exception, assuming that it is an ASIC container before doing the checks that would follow.

Am I doing something wrong?

@Freeedy
Copy link

Freeedy commented Jul 15, 2024

Up

@heititobi
Copy link
Contributor

heititobi commented Jul 16, 2024

Hello, @hello96!

Is the mime type of the container defined as application/vnd.bdoc-1.0 (found in mimetype file)?
Could you please send your container to [email protected] so we can analyze further.

Today DigiDoc4j does support only ASIC-E standard based BDOC containers and in accordance of BDOC2.1 standard only mime type application/vnd.etsi.asic-e+zip is allowed.
More information on the subject can be found here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants