Mantis - Hessian
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
4100 | minor | always | 07-01-10 08:08 | 07-01-10 08:08 | |
|
|||||
Reporter: | ferg | Platform: | |||
Assigned To: | OS: | ||||
Priority: | normal | OS Version: | |||
Status: | new | Product Version: | |||
Product Build: | Resolution: | open | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | |||
|
|||||
Summary: | 0004100: replace StringBuffer with StringBuilder for Android | ||||
Description: |
(rep by dilbert.elbonia) I ran into this issue while using Hessian on the Android platform. Android version 1.6 is severely affected and the problem is less serious on 2.1. In short the Hessian class com.caucho.hessian.io.Hessian2Input uses (and reuses) a private member StringBuffer _sbuf. Here is a snippet from said class: case 0x30: case 0x31: case 0x32: case 0x33: _isLastChunk = true; _chunkLength = (tag - 0x30) * 256 + read(); _sbuf.setLength(0); while ((ch = parseChar()) >= 0) _sbuf.append((char) ch); return _sbuf.toString(); This piece of code reads a char from the input and appends it to the _sbuf. When finished it returns the string to the caller via the toString() call. Due to an error in the Andriod implementation (for details check: http://code.google.com/p/android/issues/detail?id=9435) [^] it is possible that the call will return a string that occupies far more memory space than needed which is very bad on mobile devices. Also it seems that earlier Java implementations suffered from a similar problem: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4259569 [^] Since this is not strictly a Hessian bug I am reluctant to post a bug report but maybe a replacement of StringBuffer with a local StringBuilder should be considered. I made the replacement in my version and it solved the problem. |
||||
Steps To Reproduce: | |||||
Additional Information: | |||||
Relationships | |||||
Attached Files: |
There are no notes attached to this issue. |