<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to 9: Tab characters in answers lead to a bad parse</title><link href="https://sourceforge.net/p/mturksdk-java/bugs/9/" rel="alternate"/><link href="https://sourceforge.net/p/mturksdk-java/bugs/9/feed.atom" rel="self"/><id>https://sourceforge.net/p/mturksdk-java/bugs/9/</id><updated>2008-12-17T21:14:43Z</updated><subtitle>Recent changes to 9: Tab characters in answers lead to a bad parse</subtitle><entry><title>Tab characters in answers lead to a bad parse</title><link href="https://sourceforge.net/p/mturksdk-java/bugs/9/" rel="alternate"/><published>2008-12-17T21:14:43Z</published><updated>2008-12-17T21:14:43Z</updated><author><name>Kris</name><uri>https://sourceforge.net/u/kbcarle/</uri></author><id>https://sourceforge.netfc2c30215edb0be076e0720655105fe1568115f9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Using GetResults.java I would occasionally see: "Error processing HIT results for HIT &amp;lt;hitid&amp;gt;: 25"&lt;/p&gt;
&lt;p&gt;I traced this to an ArrayIndexOutOfBounds Exception at line 109 of HitResultProcessor.java in processAnswers()&lt;/p&gt;
&lt;p&gt;The real culprit is in HitResults.java HitResults.getAnswers(). It builds a tab-delimited list without first checking if the answer strings already contain the delimiter.&lt;/p&gt;
&lt;p&gt;I've patched the problem with the following lines of code. However, I assume that the tab characters are not meaningful and can be removed. A better solution may be to enclose everything in quotes. &lt;/p&gt;
&lt;p&gt;In HitResults.getAnswers() at ~line: 203 of HitResults.java:&lt;/p&gt;
&lt;p&gt;if (answerValue != null) {&lt;br /&gt;
//PATCH - Tabs in Data Bug - Patched 17Dec2008 By kbcarle@gmail.com//         &lt;br /&gt;
answerValue = answerValue.replaceAll(Character.toString(DELIMITER), " ");&lt;br /&gt;
//optional: also replace newline chars&lt;br /&gt;
answerValue = answerValue.replaceAll("\n", " ");&lt;br /&gt;
//END PATCH       &lt;br /&gt;
result += answerValue + DELIMITER;&lt;br /&gt;
}&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>