com.sun.org.apache.xml.internal.dtm.DTMException Java Examples

The following examples show how to use com.sun.org.apache.xml.internal.dtm.DTMException. 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: DTMManagerDefault.java    From jdk8u60 with GNU General Public License v2.0 7 votes vote down vote up
/**
 * This method returns the SAX2 parser to use with the InputSource
 * obtained from this URI.
 * It may return null if any SAX2-conformant XML parser can be used,
 * or if getInputSource() will also return null. The parser must
 * be free for use (i.e., not currently in use for another parse().
 * After use of the parser is completed, the releaseXMLReader(XMLReader)
 * must be called.
 *
 * @param inputSource The value returned from the URIResolver.
 * @return  a SAX2 XMLReader to use to resolve the inputSource argument.
 *
 * @return non-null XMLReader reference ready to parse.
 */
synchronized public XMLReader getXMLReader(Source inputSource)
{

  try
  {
    XMLReader reader = (inputSource instanceof SAXSource)
                       ? ((SAXSource) inputSource).getXMLReader() : null;

    // If user did not supply a reader, ask for one from the reader manager
    if (null == reader) {
      if (m_readerManager == null) {
          m_readerManager = XMLReaderManager.getInstance(super.useServicesMechnism());
      }

      reader = m_readerManager.getXMLReader();
    }

    return reader;

  } catch (SAXException se) {
    throw new DTMException(se.getMessage(), se);
  }
}
 
Example #2
Source File: DTMManagerDefault.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Method createDocumentFragment
 *
 *
 * NEEDSDOC (createDocumentFragment) @return
 */
synchronized public DTM createDocumentFragment()
{

  try
  {
    DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(super.useServicesMechnism());
    dbf.setNamespaceAware(true);

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    Node df = doc.createDocumentFragment();

    return getDTM(new DOMSource(df), true, null, false, false);
  }
  catch (Exception e)
  {
    throw new DTMException(e);
  }
}
 
