ICE 3.4.2
[php5-ice-freebsdport.git] / java / src / IceInternal / Ex.java
blob846775747074396bb503c8886d9e8c0aaee924e6
1 // **********************************************************************
2 //
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
4 //
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
7 //
8 // **********************************************************************
10 package IceInternal;
12 public class Ex
14 public static void throwUOE(String expectedType, String actualType)
16 throw new Ice.UnexpectedObjectException(
17 "expected element of type `" + expectedType + "' but received '" + actualType,
18 actualType, expectedType);
21 public static void throwMemoryLimitException(int requested, int maximum)
23 throw new Ice.MemoryLimitException("requested " + requested + " bytes, maximum allowed is " + maximum +
24 " bytes (see Ice.MessageSizeMax)");
28 // A small utility to get the strack trace of the exception (which also includes toString()).
30 public static String toString(java.lang.Throwable ex)
32 java.io.StringWriter sw = new java.io.StringWriter();
33 java.io.PrintWriter pw = new java.io.PrintWriter(sw);
34 ex.printStackTrace(pw);
35 pw.flush();
36 return sw.toString();