Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 360817 - Various string functions don't throw NullValueException
Summary: Various string functions don't throw NullValueException
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Huang Ji Yong CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-13 09:28 EDT by Kathy Carroll CLA
Modified: 2017-02-23 14:18 EST (History)
3 users (show)

See Also:


Attachments
EGL Library Source File (4.08 KB, application/octet-stream)
2011-10-18 10:51 EDT, Kathy Carroll CLA
no flags Details
Fix for the remaining problem (5.17 KB, patch)
2011-11-15 03:17 EST, Huang Ji Yong CLA
lasher: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kathy Carroll CLA 2011-10-13 09:28:57 EDT
Use EUNIT framework to run these variations

library tester

	s1 string;
	nS1 string?;
	actualInt int;
	expectedInt int;
	actualStr string;
	expectedStr string;
	
	function runCharacterUtilFunction10(){@Test}
		try
			nS1 = null;
			actualInt = nS1.clip();	
			LogResult.failed("clip of null string");
		onException (oops NullValueException)
			LogResult.passed("OK");
		end
	end

	function runCharacterUtilFunction11(){@Test}
		try
			nS1 = null;
			actualInt = nS1.clipLeading();	
			LogResult.failed("clipLeading of null string");
		onException (oops NullValueException)
			LogResult.passed("OK");
		end
	end
	
	function runCharacterUtilFunction12(){@Test}
		try
			nS1 = null;
			actualInt = nS1.clip();	
			LogResult.failed("trim of null string");
		onException (oops NullValueException)
			LogResult.passed("OK");
		end
	end
	
	function runCharacterUtilFunction17(){@Test}
		try
			nS1 = null;
			actualInt = nS1.toUppercase();	
			LogResult.failed("toUppercase of null string");
		onException (oops NullValueException)
			LogResult.passed("OK");
		end
	end
	
	function runCharacterUtilFunction18(){@Test}
		try
			nS1 = null;
			actualInt = nS1.toLowercase();	
			LogResult.failed("toLowercase of null string");
		onException (oops NullValueException)
			LogResult.passed("OK");
		end
	end

end
Comment 1 Kathy Carroll CLA 2011-10-13 10:36:58 EDT
	function runPatternUtilFunction34(){@Test}
		try
			nS1 = null;
			s2 = "abc";
			s3 = "wxyz";
			actualStr = nS1.replaceStr(s2,s3);
			expectedStr = "wxyzdefwxyzdefwxyzdefab";
			LogResult.failed("no exception");
		onException (ex NullValueException)
			LogResult.passed("OK");
		end
	end
Comment 2 Kathy Carroll CLA 2011-10-13 10:41:16 EDT
	
	function runIsLikeFunction10(){@Test}
		try
			s1 string = "ab*def";
			nPattern string? = null;
			actual  boolean = s1.isLike(nPattern);
			expected boolean = false;
			LogResult.failed("Expecting an exception");
		onException (ex NullValueException)
			LogResult.passed("OK");
		end
	end
Comment 3 Scott Greer CLA 2011-10-17 19:59:50 EDT
Fixed.
Comment 4 Kathy Carroll CLA 2011-10-18 08:29:48 EDT
Verified 201110172101 & closed.
Comment 5 Kathy Carroll CLA 2011-10-18 10:50:56 EDT
Related variations failed.  Use eunit framework to run the attached file.  Has a combination of missing desired NullValueException and getting undesired NullValueException
Comment 6 Kathy Carroll CLA 2011-10-18 10:51:25 EDT
Created attachment 205427 [details]
EGL Library Source File
Comment 7 Kathy Carroll CLA 2011-10-18 11:00:23 EDT
more related variations

	
	function runMatchesPatternFunction09(){@Test}
		try
			nS1 string? = null;
			pattern string = "ab\\*[abcd][abcde][^a-e]";
			actual string  = nS1.matchesPattern(pattern);
			LogResult.failed("Expecting exception");
         onException(oops AnyException)
        	if (oops isa NullValueException)
				LogResult.passed("OK");
			else
            	LogResult.failed("Wrong exception");
            end
        end
	end
	
	function runMatchesPatternFunction10(){@Test}
		try
			s1 string = "ab*def";
			nPattern string? = null;
	 		actual string = s1.matchesPattern(nPattern);
			expected boolean = false;
			LogResult.failed("Expecting exception");
         onException(oops AnyException)
        	if (oops isa NullValueException)
				LogResult.passed("OK");
			else
            	LogResult.failed("Wrong exception");
            end
        end
	end
Comment 8 Scott Greer CLA 2011-10-18 18:57:22 EDT
There are a couple of things going on with these most recent two variants:  first, there's a missing null check which is very easy to add, however, once I do that, this exposes an issue I need to discuss with Jeff (essentially, I'm not sure that the temporary variables being used need to reflect the nullability of the variable with which they are associated).
Comment 9 Huang Ji Yong CLA 2011-11-15 03:17:34 EST
Created attachment 207009 [details]
Fix for the remaining problem
Comment 10 Huang Ji Yong CLA 2011-11-15 03:17:59 EST
Change runtime/gen of EDecimal, EInt64, EString
Comment 11 Kathy Carroll CLA 2011-11-16 12:58:23 EST
verified 20111115_2101 and closed