Summary: | [archivehandlers] zipped text files have unexpected contents | ||||||
---|---|---|---|---|---|---|---|
Product: | [Tools] Target Management | Reporter: | Sanjayan Eladchumanasamy <sanjayan> | ||||
Component: | RSE | Assignee: | Xuan Chen <xuanchen> | ||||
Status: | CLOSED FIXED | QA Contact: | Martin Oberhuber <mober.at+eclipse> | ||||
Severity: | normal | ||||||
Priority: | P3 | CC: | kjdoyle, kmunir | ||||
Version: | 2.0 | Keywords: | contributed | ||||
Target Milestone: | 2.0.1 | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Sanjayan Eladchumanasamy
2007-04-10 11:55:07 EDT
Xuan can you look at this? The content of the file itself is correct. But when it is written to editor, we add extra character into it. The problem is in SystemZipHandler#extractVirtualFile(): byte[] buf = new byte[1024]; int numRead = reader.read(buf); while (numRead > 0) { if (isText) { String bufString = new String(buf, sourceEncoding); ^^^^^^^^^^^^^^^^^^^^^^^^^^^ byte[] convertedBuf = bufString.getBytes(); int newSize = convertedBuf.length; writer.write(convertedBuf, 0, newSize); } else { writer.write(buf, 0, numRead); } So, in the case of handling text file, we don't make use of numRead. The bufString will have the length of 1024 in this case. We should use: String bufString = new String(buf, 0, numRead, sourceEncoding); instead. I will provide the patch after bug 194293 has been committed. Tar file does not have this problem. Created attachment 73715 [details] Fix for bug 181784 Legal Message: I, Xuan Chen, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this contribution under the EPL. I committed the patch to cvs. Since the contribution was made before Xuan became committer, it's a good question whether this needs to be logged in our IP Log (tm-log.csv in the www-tm-dev project). I filed an IPBug for this on http://dev.eclipse.org/committers/ in order to ask the EMO Legal team -- feel free to CC if you are interested. https://dev.eclipse.org/ipzilla/show_bug.cgi?id=1632 Until this is resolved, I'm setting keyword "contributed" and target milestone 2.0.1 -- Xuan please do add it to the tm-log.csv file (as an exercise :-) I updated tm-log.csv. Please check to see if it is correct. It seems I just need to update it directly in my workspace. Didn't need to commit the change. Verified this problem is fixed in 2.0.1 RC1 driver. |