/** * Tries to convert a CmsException to the matching exception type from JLAN.<p> * * @param e the exception to convert * @return the converted exception */ public static IOException convertCmsException(CmsException e) { LOG.error(e.getLocalizedMessage(), e); if (e instanceof CmsSecurityException) { return new AccessDeniedException(e.getMessage(), e); } else if (e instanceof CmsVfsResourceAlreadyExistsException) { return new FileExistsException("File exists: " + e); } else if (e instanceof CmsVfsResourceNotFoundException) { return new FileNotFoundException("File does not exist: " + e); } else { return new IOException(e); } }
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws IOException, ServletException { if (getParamListAction().equals(LIST_ACTION_RESTORE)) { try { performRestoreOperation(); Map<String, String[]> params = new HashMap<String, String[]>(); params.put(PARAM_ACTION, new String[] {DIALOG_INITIAL}); getToolManager().jspForwardPage(this, "/system/workplace/views/explorer/explorer_files.jsp", params); } catch (CmsException e) { LOG.error(e.getMessage(), e); throw new CmsRuntimeException(e.getMessageContainer()); } } refreshList(); }
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws IOException, ServletException { if (getParamListAction().equals(LIST_ACTION_RESTORE)) { try { performRestoreOperation(); Map params = new HashMap(); params.put(PARAM_ACTION, DIALOG_INITIAL); getToolManager().jspForwardPage(this, "/system/workplace/views/explorer/explorer_files.jsp", params); } catch (CmsException e) { LOG.error(e.getMessage(), e); throw new CmsRuntimeException(e.getMessageContainer()); } } refreshList(); }
LOG.warn(e.getMessage(), e);
/** * Returns the search field mappings declared within the XSD.<p> * * @param cms the CmsObject * @param resource the resource * * @return the fields to map */ protected Set<CmsSearchField> getXSDMappings(CmsObject cms, CmsResource resource) { try { if (CmsResourceTypeXmlContent.isXmlContent(resource)) { I_CmsXmlContentHandler handler = CmsXmlContentDefinition.getContentHandlerForResource(cms, resource); if ((handler != null) && !handler.getSearchFields().isEmpty()) { return handler.getSearchFields(); } } } catch (CmsException e) { LOG.error(e.getMessage(), e); } return null; }
/** * Returns the search field mappings declared within the XSD that should be applied to the container page.<p> * * @param cms the CmsObject * @param resource the resource * * @return the fields to map */ protected Set<CmsSearchField> getXSDMappingsForPage(CmsObject cms, CmsResource resource) { try { if (CmsResourceTypeXmlContent.isXmlContent(resource)) { I_CmsXmlContentHandler handler = CmsXmlContentDefinition.getContentHandlerForResource(cms, resource); if ((handler != null) && !handler.getSearchFieldsForPage().isEmpty()) { return handler.getSearchFieldsForPage(); } } } catch (CmsException e) { LOG.error(e.getMessage(), e); } return null; }
/** * @see org.opencms.search.CmsSearchIndex#addConfigurationParameter(java.lang.String, java.lang.String) */ @Override public void addConfigurationParameter(String key, String value) { if (POST_PROCESSOR.equals(key)) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) { try { setPostProcessor((I_CmsSolrPostSearchProcessor)Class.forName(value).newInstance()); } catch (Exception e) { CmsException ex = new CmsException( Messages.get().container(Messages.LOG_SOLR_ERR_POST_PROCESSOR_NOT_EXIST_1, value), e); LOG.error(ex.getMessage(), ex); } } } super.addConfigurationParameter(key, value); }
/** * @see org.opencms.jsp.CmsJspLoginBean#login(java.lang.String, java.lang.String, java.lang.String) */ @Override public void login(String userName, String password, String projectName) { super.login(userName, password, projectName); if (isLoginSuccess()) { CmsObject cms = getCmsObject(); CmsPersistentLoginTokenHandler tokenHandler = new CmsPersistentLoginTokenHandler(); tokenHandler.setTokenLifetime(m_tokenLifetime); try { final String token = tokenHandler.createToken(cms); Cookie cookie = new Cookie(CmsPersistentLoginAuthorizationHandler.COOKIE_NAME, token); cookie.setMaxAge((int)(m_tokenLifetime / 1000)); cookie.setPath(getCookiePath(true)); getResponse().addCookie(cookie); m_isTokenSet = true; } catch (CmsException e) { LOG.error(e.getMessage(), e); } } }
/** * Checks whether the given resource is a model reuse group.<p> * * @param cms the cms context * @param resource the resource * * @return <code>true</code> in case the resource is a model reuse group */ public static boolean isModelReuseGroup(CmsObject cms, CmsResource resource) { boolean result = false; if (isModelGroup(resource)) { try { CmsProperty tempElementsProp = cms.readPropertyObject( resource, CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS, false); if (tempElementsProp.isNullProperty() || !CmsContainerElement.USE_AS_COPY_MODEL.equals(tempElementsProp.getValue())) { result = true; } } catch (CmsException e) { LOG.warn(e.getMessage(), e); } } return result; }
/** * Returns whether the given resource is a folder and is marked to be a navigation level folder.<p> * * @param cms the cms context * @param resource the resource * * @return <code>true</code> if the resource is marked to be a navigation level folder */ public static boolean isNavLevelFolder(CmsObject cms, CmsResource resource) { if (resource.isFolder()) { I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(resource); if (CmsResourceTypeFolder.RESOURCE_TYPE_NAME.equals(type.getTypeName())) { try { CmsProperty prop = cms.readPropertyObject( resource, CmsPropertyDefinition.PROPERTY_DEFAULT_FILE, false); return !prop.isNullProperty() && NAVIGATION_LEVEL_FOLDER.equals(prop.getValue()); } catch (CmsException e) { LOG.debug(e.getMessage(), e); } } } return false; }
/** * Reads the local macro formatters from the .formatters folder if present.<p> * * @param node the xml content node * * @return the local formatters */ private Set<String> readLocalMacroFormatters(I_CmsXmlContentLocation node) { Set<String> addFormatters = new HashSet<String>(); String path = m_cms.getSitePath(node.getDocument().getFile()); path = CmsStringUtil.joinPaths(CmsResource.getParentFolder(path), ".formatters"); try { if (m_cms.existsResource(path, CmsResourceFilter.IGNORE_EXPIRATION)) { I_CmsResourceType macroType = OpenCms.getResourceManager().getResourceType( CmsFormatterConfigurationCache.TYPE_MACRO_FORMATTER); CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION.addRequireType(macroType); List<CmsResource> macroFormatters = m_cms.readResources(path, filter); for (CmsResource formatter : macroFormatters) { addFormatters.add(formatter.getStructureId().toString()); } } } catch (CmsException e) { LOG.warn(e.getMessage(), e); } return addFormatters; }
} catch (CmsException e) { LOG.error(e.getMessage(), e);
m_errorMessages.add(e.getMessage()); if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e);
m_errorMessages.add(e.getMessage()); if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e);
LOG.error(e.getMessage(), e);
} catch (CmsException e) { LOG.error(e.getMessage(), e); return generateResponse(Boolean.FALSE, getCreationErrorMessage(), formatStackTrace(e)); } catch (CmsUploadException e) {
} catch (CmsException e) { return CmsMessages.formatUnknownKey(e.getMessage());
} catch (CmsException e) { return CmsMessages.formatUnknownKey(e.getMessage());
LOG.error(e.getMessage(), e); } catch (UnsupportedEncodingException e) { LOG.error(e.getMessage(), e);
LOG.error(e.getMessage(), e); } catch (UnsupportedEncodingException e) { LOG.error(e.getMessage(), e);