diff options
author | Kay Ramme <kr@openoffice.org> | 2001-05-04 10:57:12 +0000 |
---|---|---|
committer | Kay Ramme <kr@openoffice.org> | 2001-05-04 10:57:12 +0000 |
commit | d4be64fff7b3edd7cdde5d28735addf99ab3c577 (patch) | |
tree | d92d55b91ec6cde5466b1d4624238eac89017e8d | |
parent | 904027a5acd98862f9caf54d72ff55b7667bd9f7 (diff) |
cleaned up exception specification
9 files changed, 490 insertions, 195 deletions
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java b/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java index 374ed31d6c43..5f88699e3447 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java @@ -2,9 +2,9 @@ * * $RCSfile: IProtocol.java,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: kr $ $Date: 2001-04-19 16:24:57 $ + * last change: $Author: kr $ $Date: 2001-05-04 11:56:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,11 +77,10 @@ import com.sun.star.lib.uno.typedesc.TypeDescription; * This interface provides an abstraction for protocols * for remote bridges. * <p> - * @version $Revision: 1.4 $ $ $Date: 2001-04-19 16:24:57 $ + * @version $Revision: 1.5 $ $ $Date: 2001-05-04 11:56:03 $ * @author Kay Ramme * @see com.sun.star.lib.uno.environments.remote.IMessage * @see com.sun.star.lib.uno.environments.remote.Job - * @since UDK1.0 */ public interface IProtocol { /** @@ -97,7 +96,7 @@ public interface IProtocol { * @return thread read job. * @see com.sun.star.lib.uno.environments.remote.Job */ - IMessage readMessage(InputStream inputStream) throws Exception; + IMessage readMessage(InputStream inputStream) throws IOException; public void writeRequest(String oid, @@ -106,11 +105,11 @@ public interface IProtocol { ThreadID threadId, Object params[], Boolean synchron[], - Boolean mustReply[]) throws Exception; + Boolean mustReply[]); - public void writeReply(boolean exception, ThreadID threadId, Object result) throws Exception; + public void writeReply(boolean exception, ThreadID threadId, Object result); - public void flush(java.io.DataOutput dataOutput) throws Exception; + public void flush(java.io.DataOutput dataOutput) throws IOException; /** diff --git a/jurt/com/sun/star/lib/uno/environments/remote/IReceiver.java b/jurt/com/sun/star/lib/uno/environments/remote/IReceiver.java index f9feb33d9718..120fef319268 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/IReceiver.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/IReceiver.java @@ -2,9 +2,9 @@ * * $RCSfile: IReceiver.java,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:27:52 $ + * last change: $Author: kr $ $Date: 2001-05-04 11:56:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,10 +70,9 @@ import com.sun.star.lib.uno.environments.java.IRequester; * This interface is an abstraction for giving back * a reply for a request. * <p> - * @version $Revision: 1.1.1.1 $ $ $Date: 2000-09-18 15:27:52 $ + * @version $Revision: 1.2 $ $ $Date: 2001-05-04 11:56:03 $ * @author Kay Ramme * @see com.sun.star.uno.IQueryInterface - * @since UDK1.0 */ public interface IReceiver { /** @@ -87,6 +86,6 @@ public interface IReceiver { * @param params the out and in/out parameters passed with the request * @param signature the types of the out and in/out parameters */ - public void sendReply(boolean exception, ThreadID threadId, Object result) throws Exception; + public void sendReply(boolean exception, ThreadID threadId, Object result); } diff --git a/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java b/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java index 763b68bf79da..a08ce6689f97 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java @@ -2,9 +2,9 @@ * * $RCSfile: IThreadPool.java,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:27:52 $ + * last change: $Author: kr $ $Date: 2001-05-04 11:56:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,7 +65,7 @@ package com.sun.star.lib.uno.environments.remote; * This interface is an abstraction of the various * threadpool implementations. * <p> - * @version $Revision: 1.1.1.1 $ $ $Date: 2000-09-18 15:27:52 $ + * @version $Revision: 1.2 $ $ $Date: 2001-05-04 11:56:03 $ * @author Joerg Budischewski * @see com.sun.star.lib.uno.environments.remote.ThreadPool * @since UDK1.0 @@ -86,12 +86,12 @@ public interface IThreadPool { * @param disposeId the dipose id with which the thread can be interrupted while staying in the queue * @see #enter */ - public void addThread(Object disposeId) throws InterruptedException; + public void addThread(Object disposeId); /** * Removes the jobQueue for the current thread. */ - public void removeThread() throws InterruptedException; + public void removeThread(); /** * Queues a job into the jobQueue of the thread belonging to the jobs threadId. @@ -99,7 +99,7 @@ public interface IThreadPool { * @param job the job * @param disposeId the dispose id */ - public void putJob(Job job, Object disposeId) throws InterruptedException; + public void putJob(Job job, Object disposeId); /** * Lets the current thread enter the ThreadPool. @@ -107,7 +107,7 @@ public interface IThreadPool { * the ThreadPool when it gets a reply job. * <p> */ - public Object enter() throws java.lang.Exception; + public Object enter() throws Throwable; /** * Interrupts all threads which have associated the dispose id. diff --git a/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java b/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java index 56ae2ef918f2..87b6f5f066ae 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java @@ -2,9 +2,9 @@ * * $RCSfile: JavaThreadPool.java,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: kr $ $Date: 2001-03-08 12:28:12 $ + * last change: $Author: kr $ $Date: 2001-05-04 11:56:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,7 +72,7 @@ import com.sun.star.uno.UnoRuntime; /** * This class implements a java thread pool. * <p> - * @version $Revision: 1.6 $ $ $Date: 2001-03-08 12:28:12 $ + * @version $Revision: 1.7 $ $ $Date: 2001-05-04 11:56:03 $ * @author Kay Ramme * @see com.sun.star.uno.UnoRuntime * @see com.sun.star.lib.uno.environments.remote.ThreadPool @@ -184,7 +184,7 @@ public class JavaThreadPool implements IThreadPool { * @param threadId the thread id to use * @param disposeId the dispose id */ - public JobQueue addThread(boolean createWorkerThread, ThreadID threadId, Object disposeId, JobQueue syncQueue) throws InterruptedException { + public JobQueue addThread(boolean createWorkerThread, ThreadID threadId, Object disposeId, JobQueue syncQueue) { if(_disposed) throw new RuntimeException("ThreadPool.addThread(" + threadId + ") - is disposed"); if(DEBUG) System.err.println("##### ThreadPool.addThread:" + threadId); @@ -216,7 +216,7 @@ public class JavaThreadPool implements IThreadPool { * @see #enter * @see com.sun.star.lib.uno.environments.remote.IThreadPool#addThread */ - public void addThread(Object disposeId) throws InterruptedException { + public void addThread(Object disposeId) { if(_disposed) throw new RuntimeException("ThreadPool.addThread - is disposed"); addThread(false, getThreadId(Thread.currentThread()), disposeId, null); @@ -274,7 +274,7 @@ public class JavaThreadPool implements IThreadPool { */ private Object _syncPutJob = new Object(); - public void putJob(Job job, Object disposeId) throws InterruptedException { + public void putJob(Job job, Object disposeId) { if(_disposed) throw new RuntimeException("ThreadPool.putJob - is disposed"); JobQueue jobQueue = null; @@ -302,7 +302,7 @@ public class JavaThreadPool implements IThreadPool { * @result the result of final reply * @param threadId the thread id to use */ - public Object enter(int waitTime, ThreadID threadId) throws java.lang.Exception { + public Object enter(int waitTime, ThreadID threadId) throws Throwable { if(_disposed) throw new RuntimeException("ThreadPool.enter - is disposed"); JobQueue jobQueue = (JobQueue)_jobQueues.get(threadId); @@ -327,11 +327,11 @@ public class JavaThreadPool implements IThreadPool { * <p> * @see com.sun.star.lib.uno.environments.remote.IThreadPool#enter */ - public Object enter(int waitTime) throws java.lang.Exception { + public Object enter(int waitTime) throws Throwable { return enter(waitTime, getThreadId()); } - public Object enter() throws java.lang.Exception { + public Object enter() throws Throwable { return enter(0); } diff --git a/jurt/com/sun/star/lib/uno/environments/remote/Job.java b/jurt/com/sun/star/lib/uno/environments/remote/Job.java index 3a3ed5473c3d..c5265d21f17e 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/Job.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/Job.java @@ -2,9 +2,9 @@ * * $RCSfile: Job.java,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: kr $ $Date: 2001-03-12 16:49:23 $ + * last change: $Author: kr $ $Date: 2001-05-04 11:56:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,7 +81,7 @@ import com.sun.star.uno.UnoRuntime; * The Job is an abstraction for tasks which have to be done * remotely because of a method invocation. * <p> - * @version $Revision: 1.6 $ $ $Date: 2001-03-12 16:49:23 $ + * @version $Revision: 1.7 $ $ $Date: 2001-05-04 11:56:03 $ * @author Kay Ramme * @see com.sun.star.lib.uno.environments.remote.ThreadID * @see com.sun.star.lib.uno.environments.remote.IReceiver @@ -116,7 +116,7 @@ public class Job { * @param o_outs the out parameters of the call as out parameters * @param o_out_sig the out signature as an out parameter */ - protected Object dispatch_MethodCall(Object params[]) throws Exception { + protected Object dispatch_MethodCall(Object params[]) throws InvocationTargetException, IllegalAccessException { Method method = _iMessage.getInterface().getMethodDescription(_iMessage.getOperation()).getMethod(); if(DEBUG) System.err.println("##### " + getClass().getName() + ".dispatch_MethodCall:" + _object + " " + method.getName() + " " + params); @@ -134,7 +134,7 @@ public class Job { * @param o_outs the out parameters of the call as out parameters * @param o_out_sig the out signature as an out parameter */ - protected Object dispatch_queryInterface(Type type) throws Exception { + protected Object dispatch_queryInterface(Type type) { Class zInterface = ((TypeDescription)type.getTypeDescription()).getZClass(); Object result = null; @@ -154,13 +154,15 @@ public class Job { * <p> * @return returns true if the operation is a reply */ - public Object execute() throws Exception { + public Object execute() throws Throwable { Object params[][] = new Object[1][]; Object result = _iMessage.getData(params); + if(DEBUG) System.err.println("##### " + getClass().getName() + ".execute:" + result); + if(_iMessage.isException()) - throw (Exception)result; + throw (Throwable)result; try { if(_iMessage.getOperation() != null) { // it is a request @@ -175,8 +177,12 @@ public class Job { _iReceiver.sendReply(false, _iMessage.getThreadID(), xresult); } } - catch(InvocationTargetException invocationTargetException) { - Throwable throwable = invocationTargetException.getTargetException();; + catch(Exception exception) { +// catch(InvocationTargetException invocationTargetException) { + Throwable throwable = exception; + + if(exception instanceof InvocationTargetException) + throwable = ((InvocationTargetException)exception).getTargetException();; if(DEBUG) System.err.println("##### Job.execute - exception occured:" + throwable); diff --git a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java index 4bd0fee16d28..7cd515c0fe44 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java @@ -2,9 +2,9 @@ * * $RCSfile: JobQueue.java,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: kr $ $Date: 2001-04-17 16:14:21 $ + * last change: $Author: kr $ $Date: 2001-05-04 11:56:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,7 +83,7 @@ import com.sun.star.uno.UnoRuntime; * (put by <code>putjob</code>) into the async queue, which is only * known by the sync queue. * <p> - * @version $Revision: 1.12 $ $ $Date: 2001-04-17 16:14:21 $ + * @version $Revision: 1.13 $ $ $Date: 2001-05-04 11:56:03 $ * @author Kay Ramme * @see com.sun.star.lib.uno.environments.remote.ThreadPool * @see com.sun.star.lib.uno.environments.remote.Job @@ -154,7 +154,8 @@ public class JobQueue { try { _javaThreadPool.enter(5000); } - catch(java.lang.Exception exception) { + catch(Throwable exception) { +// catch(java.lang.Exception exception) { if(_head != null || _active) { // there was a job in progress, so give a stack System.err.println(getClass().getName() + " - exception occurred:" + exception); exception.printStackTrace(System.err); @@ -326,7 +327,7 @@ public class JobQueue { * @return a job or null if timed out * @param waitTime the maximum amount of time to wait for a job */ - private Job removeJob(int waitTime) throws InterruptedException { + private Job removeJob(int waitTime) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".removeJob:" + _head + " " + _threadId); Job job = null; @@ -334,7 +335,12 @@ public class JobQueue { // wait max. waitTime time for a job to enter the queue boolean waited = false; while(_head == null && waitTime >= 0 && !waited) { - wait(waitTime); + try { + wait(waitTime); + } + catch(InterruptedException interruptedException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".removeJob - caught:" + interruptedException); + } // signal that we have already waited once waited = true; @@ -360,7 +366,12 @@ public class JobQueue { // wait for async queue to be empty and last job to be done while(_async_jobQueue._active || _async_jobQueue._head != null) { if(DEBUG) System.err.println("waiting for async:" + _async_jobQueue._head + " " + _async_jobQueue._worker_thread); - _async_jobQueue.wait(10); + try { + _async_jobQueue.wait(10); + } + catch(InterruptedException interruptedException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".removeJob - caught:" + interruptedException); + } } } } @@ -437,7 +448,7 @@ public class JobQueue { * @return the result of the final job (reply) * @param disposeId a dispose id */ - Object enter(Object disposeId) throws Exception { + Object enter(Object disposeId) throws Throwable { return enter(0, disposeId); // wait infinitly } @@ -448,7 +459,7 @@ public class JobQueue { * @param waitTime the maximum amount of time to wait for a job (0 means wait infinitly) * @param disposeId a dispose id */ - Object enter(int waitTime, Object disposeId) throws Exception { + Object enter(int waitTime, Object disposeId) throws Throwable { if(DEBUG) System.err.println("#####" + getClass().getName() + ".enter: " + _threadId); boolean quit = false; diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java b/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java index 02ecd47c68bc..2435a699735f 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java @@ -2,9 +2,9 @@ * * $RCSfile: Marshal.java,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: kr $ $Date: 2001-03-06 17:09:08 $ + * last change: $Author: kr $ $Date: 2001-05-04 11:57:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,13 +64,13 @@ package com.sun.star.lib.uno.protocols.urp; import java.io.ByteArrayInputStream; import java.util.Hashtable; import com.sun.star.uno.IEnvironment; -import com.sun.star.uno.MappingException; import java.io.ByteArrayOutputStream; import java.io.DataOutput; import java.io.DataOutputStream; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.lang.reflect.Array; import java.lang.reflect.Field; @@ -107,7 +107,16 @@ class Marshal implements IMarshal { static private final M_InterfaceReference __null_M_InterfaceReference = new M_InterfaceReference("", (short)0xffff); + static final Class __anyArray; + static { + try { + __anyArray = Class.forName("[Lcom.sun.star.uno.Any;"); + } + catch(ClassNotFoundException classNotFoundException) { + throw new com.sun.star.uno.RuntimeException("urp.Marshal.<cinit> - unexpected:" + classNotFoundException); + } + } static class M_ThreadId { public byte full[]; @@ -153,13 +162,14 @@ class Marshal implements IMarshal { _threadIdCache = new Cache(cacheSize); } - void writeAny(Object object) throws Exception { + void writeAny(Object object) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeAny:" + object); TypeDescription typeDescription = null; if(object == null) - typeDescription = TypeDescription.__void_TypeDescription; + typeDescription = TypeDescription.getTypeDescription(XInterface.class); +// typeDescription = TypeDescription.__void_TypeDescription; else if(object instanceof Any) { Any any = (Any)object; @@ -177,21 +187,44 @@ class Marshal implements IMarshal { writeObject(typeDescription, object); } - void writeBoolean(Boolean zBoolean) throws Exception { + void writeboolean(boolean bool) { + try { + _dataOutput.writeBoolean(bool); + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".writeboolean - unexpected: " + iOException); + } + } + + void writeBoolean(Boolean zBoolean) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeBoolean:" + zBoolean); - _dataOutput.writeBoolean(zBoolean.booleanValue()); + writeboolean(zBoolean.booleanValue()); } - void writebyte(byte zbyte) throws Exception { + void writebyte(byte zbyte) { int ibyte = zbyte & 0xff; if(DEBUG) System.err.println("##### " + getClass().getName() + ".writebyte:" + ibyte); - _dataOutput.writeByte(ibyte); + try { + _dataOutput.writeByte(ibyte); + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".writebyte - unexpected: " + iOException); + } } - void writebyteSequence(byte bytes[]) throws Exception { + void write(byte bytes[]) { + try { + _dataOutput.write(bytes); + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".write - unexpected: " + iOException); + } + } + + void writebyteSequence(byte bytes[]) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writebyteSequence:" + bytes); int size = 0; @@ -204,34 +237,56 @@ class Marshal implements IMarshal { writeCompressedInt(size); if(size != 0) - _dataOutput.write(bytes); + write(bytes); } - void writeByte(Byte zByte) throws Exception { + void writeByte(Byte zByte) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeByte:" + zByte); - _dataOutput.writeByte(zByte.byteValue()); + writebyte(zByte.byteValue()); } - void writeCharacter(Character character) throws Exception { + void writechar(char zchar) { + if(DEBUG) System.err.println("##### " + getClass().getName() + ".writechar:" + zchar); + + try { + _dataOutput.writeChar(zchar); + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".writechar - unexpected: " + iOException); + } + } + + void writeCharacter(Character character) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeCharacter:" + character); - _dataOutput.writeChar(character.charValue()); + writechar(character.charValue()); } - void writeDouble(Double zDouble) throws Exception { + void writedouble(double zdouble) { + if(DEBUG) System.err.println("##### " + getClass().getName() + ".writedouble:" + zdouble); + + try { + _dataOutput.writeDouble(zdouble); + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".writedouble - unexpected: " + iOException); + } + } + + void writeDouble(Double zDouble) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeDouble:" + zDouble); - _dataOutput.writeDouble(zDouble.doubleValue()); + writedouble(zDouble.doubleValue()); } - void writeEnum(Enum enum) throws Exception { + void writeEnum(Enum enum) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeEnum:" + enum + " " + enum.getValue()); writeint(enum.getValue()); } - void writeThrowable(TypeDescription typeDescription, Throwable throwable) throws Exception { + void writeThrowable(TypeDescription typeDescription, Throwable throwable) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeThrowable:" + throwable); String message = throwable.getMessage(); @@ -240,31 +295,58 @@ class Marshal implements IMarshal { writeStruct(typeDescription, throwable); } - void writeFloat(Float zFloat) throws Exception { + void writefloat(float zfloat) { + if(DEBUG) System.err.println("##### " + getClass().getName() + ".writefloat:" + zfloat); + + try { + _dataOutput.writeFloat(zfloat); + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".writefloat - unexpected: " + iOException); + } + } + + void writeFloat(Float zFloat) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeFloat:" + zFloat); - _dataOutput.writeFloat(zFloat.floatValue()); + writefloat(zFloat.floatValue()); } - void writeInteger(Integer integer) throws Exception { + void writeInteger(Integer integer) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeInteger:" + integer); - _dataOutput.writeInt(integer.intValue()); + writeint(integer.intValue()); } - void writeint(int zint) throws Exception { + void writeint(int zint) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeint:" + zint); - _dataOutput.writeInt(zint); + try { + _dataOutput.writeInt(zint); + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".writeint - unexpected: " + iOException); + } + } + + void writelong(long zlong) { + if(DEBUG) System.err.println("##### " + getClass().getName() + ".writelong:" + zlong); + + try { + _dataOutput.writeLong(zlong); + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".writelong - unexpected: " + iOException); + } } - void writeLong(Long zLong) throws Exception { + void writeLong(Long zLong) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeLong:" + zLong); - _dataOutput.writeLong(zLong.longValue()); + writelong(zLong.longValue()); } - public void writeObject(TypeDescription typeDescription, Object object) throws Exception { + public void writeObject(TypeDescription typeDescription, Object object) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeObject: <" + typeDescription + "> <" + object + ">"); switch(typeDescription.getTypeClass().getValue()) { @@ -299,7 +381,7 @@ class Marshal implements IMarshal { } } - void writeOid(String oid) throws Exception { + void writeOid(String oid) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeOid:" + oid); M_InterfaceReference m_InterfaceReference = null; @@ -320,14 +402,14 @@ class Marshal implements IMarshal { writeObject(__M_InterfaceReferenceTypeDescription, m_InterfaceReference); } - void writeReference(TypeDescription typeDescription, Object object) throws Exception { + void writeReference(TypeDescription typeDescription, Object object) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeReference:" + typeDescription + " " + object); // map the object to universe writeOid(object != null ? (String)_iBridge.mapInterfaceTo(object, new Type(typeDescription)) : null); } - void writeSequence(TypeDescription typeDescription, Object object) throws Exception { + void writeSequence(TypeDescription typeDescription, Object object) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeSequence:" + typeDescription + " " + object); if(typeDescription.getTypeClass() == TypeClass.BYTE) // write a byte sequence ? @@ -348,39 +430,49 @@ class Marshal implements IMarshal { } } - void writeShort(Short zShort) throws Exception { + void writeShort(Short zShort) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeShort:" + zShort); - _dataOutput.writeShort(zShort.shortValue()); + writeshort(zShort.shortValue()); } - void writeshort(short zshort) throws Exception { + void writeshort(short zshort) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeshort:" + zshort); - _dataOutput.writeShort(zshort); + try { + _dataOutput.writeShort(zshort); + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".writeshort - unexpected: " + iOException); + } } - void writeCompressedInt(int size) throws Exception { + void writeCompressedInt(int size) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeCompressedInt:" + size); if(size >= 255) { - _dataOutput.writeByte((byte)0xff); - _dataOutput.writeInt(size); + writebyte((byte)0xff); + writeint(size); } else - _dataOutput.writeByte((byte)size); + writebyte((byte)size); } - void writeString(String string) throws Exception { + void writeString(String string) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeString:" + string); - byte bytes[] = string.getBytes("UTF8"); + try { + byte bytes[] = string.getBytes("UTF8"); - writeCompressedInt(bytes.length); - _dataOutput.write(bytes); + writeCompressedInt(bytes.length); + write(bytes); + } + catch(UnsupportedEncodingException unsupportedEncodingException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".writeString - unexpected:" + unsupportedEncodingException); + } } - void writeStruct(TypeDescription typeDescription, Object object) throws Exception { + void writeStruct(TypeDescription typeDescription, Object object) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeStruct:" + typeDescription + " " + object); Field fields[] = typeDescription.getFields(); @@ -394,7 +486,7 @@ class Marshal implements IMarshal { if(memberTypeInfo != null) { // do we have any type infos? if(memberTypeInfo.isAny()) // is the member any any? if(zInterface.isArray()) - zInterface = Class.forName("[Lcom.sun.star.uno.Any;"); + zInterface = __anyArray; else zInterface = Any.class; @@ -406,19 +498,30 @@ class Marshal implements IMarshal { if(!XInterface.class.isAssignableFrom(fields[i].getType())) // is the member type not derived of XInterface ? xInterface = XInterface.class; // ensure that we write at least an XInterface - if(zInterface.isArray()) - zInterface = Class.forName("[L" + xInterface.getName() + ";"); + if(zInterface.isArray()) { + try { + zInterface = Class.forName("[L" + xInterface.getName() + ";"); + } + catch(ClassNotFoundException classNotFoundException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".writeStruct - unexpected:" + classNotFoundException); + } + } else zInterface = xInterface; } } - writeObject(TypeDescription.getTypeDescription(zInterface), fields[i].get(object)); + try { + writeObject(TypeDescription.getTypeDescription(zInterface), fields[i].get(object)); + } + catch(IllegalAccessException illegalAccessException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".writeStruct - unexpected:" + illegalAccessException); + } } } } - void writeThreadID(ThreadID threadID) throws Exception { + void writeThreadID(ThreadID threadID) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeThreadID:" + threadID); boolean found[] = new boolean[1]; @@ -433,11 +536,12 @@ class Marshal implements IMarshal { writeObject(__M_ThreadIdTypeDescription, m_ThreadId); } - void writeTypeDescrption(TypeDescription typeDescription) throws Exception { + void writeTypeDescrption(TypeDescription typeDescription) { TypeClass typeClass = typeDescription.getTypeClass(); if(TypeDescription.isTypeClassSimple(typeClass)) - _dataOutput.writeByte((byte)typeClass.getValue()); // write the typeclass value + writebyte((byte)typeClass.getValue()); // write the typeclass value + else { boolean found[] = new boolean[1]; short index; @@ -447,19 +551,19 @@ class Marshal implements IMarshal { else index = (short)0xffff; - _dataOutput.writeByte((byte)(typeClass.getValue() | (found[0] ? 0x0 : 0x80))); // write the typeclass value + writebyte((byte)(typeClass.getValue() | (found[0] ? 0x0 : 0x80))); // write the typeclass value - _dataOutput.writeShort(index); // write the cache index + writeshort(index); // write the cache index if(!found[0]) // if not found in cache and the type is complex, write the type name writeString(typeDescription.getTypeName()); } } - void writeUnion(Union union) throws Exception { + void writeUnion(Union union) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeUnion:" + union); - throw new Exception("Marshal.writeUnion is not implemented yet!!!"); + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".writeUnion is not implemented yet!!!"); } public byte []reset() { diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java index 8409b5af1265..bc3d5bbbe259 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java @@ -2,9 +2,9 @@ * * $RCSfile: Unmarshal.java,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: kr $ $Date: 2001-04-20 11:57:33 $ + * last change: $Author: kr $ $Date: 2001-05-04 11:57:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,11 +64,14 @@ package com.sun.star.lib.uno.protocols.urp; import java.io.ByteArrayInputStream; import java.io.DataInput; import java.io.DataInputStream; +import java.io.IOException; import java.io.InputStream; +import java.io.UnsupportedEncodingException; import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; @@ -116,7 +119,7 @@ class Unmarshal implements IUnmarshal { _dataInput = new DataInputStream(_inputStream); } - Object readAny() throws Exception { + Object readAny() { TypeDescription typeDescription = readTypeDescription(); Object object = readObject(typeDescription); @@ -130,106 +133,225 @@ class Unmarshal implements IUnmarshal { return object; } - Boolean readBoolean() throws Exception { - Boolean result = new Boolean(_dataInput.readBoolean()); + boolean readboolean() { + boolean bool; + + try { + bool = _dataInput.readBoolean(); + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readboolean - unexpected:" + iOException); + } + + return bool; + } + + Boolean readBoolean() { + Boolean result = new Boolean(readboolean()); if(DEBUG) System.err.println("##### " + getClass().getName() + ".readBoolean:" + result); return result; } - Byte readByte() throws Exception { - Byte result = new Byte(_dataInput.readByte()); + Byte readByte() { + Byte result = new Byte(readbyte()); if(DEBUG) System.err.println("##### " + getClass().getName() + ".readByte:" + result); return result; } - byte readbyte() throws Exception { - byte result = (byte)(_dataInput.readByte() & 0xff); + byte readbyte() { + try { + byte result = (byte)(_dataInput.readByte() & 0xff); - if(DEBUG) System.err.println("##### " + getClass().getName() + ".readbyte:" + (result & 0xff)); + if(DEBUG) System.err.println("##### " + getClass().getName() + ".readbyte:" + (result & 0xff)); - return result; + return result; + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readByte - unexpected:" + iOException); + } } - byte []readbyteSequence() throws Exception { + void read(byte bytes[]) { + try { + _inputStream.read(bytes); + + if(DEBUG) System.err.println("##### " + getClass().getName() + ".read:" + bytes); + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".read - unexpected:" + iOException); + } + } + + byte []readbyteSequence() { int size = readCompressedInt(); byte bytes[] = new byte[size]; - _inputStream.read(bytes); + read(bytes); if(DEBUG) System.err.println("##### " + getClass().getName() + ".readbyteSequence:" + bytes); return bytes; } - Character readCharacter() throws Exception { - Character result = new Character(_dataInput.readChar()); + char readchar() { + try { + char zchar = _dataInput.readChar(); + + if(DEBUG) System.err.println("##### " + getClass().getName() + ".readChar:" + zchar); + + return zchar; + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readChar - unexpected:" + iOException); + } + } + + Character readCharacter() { + Character result = new Character(readchar()); if(DEBUG) System.err.println("##### " + getClass().getName() + ".readChar:" + result); return result; } - Double readDouble() throws Exception { - Double result = new Double(_dataInput.readDouble()); + double readdouble() { + try { + double zdouble = _dataInput.readDouble(); + + if(DEBUG) System.err.println("##### " + getClass().getName() + ".readDouble:" + zdouble); + + return zdouble; + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readDouble - unexpected:" + iOException); + } + } + + Double readDouble() { + Double result = new Double(readdouble()); if(DEBUG) System.err.println("##### " + getClass().getName() + ".readDouble:" + result); return result; } - Enum readEnum(TypeDescription typeDescription) throws Exception { - Integer index = readInteger(); + Enum readEnum(TypeDescription typeDescription) { + try { + Integer index = readInteger(); - Method fromInt = typeDescription.getZClass().getMethod("fromInt", new Class[] {int.class}); - Enum result = (Enum)fromInt.invoke(null, new Object[]{index}); + Method fromInt = typeDescription.getZClass().getMethod("fromInt", new Class[] {int.class}); + Enum result = (Enum)fromInt.invoke(null, new Object[]{index}); - if(DEBUG) System.err.println("##### " + getClass().getName() + ".readEnum:" + result); + if(DEBUG) System.err.println("##### " + getClass().getName() + ".readEnum:" + result); - return result; + return result; + } + catch(NoSuchMethodException noSuchMethodException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readEnum - unexpected:" + noSuchMethodException); + } + catch(InvocationTargetException invocationTargetException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readEnum - unexpected:" + invocationTargetException); + } + catch(IllegalAccessException illegalAccessException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readEnum - unexpected:" + illegalAccessException); + } } - Throwable readThrowable(TypeDescription typeDescription) throws Exception { - String message = readString(); + Throwable readThrowable(TypeDescription typeDescription) { + try { + String message = readString(); - Constructor constructor = typeDescription.getZClass().getConstructor(new Class[]{String.class}); - Throwable throwable = (Throwable)constructor.newInstance(new Object[]{message}); + Constructor constructor = typeDescription.getZClass().getConstructor(new Class[]{String.class}); + Throwable throwable = (Throwable)constructor.newInstance(new Object[]{message}); - readStruct(typeDescription, throwable); + readStruct(typeDescription, throwable); - if(DEBUG) System.err.println("##### " + getClass().getName() + ".readThrowable:" + throwable); + if(DEBUG) System.err.println("##### " + getClass().getName() + ".readThrowable:" + throwable); - return throwable; + return throwable; + } + catch(NoSuchMethodException noSuchMethodException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readThrowable - unexpected:" + noSuchMethodException); + } + catch(InvocationTargetException invocationTargetException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readThrowable - unexpected:" + invocationTargetException); + } + catch(IllegalAccessException illegalAccessException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readThrowable - unexpected:" + illegalAccessException); + } + catch(InstantiationException instantiationException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readThrowable - unexpected:" + instantiationException); + } } - Float readFloat() throws Exception { - Float result = new Float(_dataInput.readFloat()); + float readfloat() { + try { + float zfloat = _dataInput.readFloat(); + + if(DEBUG) System.err.println("##### " + getClass().getName() + ".readFloat:" + zfloat); + + return zfloat; + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readfloat - unexpected:" + iOException); + } + } + + Float readFloat() { + Float result = new Float(readfloat()); if(DEBUG) System.err.println("##### " + getClass().getName() + ".readFloat:" + result); return result; } - Integer readInteger() throws Exception { - Integer result = new Integer(_dataInput.readInt()); + int readint() { + try { + int zint = _dataInput.readInt(); + + if(DEBUG) System.err.println("##### " + getClass().getName() + ".readint:" + zint); + + return zint; + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readint - unexpected:" + iOException); + } + } + + Integer readInteger() { + Integer result = new Integer(readint()); if(DEBUG) System.err.println("##### " + getClass().getName() + ".readInteger:" + result); return result; } - Long readLong() throws Exception { - Long result = new Long(_dataInput.readLong()); + long readlong() { + try { + long zlong = _dataInput.readLong(); + + if(DEBUG) System.err.println("##### " + getClass().getName() + ".readlong:" + zlong); + + return zlong; + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readlong - unexpected:" + iOException); + } + } + + Long readLong() { + Long result = new Long(readlong()); if(DEBUG) System.err.println("##### " + getClass().getName() + ".readLong:" + result); return result; } - public Object readObject(TypeDescription typeDescription) throws Exception { + public Object readObject(TypeDescription typeDescription) { Object result = null; switch(typeDescription.getTypeClass().getValue()) { @@ -271,7 +393,7 @@ class Unmarshal implements IUnmarshal { return result; } - String readOid() throws Exception { + String readOid() { Marshal.M_InterfaceReference m_InterfaceReference = (Marshal.M_InterfaceReference)readObject(Marshal.__M_InterfaceReferenceTypeDescription); String oid = null; @@ -290,7 +412,7 @@ class Unmarshal implements IUnmarshal { return oid; } - Object readReference(TypeDescription typeDescription) throws Exception { + Object readReference(TypeDescription typeDescription) { Object oid = readOid();; // the result is a null ref, in case cache and oid are invalid @@ -305,7 +427,7 @@ class Unmarshal implements IUnmarshal { return result; } - Object readSequence(TypeDescription typeDescription) throws Exception { + Object readSequence(TypeDescription typeDescription) { Object result = null; if(typeDescription.getTypeClass() == TypeClass.BYTE) // read a byte sequence ? result = readbyteSequence(); @@ -329,43 +451,53 @@ class Unmarshal implements IUnmarshal { return result; } - Short readShort() throws Exception { - Short result = new Short(_dataInput.readShort()); + Short readShort() { + Short result = new Short(readshort()); if(DEBUG) System.err.println("##### " + getClass().getName() + ".readShort:" + result); return result; } - short readshort() throws Exception { - short result = _dataInput.readShort(); + short readshort() { + try { + short result = _dataInput.readShort(); - if(DEBUG) System.err.println("##### " + getClass().getName() + ".readshort:" + result); + if(DEBUG) System.err.println("##### " + getClass().getName() + ".readshort:" + result); - return result; + return result; + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readshort - unexpected:" + iOException); + } } - int readCompressedInt() throws Exception { - int result = _dataInput.readByte() & 0xff; + int readCompressedInt() { + int result = readbyte() & 0xff; if(result == 255) // if 255 then there follows a complete int - result = _dataInput.readInt(); + result = readint(); if(DEBUG) System.err.println("##### " + getClass().getName() + ".readCompressedInt:" + result); return result; } - String readString() throws Exception { - int utflen = readCompressedInt(); // the size of the string + String readString() { + try { + int utflen = readCompressedInt(); // the size of the string - byte bytes[] = new byte[utflen]; - _inputStream.read(bytes); + byte bytes[] = new byte[utflen]; + read(bytes); - return new String(bytes, "UTF8"); + return new String(bytes, "UTF8"); + } + catch(UnsupportedEncodingException unsupportedEncodingException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readString - unexpected:" + unsupportedEncodingException); + } } - void readStruct(TypeDescription typeDescription, Object object) throws Exception { + void readStruct(TypeDescription typeDescription, Object object) { Field fields[] = typeDescription.getFields(); for(int i = 0; i < fields.length; ++ i) { @@ -378,7 +510,7 @@ class Unmarshal implements IUnmarshal { if(memberTypeInfo != null) { if(memberTypeInfo.isAny()) // is the member an any? if(zInterface.isArray()) - zInterface = Class.forName("[Lcom.sun.star.uno.Any;"); + zInterface = Marshal.__anyArray; else zInterface = Any.class; @@ -405,29 +537,48 @@ class Unmarshal implements IUnmarshal { -- array_deepness; } - if(array_prefix.length() != 0) - xInterface = Class.forName(array_prefix + "L" + xInterface.getName() + ";"); + if(array_prefix.length() != 0) { + try { + xInterface = Class.forName(array_prefix + "L" + xInterface.getName() + ";"); + } + catch(ClassNotFoundException classNotFoundException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readStruct - unexpected:" + classNotFoundException); + } + } zInterface = xInterface; } } - fields[i].set(object, readObject(TypeDescription.getTypeDescription(zInterface))); + try { + fields[i].set(object, readObject(TypeDescription.getTypeDescription(zInterface))); + } + catch(IllegalAccessException illegalAccessException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readStruct - unexpected:" + illegalAccessException); + } } } if(DEBUG) System.err.println("##### " + getClass().getName() + ".readStruct:" + object); } - Object readStruct(TypeDescription typeDescription) throws Exception { - Object object = typeDescription.getZClass().newInstance(); + Object readStruct(TypeDescription typeDescription) { + try { + Object object = typeDescription.getZClass().newInstance(); - readStruct(typeDescription, object); + readStruct(typeDescription, object); - return object; + return object; + } + catch(IllegalAccessException illegalAccessException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readStruct - unexpected:" + illegalAccessException); + } + catch(InstantiationException instantiationException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readStruct - unexpected:" + instantiationException); + } } - ThreadID readThreadID() throws Exception { + ThreadID readThreadID() { Marshal.M_ThreadId m_threadId = (Marshal.M_ThreadId)readObject(Marshal.__M_ThreadIdTypeDescription); ThreadID threadId = null; @@ -446,8 +597,22 @@ class Unmarshal implements IUnmarshal { return threadId; } - TypeDescription readTypeDescription() throws Exception { - int typeClassValue = _dataInput.readUnsignedByte() & 0xff; + + int readunsignedbyte() { + try { + int result = (byte)(_dataInput.readUnsignedByte() & 0xff); + + if(DEBUG) System.err.println("##### " + getClass().getName() + ".readunsignedbyte:" + result); + + return result; + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readunsignedbyte - unexpected:" + iOException); + } + } + + TypeDescription readTypeDescription() { + int typeClassValue = readunsignedbyte() & 0xff; TypeClass typeClass = TypeClass.fromInt(typeClassValue & 0x7f); TypeDescription typeDescription = null; @@ -456,18 +621,24 @@ class Unmarshal implements IUnmarshal { typeDescription = TypeDescription.getTypeDescription(typeClass); else { - short index = _dataInput.readShort(); // the cache index + try { + short index = readshort(); // the cache index - if(index != (short)0xffff) { // shall we update the cache? - if((typeClassValue & 0x80) != 0) // update the cache? - _typeDescriptionCache[index] = TypeDescription.getTypeDescription(readString()); + if(index != (short)0xffff) { // shall we update the cache? + if((typeClassValue & 0x80) != 0) {// update the cache? + _typeDescriptionCache[index] = TypeDescription.getTypeDescription(readString()); // _typeDescriptionCache[index] = TypeDescription.getType(typeClass, readString()); + } - typeDescription = _typeDescriptionCache[index]; - } - else - typeDescription = TypeDescription.getTypeDescription(readString()); + typeDescription = _typeDescriptionCache[index]; + } + else + typeDescription = TypeDescription.getTypeDescription(readString()); // type = TypeDescription.getType(typeClass, readString()); + } + catch(ClassNotFoundException classNotFoundException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readTypeDescription - unexpected:" + classNotFoundException); + } } if(DEBUG) System.err.println("##### " + getClass().getName() + ".readType:" + typeDescription); @@ -475,8 +646,8 @@ class Unmarshal implements IUnmarshal { return typeDescription; } - Union readUnion(TypeDescription typeDescription) throws Exception { - throw new Exception("Unmarshal.readUnion - not implemented!!!"); + Union readUnion(TypeDescription typeDescription) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".readUnion - not implemented!!!"); } void reset(byte bytes[]) { @@ -484,7 +655,12 @@ class Unmarshal implements IUnmarshal { _dataInput = new DataInputStream(_inputStream); } - int bytesLeft() throws Exception { - return _inputStream.available(); + int bytesLeft() { + try { + return _inputStream.available(); + } + catch(IOException iOException) { + throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".bytesLeft - unexpected:" + iOException); + } } } diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java index b7a85ad67b9d..04d53b9bc8e4 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java @@ -2,9 +2,9 @@ * * $RCSfile: urp.java,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: kr $ $Date: 2001-04-20 10:28:13 $ + * last change: $Author: kr $ $Date: 2001-05-04 11:57:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,7 +95,7 @@ import com.sun.star.uno.Type; * from uno. The functionality is reachable through * the <code>IProtocol</code> interface. * <p> - * @version $Revision: 1.7 $ $ $Date: 2001-04-20 10:28:13 $ + * @version $Revision: 1.8 $ $ $Date: 2001-05-04 11:57:12 $ * @author Kay Ramme * @see com.sun.star.lib.uno.environments.remote.IProtocol * @since UDK1.0 @@ -162,7 +162,7 @@ public class urp extends Protocol { return "urp"; } - private Object readReply(byte header, boolean exception[]) throws Exception { + private Object readReply(byte header, boolean exception[]) { if((header & NEWTID) != 0) // new thread id ? _in_threadId = _unmarshal.readThreadID(); @@ -195,7 +195,7 @@ public class urp extends Protocol { } - private Object []readParams(MethodDescription methodDescription) throws Exception { + private Object []readParams(MethodDescription methodDescription) { TypeDescription in_sig[] = methodDescription.getInSignature(); TypeDescription out_sig[] = methodDescription.getOutSignature(); @@ -218,7 +218,7 @@ public class urp extends Protocol { } - private void readShortRequest(byte header, String operation[], Object param[][], boolean synchron[]) throws Exception { + private void readShortRequest(byte header, String operation[], Object param[][], boolean synchron[]) { ++ _requestsRecieved; int methodId = 0; @@ -242,7 +242,7 @@ public class urp extends Protocol { if(DEBUG) System.err.println("##### " + getClass().getName() + ".readShortRequest:" + _in_oid + " " + operation[0] + " " + synchron[0]); } - private void readLongRequest(byte header, String operation[], Object param[][], boolean synchron[], boolean mustReply[]) throws Exception { + private void readLongRequest(byte header, String operation[], Object param[][], boolean synchron[], boolean mustReply[]) { ++ _requestsRecieved; // read the extended flags @@ -286,7 +286,7 @@ public class urp extends Protocol { if(DEBUG) System.err.println("##### " + getClass().getName() + ".readLongRequest:" + _in_oid + " " + operation[0] + " " + synchron[0]); } - private Object readMessage(String operation[], Object param[], boolean synchron[], boolean mustReply[], boolean exception[]) throws Exception { + private Object readMessage(String operation[], Object param[], boolean synchron[], boolean mustReply[], boolean exception[]) { byte header = _unmarshal.readbyte(); Class signature[]; @@ -317,7 +317,7 @@ public class urp extends Protocol { ThreadID threadId, Object params[], Boolean synchron[], - Boolean mustReply[]) throws Exception + Boolean mustReply[]) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeRequest:" + oid + " " + zInterface + " " + operation); @@ -441,7 +441,7 @@ public class urp extends Protocol { putPendingRequest(_out_threadId, new Object[]{params, out_sig, methodDescription.getReturnSig()}); } - public void writeReply(boolean exception, ThreadID threadId, Object result) throws Exception { + public void writeReply(boolean exception, ThreadID threadId, Object result) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeReply:" + exception + " " + threadId + " " + result); ++ _message_count; @@ -483,7 +483,7 @@ public class urp extends Protocol { } - private byte []readBlock(DataInput dataInput) throws Exception { + private byte []readBlock(DataInput dataInput) throws IOException { int size = dataInput.readInt(); int message_count = dataInput.readInt(); @@ -496,7 +496,7 @@ public class urp extends Protocol { return bytes; } - private void writeBlock(DataOutput dataOutput, byte bytes[], int message_count) throws Exception { + private void writeBlock(DataOutput dataOutput, byte bytes[], int message_count) throws IOException { if(DEBUG) System.err.println("##### " + getClass().getName() + ".writeBlock: size:" + bytes.length + " message_count:" + message_count); if(message_count != 1) @@ -568,7 +568,7 @@ public class urp extends Protocol { return _oid; } - public Object getData(Object params[][]) throws Exception { + public Object getData(Object params[][]) { params[0] = _params; return _result; @@ -582,7 +582,7 @@ public class urp extends Protocol { * @see com.sun.star.lib.uno.environments.remote.Job * @see com.sun.star.lib.uno.environments.remote.IProtocol#readJob */ - public IMessage readMessage(InputStream inputStream) throws Exception { + public IMessage readMessage(InputStream inputStream) throws IOException { IMessage iMessage = null; while(iMessage == null) { // try hard to get a message @@ -632,7 +632,7 @@ public class urp extends Protocol { } - public void flush(DataOutput dataOutput) throws Exception { + public void flush(DataOutput dataOutput) throws IOException { if(_message_count > 0) { writeBlock(dataOutput, _marshal.reset(), _message_count); |