com.sun.org.apache.xml.internal.res.XMLMessages Java Examples

The following examples show how to use com.sun.org.apache.xml.internal.res.XMLMessages. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QName.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a new QName with the specified namespace URI and
 * local name.
 *
 * @param namespaceURI The namespace URI if known, or null
 * @param localName The local name
 * @param validate If true the new QName will be validated and an IllegalArgumentException will
 *                 be thrown if it is invalid.
 */
public QName(String namespaceURI, String localName, boolean validate)
{

  // This check was already here.  So, for now, I will not add it to the validation
  // that is done when the validate parameter is true.
  if (localName == null)
    throw new IllegalArgumentException(XMLMessages.createXMLMessage(
          XMLErrorResources.ER_ARG_LOCALNAME_NULL, null)); //"Argument 'localName' is null");

  if (validate)
  {
      if (!XML11Char.isXML11ValidNCName(localName))
      {
          throw new IllegalArgumentException(XMLMessages.createXMLMessage(
          XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName");
      }
  }

  _namespaceURI = namespaceURI;
  _localName = localName;
  m_hashCode = toString().hashCode();
}
 
Example #2
Source File: URI.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Set the host for this URI. If null is passed in, the userinfo
 * field is also set to null and the port is set to -1.
 *
 * @param p_host the host for this URI
 *
 * @throws MalformedURIException if p_host is not a valid IP
 *                                  address or DNS hostname.
 */
public void setHost(String p_host) throws MalformedURIException
{

  if (p_host == null || p_host.trim().length() == 0)
  {
    m_host = p_host;
    m_userinfo = null;
    m_port = -1;
  }
  else if (!isWellFormedAddress(p_host))
  {
    throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
  }

  m_host = p_host;
}
 
Example #3
Source File: ChunkedIntArray.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Overwrite the integer found at a specific record and column.
 * Used to back-patch existing records, most often changing their
 * "next sibling" reference from 0 (unknown) to something meaningful
 * @param position int Record number
 * @param offset int Column number
 * @param value int New contents
 */
void writeEntry(int position, int offset, int value) throws ArrayIndexOutOfBoundsException
{
  /*
  try
  {
    fastArray[( position*slotsize)+offset] = value;
  }
  catch(ArrayIndexOutOfBoundsException aioobe)
  */
  {
    if (offset >= slotsize)
      throw new ArrayIndexOutOfBoundsException(XMLMessages.createXMLMessage(XMLErrorResources.ER_OFFSET_BIGGER_THAN_SLOT, null)); //"Offset bigger than slot");
    position*=slotsize;
    int chunkpos = position >> lowbits;
    int slotpos = position & lowmask;
    int[] chunk = chunks.elementAt(chunkpos);
    chunk[slotpos + offset] = value; // ATOMIC!
  }
}
 
Example #4
Source File: SAX2DTM.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get a new DTM ID beginning at the specified node index.
 * @param  nodeIndex The node identity at which the new DTM ID will begin
 * addressing.
 */
protected void addNewDTMID(int nodeIndex) {
  try
  {
    if(m_mgr==null)
      throw new ClassCastException();

                            // Handle as Extended Addressing
    DTMManagerDefault mgrD=(DTMManagerDefault)m_mgr;
    int id=mgrD.getFirstFreeDTMID();
    mgrD.addDTM(this,id,nodeIndex);
    m_dtmIdent.addElement(id<<DTMManager.IDENT_DTM_NODE_BITS);
  }
  catch(ClassCastException e)
  {
    // %REVIEW% Wrong error message, but I've been told we're trying
    // not to add messages right not for I18N reasons.
    // %REVIEW% Should this be a Fatal Error?
    error(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null));//"No more DTM IDs are available";
  }
}
 
Example #5
Source File: SAX2DTM2.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a deep copy of this iterator.   The cloned iterator is not reset.
 *
 * @return a deep copy of this iterator.
 */
public DTMAxisIterator cloneIterator()
{
  _isRestartable = false;

  try
  {
    final PrecedingIterator clone = (PrecedingIterator) super.clone();
    final int[] stackCopy = new int[_stack.length];
    System.arraycopy(_stack, 0, stackCopy, 0, _stack.length);

    clone._stack = stackCopy;

    // return clone.reset();
    return clone;
  }
  catch (CloneNotSupportedException e)
  {
    throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ITERATOR_CLONE_NOT_SUPPORTED, null)); //"Iterator clone not supported.");
  }
}
 
Example #6
Source File: SAX2DTM2.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a deep copy of this iterator.  The cloned iterator is not reset.
 *
 * @return a deep copy of this iterator.
 */
public DTMAxisIterator cloneIterator()
{
  _isRestartable = false;  // must set to false for any clone

  try
  {
    final AncestorIterator clone = (AncestorIterator) super.clone();

    clone._startNode = _startNode;

    // return clone.reset();
    return clone;
  }
  catch (CloneNotSupportedException e)
  {
    throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ITERATOR_CLONE_NOT_SUPPORTED, null)); //"Iterator clone not supported.");
  }
}
 
Example #7
Source File: DTMDefaultBaseIterators.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a deep copy of this iterator.   The cloned iterator is not reset.
 *
 * @return a deep copy of this iterator.
 */
public DTMAxisIterator cloneIterator()
{
  _isRestartable = false;

  try
  {
    final PrecedingIterator clone = (PrecedingIterator) super.clone();
    final int[] stackCopy = new int[_stack.length];
    System.arraycopy(_stack, 0, stackCopy, 0, _stack.length);

    clone._stack = stackCopy;

    // return clone.reset();
    return clone;
  }
  catch (CloneNotSupportedException e)
  {
    throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ITERATOR_CLONE_NOT_SUPPORTED, null)); //"Iterator clone not supported.");
  }
}
 
Example #8
Source File: DTMDefaultBaseIterators.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a deep copy of this iterator.  The cloned iterator is not reset.
 *
 * @return a deep copy of this iterator.
 */
public DTMAxisIterator cloneIterator()
{
  _isRestartable = false;  // must set to false for any clone

  try
  {
    final AncestorIterator clone = (AncestorIterator) super.clone();

    clone._startNode = _startNode;

    // return clone.reset();
    return clone;
  }
  catch (CloneNotSupportedException e)
  {
    throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ITERATOR_CLONE_NOT_SUPPORTED, null)); //"Iterator clone not supported.");
  }
}
 
Example #9
Source File: IncrementalSAXSource_Xerces.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** startParse() is a simple API which tells the IncrementalSAXSource
 * to begin reading a document.
 *
 * @throws SAXException is parse thread is already in progress
 * or parsing can not be started.
 * */
public void startParse(InputSource source) throws SAXException
{
  if (fIncrementalParser==null)
    throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_STARTPARSE_NEEDS_SAXPARSER, null)); //"startParse needs a non-null SAXParser.");
  if (fParseInProgress)
    throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_STARTPARSE_WHILE_PARSING, null)); //"startParse may not be called while parsing.");

  boolean ok=false;

  try
  {
    ok = parseSomeSetup(source);
  }
  catch(Exception ex)
  {
    throw new SAXException(ex);
  }

  if(!ok)
    throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_COULD_NOT_INIT_PARSER, null)); //"could not initialize parser with");
}
 
Example #10
Source File: QName.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Construct a QName from a string, without namespace resolution.  Good
 * for a few odd cases.
 *
 * @param localName Local part of qualified name
 * @param validate If true the new QName will be validated and an IllegalArgumentException will
 *                 be thrown if it is invalid.
 */
public QName(String localName, boolean validate)
{

  // This check was already here.  So, for now, I will not add it to the validation
  // that is done when the validate parameter is true.
  if (localName == null)
    throw new IllegalArgumentException(XMLMessages.createXMLMessage(
          XMLErrorResources.ER_ARG_LOCALNAME_NULL, null)); //"Argument 'localName' is null");

  if (validate)
  {
      if (!XML11Char.isXML11ValidNCName(localName))
      {
          throw new IllegalArgumentException(XMLMessages.createXMLMessage(
          XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName");
      }
  }
  _namespaceURI = null;
  _localName = localName;
  m_hashCode = toString().hashCode();
}
 
Example #11
Source File: URI.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Set the scheme for this URI. The scheme is converted to lowercase
 * before it is set.
 *
 * @param p_scheme the scheme for this URI (cannot be null)
 *
 * @throws MalformedURIException if p_scheme is not a conformant
 *                                  scheme name
 */
public void setScheme(String p_scheme) throws MalformedURIException
{

  if (p_scheme == null)
  {
    throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_SCHEME_FROM_NULL_STRING, null)); //"Cannot set scheme from null string!");
  }

  if (!isConformantSchemeName(p_scheme))
  {
    throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_SCHEME_NOT_CONFORMANT, null)); //"The scheme is not conformant.");
  }

  m_scheme = p_scheme.toLowerCase();
}
 
