Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356364 - Three different behaviors when assign a decimal to smallint, int, and bigint
Summary: Three different behaviors when assign a decimal to smallint, int, and bigint
Status: CLOSED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-31 12:01 EDT by Kathy Carroll CLA
Modified: 2017-02-23 14:18 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kathy Carroll CLA 2011-08-31 12:01:30 EDT
I'm getting three different behaviors when I run my java program that assigns a decimal literal to variables of type smallint, int and bigint.  I get three different results.
  SmallInt - overflow exception
  Int - truncates and set the variable
  BigInt - java object exception

I assume EDT should work like RBD and have all three types behave like INT.

Program:

program driver type BasicProgram {}

	function main()
		try
			smallTest();
		onException(oops NumericOverflowException)
			syslib.writeStdout("  Overflow Exception ");
			syslib.writestdout("done small");
		onException(oops AnyException)
			syslib.writeStdout("  Exception " + oops.message);
			syslib.writestdout("done small");
		end
		regularTest();
		try
			bigTest();
		onException(oops NumericOverflowException)
			syslib.writeStdout("  Overflow Exception ");
			syslib.writestdout("done small");
		onException(oops AnyException)
			syslib.writeStdout("  Exception " + oops.message);
			syslib.writestdout("done big");
		end
	end
	
	function bigTest()
		syslib.writestdout("start big");
		var4 bigint = 234.4;
		var3 bigint = 234.5;
		syslib.writestdout("done big");
	end
	
	function regularTest()
		syslib.writestdout("start regular");
		var2 int = 435;
		var4 int = 234.4;
		var3 int = 234.5;
		syslib.writestdout("done regular");
	end
	
	function smallTest()
		syslib.writestdout("start small");
		var2 smallInt = 435;
		var4 smallInt = 234.4;
		var3 smallInt = 234.5;
		syslib.writestdout("done small");
	end
	
end
Comment 1 Jeff Douglas CLA 2011-09-14 12:53:22 EDT
fixed
Comment 2 Kathy Carroll CLA 2011-09-15 11:39:08 EDT
I tried with the install build 201109150902.  The bigTest is getting type mismatch java compile errors.

Is the test code provided vailid?
Comment 3 Jeff Douglas CLA 2011-09-15 11:56:07 EDT
It still works perfectly for me. I'm on the latest software for all plugins.

I had to modify the testcase to put the regularTest inside of a try block, but here's the results:

start small
  Overflow Exception 
done small
start regular
  Overflow Exception 
done small
start big
  Overflow Exception 
done small
Comment 4 Lisa Lasher CLA 2011-10-11 16:11:05 EDT
Closing this defect.