You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2014/03/22 20:34:48 UTC
svn commit: r1580294 -
/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
Author: shalin
Date: Sat Mar 22 19:34:47 2014
New Revision: 1580294
URL: http://svn.apache.org/r1580294
Log:
Don't swallow exception in getLatestVersion. Refactored some odd if conditions.
Modified:
lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java?rev=1580294&r1=1580293&r2=1580294&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/SnapPuller.java Sat Mar 22 19:34:47 2014
@@ -251,7 +251,7 @@ public class SnapPuller {
rsp = server.request(req);
} catch (SolrServerException e) {
- throw new SolrException(ErrorCode.SERVER_ERROR, e.getMessage());
+ throw new SolrException(ErrorCode.SERVER_ERROR, e.getMessage(), e);
} finally {
server.shutdown();
}
@@ -883,9 +883,8 @@ public class SnapPuller {
File oldFile = new File(confDir, file.getPath().substring(tmpconfDir.getPath().length(), file.getPath().length()));
if (!oldFile.getParentFile().exists()) {
status = oldFile.getParentFile().mkdirs();
- if (status) {
- } else {
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ if (!status) {
+ throw new SolrException(ErrorCode.SERVER_ERROR,
"Unable to mkdirs: " + oldFile.getParentFile());
}
}
@@ -893,9 +892,8 @@ public class SnapPuller {
File backupFile = new File(oldFile.getPath() + "." + getDateAsStr(new Date(oldFile.lastModified())));
if (!backupFile.getParentFile().exists()) {
status = backupFile.getParentFile().mkdirs();
- if (status) {
- } else {
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ if (!status) {
+ throw new SolrException(ErrorCode.SERVER_ERROR,
"Unable to mkdirs: " + backupFile.getParentFile());
}
}
@@ -906,9 +904,8 @@ public class SnapPuller {
}
}
status = file.renameTo(oldFile);
- if (status) {
- } else {
- throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+ if (!status) {
+ throw new SolrException(ErrorCode.SERVER_ERROR,
"Unable to rename: " + file + " to: " + oldFile);
}
}