Example #12
Source File: URI.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Set the port for this URI. -1 is used to indicate that the port is
 * not specified, otherwise valid port numbers are  between 0 and 65535.
 * If a valid port number is passed in and the host field is null,
 * an exception is thrown.
 *
 * @param p_port the port number for this URI
 *
 * @throws MalformedURIException if p_port is not -1 and not a
 *                                  valid port number
 */
public void setPort(int p_port) throws MalformedURIException
{

  if (p_port >= 0 && p_port <= 65535)
  {
    if (m_host == null)
    {
      throw new MalformedURIException(
        XMLMessages.createXMLMessage(XMLErrorResources.ER_PORT_WHEN_HOST_NULL, null)); //"Port cannot be set when host is null!");
    }
  }
  else if (p_port != -1)
  {
    throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_INVALID_PORT, null)); //"Invalid port number!");
  }

  m_port = p_port;
}
 
Example #13
Source File: ChunkedIntArray.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an integer from the CIA by record number and column within
 * the record, both 0-based (though position 0 is reserved for special
 * purposes).
 * @param position int Record number
 * @param slotpos int Column number
 */
int readEntry(int position, int offset) throws ArrayIndexOutOfBoundsException
{
  /*
  try
  {
    return fastArray[(position*slotsize)+offset];
  }
  catch(ArrayIndexOutOfBoundsException aioobe)
  */
  {
    // System.out.println("Using slow read (1)");
    if (offset>=slotsize)
      throw new ArrayIndexOutOfBoundsException(XMLMessages.createXMLMessage(XMLErrorResources.ER_OFFSET_BIGGER_THAN_SLOT, null)); //"Offset bigger than slot");
    position*=slotsize;
    int chunkpos = position >> lowbits;
    int slotpos = position & lowmask;
    int[] chunk = chunks.elementAt(chunkpos);
    return chunk[slotpos + offset];
  }
}
 
Example #14
Source File: ChunkedIntArray.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Overwrite the integer found at a specific record and column.
 * Used to back-patch existing records, most often changing their
 * "next sibling" reference from 0 (unknown) to something meaningful
 * @param position int Record number
 * @param offset int Column number
 * @param value int New contents
 */
void writeEntry(int position, int offset, int value) throws ArrayIndexOutOfBoundsException
{
  /*
  try
  {
    fastArray[( position*slotsize)+offset] = value;
  }
  catch(ArrayIndexOutOfBoundsException aioobe)
  */
  {
    if (offset >= slotsize)
      throw new ArrayIndexOutOfBoundsException(XMLMessages.createXMLMessage(XMLErrorResources.ER_OFFSET_BIGGER_THAN_SLOT, null)); //"Offset bigger than slot");
    position*=slotsize;
    int chunkpos = position >> lowbits;
    int slotpos = position & lowmask;
    int[] chunk = chunks.elementAt(chunkpos);
    chunk[slotpos + offset] = value; // ATOMIC!
  }
}
 
Example #15
Source File: QName.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a new QName with the specified namespace URI and
 * local name.
 *
 * @param namespaceURI The namespace URI if known, or null
 * @param localName The local name
 * @param validate If true the new QName will be validated and an IllegalArgumentException will
 *                 be thrown if it is invalid.
 */
