"Error [2]: Error submitting XML Data" with Java 1.7
<p>I have an embedded system that sends a java script to run in a browser. It takes input in the browser and sends update to the embedded system's database.</p>

<p>It was designed and worked with Java 1.6. 
This is Java 1.6 trace:</p>

<pre><code>SubmitFormCommand:  SubmitToXML

SubmitFormCommand:  write ....

SubmitFormCommand:  read  results=1
</code></pre>

<p>However, with Java 1.7, when changes are sent to the embedded device, the embedded device can handle the change and updates the database, however, when it sends back <code>results=1</code>, Java trace shows exception:</p>

<pre><code>SubmitFormCommand:  SubmitToXML

SubmitFormCommand:  write ....

SubmitFormCommand:  Exception

Error [2]:  Error submitting XML Data
</code></pre>

<p>The browser pops up a message box and complaining <code>Error [2]: Error submitting XML Data</code>. As far as I can see, XML data is fine and has no change since the embedded device is running with the same firmware version. The only difference is Java version <strong>changed from 1.6 to 1.7</strong>.</p>

<p>After substantial debugging, I have found the code that is causing the problem:</p>

<pre><code>System.out.println ("SubmitFormCommand:  write  " + outputstring); //this line logs to java trace
os.writeBytes(outputstring); //this line writes XML data to the embedded system

os.flush(); //os is output  stream (not operating system)

os.close(); //closes output stream

// this.SetTimeoutMS (nTimeoutMS); //this line is taken out to prevent it being the problem, but prooved not the cause

BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
</code></pre>

<p>The <strong>last line</strong> is the line that causes exception. I have verified that the embedded system did send <code>results=1</code> (successful) to Java. However, exception occurs at <code>new InputStreamReader(conn.getInputStream())</code>. Hence, Java code never sees the <code>results=1</code> from the embedded system. </p>

<p>I have verified that the connection is still up. This line works with Java 1.6 but not Java 1.7</p>
