Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333767 - XMLSourceFromInputStream trim input data
Summary: XMLSourceFromInputStream trim input data
Status: NEW
Alias: None
Product: Data Tools
Classification: Tools
Component: Enablement:ODA (show other bugs)
Version: 1.8.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Mingxia Wu CLA
QA Contact: Xiaoying Gu CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-07 11:56 EST by Břetislav Če ník CLA
Modified: 2011-02-22 13:03 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Břetislav Če ník CLA 2011-01-07 11:56:03 EST
There are bad implementation of reading data in the class
org.eclipse.datatools.enablement.oda.xml.util.XMLSourceFromInputStream.LocalCache

on construtor LocalCache( InputStream in )

The constructor read data from InputStream to local memory variable cacheMem but on some platform - Tomcat on windows x64 it doesn't read all data but only first available block/packet.

public LocalCache( InputStream in ) throws OdaException
{
	assert in != null;
	try
	{
		memSize = in.read( cacheMem ); 
// !!! there is bug. It doesn't read data to end of stream or cacheMem.length. 
// It read only a few first kB from InputStream
		if ( memSize == MAX_MEMORY_CACHE_SIZE )
		{
.
.
.


Method read of InputStream class read only available data not all data to end of file. Result is that the xml data are trimmed.

I get this trouble in Tomcat 7 x64 Winddows 2008 x64 platform in HttpServlet that call Birt with setting "org.eclipse.datatools.enablement.oda.xml.inputStream" appContext property
Comment 1 Bin Feng CLA 2011-02-21 04:14:28 EST
The behavior of InputStream.read() is determined by the underlying implementation. There is little information about the InputStream being used for producing the problem. Could you provide more detailed info required for reproduced the problem?
Comment 2 Břetislav Če ník CLA 2011-02-22 13:03:56 EST
In Java API Specification for Inputstream method 
public int read(byte[] b)
         throws IOException

Reads some number of bytes from the input stream and stores them into the buffer array b. The number of bytes actually read is returned as an integer. This method blocks until input !!! data is available !!!, end of file is detected, or an exception is thrown. 

By the API specification one read method doesn't need to read all data of InputStream to EOF. 
If no data is available ie. reading from HttpServletRequest.getInputStream() method return control and next data will be available after some time.