Skip to content

Commit

Permalink
Fix for checkstyle/findbugs (#377).
Browse files Browse the repository at this point in the history
  • Loading branch information
ashigeru authored and akirakw committed Mar 12, 2014
1 parent e9f1910 commit 9d181c8
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 32 deletions.
Expand Up @@ -285,7 +285,8 @@ public RecordReader<NullWritable, Object> createRecordReader(
TaskAttemptContext context) throws IOException, InterruptedException {
if (split instanceof BridgeInputSplit) {
BridgeInputSplit bridgeInfo = (BridgeInputSplit) split;
DataFormat<?> format = ReflectionUtils.newInstance(bridgeInfo.group.formatClass, context.getConfiguration());
DataFormat<?> format =
ReflectionUtils.newInstance(bridgeInfo.group.formatClass, context.getConfiguration());
return createRecordReader(format, bridgeInfo, context);
} else if (split instanceof NullInputSplit) {
return createNullRecordReader(context);
Expand Down
Expand Up @@ -459,7 +459,8 @@ private Map<String, PropertyDeclaration> resolveSummarizeProperties(
report(new Diagnostic(
Level.ERROR,
property,
Messages.getString("DmdlAnalyzer.diagnosticInconsistentSummarizeAggregateFunction"), //$NON-NLS-1$
Messages.getString(
"DmdlAnalyzer.diagnosticInconsistentSummarizeAggregateFunction"), //$NON-NLS-1$
property.aggregator.toString(),
property.source.identifier,
original.getType()));
Expand Down Expand Up @@ -739,7 +740,8 @@ public Void visitRecordDefinition(ModelDeclaration model, AstRecordDefinition no
report(new Diagnostic(
Level.ERROR,
property.name,
Messages.getString("DmdlAnalyzer.diagnosticInconsistentTypeRepordProperty"), //$NON-NLS-1$
Messages.getString(
"DmdlAnalyzer.diagnosticInconsistentTypeRepordProperty"), //$NON-NLS-1$
property.name,
model.getName()));
}
Expand Down
Expand Up @@ -130,7 +130,8 @@ public static DmdlSourceRepository buildRepository(List<File> files, Charset cs)
Pattern.compile(".*\\.dmdl"), //$NON-NLS-1$
Pattern.compile("^\\..*"))); //$NON-NLS-1$
} else {
LOG.warn(MessageFormat.format(Messages.getString("CommandLineUtils.warnMissingFile"), file)); //$NON-NLS-1$
LOG.warn(MessageFormat.format(
Messages.getString("CommandLineUtils.warnMissingFile"), file)); //$NON-NLS-1$
}
}
if (repositories.size() == 1) {
Expand Down
Expand Up @@ -79,7 +79,8 @@ public void process(JavaDataModelDriver driver) throws IOException {
}

private DmdlSemantics analyze() throws IOException {
AnalyzeTask analyzer = new AnalyzeTask(Messages.getString("GenerateTask.name"), conf.getServiceClassLoader()); //$NON-NLS-1$
AnalyzeTask analyzer =
new AnalyzeTask(Messages.getString("GenerateTask.name"), conf.getServiceClassLoader()); //$NON-NLS-1$
return analyzer.process(conf.getSource());
}
}
Expand Up @@ -71,9 +71,9 @@ private MethodDeclaration createToString(EmitContext context, ModelDeclaration m
.toStatement());
for (PropertyDeclaration property : model.getDeclaredProperties()) {
statements.add(new ExpressionBuilder(f, buffer)
.method("append", Models.toLiteral(f, MessageFormat.format( //$NON-NLS-1$
", {0}=", //$NON-NLS-1$
context.getFieldName(property))))
.method("append", //$NON-NLS-1$
Models.toLiteral(f,
MessageFormat.format(", {0}=", context.getFieldName(property)))) //$NON-NLS-1$
.toStatement());
statements.add(new ExpressionBuilder(f, buffer)
.method("append", new ExpressionBuilder(f, f.newThis()) //$NON-NLS-1$
Expand Down
Expand Up @@ -209,7 +209,8 @@ private Map<String, Expression> createTraceLocationElements() {
Map<String, Expression> results = new LinkedHashMap<String, Expression>();
results.put("batchId", Models.toLiteral(factory, environment.getBatchId()));
results.put("flowId", Models.toLiteral(factory, environment.getFlowId()));
results.put("stageId", Models.toLiteral(factory, Naming.getStageName(model.getStageBlock().getStageNumber())));
results.put("stageId",
Models.toLiteral(factory, Naming.getStageName(model.getStageBlock().getStageNumber())));
results.put("stageUnitId", Models.toLiteral(factory, "m" + unit.getSerialNumber()));
return results;
}
Expand Down
Expand Up @@ -184,7 +184,8 @@ private Map<String, Expression> createTraceLocationElements() {
Map<String, Expression> results = new LinkedHashMap<String, Expression>();
results.put("batchId", Models.toLiteral(factory, environment.getBatchId()));
results.put("flowId", Models.toLiteral(factory, environment.getFlowId()));
results.put("stageId", Models.toLiteral(factory, Naming.getStageName(model.getStageBlock().getStageNumber())));
results.put("stageId",
Models.toLiteral(factory, Naming.getStageName(model.getStageBlock().getStageNumber())));
results.put("stageUnitId", Models.toLiteral(factory, "r"));
return results;
}
Expand Down
Expand Up @@ -44,7 +44,7 @@
* @since 0.6.0
* @version 0.6.1
*/
public class BatchTestRunner {
public final class BatchTestRunner {

static final Logger LOG = LoggerFactory.getLogger(BatchTestRunner.class);

Expand Down Expand Up @@ -73,6 +73,10 @@ public class BatchTestRunner {
OPTIONS.addOption(OPT_ARGUMENT);
}

private BatchTestRunner() {
return;
}

/**
* Program entry.
* @param args program arguments
Expand Down
Expand Up @@ -128,12 +128,11 @@ void initialize(String... args) {
* Executes the program with the specified input/output.
* @param input input stream
* @param output output stream
* @throws IOException
* @throws BulkLoaderSystemException
* @throws BulkLoaderSystemException if failed to execute
*/
void execute(
FileList.Reader input,
FileList.Writer output) throws IOException, BulkLoaderSystemException {
FileList.Writer output) throws BulkLoaderSystemException {
assert input != null;
assert output != null;
try {
Expand Down
Expand Up @@ -139,12 +139,11 @@ void initialize(String... args) {
* Executes the program with the specified input/output.
* @param input input stream
* @param output output stream
* @throws IOException
* @throws BulkLoaderSystemException
* @throws BulkLoaderSystemException if failed to execute
*/
void execute(
FileList.Reader input,
FileList.Writer output) throws IOException, BulkLoaderSystemException {
FileList.Writer output) throws BulkLoaderSystemException {
assert input != null;
assert output != null;
try {
Expand Down
Expand Up @@ -104,7 +104,7 @@ public static String selectJobFlowSid(String executionId) throws BulkLoaderSyste
* ジョブフロー実行IDを条件に検索を行い、
* 指定されていない場合は全件を検索する。
* @param executionId ジョブフロー実行ID
* @return ジョブフロー実行テーブル
* @return ジョブフロー実行テーブル, never {@code null}
* @throws BulkLoaderSystemException SQL例外が発生した場合
*/
public static List<ExporterBean> selectRunningJobFlow(String executionId) throws BulkLoaderSystemException {
Expand Down
Expand Up @@ -27,6 +27,7 @@
import org.apache.hadoop.fs.Path;

import com.asakusafw.bulkloader.exception.BulkLoaderSystemException;
import com.asakusafw.bulkloader.log.Log;
import com.asakusafw.runtime.util.VariableTable;


Expand All @@ -42,6 +43,8 @@ public final class FileNameUtil {
*/
private static final Class<?> CLASS = FileNameUtil.class;

private static final Log LOG = new Log(CLASS);

private FileNameUtil() {
return;
}
Expand Down Expand Up @@ -252,8 +255,12 @@ public static File createExportFilePath(
*/
public static boolean prepareTemporaryDirectory(File directory) {
if (directory.mkdirs() || directory.isDirectory()) {
directory.setReadable(true, false);
directory.setWritable(true, false);
if (directory.setReadable(true, false) == false && directory.canRead() == false) {
LOG.debugMessage("Failed to set readable: {0}", directory);
}
if (directory.setWritable(true, false) == false && directory.canWrite() == false) {
LOG.debugMessage("Failed to set writable: {0}", directory);
}
return true;
}
return false;
Expand Down
Expand Up @@ -17,7 +17,6 @@

import java.sql.Connection;
import java.text.MessageFormat;
import java.util.Collections;
import java.util.Date;
import java.util.List;

Expand Down Expand Up @@ -141,9 +140,6 @@ protected int execute(String[] args) {
List<ExporterBean> beans;
try {
beans = selectRunningJobFlow(executionId);
if (beans == null) {
beans = Collections.emptyList();
}
if (beans.size() > 0) {
isExistJobFlowInstance = true;
}
Expand Down Expand Up @@ -556,7 +552,7 @@ protected List<ExportTempTableBean> getExportTempTable(String jobflowSid) throws
/**
* ジョブフロー実行テーブルの内容を取得する。
* @param executionId 実行ID
* @return ジョブフロー実行テーブルの内容
* @return ジョブフロー実行テーブルの内容, never {@code null}
* @throws BulkLoaderSystemException SQL例外が発生した場合
*/
protected List<ExporterBean> selectRunningJobFlow(String executionId) throws BulkLoaderSystemException {
Expand Down
Expand Up @@ -28,7 +28,7 @@
public class CoreProfileTest {

/**
* Test method for {@link CoreProfile#loadFrom(java.util.Properties, java.lang.ClassLoader)}.
* Test method for {@link CoreProfile#loadFrom(Properties, ProfileContext)}.
*/
@Test
public void loadFrom() {
Expand Down
Expand Up @@ -33,7 +33,7 @@
public class ProcessProfileTest {

/**
* Test method for {@link ProcessProfile#loadFrom(java.util.Properties, java.lang.ClassLoader)}.
* Test method for {@link ProcessProfile#loadFrom(Properties, ProfileContext)}.
*/
@Test
public void loadFrom() {
Expand All @@ -49,7 +49,7 @@ public void loadFrom() {
}

/**
* Test method for {@link ProcessProfile#loadFrom(java.util.Properties, java.lang.ClassLoader)}.
* Test method for {@link ProcessProfile#loadFrom(Properties, ProfileContext)}.
*/
@Test
public void loadFrom_configured() {
Expand All @@ -69,7 +69,7 @@ public void loadFrom_configured() {
}

/**
* Test method for {@link ProcessProfile#loadFrom(java.util.Properties, java.lang.ClassLoader)}.
* Test method for {@link ProcessProfile#loadFrom(Properties, ProfileContext)}.
*/
@Test
public void loadFrom_multiple() {
Expand Down
Expand Up @@ -26,6 +26,7 @@

import com.asakusafw.windgate.core.BaseProfile;
import com.asakusafw.windgate.core.ProfileContext;
import com.asakusafw.windgate.core.process.ProcessProfile;
import com.asakusafw.windgate.core.session.SessionProfile;

/**
Expand All @@ -34,7 +35,7 @@
public class ResourceProfileTest {

/**
* Test method for {@link ResourceProfile#loadFrom(java.util.Properties, java.lang.ClassLoader)}.
* Test method for {@link ProcessProfile#loadFrom(Properties, ProfileContext)}.
*/
@Test
public void loadFrom() {
Expand Down
Expand Up @@ -27,6 +27,7 @@
import org.junit.rules.TemporaryFolder;

import com.asakusafw.windgate.core.ProfileContext;
import com.asakusafw.windgate.core.process.ProcessProfile;
import com.asakusafw.windgate.file.session.FileSessionProvider;

/**
Expand All @@ -41,7 +42,7 @@ public class SessionProfileTest {
public TemporaryFolder folder = new TemporaryFolder();

/**
* Test method for {@link SessionProfile#loadFrom(java.util.Properties, java.lang.ClassLoader)}.
* Test method for {@link ProcessProfile#loadFrom(Properties, ProfileContext)}.
*/
@Test
public void loadFrom() {
Expand All @@ -54,7 +55,7 @@ public void loadFrom() {
}

/**
* Test method for {@link SessionProfile#loadFrom(java.util.Properties, java.lang.ClassLoader)}.
* Test method for {@link ProcessProfile#loadFrom(Properties, ProfileContext)}.
*/
@Test
public void loadFrom_configure() {
Expand Down
Expand Up @@ -27,6 +27,7 @@
/**
* Supports {@link StringBuilder}.
*/
@SuppressWarnings("resource")
public class StringBuilderSupport implements DataModelStreamSupport<StringBuilder> {

@Override
Expand Down
Expand Up @@ -260,6 +260,7 @@ public static int execute(
stdout.get();
} catch (ExecutionException e) {
// don't care
LOG.debug("Error occurred while waiting stdout is closed", e);
}
return exit;
} finally {
Expand Down

0 comments on commit 9d181c8

Please sign in to comment.