mirror of https://github.com/apache/lucene.git
SOLR-4019: Log 503 stack traces unless from PingRequestHandler. Suppress logging some stack traces with ShowFileRequestHandler.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1405893 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5c7afe05df
commit
3ea6657976
|
@ -142,6 +142,10 @@ Bug Fixes
|
|||
* SOLR-4009: OverseerCollectionProcessor is not resiliant to many error conditions
|
||||
and can stop running on errors. (milesli, Mark Miller)
|
||||
|
||||
* SOLR-4019: Log stack traces for 503/Service Unavailable SolrException if not
|
||||
thrown by PingRequestHandler. Do not log exceptions if a user tries to view a
|
||||
hidden file using ShowFileRequestHandler. (Tomás Fernández Löbbe via James Dyer)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
package org.apache.solr.handler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
@ -201,8 +200,10 @@ public class PingRequestHandler extends RequestHandlerBase implements SolrCoreAw
|
|||
switch(action){
|
||||
case PING:
|
||||
if( isPingDisabled() ) {
|
||||
throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE,
|
||||
SolrException e = new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE,
|
||||
"Service disabled");
|
||||
rsp.setException(e);
|
||||
return;
|
||||
}
|
||||
handlePing(req, rsp);
|
||||
break;
|
||||
|
|
|
@ -139,10 +139,12 @@ public class ShowFileRequestHandler extends RequestHandlerBase
|
|||
} else {
|
||||
fname = fname.replace('\\', '/'); // normalize slashes
|
||||
if (hiddenFiles.contains(fname.toUpperCase(Locale.ROOT))) {
|
||||
throw new SolrException(ErrorCode.FORBIDDEN, "Can not access: " + fname);
|
||||
rsp.setException(new SolrException(ErrorCode.FORBIDDEN, "Can not access: " + fname));
|
||||
return;
|
||||
}
|
||||
if (fname.indexOf("..") >= 0) {
|
||||
throw new SolrException(ErrorCode.FORBIDDEN, "Invalid path: " + fname);
|
||||
rsp.setException(new SolrException(ErrorCode.FORBIDDEN, "Invalid path: " + fname));
|
||||
return;
|
||||
}
|
||||
if (fname.startsWith("/")) { // Only files relative to conf are valid
|
||||
fname = fname.substring(1);
|
||||
|
@ -218,10 +220,12 @@ public class ShowFileRequestHandler extends RequestHandlerBase
|
|||
else {
|
||||
fname = fname.replace( '\\', '/' ); // normalize slashes
|
||||
if( hiddenFiles.contains( fname.toUpperCase(Locale.ROOT) ) ) {
|
||||
throw new SolrException( ErrorCode.FORBIDDEN, "Can not access: "+fname );
|
||||
rsp.setException(new SolrException( ErrorCode.FORBIDDEN, "Can not access: "+fname ));
|
||||
return;
|
||||
}
|
||||
if( fname.indexOf( ".." ) >= 0 ) {
|
||||
throw new SolrException( ErrorCode.FORBIDDEN, "Invalid path: "+fname );
|
||||
rsp.setException(new SolrException( ErrorCode.FORBIDDEN, "Invalid path: "+fname ));
|
||||
return;
|
||||
}
|
||||
adminFile = new File( configdir, fname );
|
||||
}
|
||||
|
|
|
@ -76,10 +76,6 @@ public class SolrException extends RuntimeException {
|
|||
|
||||
public void log(Logger log) { log(log,this); }
|
||||
public static void log(Logger log, Throwable e) {
|
||||
if (e instanceof SolrException
|
||||
&& ((SolrException) e).code() == ErrorCode.SERVICE_UNAVAILABLE.code) {
|
||||
return;
|
||||
}
|
||||
String stackTrace = toStr(e);
|
||||
String ignore = doIgnore(e, stackTrace);
|
||||
if (ignore != null) {
|
||||
|
@ -91,10 +87,6 @@ public class SolrException extends RuntimeException {
|
|||
}
|
||||
|
||||
public static void log(Logger log, String msg, Throwable e) {
|
||||
if (e instanceof SolrException
|
||||
&& ((SolrException) e).code() == ErrorCode.SERVICE_UNAVAILABLE.code) {
|
||||
log(log, msg);
|
||||
}
|
||||
String stackTrace = msg + ':' + toStr(e);
|
||||
String ignore = doIgnore(e, stackTrace);
|
||||
if (ignore != null) {
|
||||
|
|
Loading…
Reference in New Issue