/** * Writes s String to the output stream.<p> * * @param s the String to write * @throws SAXException in case of I/O errors */ private void write(String s) throws SAXException { try { m_writer.write(s); } catch (IOException e) { throw new SAXException(Messages.get().getBundle().key(Messages.ERR_IOERROR_0), e); } }
/** * Writes s String to the output stream.<p> * * @param s the String to write * @throws SAXException in case of I/O errors */ private void write(String s) throws SAXException { try { m_writer.write(s); } catch (IOException e) { throw new SAXException(Messages.get().getBundle().key(Messages.ERR_IOERROR_0), e); } }
/** * Writes a linebreak to the output stream, also handles the indentation.<p> * * @throws SAXException in case of I/O errors */ private void writeNewLine() throws SAXException { try { // write new line m_writer.write("\r\n"); // write indentation for (int i = 1; i < m_indentLevel; i++) { m_writer.write(INDENT_STR); } // flush the stream m_writer.flush(); } catch (IOException e) { throw new SAXException(Messages.get().getBundle().key(Messages.ERR_IOERROR_0), e); } } }
/** * Internal helper that throws a <code>{@link CmsRuntimeException}</code> if the * configuration of this instance has been frozen ({@link #setFrozen(boolean)}).<p> * * @throws CmsRuntimeException if the configuration of this instance has been frozen * ({@link #setFrozen(boolean)}) */ private void checkFrozen() throws CmsRuntimeException { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_FILE_VIEW_SETTINGS_FROZEN_0)); } }
/** * Internal helper that throws a <code>{@link CmsRuntimeException}</code> if the * configuration of this instance has been frozen ({@link #setFrozen(boolean)}).<p> * * @throws CmsRuntimeException if the configuration of this instance has been frozen * ({@link #setFrozen(boolean)}) */ private void checkFrozen() throws CmsRuntimeException { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_FILE_VIEW_SETTINGS_FROZEN_0)); } }
/** * * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput) */ public void writeExternal(ObjectOutput out) throws IOException { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_WRITE_UUID_1, toString())); } out.writeObject(toString()); } }
/** * * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput) */ public void writeExternal(ObjectOutput out) throws IOException { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_WRITE_UUID_1, toString())); } out.writeObject(toString()); } }
/** * Format an Object argument using this conversion * specification. * @param s the Object to format. * @return the formatted String. * @exception CmsIllegalArgumentException if the * conversion character is neither s nor S. */ String internalsprintf(Object s) throws CmsIllegalArgumentException { String s2 = ""; if ((m_conversionCharacter == 's') || (m_conversionCharacter == 'S')) { s2 = printSFormat(s.toString()); } else { throw new CmsIllegalArgumentException(Messages.get().container( Messages.ERR_INVALID_DOUBLE_FMT_CHAR_2, "String", new Character(m_conversionCharacter))); } return s2; }
/** * Format an Object argument using this conversion * specification. * @param s the Object to format. * @return the formatted String. * @exception CmsIllegalArgumentException if the * conversion character is neither s nor S. */ String internalsprintf(Object s) throws CmsIllegalArgumentException { String s2 = ""; if ((m_conversionCharacter == 's') || (m_conversionCharacter == 'S')) { s2 = printSFormat(s.toString()); } else { throw new CmsIllegalArgumentException( Messages.get().container( Messages.ERR_INVALID_DOUBLE_FMT_CHAR_2, "String", new Character(m_conversionCharacter))); } return s2; }
/** * Converts the given HTML code according to the settings of this converter.<p> * * If an any error occurs during the conversion process, the original input is returned unmodified.<p> * * @param htmlInput HTML input stored in an array of bytes * @return array of bytes containing the converted HTML */ public byte[] convertToByteSilent(byte[] htmlInput) { try { return convertToByte(htmlInput); } catch (Exception e) { if (LOG.isWarnEnabled()) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_CONVERSION_BYTE_FAILED_0), e); } return htmlInput; } }
/** * Format a String argument using this conversion * specification. * @param s the String to format. * @return the formatted String. * @exception CmsIllegalArgumentException if the * conversion character is neither s nor S. */ String internalsprintf(String s) throws CmsIllegalArgumentException { String s2 = ""; if ((m_conversionCharacter == 's') || (m_conversionCharacter == 'S')) { s2 = printSFormat(s); } else { throw new CmsIllegalArgumentException(Messages.get().container( Messages.ERR_INVALID_DOUBLE_FMT_CHAR_2, "String", new Character(m_conversionCharacter))); } return s2; }
/** * Converts the given HTML code according to the settings of this converter.<p> * * If an any error occurs during the conversion process, the original input is returned unmodified.<p> * * @param htmlInput HTML input stored in an array of bytes * @return array of bytes containing the converted HTML */ public byte[] convertToByteSilent(byte[] htmlInput) { try { return convertToByte(htmlInput); } catch (Exception e) { if (LOG.isWarnEnabled()) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_CONVERSION_BYTE_FAILED_0), e); } return htmlInput; } }
/** * Converts the given HTML code according to the settings of this converter.<p> * * If an any error occurs during the conversion process, the original input is returned unmodified.<p> * * @param htmlInput HTML input stored in string * * @return string containing the converted HTML */ public String convertToStringSilent(String htmlInput) { try { return convertToString(htmlInput); } catch (Exception e) { if (LOG.isWarnEnabled()) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_CONVERSION_BYTE_FAILED_0), e); } return htmlInput; } }
/** * Converts the given HTML code according to the settings of this converter.<p> * * If an any error occurs during the conversion process, the original input is returned unmodified.<p> * * @param htmlInput HTML input stored in string * * @return string containing the converted HTML */ public String convertToStringSilent(String htmlInput) { try { return convertToString(htmlInput); } catch (Exception e) { if (LOG.isWarnEnabled()) { LOG.warn(Messages.get().getBundle().key(Messages.LOG_CONVERSION_BYTE_FAILED_0), e); } return htmlInput; } }
/** * @see org.xml.sax.ContentHandler#endDocument() */ @Override public void endDocument() throws SAXException { try { if (m_openElement) { write("/>"); m_openElement = false; } writeNewLine(); m_writer.flush(); } catch (IOException e) { throw new SAXException(Messages.get().getBundle().key(Messages.ERR_IOERROR_0), e); } }
/** * @see org.xml.sax.ContentHandler#endDocument() */ @Override public void endDocument() throws SAXException { try { if (m_openElement) { write("/>"); m_openElement = false; } writeNewLine(); m_writer.flush(); } catch (IOException e) { throw new SAXException(Messages.get().getBundle().key(Messages.ERR_IOERROR_0), e); } }
/** * Check that the given id is not the null id.<p> * * @param id the id to check * @param canBeNull only if flag is set, <code>null</code> is accepted * * @see #isNullUUID() */ public static void checkId(CmsUUID id, boolean canBeNull) { if (canBeNull && (id == null)) { return; } if ((!canBeNull && (id == null)) || id.isNullUUID()) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_INVALID_UUID_1, id)); } }
/** * Check that the given id is not the null id.<p> * * @param id the id to check * @param canBeNull only if flag is set, <code>null</code> is accepted * * @see #isNullUUID() */ public static void checkId(CmsUUID id, boolean canBeNull) { if (canBeNull && (id == null)) { return; } if ((!canBeNull && (id == null)) || id.isNullUUID()) { throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_INVALID_UUID_1, id)); } }
/** * Initialize the UUID generator with the ethernet address of the server machine.<p> * * The ethernetAddress parameter must represent a 'standard' ethernet MAC address string * (e.g. '00:C0:F0:3D:5B:7C'). * * @param ethernetAddress the ethernet address of the server machine * @throws CmsInitException in case the ethernetAddress String is not a valid ethernet address */ public static void init(String ethernetAddress) throws CmsInitException { try { m_ethernetAddress = new EthernetAddress(ethernetAddress); } catch (Exception e) { throw new CmsInitException( Messages.get().container(Messages.ERR_INVALID_ETHERNET_ADDRESS_1, ethernetAddress)); } }
/** * Initialize the UUID generator with the ethernet address of the server machine.<p> * * The ethernetAddress parameter must represent a 'standard' ethernet MAC address string * (e.g. '00:C0:F0:3D:5B:7C'). * * @param ethernetAddress the ethernet address of the server machine * @throws CmsInitException in case the ethernetAddress String is not a valid ethernet address */ public static void init(String ethernetAddress) throws CmsInitException { try { m_ethernetAddress = new EthernetAddress(ethernetAddress); } catch (Exception e) { throw new CmsInitException(Messages.get().container( Messages.ERR_INVALID_ETHERNET_ADDRESS_1, ethernetAddress)); } }