Example #3
Source File: DTMManagerDefault.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method returns the SAX2 parser to use with the InputSource
 * obtained from this URI.
 * It may return null if any SAX2-conformant XML parser can be used,
 * or if getInputSource() will also return null. The parser must
 * be free for use (i.e., not currently in use for another parse().
 * After use of the parser is completed, the releaseXMLReader(XMLReader)
 * must be called.
 *
 * @param inputSource The value returned from the URIResolver.
 * @return  a SAX2 XMLReader to use to resolve the inputSource argument.
 *
 * @return non-null XMLReader reference ready to parse.
 */
synchronized public XMLReader getXMLReader(Source inputSource)
{

  try
  {
    XMLReader reader = (inputSource instanceof SAXSource)
                       ? ((SAXSource) inputSource).getXMLReader() : null;

    // If user did not supply a reader, ask for one from the reader manager
    if (null == reader) {
      if (m_readerManager == null) {
          m_readerManager = XMLReaderManager.getInstance(super.overrideDefaultParser());
      }

      reader = m_readerManager.getXMLReader();
    }

    return reader;

  } catch (SAXException se) {
    throw new DTMException(se.getMessage(), se);
  }
}
 
Example #4
Source File: DTMManagerDefault.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method createDocumentFragment
 *
 *
 * NEEDSDOC (createDocumentFragment) @return
 */
synchronized public DTM createDocumentFragment()
{

  try
  {
    DocumentBuilderFactory dbf = JdkXmlUtils.getDOMFactory(super.overrideDefaultParser());

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    Node df = doc.createDocumentFragment();

    return getDTM(new DOMSource(df), true, null, false, false);
  }
  catch (Exception e)
  {
    throw new DTMException(e);
  }
}
 
Example #5
Source File: DTMManagerDefault.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method returns the SAX2 parser to use with the InputSource
 * obtained from this URI.
 * It may return null if any SAX2-conformant XML parser can be used,
 * or if getInputSource() will also return null. The parser must
 * be free for use (i.e., not currently in use for another parse().
 * After use of the parser is completed, the releaseXMLReader(XMLReader)
 * must be called.
 *
 * @param inputSource The value returned from the URIResolver.
 * @return  a SAX2 XMLReader to use to resolve the inputSource argument.
 *
 * @return non-null XMLReader reference ready to parse.
 */
synchronized public XMLReader getXMLReader(Source inputSource)
{

  try
  {
    XMLReader reader = (inputSource instanceof SAXSource)
                       ? ((SAXSource) inputSource).getXMLReader() : null;

    // If user did not supply a reader, ask for one from the reader manager
    if (null == reader) {
      if (m_readerManager == null) {
          m_readerManager = XMLReaderManager.getInstance(super.overrideDefaultParser());
      }

      reader = m_readerManager.getXMLReader();
    }

    return reader;

  } catch (SAXException se) {
    throw new DTMException(se.getMessage(), se);
  }
}
 
Example #6
Source File: DTMManagerDefault.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method createDocumentFragment
 *
 *
 * NEEDSDOC (createDocumentFragment) @return
 */
synchronized public DTM createDocumentFragment()
{

  try
  {
    DocumentBuilderFactory dbf = JdkXmlUtils.getDOMFactory(super.overrideDefaultParser());

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    Node df = doc.createDocumentFragment();

    return getDTM(new DOMSource(df), true, null, false, false);
  }
  catch (Exception e)
  {
    throw new DTMException(e);
  }
}
 
Example #7
Source File: DTMManagerDefault.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method returns the SAX2 parser to use with the InputSource
 * obtained from this URI.
 * It may return null if any SAX2-conformant XML parser can be used,
 * or if getInputSource() will also return null. The parser must
 * be free for use (i.e., not currently in use for another parse().
 * After use of the parser is completed, the releaseXMLReader(XMLReader)
 * must be called.
 *
 * @param inputSource The value returned from the URIResolver.
 * @return  a SAX2 XMLReader to use to resolve the inputSource argument.
 *
 * @return non-null XMLReader reference ready to parse.
 */
synchronized public XMLReader getXMLReader(Source inputSource)
{

  try
  {
    XMLReader reader = (inputSource instanceof SAXSource)
                       ? ((SAXSource) inputSource).getXMLReader() : null;

    // If user did not supply a reader, ask for one from the reader manager
    if (null == reader) {
      if (m_readerManager == null) {
          m_readerManager = XMLReaderManager.getInstance(super.overrideDefaultParser());
      }

      reader = m_readerManager.getXMLReader();
    }

    return reader;

  } catch (SAXException se) {
    throw new DTMException(se.getMessage(), se);
  }
}
 
Example #8
Source File: DTMManagerDefault.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * This method returns the SAX2 parser to use with the InputSource
 * obtained from this URI.
 * It may return null if any SAX2-conformant XML parser can be used,
 * or if getInputSource() will also return null. The parser must
 * be free for use (i.e., not currently in use for another parse().
 * After use of the parser is completed, the releaseXMLReader(XMLReader)
 * must be called.
 *
 * @param inputSource The value returned from the URIResolver.
 * @return  a SAX2 XMLReader to use to resolve the inputSource argument.
 *
 * @return non-null XMLReader reference ready to parse.
 */
synchronized public XMLReader getXMLReader(Source inputSource)
{

  try
  {
    XMLReader reader = (inputSource instanceof SAXSource)
                       ? ((SAXSource) inputSource).getXMLReader() : null;

    // If user did not supply a reader, ask for one from the reader manager
    if (null == reader) {
      if (m_readerManager == null) {
          m_readerManager = XMLReaderManager.getInstance(super.overrideDefaultParser());
      }

      reader = m_readerManager.getXMLReader();
    }

    return reader;

  } catch (SAXException se) {
    throw new DTMException(se.getMessage(), se);
  }
}
 
Example #9
Source File: DTMManagerDefault.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method createDocumentFragment
 *
 *
 * NEEDSDOC (createDocumentFragment) @return
 */
synchronized public DTM createDocumentFragment()
{

  try
  {
    DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(super.useServicesMechnism());
    dbf.setNamespaceAware(true);

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    Node df = doc.createDocumentFragment();

    return getDTM(new DOMSource(df), true, null, false, false);
  }
  catch (Exception e)
  {
    throw new DTMException(e);
  }
}
 
Example #10
Source File: DTMManagerDefault.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method returns the SAX2 parser to use with the InputSource
 * obtained from this URI.
 * It may return null if any SAX2-conformant XML parser can be used,
 * or if getInputSource() will also return null. The parser must
 * be free for use (i.e., not currently in use for another parse().
 * After use of the parser is completed, the releaseXMLReader(XMLReader)
 * must be called.
 *
 * @param inputSource The value returned from the URIResolver.
 * @return  a SAX2 XMLReader to use to resolve the inputSource argument.
 *
 * @return non-null XMLReader reference ready to parse.
 */
synchronized public XMLReader getXMLReader(Source inputSource)
{

  try
  {
    XMLReader reader = (inputSource instanceof SAXSource)
                       ? ((SAXSource) inputSource).getXMLReader() : null;

    // If user did not supply a reader, ask for one from the reader manager
    if (null == reader) {
      if (m_readerManager == null) {
          m_readerManager = XMLReaderManager.getInstance(super.useServicesMechnism());
      }

      reader = m_readerManager.getXMLReader();
    }

    return reader;

  } catch (SAXException se) {
    throw new DTMException(se.getMessage(), se);
  }
}
 
Example #11
Source File: DTMManagerDefault.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * This method returns the SAX2 parser to use with the InputSource
 * obtained from this URI.
 * It may return null if any SAX2-conformant XML parser can be used,
 * or if getInputSource() will also return null. The parser must
 * be free for use (i.e., not currently in use for another parse().
 * After use of the parser is completed, the releaseXMLReader(XMLReader)
 * must be called.
 *
 * @param inputSource The value returned from the URIResolver.
 * @return  a SAX2 XMLReader to use to resolve the inputSource argument.
 *
 * @return non-null XMLReader reference ready to parse.
 */
synchronized public XMLReader getXMLReader(Source inputSource)
{

  try
  {
    XMLReader reader = (inputSource instanceof SAXSource)
                       ? ((SAXSource) inputSource).getXMLReader() : null;

    // If user did not supply a reader, ask for one from the reader manager
    if (null == reader) {
      if (m_readerManager == null) {
          m_readerManager = XMLReaderManager.getInstance(super.useServicesMechnism());
      }

      reader = m_readerManager.getXMLReader();
    }

    return reader;

  } catch (SAXException se) {
    throw new DTMException(se.getMessage(), se);
  }
}
 
Example #12
Source File: SAX2DTM2.java    From openjdk-jdk9 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 #13
Source File: DTMManagerDefault.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method createDocumentFragment
 *
 *
 * NEEDSDOC (createDocumentFragment) @return
 */
synchronized public DTM createDocumentFragment()
{

  try
  {
    DocumentBuilderFactory dbf = JdkXmlUtils.getDOMFactory(super.overrideDefaultParser());

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    Node df = doc.createDocumentFragment();

    return getDTM(new DOMSource(df), true, null, false, false);
  }
  catch (Exception e)
  {
    throw new DTMException(e);
  }
}
 
Example #14
Source File: SAX2DTM2.java    From Bytecoder 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 #15
Source File: SAX2DTM2.java    From Bytecoder 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 #16
Source File: SAX2DTM2.java    From openjdk-jdk9 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 #17
Source File: DTMManagerDefault.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * This method returns the SAX2 parser to use with the InputSource
 * obtained from this URI.
 * It may return null if any SAX2-conformant XML parser can be used,
 * or if getInputSource() will also return null. The parser must
 * be free for use (i.e., not currently in use for another parse().
 * After use of the parser is completed, the releaseXMLReader(XMLReader)
 * must be called.
 *
 * @param inputSource The value returned from the URIResolver.
 * @return  a SAX2 XMLReader to use to resolve the inputSource argument.
 *
 * @return non-null XMLReader reference ready to parse.
 */
synchronized public XMLReader getXMLReader(Source inputSource)
{

  try
  {
    XMLReader reader = (inputSource instanceof SAXSource)
                       ? ((SAXSource) inputSource).getXMLReader() : null;

    // If user did not supply a reader, ask for one from the reader manager
    if (null == reader) {
      if (m_readerManager == null) {
          m_readerManager = XMLReaderManager.getInstance(super.overrideDefaultParser());
      }

      reader = m_readerManager.getXMLReader();
    }

    return reader;

  } catch (SAXException se) {
    throw new DTMException(se.getMessage(), se);
  }
}
 
Example #18
Source File: DTMManagerDefault.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Method createDocumentFragment
 *
 *
 * NEEDSDOC (createDocumentFragment) @return
 */
synchronized public DTM createDocumentFragment()
{

  try
  {
    DocumentBuilderFactory dbf = JdkXmlUtils.getDOMFactory(super.overrideDefaultParser());

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    Node df = doc.createDocumentFragment();

    return getDTM(new DOMSource(df), true, null, false, false);
  }
  catch (Exception e)
  {
    throw new DTMException(e);
  }
}
 
Example #19
Source File: DTMManagerDefault.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Method createDocumentFragment
 *
 *
 * NEEDSDOC (createDocumentFragment) @return
 */
synchronized public DTM createDocumentFragment()
{

  try
  {
    DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(super.useServicesMechnism());
    dbf.setNamespaceAware(true);

    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.newDocument();
    Node df = doc.createDocumentFragment();

    return getDTM(new DOMSource(df), true, null, false, false);
  }
  catch (Exception e)
  {
    throw new DTMException(e);
  }
}
 
Example #20
Source File: DTMManagerDefault.java    From JDKSourceCode1.8 with MIT License 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 #21
Source File: DTMManagerDefault.java    From openjdk-jdk8u-backup 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 #22
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 #23
Source File: DTMManagerDefault.java    From openjdk-jdk8u 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 #24
Source File: DTMManagerDefault.java    From jdk8u60 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 #25
Source File: DTMManagerDefault.java    From jdk1.8-source-analysis with Apache License 2.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 #26
Source File: DTMManagerDefault.java    From openjdk-jdk9 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 #27
Source File: DTMManagerDefault.java    From Bytecoder with Apache License 2.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 #28
Source File: DOM2DTMdefaultNamespaceDeclarationNode.java    From openjdk-jdk8u with GNU General Public License v2.0 votes vote down vote up
public Node cloneNode(boolean deep) {throw new DTMException(NOT_SUPPORTED_ERR);} 
Example #29
Source File: DOM2DTMdefaultNamespaceDeclarationNode.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 votes vote down vote up
public void setValue(String value) {throw new DTMException(NOT_SUPPORTED_ERR);} 
Example #30
Source File: DOM2DTMdefaultNamespaceDeclarationNode.java    From openjdk-jdk8u with GNU General Public License v2.0 votes vote down vote up
public Node appendChild(Node a) {throw new DTMException(NOT_SUPPORTED_ERR);}