Patch for NullPointerException bug when ingesting Properties

12 views
Skip to first unread message

shlomo

unread,
Oct 28, 2008, 4:11:01 AM10/28/08
to lifeguard-dev
Hi,

I tripped on this bug in IngestorBase.java that throws a
NullPointerException when ingesting Properties. The code at
IngestorBase.java:156 threw the exception.

Here is the (small) patch, generated using svn diff --old :

Index: java/com/directthought/lifeguard/IngestorBase.java
===================================================================
--- java/com/directthought/lifeguard/IngestorBase.java (revision 89)
+++ java/com/directthought/lifeguard/IngestorBase.java (working copy)
@@ -153,31 +153,33 @@

try {
WorkRequest wr = constructBaseWorkRequest(outputKeys);
- for (MetaFile file : files) {
- long startTime = System.currentTimeMillis();
- if (file.file != null) {
- // put file in S3 input bucket
- String s3Key = MD5Util.md5Sum(new FileInputStream(file.file));
- RestS3Service s3 = new RestS3Service(new
AWSCredentials(awsAccessId, awsSecretKey));
- if (proxyHost != null && !proxyHost.equals("")) {
- s3.initHttpProxy(proxyHost, proxyPort);
+ if (files != null) {
+ for (MetaFile file : files) {
+ long startTime = System.currentTimeMillis();
+ if (file.file != null) {
+ // put file in S3 input bucket
+ String s3Key = MD5Util.md5Sum(new FileInputStream(file.file));
+ RestS3Service s3 = new RestS3Service(new
AWSCredentials(awsAccessId, awsSecretKey));
+ if (proxyHost != null && !proxyHost.equals("")) {
+ s3.initHttpProxy(proxyHost, proxyPort);
+ }
+ S3Object obj = new S3Object(new S3Bucket(inputBucket), s3Key);
+ obj.setDataInputFile(file.file);
+ obj.setContentLength(file.file.length());
+ obj.setContentType(file.mimeType);
+ obj = s3.putObject(inputBucket, obj);
+ file.key = s3Key;
}
- S3Object obj = new S3Object(new S3Bucket(inputBucket), s3Key);
- obj.setDataInputFile(file.file);
- obj.setContentLength(file.file.length());
- obj.setContentType(file.mimeType);
- obj = s3.putObject(inputBucket, obj);
- file.key = s3Key;
+ // send work request message
+ FileRef ref = of.createFileRef();
+ ref.setKey(file.key);
+ ref.setType(file.mimeType);
+ ref.setLocation("");
+ wr.setInput(ref);
+ long endTime = System.currentTimeMillis();
+ sendMessages(wr, file, startTime, endTime, workQueue,
statusQueue);
+ logger.debug("ingested : "+((file.file==null)?
file.key:file.file.getName()));
}
- // send work request message
- FileRef ref = of.createFileRef();
- ref.setKey(file.key);
- ref.setType(file.mimeType);
- ref.setLocation("");
- wr.setInput(ref);
- long endTime = System.currentTimeMillis();
- sendMessages(wr, file, startTime, endTime, workQueue,
statusQueue);
- logger.debug("ingested : "+((file.file==null)?
file.key:file.file.getName()));
}
if (properties != null) {
for (Properties props : properties) {
Reply all
Reply to author
Forward
0 new messages