-
Notifications
You must be signed in to change notification settings - Fork 240
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
"java.lang.IllegalArgumentException: Illegal character in name 11474" error after upgrading to 2.1.3 from 1.5.2 #176
Comments
Are you creating xml out of those json data? I think xml elements have to start with non-digits. I would add a check in your program to add a prefix. (We use for example _ in some cases). if you show the whole stack trace it’s easier to tell, but I suspect the error might be from xml parser not from JDom. |
Thank you @ecki for the quick response. Yes, I am converting xml out of json data, yes, xml elements have to start with non-digit hence it is throwing error, but it was working fine with dom4j 1.5.2, the only difference is if I replace dom4j 1.5.2 to with dom4j 2.1.3 it is failing. Below is my code, here the Node is dom4j node: public List serializeToXml(String tag) { in the above function if the tag value starts with digit it is failing, I am converting the tag like this: private String makeXmlCompliantTag(String tag) { **after this it is working fine, but the json I am getting is from external application hence I don't want to modify the data, is there any other way to resolve this issue? ** why is it failing after dom4j upgrade? anything I can do to avoid strict check by dom4j? Really appreciate your help. Thanks |
Well, it looks like an intentional fix to make JDom more compliant. This is the change: c2a99d7 |
yes @ecki I agree with you it is to make it more compliant, but it is another application which I cannot control, can you make it configurable? because of this issue I got stuck with old dom4j(1.5.2), with this I am not able to address the vulnerabilities in my product. Thank you again for your prompt response. Thanks |
I don't want to add configuration options to these classes, because testing the configuration options would slow down code for everyone. In the future, I rather consider that it should be possible to use a custom implementation of these classes (i.e. |
Sure Filip, I will try to avoid using non-standard xml itself,
Thank you so much for your response.
Thanks
Ashok.
…On Fri, Dec 8, 2023 at 4:33 PM Filip Jirsák ***@***.***> wrote:
I don't want to add configuration options to these classes, because
testing the configuration options would slow down code for everyone. In the
future, I rather consider that it should be possible to use a custom
implementation of these classes (i.e. QName and Namespace would become an
interface, as is the case with Node and its descendants).
At the moment, probably the only option is to build dom4j yourself from
source and comment the above test there.
In general, I'd recommend trying to avoid using non-standard XML, because
you're bound to run into similar problems in virtually any software where
you work with such XML.
—
Reply to this email directly, view it on GitHub
<#176 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGZ5GFH6UUNBFYVQTO5RXH3YILXWXAVCNFSM6AAAAABAHGEYKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBWHE3DQNBTGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hi Team,
After upgrading to 2.1.3 from 1.5.2 I am getting java.lang.IllegalArgumentException: Illegal character in name 11474, if my name has number like below:
{"11474" : [{"name" : "dept",
"type" : "9",
"value" : "003|Engineering"},{"name" : "empid",
"type" : "5",
"value" : "spadmin"},{"name" : "empName",
"type" : "5",
"value" : "Administrator, Service Delivery"},{"name" : "reason",
"type" : "12",
"value" : "0"}]}
This was working fine in previous dom4j 1.5.2, if I add a prefix to 11474 like "string_11474", it is working fine.
{"string_11474" : [{"name" : "dept",
"type" : "9",
"value" : "003|Engineering"},{"name" : "empid",
"type" : "5",
"value" : "spadmin"},{"name" : "empName",
"type" : "5",
"value" : "Administrator, Service Delivery"},{"name" : "reason",
"type" : "12",
"value" : "0"}]}
But I am getting this data from external application which I cannot control, how to resolve this issue?
With this I am not able to upgrade from dom4j 1.5.2 to 2.1.3
Appreciate your help.
Thanks
Ashok.
The text was updated successfully, but these errors were encountered: