mea culpa, It looked like a trivial fix . I did an only ant example .
Thanks for catching this On Sat, Jul 11, 2009 at 12:36 AM, Chris Hostetter<hossman_luc...@fucit.org> wrote: > > Dude .... you've got to at least run "ant test" before you commit ... > TestWriterPerf can't even compile now. > > This breaks anyone that was explicitly passing null to the existing > getRequestHandler(String) method (like TestWriterPerf) ... but besides > that it also seems really weird to have a method that takes in a class and > arbitrarily returns the first instance of that class found -- especially > since it's iterating over the values in a Map, so if someone has multiple > instances of a handler they could get a different one each time this > method is called. > > making a method that returns *all* the handlers of that type seems like a > better general feature for SolrCore/RequestHandlers, and then in this > specific use case of the replication JSP can be as arbitrary as it wants. > > > i've got a fix i'll commit as soon as my tests finish... > > > > : Date: Fri, 10 Jul 2009 10:04:29 -0000 > : From: no...@apache.org > : Reply-To: solr-dev@lucene.apache.org > : To: solr-comm...@lucene.apache.org > : Subject: svn commit: r792861 - in /lucene/solr/trunk/src: > : java/org/apache/solr/core/RequestHandlers.java > : java/org/apache/solr/core/SolrCore.java webapp/web/admin/index.jsp > : webapp/web/admin/replication/header.jsp > : > : Author: noble > : Date: Fri Jul 10 10:04:29 2009 > : New Revision: 792861 > : > : URL: http://svn.apache.org/viewvc?rev=792861&view=rev > : Log: > : SOLR-1255 An attempt to visit the replication admin page when its not a > defined handler should display an approp message > : > : Modified: > : lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java > : lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java > : lucene/solr/trunk/src/webapp/web/admin/index.jsp > : lucene/solr/trunk/src/webapp/web/admin/replication/header.jsp > : > : Modified: > lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java > : URL: > http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java?rev=792861&r1=792860&r2=792861&view=diff > : > ============================================================================== > : --- lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java > (original) > : +++ lucene/solr/trunk/src/java/org/apache/solr/core/RequestHandlers.java > Fri Jul 10 10:04:29 2009 > : @@ -66,7 +66,7 @@ > : public RequestHandlers(SolrCore core) { > : this.core = core; > : } > : - > : + > : /** > : * @return the RequestHandler registered at the given name > : */ > : @@ -74,6 +74,13 @@ > : return handlers.get(normalize(handlerName)); > : } > : > : + public SolrRequestHandler get(Class clazz) { > : + for (SolrRequestHandler requestHandler : handlers.values()) { > : + if(requestHandler.getClass() == clazz) return requestHandler; > : + } > : + return null; > : + } > : + > : /** > : * Handlers must be initialized before calling this function. As soon > as this is > : * called, the handler can immediately accept requests. > : > : Modified: lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java > : URL: > http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java?rev=792861&r1=792860&r2=792861&view=diff > : > ============================================================================== > : --- lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java (original) > : +++ lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java Fri Jul > 10 10:04:29 2009 > : @@ -767,6 +767,10 @@ > : public SolrRequestHandler getRequestHandler(String handlerName) { > : return reqHandlers.get(handlerName); > : } > : + > : + public SolrRequestHandler getRequestHandler(Class clazz) { > : + return reqHandlers.get(clazz); > : + } > : > : /** > : * Returns an unmodifieable Map containing the registered handlers > : > : Modified: lucene/solr/trunk/src/webapp/web/admin/index.jsp > : URL: > http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/index.jsp?rev=792861&r1=792860&r2=792861&view=diff > : > ============================================================================== > : --- lucene/solr/trunk/src/webapp/web/admin/index.jsp (original) > : +++ lucene/solr/trunk/src/webapp/web/admin/index.jsp Fri Jul 10 10:04:29 > 2009 > : @@ -24,11 +24,12 @@ > : <%@ page import="java.util.List" %> > : <%@ page import="java.util.Collection" %> > : <%@ page import="org.apache.solr.request.SolrRequestHandler"%> > : +<%@ page import="org.apache.solr.handler.ReplicationHandler" %> > : > : <%-- jsp:include page="header.jsp"/ --%> > : <%-- do a verbatim include so we can use the local vars --%> > : <%...@include file="header.jsp" %> > : -<%SolrRequestHandler replicationhandler = > core.getRequestHandler("/replication");%> > : +<%SolrRequestHandler replicationhandler = > core.getRequestHandler(ReplicationHandler.class);%> > : <br clear="all"> > : <table> > : > : > : Modified: lucene/solr/trunk/src/webapp/web/admin/replication/header.jsp > : URL: > http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/replication/header.jsp?rev=792861&r1=792860&r2=792861&view=diff > : > ============================================================================== > : --- lucene/solr/trunk/src/webapp/web/admin/replication/header.jsp (original) > : +++ lucene/solr/trunk/src/webapp/web/admin/replication/header.jsp Fri Jul > 10 10:04:29 2009 > : @@ -21,14 +21,14 @@ > : > org.apache.solr.request.LocalSolrQueryRequest, > : org.apache.solr.request.SolrQueryResponse, > : org.apache.solr.request.SolrRequestHandler"%> > : - > : -<html> > : -<head> > : - > : +<%@ page import="org.apache.solr.handler.ReplicationHandler" %> > : <% > : request.setCharacterEncoding("UTF-8"); > : %> > : > : +<html> > : +<head> > : + > : <%...@include file="../_info.jsp" %> > : > : <script> > : @@ -55,7 +55,11 @@ > : %> > : > : <% > : -final SolrRequestHandler rh = core.getRequestHandler("/replication"); > : +final SolrRequestHandler rh = > core.getRequestHandler(ReplicationHandler.class); > : + if(rh == null){ > : + response.sendError( 404, "No ReplicationHandler registered" ); > : + return; > : + } > : NamedList namedlist = executeCommand("details",core,rh); > : NamedList detailsMap = (NamedList)namedlist.get("details"); > : if(detailsMap != null) > : > : > > > > -Hoss > > -- ----------------------------------------------------- Noble Paul | Principal Engineer| AOL | http://aol.com