Community
Participate
Working Groups
Build Identifier: 0.7.0.v201110241434 Create a program, and copy following two lines of EGL code to the main function. -------------------------- times timeStamp?; syslib.writeStdout(times); -------------------------- Following exception will be thrown when running the program. A null value was used. eglx.lang.NullValueException A null value was used. at eglx.lang.AnyException.fillInStackTrace(AnyException.java:187) at java.lang.Throwable.<init>(Throwable.java:181) at java.lang.Exception.<init>(Exception.java:29) at java.lang.RuntimeException.<init>(RuntimeException.java:32) at eglx.lang.AnyException.<init>(AnyException.java:32) at eglx.lang.NullValueException.<init>(NullValueException.java:17) at org.eclipse.edt.javart.util.JavartUtil.checkNullable(JavartUtil.java:243) at server.PrimitiveNotInitPrg.main(PrimitiveNotInitPrg.java:33) at org.eclipse.edt.javart.resources.RunUnitBase.start(RunUnitBase.java:244) at server.PrimitiveNotInitPrg.main(PrimitiveNotInitPrg.java:18) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.edt.javart.ide.MainProgramLauncher.main(MainProgramLauncher.java:68) I don't think simply print the null object should throw the exception. I made another test - if use this statement "syslib.writeStdout(null);", then the console print an empty line. It looks to me that the behavior of the same syntax have is different. Reproducible: Always
Brian, could you please advise on this?
I talked with Matt about this defect, and he pointed out that the signature for writestdout is: static function writeStdout(text string in); This means that passing a null value to this function would be the equivalent of doing an assignment of that null value to a temporary variable of type "string". This can also be tested using the following example: function main() var1 String; //var1 = null; Compile Error var2 Timestamp?; var1 = var2; end If you run the program above, you get the same exception as listed in the initial Description for this defect. This means that passing 'times' to writestdout is working correctly. During our discussion, we also determined that passing Null to writestdout should throw the same exception. NOTE: There should already be a defect opened for producing a better error message. I have subscribed Jing as well, since the test group will need to verify that this behavior is the same on Java and JavaScript.
Kathy will add this into the EUnit tests as part of null testing. - pass in the literal null - pass in the null variable
Fixed. A NullValueException will now be throw on writestdout and writestderr.
Jeff, I hope this means anywhere a string is used, not just writestdout and writestderr.
Verified in 0.7.0.v201110272101 for the test scenario in this defect.