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

xml parsing error #9

Open
mwangidennis1 opened this issue Sep 27, 2024 · 0 comments
Open

xml parsing error #9

mwangidennis1 opened this issue Sep 27, 2024 · 0 comments

Comments

@mwangidennis1
Copy link

Description

The fromXml method in XmlParserReader class is throwing an error when trying to deserialize an XML file using JAXB.

Steps to Reproduce

  1. put some strings you want to translate in the output.xml file
  2. run the ./mobile-translate.sh
  3. Enter the L (translation) then A (android) then the path to the output.xml path
  4. observe the error

Code

INFO: No strings found in xml
Exception in thread "main" java.lang.NullPointerException: Cannot read the array length because the return value of "com.owino.mobiletranslate.android.model.Resources.getStrings()" is null
at com.owino.mobiletranslate.android.translate.AndroidTranslateFactory.translateResources(AndroidTranslateFactory.java:26)
at com.owino.mobiletranslate.android.translate.AndroidTranslateFactory.getTranslatedResources(AndroidTranslateFactory.java:20)
at com.owino.mobiletranslate.android.xml.XmlParserReader.executeXmlAndTranslationParser(XmlParserReader.java:31)
at com.owino.mobiletranslate.android.AndroidTranslationProcessor.runTranslation(AndroidTranslationProcessor.java:10)
at com.owino.mobiletranslate.TranslateApplication.main(TranslateApplication.java:28)

expected behavior

The project will generate localised content and place them in the project/target directory, in the format of [locale].xml e.g de.xml or zh.xml.

Actual behavior

The method 'executeXmlAndTranslationParser` in the class XmlParserReader expects a type of File as it inputs to its parameters but in the method main of TranslateApplication we pass a type string which is the path to the xml file hence a type mismatch leading to the xml file not being parsed well

environment

ran it on windows 10 and arch
both have openjdk17

possible solution

if allowed will fix it since my main goal was to take care of previous issues on the issues page

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

1 participant