/** * Helper method for reading the default file of a folder.<p> * * If the resource given already is a file, it will be returned, otherwise * the default file (or null, if none exists) of the folder will be returned. * * @param res the resource whose default file to read * @return the default file */ protected CmsResource getDefaultFileOrSelf(CmsResource res) { CmsResource defaultfile = null; if (res.isFolder()) { try { defaultfile = m_cms.readDefaultFile("" + res.getStructureId()); } catch (CmsSecurityException e) { LOG.error(e.getLocalizedMessage(), e); return null; } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); return null; } return defaultfile; } return res; }
throw e; } catch (CmsSecurityException e) { LOG.warn(e.getLocalizedMessage(), e); throw e; } catch (CmsPdfLink.CmsPdfLinkParseException e) {
/** * @see org.opencms.gwt.shared.rpc.I_CmsCoreService#changePassword(java.lang.String, java.lang.String, java.lang.String) */ public String changePassword(String oldPassword, String newPassword, String newPasswordConfirm) throws CmsRpcException { CmsObject cms = getCmsObject(); CmsPasswordInfo passwordBean = new CmsPasswordInfo(cms); Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms); try { passwordBean.setCurrentPwd(oldPassword); passwordBean.setNewPwd(newPassword); passwordBean.setConfirmation(newPasswordConfirm); passwordBean.applyChanges(); return null; } catch (CmsSecurityException e) { LOG.error(e.getLocalizedMessage(), e); return e.getMessageContainer().key(wpLocale); } catch (CmsIllegalArgumentException e) { LOG.warn(e.getLocalizedMessage(), e); return e.getMessageContainer().key(wpLocale); } catch (Exception e) { error(e); return null; // will never be executed } }
/** * Checks the security level of the given password.<p> * * @param password the password */ void checkSecurity(String password) { I_CmsPasswordHandler handler = OpenCms.getPasswordHandler(); try { handler.validatePassword(password); if (handler instanceof I_CmsPasswordSecurityEvaluator) { SecurityLevel level = ((I_CmsPasswordSecurityEvaluator)handler).evaluatePasswordSecurity(password); m_form.setErrorPassword1(null, OpenCmsTheme.SECURITY + "-" + level.name()); } else { m_form.setErrorPassword1(null, OpenCmsTheme.SECURITY_STRONG); } } catch (CmsSecurityException e) { m_form.setErrorPassword1(new UserError(e.getLocalizedMessage(m_locale)), OpenCmsTheme.SECURITY_INVALID); } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_form.getPassword2())) { showPasswordMatchError(!password.equals(m_form.getPassword2())); } }