Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8001] iOS: Can write to a BufferStream created in read-only mode

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Do
Resolution Date2020-01-09T21:34:50.000+0000
Affected Version/sRelease 1.8.2, Release 3.1.0
Fix Version/sn/a
ComponentsiOS
Labelsparity, reprod
ReporterArthur Evans
AssigneeUnknown
Created2012-03-14T12:36:16.000+0000
Updated2020-01-09T21:34:50.000+0000

Description

When writing to a buffer stream created with MODE_READ, Android throws an exception, as expected, but iOS reports a successful write. Code sample follows:
var win1 = Titanium.UI.createWindow({
	title : 'Tab 1',
	backgroundColor : '#fff'
});
win1.open();

var stream1 = Ti.Stream.createStream({
	source : Ti.createBuffer({
		value: "Now is the time for all good men to come to the aid of their country. Or party. Or something. Honestly, I don't remember."
	}),
	mode : Ti.Stream.MODE_READ
});

var stream2 = Ti.Stream.createStream({
	source : Ti.createBuffer({
                // Note that if the buffer is not initialized with a length or data, iOS throws a different exception.
		length: 100
	}),
        // Ooops! It's a read-only stream!
	mode : Ti.Stream.MODE_READ
});
var sync = true;
if(sync) {
	var bytes = Ti.Stream.writeStream(stream1, stream2, 100);
	Ti.API.info("Bytes written: " + bytes);
} else {
	Ti.Stream.writeStream(stream1, stream2, 1024, function(arg) {
		Ti.API.info("bytes processed: " + arg.bytesProcessed);
		Ti.API.info("Event: " + JSON.stringify(arg, false, 2));
	});
}

Comments

  1. jithinpv 2013-04-04

    Issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 iOS iPhone Simulator: iOS SDK version: 6.0
  2. Lee Morris 2017-06-23

    I am able to reproduce this issue with the following environment; iPhone 7 (10.2) Studio 4.9.0.201705302345 Ti SDK 6.1.1.v20170620103414 Appc NPM 4.2.9 Appc CLI 6.2.1 Ti CLI 5.0.13 Alloy 1.9.11 Arrow 2.0.0 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131
  3. Alan Hutton 2020-01-09

    It has been decided that this issue should be closed as “Won’t do.” This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. If community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.

JSON Source