You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mdfst13 <gi...@git.apache.org> on 2018/10/15 10:00:20 UTC

[GitHub] tomcat pull request #127: Add a fake attribute for source

GitHub user mdfst13 opened a pull request:

    https://github.com/apache/tomcat/pull/127

    Add a fake attribute for source

    Eclipse adds a source attribute to Tomcat's Context element.  Presumably this helps it keep track of what context element relates to what project.  Tomcat however warns on unrecognized attributes.  This sets source as a fake attribute, which tells Tomcat not to report it.  
    
    You can see more of a description of this on Stack Overflow, e.g. at https://stackoverflow.com/a/3566358/6660678
    
    As you can see, several people ascribed unrelated behavior to this warning.  Meanwhile, all the warning is saying is that Tomcat doesn't know what a source attribute is in server.xml.  Removing the warning thus makes it easier to find the real warning.  
    
    Due to the way that fakeAttributes work (see java/org/apache/tomcat/util/digester/SetPropertiesRule.java lines 72-78), they are not checked until just before the system would issue the warning.  So this would make no difference if someone actually added a source attribute.  
    
    All this does is suppress the warning for a correctly spelled source attribute.  The warning would still appear for incorrectly spelled attributes like sorce or peth.  I can't really see any circumstance where one could misspell a legitimate (not fake) attribute as source.  
    
    You can also view java/org/apache/tomcat/util/digester/Digester.java at lines 734-773 (particularly 748-761) for more context.  Convenience links:  
    
    https://github.com/apache/tomcat/blob/18e106480a59f3b7b5b1d2f3bda3b2d7e065361e/java/org/apache/tomcat/util/digester/Digester.java#L734-L773
    https://github.com/apache/tomcat/blob/18e106480a59f3b7b5b1d2f3bda3b2d7e065361e/java/org/apache/tomcat/util/digester/SetPropertiesRule.java#L72-L78
    
    In case you were wondering, `top` is declared here as type `Object`, so there isn't a more specific class that we could use for indexing in this case.  
    
    You can view the issue yourself, outside of Eclipse, by adding something like `source="org.eclipse.jst.jee.server"` to your Context entry in servers.xml (assuming that's where you have your context defined).  
    
    This issue annoys me because inevitably, just as I've forgotten the whole thing, I find myself scanning logs trying to diagnose something.  I see this warning, remember that it's not really important, but wonder about getting rid of it.  Then I go through the whole process again of finding out what causes it.  And of course, short of dropping Eclipse or modifying code, there is no way to get rid of the warning.  
    
    I don't want to drop Eclipse.  Can we make this small code modification, please?  

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mdfst13/tomcat fake-eclipse-source

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tomcat/pull/127.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #127
    
----
commit f12b732ea381f45e6670a613eaccf85c357aa672
Author: mdfst13 <43...@...>
Date:   2018-10-15T09:05:16Z

    Add a fake attribute for source
    
    Eclipse adds a source attribute to Tomcat's Context element.  Presumably this helps it keep track of what context element relates to what project.  Tomcat however warns on unrecognized attributes.  This sets source as a fake attribute, which tells Tomcat not to report it.

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] tomcat issue #127: Add a fake attribute for source

Posted by markt-asf <gi...@git.apache.org>.
Github user markt-asf commented on the issue:

    https://github.com/apache/tomcat/pull/127
  
    Nice idea. I've applied a variation of this patch to Tomcat. The key changes were:
    - Only ignore source on Context elements
    - Ignore source on Context elements in server.xml and context.xml files


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] tomcat pull request #127: Add a fake attribute for source

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/tomcat/pull/127


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org