Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14573] Parity: Platforms all have different behavior if borderColor is set to null

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-07-30T00:39:00.000+0000
Affected Version/sRelease 3.1.1
Fix Version/s2013 Sprint 15 API, 2013 Sprint 15, Release 3.2.0
ComponentsAndroid
Labelsmodule_label, parity, qe-testadded
ReporterTony Lukasavage
AssigneeBiju pm
Created2013-07-16T21:45:25.000+0000
Updated2014-06-19T12:44:41.000+0000

Description

problem

When setting *borderColor* of a proxy to null, out supported platforms all have different behaviors:

ios

The borderColor is given the default solid color, which is black

mobileweb

The borderColor is made transparent

android

A force close happens and this error log is generated
W/dalvikvm(  765): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/TiApplication(  765): (main) [22789,22790] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 3.1.1,2013/06/15 16:10,f7592c1
E/TiApplication(  765): java.lang.NullPointerException
E/TiApplication(  765): 	at org.appcelerator.titanium.view.TiUIView.handleBorderProperty(TiUIView.java:1023)
E/TiApplication(  765): 	at org.appcelerator.titanium.view.TiUIView.propertyChanged(TiUIView.java:619)
E/TiApplication(  765): 	at ti.modules.titanium.ui.widget.TiUILabel.propertyChanged(TiUILabel.java:168)
E/TiApplication(  765): 	at org.appcelerator.kroll.KrollPropertyChange.fireEvent(KrollPropertyChange.java:21)
E/TiApplication(  765): 	at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1011)
E/TiApplication(  765): 	at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:316)
E/TiApplication(  765): 	at android.os.Handler.dispatchMessage(Handler.java:95)
E/TiApplication(  765): 	at android.os.Looper.loop(Looper.java:130)
E/TiApplication(  765): 	at android.app.ActivityThread.main(ActivityThread.java:3683)
E/TiApplication(  765): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/TiApplication(  765): 	at java.lang.reflect.Method.invoke(Method.java:507)
E/TiApplication(  765): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/TiApplication(  765): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/TiApplication(  765): 	at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(  765): FATAL EXCEPTION: main
E/AndroidRuntime(  765): java.lang.NullPointerException
E/AndroidRuntime(  765): 	at org.appcelerator.titanium.view.TiUIView.handleBorderProperty(TiUIView.java:1023)
E/AndroidRuntime(  765): 	at org.appcelerator.titanium.view.TiUIView.propertyChanged(TiUIView.java:619)
E/AndroidRuntime(  765): 	at ti.modules.titanium.ui.widget.TiUILabel.propertyChanged(TiUILabel.java:168)
E/AndroidRuntime(  765): 	at org.appcelerator.kroll.KrollPropertyChange.fireEvent(KrollPropertyChange.java:21)
E/AndroidRuntime(  765): 	at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1011)
E/AndroidRuntime(  765): 	at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:316)
E/AndroidRuntime(  765): 	at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(  765): 	at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime(  765): 	at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime(  765): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  765): 	at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(  765): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime(  765): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime(  765): 	at dalvik.system.NativeStart.main(Native Method)

expected

Whether the borderColor is turned to solid black or transparent, it needs to be uniform across platforms. Also, there should be no errors when setting borderColor to null.

test case

var win = Ti.UI.createWindow({
	backgroundColor: '#fff',
	modal: false,
	exitOnClose: true
});
var label = Ti.UI.createLabel({
	text: 'just a test label',
	borderColor: '#0f0',

	// note: borderWidth is required to cause the android exception
	borderWidth: 2
});
label.addEventListener('click', function(e) {
	label.borderColor = null;
});

win.add(label);
win.open();

Comments

  1. Biju pm 2013-07-23

    PR :- https://github.com/appcelerator/titanium_mobile/pull/4472
  2. Priya Agarwal 2013-10-10

    Verified the fix with: Appc-Studio: 3.2.0.201310100354 Sdk:3.2.0.v20131009134844 alloy:1.2.2 npm:1.3.2 titanium:3.2.0 titanium-code-processor:1.0.3 Device:Google Nexus 7(v4.3),ipodTouch1(v7.0) Xcode: 5 BorderColor when set to null for label in iOS turns black and in Android turns transparent.

JSON Source