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

IllegalArgumentException because of accessExternalDTD not supported on the Parser #38

Open
marceloprof opened this issue Nov 25, 2020 · 3 comments

Comments

@marceloprof
Copy link

Hi!

After the last commit on src/com/amazon/pay/impl/PayLogUtil.java (Line 128)

image

it generates a IllegalArgumentException calling the com.amazon.pay.response.parser.Parser methods, probably because there the accessExternalDTD has been set as not supported:

image

Stacktrace:

java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD at org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:571) at com.amazon.pay.impl.PayLogUtil.getSanitizedData(PayLogUtil.java:126) at com.amazon.pay.impl.PayLogUtil.sanitizeString(PayLogUtil.java:75) at com.amazon.pay.response.parser.ResponseData.<init>(ResponseData.java:36) at com.amazon.pay.response.parser.GetOrderReferenceDetailsResponseData.<init>(GetOrderReferenceDetailsResponseData.java:30) at com.amazon.pay.response.parser.Parser.getOrderReferenceDetails(Parser.java:61)

@marceloprof marceloprof changed the title IllegalArgumentException because accessExternalDTD not supported on the Parser IllegalArgumentException because of accessExternalDTD not supported on the Parser Nov 25, 2020
@bjguillot
Copy link
Contributor

Can you share what version of Java you were running this against, and which XML parsing related jars/libraries you are using? The changes worked against our internal integration tests. I'll need to know more about your environment so that we can troubleshoot further.

@yuki-naki
Copy link

yuki-naki commented Mar 5, 2021

I have same problems of this issues.

because TransformerFactory and Xalan Dependency Conflict
so when try call some API can not working

※java version 11

@jamesgorrie
Copy link

We have seen this from the same update which was introduced in 3.6.4:
3.6.2...3.6.4#diff-d6aa52c278cef70f54019b3ccbbec94e6985cf71dbd86e732d66f9dae9b8ac24R126-R127

We are using:

  • JDK: Amazon Corretto v11
  • amazon-pay-java-sdk v3.7.1

The solution we have settled on is by overriding the TransformerFactory class:
https://www.google.com/url?sa=j&url=https%3A%2F%2Fgithub.com%2Fguardian%2Fsupport-frontend%2Fpull%2F5355&uct=1697555454&usg=lbVWXUIxK4Zq4p3bIt-oEfjEWCE.&opi=82159412&source=chat

A Java style implementation of this can be seen here:
https://stackoverflow.com/a/64364531

I do wonder, that given not all Transformers support this if there should be check or similar before setting these properties?

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

4 participants