1. /*
  2. * Copyright 1999-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /*
  17. * $Id: WrappedRuntimeException.java,v 1.6 2004/02/17 04:21:14 minchau Exp $
  18. */
  19. package com.sun.org.apache.xml.internal.utils;
  20. /**
  21. * This class is for throwing important checked exceptions
  22. * over non-checked methods. It should be used with care,
  23. * and in limited circumstances.
  24. */
  25. public class WrappedRuntimeException extends RuntimeException
  26. {
  27. /** Primary checked exception.
  28. * @serial */
  29. private Exception m_exception;
  30. /**
  31. * Construct a WrappedRuntimeException from a
  32. * checked exception.
  33. *
  34. * @param e Primary checked exception
  35. */
  36. public WrappedRuntimeException(Exception e)
  37. {
  38. super(e.getMessage());
  39. m_exception = e;
  40. }
  41. /**
  42. * Constructor WrappedRuntimeException
  43. *
  44. *
  45. * @param msg Exception information.
  46. * @param e Primary checked exception
  47. */
  48. public WrappedRuntimeException(String msg, Exception e)
  49. {
  50. super(msg);
  51. m_exception = e;
  52. }
  53. /**
  54. * Get the checked exception that this runtime exception wraps.
  55. *
  56. * @return The primary checked exception
  57. */
  58. public Exception getException()
  59. {
  60. return m_exception;
  61. }
  62. }