private Document buildDoc(Reader in) throws IOException {
        final Lock writeLock = readWriteLock.writeLock();
        writeLock.lock();
        try {
            SAXReader xmlReader = new SAXReader();
            xmlReader.setEncoding("UTF-8");
            xmlReader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
            xmlReader.setFeature("http://xml.org/sax/features/external-general-entities", false);
            xmlReader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
            return xmlReader.read(in);
        }
        catch (Exception e) {
            Log.error("Error reading XML properties", e);
            throw new IOException(e.getMessage());
        } finally {
            writeLock.unlock();
        }
    }
Builds the document XML model up based the given reader of XML data.
@param in the input stream used to build the xml document
@throws java.io.IOException thrown when an error occurs reading the input stream.
xmppserver/src/main/java/org/jivesoftware/util/XMLProperties.java