public QName(String namespaceURI, String localName, boolean validate)
{

  // This check was already here.  So, for now, I will not add it to the validation
  // that is done when the validate parameter is true.
  if (localName == null)
    throw new IllegalArgumentException(XMLMessages.createXMLMessage(
          XMLErrorResources.ER_ARG_LOCALNAME_NULL, null)); //"Argument 'localName' is null");

  if (validate)
  {
      if (!XML11Char.isXML11ValidNCName(localName))
      {
          throw new IllegalArgumentException(XMLMessages.createXMLMessage(
          XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName");
      }
  }

  _namespaceURI = namespaceURI;
  _localName = localName;
  m_hashCode = toString().hashCode();
}
 
Example #16
Source File: QName.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Construct a QName from a string, without namespace resolution.  Good
 * for a few odd cases.
 *
 * @param localName Local part of qualified name
 * @param validate If true the new QName will be validated and an IllegalArgumentException will
 *                 be thrown if it is invalid.
 */
public QName(String localName, boolean validate)
{

  // This check was already here.  So, for now, I will not add it to the validation
  // that is done when the validate parameter is true.
  if (localName == null)
    throw new IllegalArgumentException(XMLMessages.createXMLMessage(
          XMLErrorResources.ER_ARG_LOCALNAME_NULL, null)); //"Argument 'localName' is null");

  if (validate)
  {
      if (!XML11Char.isXML11ValidNCName(localName))
      {
          throw new IllegalArgumentException(XMLMessages.createXMLMessage(
          XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName");
      }
  }
  _namespaceURI = null;
  _localName = localName;
  m_hashCode = toString().hashCode();
}
 
Example #17
Source File: IncrementalSAXSource_Xerces.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/** startParse() is a simple API which tells the IncrementalSAXSource
 * to begin reading a document.
 *
 * @throws SAXException is parse thread is already in progress
 * or parsing can not be started.
 * */
public void startParse(InputSource source) throws SAXException
{
  if (fIncrementalParser==null)
    throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_STARTPARSE_NEEDS_SAXPARSER, null)); //"startParse needs a non-null SAXParser.");
  if (fParseInProgress)
    throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_STARTPARSE_WHILE_PARSING, null)); //"startParse may not be called while parsing.");

  boolean ok=false;

  try
  {
    ok = parseSomeSetup(source);
  }
  catch(Exception ex)
  {
    throw new SAXException(ex);
  }

  if(!ok)
    throw new SAXException(XMLMessages.createXMLMessage(XMLErrorResources.ER_COULD_NOT_INIT_PARSER, null)); //"could not initialize parser with");
}
 
Example #18
Source File: DTMDefaultBaseIterators.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a deep copy of this iterator.  The cloned iterator is not reset.
 *
 * @return a deep copy of this iterator.
 */
public DTMAxisIterator cloneIterator()
{
  _isRestartable = false;  // must set to false for any clone

  try
  {
    final AncestorIterator clone = (AncestorIterator) super.clone();

    clone._startNode = _startNode;

    // return clone.reset();
    return clone;
  }
  catch (CloneNotSupportedException e)
  {
    throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ITERATOR_CLONE_NOT_SUPPORTED, null)); //"Iterator clone not supported.");
  }
}
 
Example #19
Source File: DTMDefaultBaseIterators.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a deep copy of this iterator.   The cloned iterator is not reset.
 *
 * @return a deep copy of this iterator.
 */
public DTMAxisIterator cloneIterator()
{
  _isRestartable = false;

  try
  {
    final PrecedingIterator clone = (PrecedingIterator) super.clone();
    final int[] stackCopy = new int[_stack.length];
    System.arraycopy(_stack, 0, stackCopy, 0, _stack.length);

    clone._stack = stackCopy;

    // return clone.reset();
    return clone;
  }
  catch (CloneNotSupportedException e)
  {
    throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ITERATOR_CLONE_NOT_SUPPORTED, null)); //"Iterator clone not supported.");
  }
}
 
Example #20
Source File: URI.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Set the scheme for this URI. The scheme is converted to lowercase
 * before it is set.
 *
 * @param p_scheme the scheme for this URI (cannot be null)
 *
 * @throws MalformedURIException if p_scheme is not a conformant
 *                                  scheme name
 */
public void setScheme(String p_scheme) throws MalformedURIException
{

  if (p_scheme == null)
  {
    throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_SCHEME_FROM_NULL_STRING, null)); //"Cannot set scheme from null string!");
  }

  if (!isConformantSchemeName(p_scheme))
  {
    throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_SCHEME_NOT_CONFORMANT, null)); //"The scheme is not conformant.");
  }

  m_scheme = p_scheme.toLowerCase();
}
 
Example #21
Source File: SAX2DTM2.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a deep copy of this iterator.  The cloned iterator is not reset.
 *
 * @return a deep copy of this iterator.
 */
public DTMAxisIterator cloneIterator()
{
  _isRestartable = false;  // must set to false for any clone

  try
  {
    final AncestorIterator clone = (AncestorIterator) super.clone();

    clone._startNode = _startNode;

    // return clone.reset();
    return clone;
  }
  catch (CloneNotSupportedException e)
  {
    throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ITERATOR_CLONE_NOT_SUPPORTED, null)); //"Iterator clone not supported.");
  }
}
 
