[Jspro-cvs] jsPro string.js,1.20,1.21
Brought to you by:
wigleys
|
From: <gat...@us...> - 2003-09-22 06:28:56
|
Update of /cvsroot/jspro/jsPro
In directory sc8-pr-cvs1:/tmp/cvs-serv8309
Modified Files:
string.js
Log Message:
updated certain TypeMismatchExceptions to test for and display the correct datatype ('integer' instead of 'number') and updated methods with new error IllegalValueException
Index: string.js
===================================================================
RCS file: /cvsroot/jspro/jsPro/string.js,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** string.js 21 Sep 2003 22:26:10 -0000 1.20
--- string.js 22 Sep 2003 06:28:47 -0000 1.21
***************
*** 355,360 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('String.insert', 'number', typeof iStart);
}
--- 355,360 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.insert', 'integer', typeof iStart);
}
***************
*** 524,527 ****
--- 524,528 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws MethodNotAvailableException
* @throws TypeMismatchException
***************
*** 551,556 ****
}
! if ((typeof iMultiplier != 'number') || (parseInt(iMultiplier.toString()) != iMultiplier)) {
! throw vError = new TypeMismatchException('String.lpad', 'number', typeof iMultiplier);
}
--- 552,561 ----
}
! if ((typeof iMultiplier != 'number') || (iMultiplier.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.lpad', 'integer', typeof iMultiplier);
! }
!
! if (iMultiplier < 0) {
! throw vError = new IllegalValueException('String.lpad', 'iMultiplier', '0 or greater', iMultiplier);
}
***************
*** 639,642 ****
--- 644,648 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 655,660 ****
}
! if ((typeof iDocType != 'number') || (parseInt(iDocType.toString()) != iDocType)) {
! throw vError = new TypeMismatchException('String.nl2br', 'number', typeof iDocType);
}
--- 661,670 ----
}
! if ((typeof iDocType != 'number') || (iDocType.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.nl2br', 'integer', typeof iDocType);
! }
!
! if ((iDocType != 0) && (iDocType != 1)) {
! throw vError = new IllegalValueException('String.nl2br', 'iDocType', '0 or 1', iDocType);
}
***************
*** 713,718 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('String.overlay', 'number', typeof iStart);
}
--- 723,728 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.overlay', 'integer', typeof iStart);
}
***************
*** 769,772 ****
--- 779,783 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 793,802 ****
}
! if ((typeof iMultiplier != 'number') || (parseInt(iMultiplier.toString()) != iMultiplier)) {
! throw vError = new TypeMismatchException('String.pad', 'number', typeof iMultiplier);
}
! if ((typeof iSide != 'number') || (parseInt(iSide.toString()) != iSide)) {
! throw vError = new TypeMismatchException('String.pad', 'number', typeof iSide);
}
--- 804,821 ----
}
! if ((typeof iMultiplier != 'number') || (iMultiplier.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.pad', 'integer', typeof iMultiplier);
}
! if (iMultiplier < 0) {
! throw vError = new IllegalValueException('String.pad', 'iMultiplier', '0 or greater', iMultiplier);
! }
!
! if ((typeof iSide != 'number') || (iSide.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.pad', 'integer', typeof iSide);
! }
!
! if ((iSide != -1) && (iSide != 0) && (iSide != 1)) {
! throw vError = new IllegalValueException('String.pad', 'iSide', '-1, 0 or 1', iSide);
}
***************
*** 867,876 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('String.remove', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('String.remove', 'number', typeof iLength);
}
--- 886,895 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.remove', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.remove', 'integer', typeof iLength);
}
***************
*** 916,919 ****
--- 935,939 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 929,934 ****
}
! if ((typeof iMultiplier != 'number') || (parseInt(iMultiplier.toString()) != iMultiplier)) {
! throw vError = new TypeMismatchException('String.repeat', 'number', typeof iMultiplier);
}
--- 949,958 ----
}
! if ((typeof iMultiplier != 'number') || (iMultiplier.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.repeat', 'integer', typeof iMultiplier);
! }
!
! if (iMultiplier < 0) {
! throw vError = new IllegalValueException('String.repeat', 'iMultiplier', '0 or greater', iMultiplier);
}
***************
*** 966,969 ****
--- 990,994 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 979,984 ****
}
! if ((typeof iMultiplier != 'number') || (parseInt(iMultiplier.toString()) != iMultiplier)) {
! throw vError = new TypeMismatchException('String.repeatChars', 'number', typeof iMultiplier);
}
--- 1004,1013 ----
}
! if ((typeof iMultiplier != 'number') || (iMultiplier.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.repeatChars', 'integer', typeof iMultiplier);
! }
!
! if (iMultiplier < 0) {
! throw vError = new IllegalValueException('String.repeatChars', 'iMultiplier', '0 or greater', iMultiplier);
}
***************
*** 1046,1055 ****
}
! if ((typeof iStart != 'number') || (parseInt(iStart.toString()) != iStart)) {
! throw vError = new TypeMismatchException('String.reverse', 'number', typeof iStart);
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('String.reverse', 'number', typeof iLength);
}
--- 1075,1084 ----
}
! if ((typeof iStart != 'number') || (iStart.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.reverse', 'integer', typeof iStart);
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.reverse', 'integer', typeof iLength);
}
***************
*** 1168,1171 ****
--- 1197,1201 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws MethodNotAvailableException
* @throws TypeMismatchException
***************
*** 1195,1200 ****
}
! if ((typeof iMultiplier != 'number') || (parseInt(iMultiplier.toString()) != iMultiplier)) {
! throw vError = new TypeMismatchException('String.rpad', 'number', typeof iMultiplier);
}
--- 1225,1234 ----
}
! if ((typeof iMultiplier != 'number') || (iMultiplier.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.rpad', 'integer', typeof iMultiplier);
! }
!
! if (iMultiplier < 0) {
! throw vError = new IllegalValueException('String.rpad', 'iMultiplier', '0 or greater', iMultiplier);
}
***************
*** 1331,1334 ****
--- 1365,1369 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 1347,1352 ****
}
! if ((typeof iSide != 'number') || (parseInt(iSide.toString()) != iSide)) {
! throw vError = new TypeMismatchException('String.trim', 'number', typeof iSide);
}
--- 1382,1391 ----
}
! if ((typeof iSide != 'number') || (iSide.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.trim', 'integer', typeof iSide);
! }
!
! if ((iSide != -1) && (iSide != 0) && (iSide != 1)) {
! throw vError = new IllegalValueException('String.trim', 'iSide', '-1, 0 or 1', iSide);
}
***************
*** 1409,1414 ****
}
! if ((typeof iLength != 'number') || (parseInt(iLength.toString()) != iLength)) {
! throw vError = new TypeMismatchException('String.truncate', 'number', typeof iLength);
}
--- 1448,1453 ----
}
! if ((typeof iLength != 'number') || (iLength.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.truncate', 'integer', typeof iLength);
}
***************
*** 1568,1571 ****
--- 1607,1611 ----
* @return <code>null</code> if an exception is encountered
* @throws IllegalArgumentException
+ * @throws IllegalValueException
* @throws TypeMismatchException
*/
***************
*** 1593,1602 ****
}
! if ((typeof iColumnNum != 'number') || (parseInt(iColumnNum.toString()) != iColumnNum)) {
! throw vError = new TypeMismatchException('String.wordWrap', 'number', typeof iColumnNum);
}
! if ((typeof iDocType != 'number') || (parseInt(iDocType.toString()) != iDocType)) {
! throw vError = new TypeMismatchException('String.wordWrap', 'number', typeof iDocType);
}
--- 1633,1650 ----
}
! if ((typeof iColumnNum != 'number') || (iColumnNum.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.wordWrap', 'integer', typeof iColumnNum);
}
! if (iColumnNum < 1) {
! throw vError = new IllegalValueException('String.wordWrap', 'iColumnNum', '1 or greater', iColumnNum);
! }
!
! if ((typeof iDocType != 'number') || (iDocType.toString().indexOf('.') != -1)) {
! throw vError = new TypeMismatchException('String.wordWrap', 'integer', typeof iDocType);
! }
!
! if ((iDocType != 0) && (iDocType != 1) && (iDocType != 2) && (iDocType != 3) && (iDocType != 4)) {
! throw vError = new IllegalValueException('String.wordWrap', 'iDocType', '0, 1, 2, 3 or 4', iDocType);
}
|