[3048] in java-interest

home help back first fref pref prev next nref lref last post

Re: String.substring lies about what exceptions is throws

daemon@ATHENA.MIT.EDU (Thomas Ball)
Fri Oct 27 19:25:13 1995

Date: Fri, 27 Oct 1995 14:26:41 -0700
From: tball@scndprsn.eng.sun.com (Thomas Ball)
To: jpayne@starwave.com
Cc: java-interest@java.Eng.Sun.COM

Sami Shaio says:  You don't need to declare them since they're runtime 
exceptions.

Tom

>  From daemon@java  Thu Oct 26 17:37:58 1995
>  To: java-interest@java.Eng.Sun.COM
>  Subject: String.substring lies about what exceptions is throws
>  X-Info: To unsubscribe, send 'unsubscribe' to java-interest-request@java.sun.com
>  
>  	
>      public String substring(int beginIndex, int endIndex) {
>  	if (beginIndex > endIndex) {
>  	    int tmp = beginIndex;
>  	    beginIndex = endIndex;
>  	    endIndex = tmp;
>  	}
>  	if (beginIndex < 0) {
>  	    throw new StringIndexOutOfBoundsException(beginIndex);
>  	} 
>  	if (endIndex > count) {
>  	    throw new StringIndexOutOfBoundsException(endIndex);
>  	}
>  	return ((beginIndex == 0) && (endIndex == count)) ? this :
>  		   new String(value, offset + beginIndex, endIndex - beginIndex);
>      }
>  
>  It doesn't declare it's throwing any exceptions ...  Was the prebeta
>  release compiled with the prebeta compiler?  I think not.
>  -
>  This message was sent to the java-interest mailing list
>  Info: send 'help' to java-interest-request@java.sun.com
>  
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post