Advertisement
Mortihead

Untitled

Feb 9th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.38 KB | None | 0 0
  1.     private InputStream getCeResourceAndWrapExceptions(String path, boolean suppressObjectNotFound) {
  2.         Preconditions.checkNotNull(path, "Argument: 'path' can't be null.");
  3.         if (logger != null) logger.trace("Full file path: {}", path);
  4.         else System.out.println("Full file path: " + path);
  5.         try {
  6.             System.out.println("getCeResourceAndWrapExceptions before getCeResource");
  7.             return getCeResource(path);
  8.         } catch (EngineRuntimeException e) {
  9.             System.out.println("getCeResourceAndWrapExceptions Exception " +e.getMessage());
  10.             if (e.getExceptionCode() == ExceptionCode.E_OBJECT_NOT_FOUND) {
  11.                 if (suppressObjectNotFound) {
  12.                     System.out.println("getCeResourceAndWrapExceptions Exception not found return null ");
  13.                     return null;
  14.                 }
  15.                 throw ExceptionUtils.createException(ObjectNotFoundException.class, ru.brbpm.lecm.shared.exceptions
  16.                         .ExceptionCode.GENERIC_OBJECT_NOT_FOUND, path);
  17.             } else if (e.getExceptionCode() == ExceptionCode.E_ACCESS_DENIED) {
  18.                 throw ExceptionUtils.createException(AccessDeniedException.class, ru.brbpm.lecm.shared.exceptions
  19.                         .ExceptionCode.GENERIC_ACCESS_DENIED);
  20.             } else {
  21.                 throw e;
  22.             }
  23.         }
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement