[ 
https://issues.apache.org/jira/browse/FOR-1079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592294#action_12592294
 ] 

Thorsten Scherler commented on FOR-1079:
----------------------------------------

I did 
ngrep forrest
ngrep dtd
as su but that did only return #. 

However the exception:
...
java.net.UnknownHostException: forrest.apache.org
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)

Meaning we actually want to connect to forrest.apache.org.
...
        at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:938)
        at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown 
Source)

That is interesting! The method reads (sniped to the interesting parts):
/**
     * This method uses the passed-in XMLInputSource to make 
     * fCurrentEntity usable for reading.
     * @param name  name of the entity (XML is it's the document entity)
     * @param xmlInputSource    the input source, with sufficient information
     *      to begin scanning characters.
     * @param literal        True if this entity is started within a
     *                       literal value.
     * @param isExternal    whether this entity should be treated as an 
internal or external entity.
     * @throws IOException  if anything can't be read
     *  XNIException    If any parser-specific goes wrong.
     * @return the encoding of the new entity or null if a character stream was 
employed
     */
    public String setupCurrentEntity(String name, XMLInputSource xmlInputSource,
                boolean literal, boolean isExternal)
            throws IOException, XNIException {
        // get information
...
        // create reader
        InputStream stream = null;
        Reader reader = xmlInputSource.getCharacterStream();
        // First chance checking strict URI
        String expandedSystemId = expandSystemId(literalSystemId, baseSystemId, 
fStrictURI);
        if (baseSystemId == null) {
            baseSystemId = expandedSystemId;
        }
        if (reader == null) {
            stream = xmlInputSource.getByteStream();
            if (stream == null) {
                URL location = new URL(expandedSystemId);
                URLConnection connect = location.openConnection();
                if (!(connect instanceof HttpURLConnection)) {

// NOTE thorsten:
// The following line will produce the error
                    stream = connect.getInputStream();
                }
                else {                  
                ...

The above code seems to be responsible to produce the exception. 

        at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown 
Source)

seems that it is related to the DTD entities.

...
        at 
org.apache.tools.ant.taskdefs.optional.XMLValidateTask.doValidate(XMLValidateTask.java:539)

and it related to the validate task. 

That is why setting
forrest.validate=false
is an ugly but working workaround.


> validate-xdocs fails if no DNS server is configured on the underlying OS
> ------------------------------------------------------------------------
>
>                 Key: FOR-1079
>                 URL: https://issues.apache.org/jira/browse/FOR-1079
>             Project: Forrest
>          Issue Type: Bug
>          Components: XML grammars & validation
>    Affects Versions: 0.9-dev
>            Reporter: Thorsten Scherler
>         Attachments: 1079.exception.txt
>
>
> If you remove the DNS server entries from your OS forrest cannot validate 
> anymore.
> sudo vi /etc/resolv.conf
> -> comment all DNS
> try "forrest" as usual on your project, it will fail like:
> ...
> forrest/trunk/main/targets/validate.xml:136: Could not validate document 
> /home/thorsten/src/sadesi/boja2/trunk/exporter/src/documentation/content/xdocs/index.xml

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.