rmi and java/lang/String.java

alice dubois alice.dubois at lemel.fr
Thu Dec 3 06:28:59 PST 1998


To use commands 'rmic' and 'rmiregistry' from kaffe, I use sun/rmi package.

Here's what I do:
#> javac Client.java KaraokeBox.java KaraokeBoxImpl.java    //OK
#> rmic KaraokeBoxImpl					    //OK
#> rmiregistry &
#> kaffe KaraokeBoxImpl
java.lang.StringIndexOutOfBoundsException: 7
        at java/lang/Throwable.<init>(37)
        at java/lang/Exception.<init>(21)
        at java/lang/RuntimeException.<init>(21)
        at java/lang/IndexOutOfBoundsException.<init>(21)
        at java/lang/StringIndexOutOfBoundsException.<init>(25)
        at java/lang/String.substring(419)
        at java/net/URL.<init>(44)
        at java/rmi/Naming.cleanURL(176)
        at java/rmi/Naming.rebind(109)
        at KaraokeBoxImpl.main(19)

Here's the method of java/lang/String.java where the exception is caught:

public String substring( int sIdx, int eIdx) {
	if ( sIdx < 0)     throw new StringIndexOutOfBoundsException( sIdx);
	if ( eIdx > count) throw new StringIndexOutOfBoundsException( eIdx);
	if ( sIdx > eIdx)  throw new StringIndexOutOfBoundsException( eIdx-sIdx);
	if ( ( sIdx == 0) && ( eIdx  == count ) )
		return this;
	return new String( offset+sIdx, offset+eIdx, value);

(I've found that it was at the second line ( if ( eIdx > count) ...) ).
Is it because of sun/rmi package ? (it works with jdk )
Or is there something to add in "KaraokeBoxImpl.java" ?


class Client{
   public static void main(String argv[]){
       String name = (argv.length == 1) ? argv[0] : "-";
         KaraokeBox box =
       catch(Exception e){e.printStackTrace();}                             

interface KaraokeBox extends java.rmi.Remote{
   public void hello(String s) throws java.rmi.RemoteException;

import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
public class KaraokeBoxImpl extends UnicastRemoteObject implements 
    public KaraokeBoxImpl() throws RemoteException{
    public void hello(String s) throws RemoteException{
        System.out.println("Client Name " + s);
    public static void main(String argv[]){
        System.setSecurityManager(new RMISecurityManager());
	    KaraokeBox box = new KaraokeBoxImpl();
	    java.rmi.Naming.rebind("karaokebox1", box);
         catch(Exception e)e.printStackTrace();



More information about the kaffe mailing list