<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 9: Tab characters in answers lead to a bad parse</title><link>https://sourceforge.net/p/mturksdk-java/bugs/9/</link><description>Recent changes to 9: Tab characters in answers lead to a bad parse</description><atom:link href="https://sourceforge.net/p/mturksdk-java/bugs/9/feed.rss" rel="self"/><language>en</language><lastBuildDate>Wed, 17 Dec 2008 21:14:43 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/mturksdk-java/bugs/9/feed.rss" rel="self" type="application/rss+xml"/><item><title>Tab characters in answers lead to a bad parse</title><link>https://sourceforge.net/p/mturksdk-java/bugs/9/</link><description>&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;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Kris</dc:creator><pubDate>Wed, 17 Dec 2008 21:14:43 -0000</pubDate><guid>https://sourceforge.netfc2c30215edb0be076e0720655105fe1568115f9</guid></item></channel></rss>