Example #22
Source File: SAX2DTM2.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a deep copy of this iterator.   The cloned iterator is not reset.
 *
 * @return a deep copy of this iterator.
 */
public DTMAxisIterator cloneIterator()
{
  _isRestartable = false;

  try
  {
    final PrecedingIterator clone = (PrecedingIterator) super.clone();
    final int[] stackCopy = new int[_stack.length];
    System.arraycopy(_stack, 0, stackCopy, 0, _stack.length);

    clone._stack = stackCopy;

    // return clone.reset();
    return clone;
  }
  catch (CloneNotSupportedException e)
  {
    throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_ITERATOR_CLONE_NOT_SUPPORTED, null)); //"Iterator clone not supported.");
  }
}
 
Example #23
Source File: URI.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Set the host for this URI. If null is passed in, the userinfo
 * field is also set to null and the port is set to -1.
 *
 * @param p_host the host for this URI
 *
 * @throws MalformedURIException if p_host is not a valid IP
 *                                  address or DNS hostname.
 */
public void setHost(String p_host) throws MalformedURIException
{

  if (p_host == null || p_host.trim().length() == 0)
  {
    m_host = p_host;
    m_userinfo = null;
    m_port = -1;
  }
  else if (!isWellFormedAddress(p_host))
  {
    throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
  }

  m_host = p_host;
}
 
Example #24
Source File: SAX2DTM.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Get a new DTM ID beginning at the specified node index.
 * @param  nodeIndex The node identity at which the new DTM ID will begin
 * addressing.
 */
protected void addNewDTMID(int nodeIndex) {
  try
  {
    if(m_mgr==null)
      throw new ClassCastException();

                            // Handle as Extended Addressing
    DTMManagerDefault mgrD=(DTMManagerDefault)m_mgr;
    int id=mgrD.getFirstFreeDTMID();
    mgrD.addDTM(this,id,nodeIndex);
    m_dtmIdent.addElement(id<<DTMManager.IDENT_DTM_NODE_BITS);
  }
  catch(ClassCastException e)
  {
    // %REVIEW% Wrong error message, but I've been told we're trying
    // not to add messages right not for I18N reasons.
    // %REVIEW% Should this be a Fatal Error?
    error(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null));//"No more DTM IDs are available";
  }
}
 
Example #25
Source File: URI.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Set the port for this URI. -1 is used to indicate that the port is
 * not specified, otherwise valid port numbers are  between 0 and 65535.
 * If a valid port number is passed in and the host field is null,
 * an exception is thrown.
 *
 * @param p_port the port number for this URI
 *
 * @throws MalformedURIException if p_port is not -1 and not a
 *                                  valid port number
 */
public void setPort(int p_port) throws MalformedURIException
{

  if (p_port >= 0 && p_port <= 65535)
  {
    if (m_host == null)
    {
      throw new MalformedURIException(
        XMLMessages.createXMLMessage(XMLErrorResources.ER_PORT_WHEN_HOST_NULL, null)); //"Port cannot be set when host is null!");
    }
  }
  else if (p_port != -1)
  {
    throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_INVALID_PORT, null)); //"Invalid port number!");
  }

  m_port = p_port;
}
 
Example #26
Source File: ChunkedIntArray.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Retrieve an integer from the CIA by record number and column within
 * the record, both 0-based (though position 0 is reserved for special
 * purposes).
 * @param position int Record number
 * @param slotpos int Column number
 */
int readEntry(int position, int offset) throws ArrayIndexOutOfBoundsException
{
  /*
  try
  {
    return fastArray[(position*slotsize)+offset];
  }
  catch(ArrayIndexOutOfBoundsException aioobe)
  */
  {
    // System.out.println("Using slow read (1)");
    if (offset>=slotsize)
      throw new ArrayIndexOutOfBoundsException(XMLMessages.createXMLMessage(XMLErrorResources.ER_OFFSET_BIGGER_THAN_SLOT, null)); //"Offset bigger than slot");
    position*=slotsize;
    int chunkpos = position >> lowbits;
    int slotpos = position & lowmask;
    int[] chunk = chunks.elementAt(chunkpos);
    return chunk[slotpos + offset];
  }
}
 
