Return-Path: X-Original-To: apmail-lucene-commits-archive@www.apache.org Delivered-To: apmail-lucene-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9DF9110ED6 for ; Sat, 6 Jul 2013 11:50:52 +0000 (UTC) Received: (qmail 81138 invoked by uid 500); 6 Jul 2013 11:50:51 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 81130 invoked by uid 99); 6 Jul 2013 11:50:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Jul 2013 11:50:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Jul 2013 11:50:49 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id BDD04238890D; Sat, 6 Jul 2013 11:50:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1500244 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/core/ solr/core/src/java/org/apache/solr/core/RequestHandlers.java solr/core/src/java/org/apache/solr/core/SolrCore.java Date: Sat, 06 Jul 2013 11:50:29 -0000 To: commits@lucene.apache.org From: uschindler@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130706115029.BDD04238890D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: uschindler Date: Sat Jul 6 11:50:29 2013 New Revision: 1500244 URL: http://svn.apache.org/r1500244 Log: Merged revision(s) 1500243 from lucene/dev/trunk: Fix broken generics Modified: lucene/dev/branches/branch_4x/ (props changed) lucene/dev/branches/branch_4x/solr/ (props changed) lucene/dev/branches/branch_4x/solr/core/ (props changed) lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/RequestHandlers.java lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrCore.java Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/RequestHandlers.java URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/RequestHandlers.java?rev=1500244&r1=1500243&r2=1500244&view=diff ============================================================================== --- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/RequestHandlers.java (original) +++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/RequestHandlers.java Sat Jul 6 11:50:29 2013 @@ -79,11 +79,10 @@ public final class RequestHandlers { /** * @return a Map of all registered handlers of the specified type. */ - public Map getAll(Class clazz) { - Map result - = new HashMap(7); + public Map getAll(Class clazz) { + Map result = new HashMap(7); for (Map.Entry e : handlers.entrySet()) { - if(clazz.isInstance(e.getValue())) result.put(e.getKey(), e.getValue()); + if(clazz.isInstance(e.getValue())) result.put(e.getKey(), clazz.cast(e.getValue())); } return result; } Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrCore.java URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrCore.java?rev=1500244&r1=1500243&r2=1500244&view=diff ============================================================================== --- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrCore.java (original) +++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrCore.java Sat Jul 6 11:50:29 2013 @@ -525,13 +525,13 @@ public final class SolrCore implements S if (msg == null) msg = "SolrCore Object"; try { clazz = getResourceLoader().findClass(className, cast); - //most of the classes do not have constructors which takes SolrCore argument. It is recommended to obtain SolrCore by implementing SolrCoreAware. - // So invariably always it will cause a NoSuchMethodException. So iterate though the list of available constructors - Constructor[] cons = clazz.getConstructors(); - for (Constructor con : cons) { - Class[] types = con.getParameterTypes(); + //most of the classes do not have constructors which takes SolrCore argument. It is recommended to obtain SolrCore by implementing SolrCoreAware. + // So invariably always it will cause a NoSuchMethodException. So iterate though the list of available constructors + Constructor[] cons = clazz.getConstructors(); + for (Constructor con : cons) { + Class[] types = con.getParameterTypes(); if(types.length == 1 && types[0] == SolrCore.class){ - return (T)con.newInstance(this); + return cast.cast(con.newInstance(this)); } } return getResourceLoader().newInstance(className, cast);//use the empty constructor @@ -554,14 +554,13 @@ public final class SolrCore implements S if (msg == null) msg = "SolrCore Object"; try { clazz = getResourceLoader().findClass(className, UpdateHandler.class); - //most of the classes do not have constructors which takes SolrCore argument. It is recommended to obtain SolrCore by implementing SolrCoreAware. - // So invariably always it will cause a NoSuchMethodException. So iterate though the list of available constructors - Constructor justSolrCoreCon = null; - Constructor[] cons = clazz.getConstructors(); - for (Constructor con : cons) { - Class[] types = con.getParameterTypes(); + //most of the classes do not have constructors which takes SolrCore argument. It is recommended to obtain SolrCore by implementing SolrCoreAware. + // So invariably always it will cause a NoSuchMethodException. So iterate though the list of available constructors + Constructor[] cons = clazz.getConstructors(); + for (Constructor con : cons) { + Class[] types = con.getParameterTypes(); if(types.length == 2 && types[0] == SolrCore.class && types[1] == UpdateHandler.class){ - return (UpdateHandler) con.newInstance(this, updateHandler); + return UpdateHandler.class.cast(con.newInstance(this, updateHandler)); } } throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error Instantiating "+msg+", "+className+ " could not find proper constructor for " + UpdateHandler.class.getName()); @@ -698,7 +697,7 @@ public final class SolrCore implements S // mode as well, and can't assert version field support on init. try { - Object ignored = VersionInfo.getAndCheckVersionField(schema); + VersionInfo.getAndCheckVersionField(schema); } catch (SolrException e) { throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Schema will not work with SolrCloud mode: " + @@ -775,9 +774,9 @@ public final class SolrCore implements S // cause the executor to stall so firstSearcher events won't fire // until after inform() has been called for all components. // searchExecutor must be single-threaded for this to work - searcherExecutor.submit(new Callable() { + searcherExecutor.submit(new Callable() { @Override - public Object call() throws Exception { + public Void call() throws Exception { latch.await(); return null; } @@ -1176,7 +1175,7 @@ public final class SolrCore implements S /** * Returns an unmodifiable Map containing the registered handlers of the specified type. */ - public Map getRequestHandlers(Class clazz) { + public Map getRequestHandlers(Class clazz) { return reqHandlers.getAll(clazz); }