List of usage examples for com.liferay.portal.kernel.sanitizer SanitizerException SanitizerException
public SanitizerException(Throwable cause)
From source file:com.liferay.antisamy.hook.sanitizer.AntiSamySanitizerImpl.java
License:Open Source License
@Override public void sanitize(long companyId, long groupId, long userId, String className, long classPK, String contentType, String[] modes, InputStream inputStream, OutputStream outputStream, Map<String, Object> options) throws SanitizerException { if (_log.isDebugEnabled()) { _log.debug("Sanitizing " + className + "#" + classPK); }//from w w w. jav a 2 s . c om try { StreamUtil.transfer(inputStream, outputStream); } catch (IOException ioe) { throw new SanitizerException(ioe); } }
From source file:com.liferay.antisamy.hook.sanitizer.AntiSamySanitizerImpl.java
License:Open Source License
@Override public String sanitize(long companyId, long groupId, long userId, String className, long classPK, String contentType, String[] modes, String s, Map<String, Object> options) throws SanitizerException { if (_log.isDebugEnabled()) { _log.debug("Sanitizing " + className + "#" + classPK); }/* ww w . j av a 2 s . com*/ if (!_initialized) { _init(); } if (_disabled) { return s; } if (Validator.isNull(contentType) || !contentType.equals(ContentTypes.TEXT_HTML)) { return s; } try { AntiSamy antiSamy = new AntiSamy(); CleanResults cleanResults = antiSamy.scan(s, _policy); return cleanResults.getCleanHTML(); } catch (Exception e) { _log.error("Unable to sanitize input", e); throw new SanitizerException(e); } }
From source file:com.liferay.emailtombfilter.hook.sanitizer.EmailToMBMessageFilterSanitizerImpl.java
License:Open Source License
@Override public void sanitize(long companyId, long groupId, long userId, String className, long classPK, String contentType, String[] modes, InputStream inputStream, OutputStream outputStream, Map<String, Object> options) throws SanitizerException { try {//w w w .ja v a 2 s . co m StreamUtil.transfer(inputStream, outputStream); } catch (IOException ioe) { throw new SanitizerException(ioe); } }
From source file:com.sympo.sanitizer.MentionSanitizerImpl.java
License:Open Source License
public void sanitize(long companyId, long groupId, long userId, String className, long classPK, String contentType, String[] modes, InputStream inputStream, OutputStream outputStream, Map<String, Object> options) throws SanitizerException { if (_log.isDebugEnabled()) { _log.debug("Sanitizing " + className + "#" + classPK); }// w w w. j ava 2s . c om try { StreamUtil.transfer(inputStream, outputStream); } catch (IOException ioe) { throw new SanitizerException(ioe); } }
From source file:it.smc.calendar.sync.caldav.ICSSanitizer.java
License:Open Source License
public String sanitize(String ics) throws SanitizerException { try {//from w ww . ja v a 2 s . c o m CalendarBuilder calendarBuilder = new CalendarBuilder(); UnsyncStringReader unsyncStringReader = new UnsyncStringReader(ics); net.fortuna.ical4j.model.Calendar iCalCalendar = calendarBuilder.build(unsyncStringReader); List<VEvent> vEvents = iCalCalendar.getComponents(Component.VEVENT); for (VEvent vEvent : vEvents) { if (vEvent.getAlarms().size() > 0) { updateAlarmAttendeers(vEvent); } } return toString(iCalCalendar); } catch (Exception e) { throw new SanitizerException(e); } }