Skip to content

Commit

Permalink
Merge pull request #926 from dimagi/bug/form-record-process-parse-fai…
Browse files Browse the repository at this point in the history
…lure-2.25

Hotfix 2.25.1: Form record process parse failure
  • Loading branch information
philomates committed Dec 23, 2015
2 parents 6280e3d + 04cf989 commit 3ab6b03
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions app/src/org/commcare/android/models/logic/FormRecordProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import org.commcare.android.util.FormUploadUtil;
import org.commcare.core.process.XmlFormRecordProcessor;
import org.commcare.dalvik.application.CommCareApplication;
import org.commcare.data.xml.TransactionParser;
import org.commcare.xml.AndroidTransactionParserFactory;
import org.commcare.xml.LedgerXmlParsers;
import org.javarosa.xml.util.InvalidStructureException;
import org.javarosa.xml.util.UnfullfilledRequirementsException;
import org.kxml2.io.KXmlParser;
Expand Down Expand Up @@ -61,12 +63,20 @@ public FormRecord process(FormRecord record)
FormUploadUtil.getDecryptCipher((new SecretKeySpec(record.getAesKey(), "AES")));
InputStream is = new CipherInputStream(new FileInputStream(f), decrypter);

AndroidTransactionParserFactory factory = new AndroidTransactionParserFactory(c, null);

factory.initCaseParser();
factory.initStockParser();
AndroidTransactionParserFactory factory = new AndroidTransactionParserFactory(c, null) {
@Override
public TransactionParser getParser(KXmlParser parser) {
String namespace = parser.getNamespace();
String name = parser.getName();
if (LedgerXmlParsers.STOCK_XML_NAMESPACE.equals(namespace) || "case".equalsIgnoreCase(name)) {
return super.getParser(parser);
} else {
return null;
}
}
};

XmlFormRecordProcessor.process(new AndroidSandbox(CommCareApplication._()), is, factory);
XmlFormRecordProcessor.process(null, is, factory);

//Let anyone who is listening know!
Intent i = new Intent("org.commcare.dalvik.api.action.data.update");
Expand Down

0 comments on commit 3ab6b03

Please sign in to comment.