[
https://issues.apache.org/jira/browse/SOLR-5249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13770915#comment-13770915
]
Uwe Schindler commented on SOLR-5249:
-------------------------------------
This is a bug in your XML editor: In your example, adding a line break inside
an XML element is *not* ignorable whitespace. Ignorable whitespace is only in
so called mixed-content elements (XML elements that contains TEXT and other
elements, like XHTML), but a CDATA/TEXT xml element with no other inner
elements is always treated by default as having only significant whitespace!
You my change this by adding xml:space attributes.
The fix is also not a good idea: Adding trim() on such a low level of parsing
may fix this bug, but may create new bugs. This is like if the JDK by itsself
would do a trim() on e.g. Class.forName()!!! So if we really want to support
this, the parts parsing the XML has to strip whitespace, not the resource
loader! This also does not help for other things like file names - which can
indeed contain spaces! This is the reason why its important to *not* ignore the
whitespace.
I would like to fix this as not-a-problem.
> ClassNotFoundException due to white-spaces in solrconfig.xml
> ------------------------------------------------------------
>
> Key: SOLR-5249
> URL: https://issues.apache.org/jira/browse/SOLR-5249
> Project: Solr
> Issue Type: Bug
> Reporter: Simon Endele
> Priority: Minor
> Attachments: SolrResourceLoader.java.patch
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Due to auto-formatting by an text editor/IDE there may be line-breaks after
> class names in the solrconfig.xml, for example:
> {code:xml}<searchComponent class="solr.SpellCheckComponent" name="suggest">
> <lst name="spellchecker">
> <str name="name">suggest</str>
> <str
> name="classname">org.apache.solr.spelling.suggest.Suggester</str>
> <str
> name="lookupImpl">org.apache.solr.spelling.suggest.fst.WFSTLookupFactory
> </str>
> [...]
> </lst>
> </searchComponent>{code}
> This will raise an exception in SolrResourceLoader as the white-spaces are
> not stripped from the class name:
> {code}Caused by: org.apache.solr.common.SolrException: Error loading class
> 'org.apache.solr.spelling.suggest.fst.WFSTLookupFactory
> '
> at
> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:449)
> at
> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:471)
> at
> org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:467)
> at org.apache.solr.spelling.suggest.Suggester.init(Suggester.java:102)
> at
> org.apache.solr.handler.component.SpellCheckComponent.inform(SpellCheckComponent.java:623)
> at
> org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:601)
> at org.apache.solr.core.SolrCore.<init>(SolrCore.java:830)
> ... 13 more
> Caused by: java.lang.ClassNotFoundException:
> org.apache.solr.spelling.suggest.fst.WFSTLookupFactory
>
> at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
> at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:789)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:264)
> at
> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:433)
> ... 19 more{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]