Skip to content

Commit

Permalink
revise logging of empty load attempts to be based on whether a data l…
Browse files Browse the repository at this point in the history
…oad file exists
  • Loading branch information
chenson42 committed Jun 21, 2011
1 parent 4bf5963 commit 0deb737
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.jumpmind.symmetric.service.impl;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
Expand Down Expand Up @@ -263,8 +264,11 @@ protected List<IncomingBatch> loadDataAndReturnBatches(IIncomingTransport transp
}
}

if (totalNetworkMillis > Constants.LONG_OPERATION_THRESHOLD && batchesProcessed.size() == 0) {
log.warn("LoaderNoBatchesLoadedWarning", totalNetworkMillis);
if (transport instanceof FileIncomingTransport && batchesProcessed.size() == 0) {
File incomingFile = ((FileIncomingTransport) transport).getFile();
if (incomingFile != null && incomingFile.exists()) {
log.warn("LoaderNoBatchesLoadedWarning", incomingFile.length());
}
}

} catch (RegistrationRequiredException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package org.jumpmind.symmetric.transport.file;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;

import org.apache.commons.io.IOUtils;
Expand Down Expand Up @@ -59,5 +60,13 @@ public BufferedReader open() throws IOException {
public String getRedirectionUrl() {
return null;
}

public File getFile() {
if (fileWriter != null) {
return fileWriter.getFile();
} else {
return null;
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ LauncherMissingArgument=Check the argument you passed in. --%s takes an argumen
LauncherMissingFilenameTriggerSQL=Please provide a file name to write the trigger SQL to
LoaderProcessingBatch=Processing batch %d
LoaderIgnoringToken=Ignoring csv token: %s
LoaderNoBatchesLoadedWarning=Spent %d ms in network transfer, but no batches were loaded!
LoaderNoBatchesLoadedWarning=There was an incoming file of size %d to load, but not batches were loaded.
LoaderFailedToUpdateBatch=Failed to update batch %d. Zero rows returned.
LoaderTableMissing=The data loader could not find the table: %s. Please ensure that the table exists and that the database user has access to it
LoaderTokenUnexpected=Unexpected token '%s' on line %d of batch %d
Expand Down

0 comments on commit 0deb737

Please sign in to comment.