mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-11-15 10:20:47 +00:00
Various little cleanups including several discovered by Aaron using an automated tool.
* WorkQueueFrontier.java
(HER-1925) avoid 2 possible null pointer dereferences
* CrawlController.java
getState() - change declared return type from Object to State
* CrawlerLoggerModule.java
(HER-1932) remove unused, unset field "reports"
* BdbCookieStorage.java
elide pointless extra variable
* FetchHTTP.java, DownloadURLConnection.java, ProcessUtils.java
(HER-1933) use Arrays.toString() for logged arrays
* CrawlServer.java
- remove unused field robotstxtChecksum
- updateRobots() - avoid reinventing existing utility class InstanceofPredicate
* ExternalGeoLookupInterface.java
(HER-1938) extend Serializable, since ExternalGeoLocationDecideRule is declared Serializable and has a ExternalGeoLookupInterface field
* DecideRuleSequence.java
(HER-1937) make field fileLogger transient
* PersistLogProcessor.java
(HER-1924) remove field recoveryCheckpoint shadowing same field in superclass Processor
* ExtractorUniversal.java
(HER-1920) use return value of potentialTLD.toLowerCase() as it appears was intended
* ARCWriterProcessor.java
(HER-1928) avoid possible null pointer dereference
* S3URLConnection.java
(HER-1933) set S3ServiceException as cause of rethrown IOException, and do not put stacktrace array in message
* ObjectIdentityMemCache.java
(HER-1929) avoid possible null pointer dereference
* .classpath
more source jar references, other cleanup
This commit is contained in:
1 parent
e38f0a73ba
commit
24f4b715ec
16 files changed
+56
-82
No files matched your search
@@ -25,6 +25,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -84,7 +85,7 @@ public abstract class DownloadURLConnection extends URLConnection {
|
||||
}
|
||||
ProcessResult pr = ProcessUtils.exec(cmd);
|
||||
if (pr.getResult() != 0) {
|
||||
LOGGER.info(cmd + " returned non-null " + pr.getResult());
|
||||
LOGGER.info(Arrays.toString(cmd) + " returned non-null " + pr.getResult());
|
||||
}
|
||||
// Assume download went smoothly.
|
||||
this.connected = true;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class S3URLConnection extends URLConnection {
|
||||
object = service.getObject(bucket, url.getPath().substring(1));
|
||||
} catch (S3ServiceException s3e) {
|
||||
s3e.printStackTrace();
|
||||
throw new IOException("Error connecting to S3: " + s3e.getStackTrace());
|
||||
throw new IOException("Error connecting to S3: " + s3e, s3e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class S3URLConnection extends URLConnection {
|
||||
}
|
||||
catch (S3ServiceException s3e) {
|
||||
s3e.printStackTrace();
|
||||
throw new IOException("Error reading from S3: " + s3e.getStackTrace());
|
||||
throw new IOException("Error reading from S3: " + s3e, s3e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,14 +55,15 @@ implements ObjectIdentityCache<V> {
|
||||
|
||||
public V getOrUse(String key, Supplier<V> supplierOrNull) {
|
||||
V val = map.get(key);
|
||||
if (val==null && supplierOrNull!=null) {
|
||||
if (val != null) {
|
||||
val.setIdentityCache(this);
|
||||
} else if (supplierOrNull!=null) {
|
||||
val = supplierOrNull.get();
|
||||
V prevVal = map.putIfAbsent(key, val);
|
||||
if(prevVal!=null) {
|
||||
val = prevVal;
|
||||
}
|
||||
}
|
||||
val.setIdentityCache(this);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -135,7 +136,7 @@ public class ProcessUtils {
|
||||
try {
|
||||
exitVal = p.waitFor();
|
||||
} catch (InterruptedException e) {
|
||||
throw new IOException("Wait on process " + args + " interrupted: "
|
||||
throw new IOException("Wait on process " + Arrays.toString(args) + " interrupted: "
|
||||
+ e.getMessage());
|
||||
}
|
||||
ProcessUtils.ProcessResult result =
|
||||
|
||||
Reference in new issue
Block a user