@Override @TransactionAttribute(TransactionAttributeType.NEVER) public BundleVersion createOrStoreBundleVersionViaFile(Subject subject, File distributionFile) throws Exception { try { return createBundleVersionViaFileImpl(subject, distributionFile, false, null); } catch (PermissionException e) { if (null != e.getCause() && e.getCause() instanceof BundleNotFoundException) { // This application exception indicates the special token handling workflow throw new BundleNotFoundException("[" + distributionFile.getName() + "]"); } else { throw e; } } }
@Override @TransactionAttribute(TransactionAttributeType.NEVER) public BundleVersion createOrStoreBundleVersionViaURL(Subject subject, String distributionFileUrl, String username, String password) throws Exception { File file = null; boolean deleteFile = true; try { file = downloadFile(distributionFileUrl, username, password); if (LOG.isDebugEnabled()) { LOG.debug("Copied [" + file.length() + "] bytes from [" + distributionFileUrl + "] into [" + file.getPath() + "]"); } return createBundleVersionViaFileImpl(subject, file, false, null); } catch (PermissionException e) { if (null != e.getCause() && e.getCause() instanceof BundleNotFoundException) { deleteFile = false; // This application exception indicates the special token handling workflow throw new BundleNotFoundException("[" + distributionFileUrl + "]"); } else { throw e; } } finally { if (deleteFile && file != null) { file.delete(); } } }
String msg = "Subject [" + subject.getName() + "] requires Global CREATE_BUNDLES and VIEW_BUNDLES to create unassigned initial bundle version."; throw new PermissionException(msg, new BundleNotFoundException()); // set the cause to BNFE, this is helpful to some callers
bundle = entityManager.find(Bundle.class, bundleId); if (null == bundle) { throw new BundleNotFoundException("Bundle ID [" + bundleId + "]");