Example #27
Source File: UnImplNode.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Throw an error.
 *
 * @param msg Message Key for the error
 */
public void error(String msg)
{

  System.out.println("DOM ERROR! class: " + this.getClass().getName());

  throw new RuntimeException(XMLMessages.createXMLMessage(msg, null));
}
 
Example #28
Source File: DTMDefaultBase.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Given a node handle, return the XPath node name.  This should be
 * the name as described by the XPath data model, NOT the DOM-style
 * name.
 *
 * @param nodeHandle the id of the node.
 * @return String Name of this node, which may be an empty string.
 */
public String getNodeNameX(int nodeHandle)
{

  /** @todo: implement this com.sun.org.apache.xml.internal.dtm.DTMDefaultBase abstract method */
  error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"Not yet supported!");

  return null;
}
 
Example #29
Source File: DTMManagerDefault.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Add a DTM to the DTM table.
 *
 * @param dtm Should be a valid reference to a DTM.
 * @param id Integer DTM ID to be bound to this DTM.
 * @param offset Integer addressing offset. The internal DTM Node ID is
 * obtained by adding this offset to the node-number field of the
 * public DTM Handle. For the first DTM ID accessing each DTM, this is 0;
 * for overflow addressing it will be a multiple of 1<<IDENT_DTM_NODE_BITS.
 */
synchronized public void addDTM(DTM dtm, int id, int offset)
{
              if(id>=IDENT_MAX_DTMS)
              {
                      // TODO: %REVIEW% Not really the right error message.
          throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null)); //"No more DTM IDs are available!");
              }

              // We used to just allocate the array size to IDENT_MAX_DTMS.
              // But we expect to increase that to 16 bits, and I'm not willing
              // to allocate that much space unless needed. We could use one of our
              // handy-dandy Fast*Vectors, but this will do for now.
              // %REVIEW%
              int oldlen=m_dtms.length;
              if(oldlen<=id)
              {
                      // Various growth strategies are possible. I think we don't want
                      // to over-allocate excessively, and I'm willing to reallocate
                      // more often to get that. See also Fast*Vector classes.
                      //
                      // %REVIEW% Should throw a more diagnostic error if we go over the max...
                      int newlen=Math.min((id+256),IDENT_MAX_DTMS);

                      DTM new_m_dtms[] = new DTM[newlen];
                      System.arraycopy(m_dtms,0,new_m_dtms,0,oldlen);
                      m_dtms=new_m_dtms;
                      int new_m_dtm_offsets[] = new int[newlen];
                      System.arraycopy(m_dtm_offsets,0,new_m_dtm_offsets,0,oldlen);
                      m_dtm_offsets=new_m_dtm_offsets;
              }

  m_dtms[id] = dtm;
              m_dtm_offsets[id]=offset;
  dtm.documentRegistration();
              // The DTM should have been told who its manager was when we created it.
              // Do we need to allow for adopting DTMs _not_ created by this manager?
}
 
Example #30
Source File: QName.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new QName with the specified namespace URI, prefix
 * and local name.
 *
 * @param namespaceURI The namespace URI if known, or null
 * @param prefix The namespace prefix is known, or null
 * @param localName The local name
 * @param validate If true the new QName will be validated and an IllegalArgumentException will
 *                 be thrown if it is invalid.
 */
public QName(String namespaceURI, String prefix, String localName, boolean validate)
{

  // This check was already here.  So, for now, I will not add it to the validation
  // that is done when the validate parameter is true.
  if (localName == null)
    throw new IllegalArgumentException(XMLMessages.createXMLMessage(
          XMLErrorResources.ER_ARG_LOCALNAME_NULL, null)); //"Argument 'localName' is null");

  if (validate)
  {
      if (!XML11Char.isXML11ValidNCName(localName))
      {
          throw new IllegalArgumentException(XMLMessages.createXMLMessage(
          XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName");
      }

      if ((null != prefix) && (!XML11Char.isXML11ValidNCName(prefix)))
      {
          throw new IllegalArgumentException(XMLMessages.createXMLMessage(
          XMLErrorResources.ER_ARG_PREFIX_INVALID,null )); //"Argument 'prefix' not a valid NCName");
      }

  }
  _namespaceURI = namespaceURI;
  _prefix = prefix;
  _localName = localName;
  m_hashCode = toString().hashCode();
}