1. /*
  2. * @(#)FallbackObjectCopierImpl.java 1.7 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.impl.copyobject ;
  8. import com.sun.corba.se.spi.copyobject.ObjectCopier ;
  9. import com.sun.corba.se.spi.copyobject.ReflectiveCopyException ;
  10. /** Trys a first ObjectCopier. If the first throws a ReflectiveCopyException,
  11. * falls back and tries a second ObjectCopier.
  12. */
  13. public class FallbackObjectCopierImpl implements ObjectCopier
  14. {
  15. private ObjectCopier first ;
  16. private ObjectCopier second ;
  17. public FallbackObjectCopierImpl( ObjectCopier first,
  18. ObjectCopier second )
  19. {
  20. this.first = first ;
  21. this.second = second ;
  22. }
  23. public Object copy( Object src ) throws ReflectiveCopyException
  24. {
  25. try {
  26. return first.copy( src ) ;
  27. } catch (ReflectiveCopyException rce ) {
  28. // XXX log this fallback at a low level
  29. return second.copy( src ) ;
  30. }
  31. }
  32. }