Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 362152

Summary: Print the default decimal type throws exception
Product: z_Archived Reporter: fahua jin <jinfahua>
Component: EDTAssignee: Project Inbox <edt.javascriptgen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jeffdouglas, jqian, pharmon, svihovec, zhuzhi
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description fahua jin CLA 2011-10-27 02:13:42 EDT
Build Identifier: 0.7.0.v201110241434

Create an RUIHandler, and copy following code to the start function. You can find an exception is thrown by clicking view the handler in external web browser.

    	decimalType decimal?;
    	syslib.writeStdout("decimalType " + decimalType);

Reproducible: Always
Comment 1 Brian Svihovec CLA 2011-10-31 23:13:53 EDT
If the exception being thrown is a NullValueException, then this is working as designed.  If otherwise, please include the exception here.
Comment 2 fahua jin CLA 2011-10-31 23:28:06 EDT
(In reply to comment #1)
> If the exception being thrown is a NullValueException, then this is working as
> designed.  If otherwise, please include the exception here.

The exception cannot be found now, I tried following two variants.

If has following statements, it prints NullPointerException.
        decimalType decimal?;
        syslib.writeStdout(decimalType);

If has following statements, it prints "decimalType ".
        decimalType decimal?;
        syslib.writeStdout("decimalType " + decimalType);


Does it work as design?
Comment 3 Brian Svihovec CLA 2011-11-01 13:36:39 EDT
Both snippets in comment 2 should be throwing a NullValueException.

There are issues here with both Java and JavaScript.

Java correctly throws a NVE for:

decimalType decimal?;
syslib.writeStdout(decimalType);

Java is not throwing an NVE for the following when it should be:

decimalType decimal?;
syslib.writeStdout("decimalType " + decimalType);

The + operator for EString does not accept nullable types:

static function $Plus(lvalue EString in, rvalue EString in) returns(EString) {@Operation{"+"}};

JavaScript is throwing a runtime exception on the null values and is not throwing an EGL NVE.

Also, Paul, can you update the ?: operator in EString to allow null values to be passed in?

/**
	 * {@Operation ?:} Concatenates two strings.  If either is null then null is returned.
	 */
	static function $ConcatNull(value EString in, rvalue EString in) returns(EString) {@Operation{"?:"}};
Comment 4 Brian Svihovec CLA 2011-11-22 15:55:35 EST
I opened Bug 364517 - String + operator does not throw a NVE for Java.
Comment 5 Brian Svihovec CLA 2011-11-22 16:00:03 EST
I opened Bug 364519 - String + operator does not throw a NVE for JavaScript.  

I believe the original problem found in this defect has been resolved and this defect should be closed.
Comment 6 Jing Qian CLA 2011-11-22 16:02:45 EST
      decimalType decimal?;
        syslib.writeStdout(decimalType);

throws NVE for both java and javascript
Comment 7 Zhi Zhu CLA 2011-11-23 00:34:37 EST
Now the bug behaves like bug Bug 364519 , so I close this one