Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import org.labkey.api.util.URLHelper;
import org.labkey.api.view.ActionURL;
import org.labkey.api.view.HtmlView;
import org.labkey.api.view.HttpView;
import org.labkey.api.view.JspView;
import org.labkey.api.view.NavTree;
import org.labkey.api.view.NotFoundException;
Expand All @@ -85,6 +84,7 @@ public class OConnorExperimentsController extends SpringActionController
{
public static final String EXPERIMENTS = "Experiments";
private static final DefaultActionResolver _actionResolver = new DefaultActionResolver(OConnorExperimentsController.class);
public static final org.apache.logging.log4j.Logger LOG = LogManager.getLogger(OConnorExperimentsController.class);

public OConnorExperimentsController()
{
Expand All @@ -110,7 +110,7 @@ public boolean handlePost(UserForm form, BindException errors) throws Exception
{
if (form.isFinalMigration())
{
LogManager.getLogger(OConnorExperimentsController.class).info("Final migration to be performed - file move events will be performed (irreversible).");
LOG.info("Final migration to be performed - file move events will be performed (irreversible).");
}

// global containers
Expand Down Expand Up @@ -160,7 +160,7 @@ public boolean handlePost(UserForm form, BindException errors) throws Exception
newType.put("Name", currentType);
newType.put("Enabled", true);
List<Map<String, Object>> newTypes = typeUpdateService.insertRows(getUser(), getContainer(), Collections.singletonList(newType), new BatchValidationException(), null, null);
targetType = (Integer) newTypes.get(0).get("RowId");
targetType = (Integer) newTypes.getFirst().get("RowId");
}
}

Expand All @@ -178,7 +178,7 @@ public boolean handlePost(UserForm form, BindException errors) throws Exception
User user = UserManager.getUserByDisplayName((String) databaseMap.get("initials"));
if (user == null)
{
LogManager.getLogger(OConnorExperimentsController.class).warn("User '" + databaseMap.get("initials") + "' not found for experiment " + databaseMap.get("expnumber"));
LOG.warn("User '{}' not found for experiment {}", databaseMap.get("initials"), databaseMap.get("expnumber"));
effectiveUser = getUser();
}
else
Expand All @@ -188,7 +188,7 @@ public boolean handlePost(UserForm form, BindException errors) throws Exception
}

databaseMap.put("EffectiveUser", effectiveUser);
LogManager.getLogger(OConnorExperimentsController.class).info("Insert on experiment " + databaseMap.get("expnumber"));
LOG.info("Insert on experiment {}", databaseMap.get("expnumber"));
List<Map<String, Object>> updateResult;
try
{
Expand All @@ -197,18 +197,18 @@ public boolean handlePost(UserForm form, BindException errors) throws Exception
catch (Exception e)
{
// log the error to the logfile and continue
LogManager.getLogger(OConnorExperimentsController.class).warn("Error inserting expNumber " + expNumber + " with exception " + e.getMessage());
LOG.warn("Error inserting expNumber {} with exception {}", expNumber, e.getMessage());
continue;
}
if (batchErrors.hasErrors())
{
// throw batchErrors.getLastRowError();
LogManager.getLogger(OConnorExperimentsController.class).warn("Error inserting expNumber " + expNumber);
LOG.warn("Error inserting expNumber {}", expNumber);
}

Container workbookContainer = ContainerManager.getForId((String)updateResult.get(0).get("EntityId"));
Container workbookContainer = ContainerManager.getForId((String)updateResult.getFirst().get("EntityId"));
databaseMap.put("ContainerObj", workbookContainer);
databaseMap.put("ContainerStr", updateResult.get(0).get("EntityId"));
databaseMap.put("ContainerStr", updateResult.getFirst().get("EntityId"));

// We don't want these fields to be spoofable through the QueryUpdateService (and hence the Client API),
// so preserve the value from the source data manually
Expand All @@ -218,7 +218,7 @@ public boolean handlePost(UserForm form, BindException errors) throws Exception
// Move files
File sourceFile = new File(fileContentService.getFileRoot(sourceContainer).getPath() + File.separator + "@files", databaseMap.get("expnumber").toString());
File targetDir = new File(fileContentService.getFileRoot(targetContainer).getPath() + File.separator + databaseMap.get("expnumber").toString() + File.separator + "@files");
LogManager.getLogger(OConnorExperimentsController.class).info("Copy from file '" + sourceFile + "' to directory '" + targetDir +"'" );
LOG.info("Copy from file '{}' to directory '{}'", sourceFile, targetDir);
if (sourceFile.exists())
{
FileUtils.copyDirectory(sourceFile, targetDir);
Expand Down Expand Up @@ -260,7 +260,7 @@ public boolean handlePost(UserForm form, BindException errors) throws Exception
}
else
{
LogManager.getLogger(OConnorExperimentsController.class).warn("child container not found: " + parents[i] + " for experiment " + databaseMap.get("expnumber") + " with username " + databaseMap.get("initials"));
LOG.warn("child container not found: {} for experiment {} with username {}", parents[i], databaseMap.get("expnumber"), databaseMap.get("initials"));
}
}
}
Expand All @@ -269,16 +269,15 @@ public boolean handlePost(UserForm form, BindException errors) throws Exception
map.put("ParentExperiments", parentsEntityId.toArray(new String[0]));

// workaround, pass user, container - databaseMap.get("Container"), singleton list
LogManager.getLogger(OConnorExperimentsController.class).info("Update rows on experiment " + databaseMap.get("expnumber"));
LOG.info("Update rows on experiment {}", databaseMap.get("expnumber"));
try
{
queryUpdateService.updateRows(getUser(), targetContainer, Collections.singletonList(map), null, null, null);
}
catch (Exception e)
{
// log the error to the logfile and continue
LogManager.getLogger(OConnorExperimentsController.class).warn("Error updating parent experiments for experiment number " + expNumber + " with exception " + e.getMessage());
continue;
LOG.warn("Error updating parent experiments for experiment number {} with exception {}", expNumber, e.getMessage());
}

}
Expand All @@ -304,7 +303,7 @@ public boolean handlePost(UserForm form, BindException errors) throws Exception
Container workbookContainer = targetContainer.getChild(databaseMap.get("expnumber").toString());
if (workbookContainer == null)
{
LogManager.getLogger(OConnorExperimentsController.class).warn("Updating wiki, container not found: " + databaseMap.get("expnumber"));
LOG.warn("Updating wiki, container not found: {}", databaseMap.get("expnumber"));
}
else
{
Expand All @@ -320,14 +319,14 @@ public boolean handlePost(UserForm form, BindException errors) throws Exception
catch (Exception e)
{
// log the error to the logfile and continue
LogManager.getLogger(OConnorExperimentsController.class).warn("Error wiki for experiment number " + expNumber + " with exception " + e.getMessage());
LOG.warn("Error wiki for experiment number {} with exception {}", expNumber, e.getMessage());
continue;
}
finally
{
in.closeInputStream();
}
LogManager.getLogger(OConnorExperimentsController.class).info("Inserting wiki for experiment " + databaseMap.get("expnumber"));
LOG.info("Inserting wiki for experiment {}", databaseMap.get("expnumber"));
}
}
}
Expand Down Expand Up @@ -439,7 +438,7 @@ public boolean handlePost(Object o, BindException errors) throws Exception

if (result != null && !result.isEmpty())
{
String entityId = (String)result.get(0).get("Container");
String entityId = (String)result.getFirst().get("Container");
newExperiment = ContainerManager.getForId(entityId);
return true;
}
Expand All @@ -464,7 +463,7 @@ public ApiResponse execute(Object o, BindException errors) throws Exception
ApiSimpleResponse resp = new ApiSimpleResponse();
if (result != null && !result.isEmpty())
{
Map<String, Object> exp = result.get(0);
Map<String, Object> exp = result.getFirst();

resp.put("success", true);
resp.put("experiment", exp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.labkey.oconnorexperiments.query;

import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
import org.labkey.api.collections.Sets;
import org.labkey.api.data.Container;
import org.labkey.api.data.ContainerFilter;
Expand Down Expand Up @@ -139,7 +140,7 @@ private TableInfo createParentExperimentsTable(String name, ContainerFilter cf)
}

@Override
public QueryView createView(ViewContext context, QuerySettings settings, BindException errors)
public @NotNull QueryView createView(ViewContext context, QuerySettings settings, BindException errors)
{
if (OConnorExperimentsController.EXPERIMENTS.equalsIgnoreCase(settings.getQueryName()))
{
Expand Down
12 changes: 3 additions & 9 deletions genotyping/src/org/labkey/genotyping/GenotypingController.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.ResultSet;
import java.sql.SQLException;
Expand Down Expand Up @@ -381,7 +380,7 @@ public boolean handlePost(ReturnUrlForm returnUrlForm, BindException errors)
{
long startTime = System.currentTimeMillis();
SequenceManager.get().loadSequences(getContainer(), getUser());
LOG.info(DateUtil.formatDuration(System.currentTimeMillis() - startTime) + " to load sequences");
LOG.info("{} to load sequences", DateUtil.formatDuration(System.currentTimeMillis() - startTime));

return true;
}
Expand Down Expand Up @@ -1299,7 +1298,7 @@ public void validateForm(ImportAnalysisForm form, Errors errors)
@Override
public Object execute(ImportAnalysisForm form, BindException errors) throws Exception
{
LOG.info("Galaxy signaled the completion of analysis " + form.getAnalysis());
LOG.info("Galaxy signaled the completion of analysis {}", form.getAnalysis());
String message;

// Send any exceptions back to the Galaxy task so it can log it as well.
Expand Down Expand Up @@ -1337,7 +1336,7 @@ public Object execute(ImportAnalysisForm form, BindException errors) throws Exce
message = FAILURE_PREFACE + "Analysis path doesn't match import path (see system log for more details)";

// But log more detail to the administrator so they're aware
LOG.error(FAILURE_PREFACE + fnf.getMessage());
LOG.error("{}{}", FAILURE_PREFACE, fnf.getMessage());
}
catch (Exception e)
{
Expand Down Expand Up @@ -1657,11 +1656,6 @@ public static class RunForm extends QueryExportForm
public enum Platforms{

LS454 {
@Override
public String getTableName()
{
return TableType.Reads.toString();
}
},
ILLUMINA {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
import org.labkey.api.collections.CaseInsensitiveHashSet;
import org.labkey.api.collections.Sets;
import org.labkey.api.data.*;
Expand Down Expand Up @@ -952,7 +952,7 @@ public Set<String> getTableNames()
}

@Override
public QueryView createView(ViewContext context, QuerySettings settings, BindException errors)
public @NotNull QueryView createView(ViewContext context, QuerySettings settings, BindException errors)
{
TableType type = findTableType(settings.getQueryName());
return type == null ? super.createView(context, settings, errors) : type.createQueryView(context, settings, errors, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import org.labkey.api.view.NavTree;
import org.labkey.api.view.ViewContext;

import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import org.labkey.api.view.ViewBackgroundInfo;
import org.labkey.vfs.FileLike;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -75,7 +74,7 @@ public void importFile(@NotNull ExpData data, @NotNull FileLike dataFile, @NotNu
{
if (!dataFile.exists())
{
log.warn("Could not find file " + dataFile + " on disk for data with LSID " + data.getLSID());
log.warn("Could not find file {} on disk for data with LSID {}", dataFile, data.getLSID());
return;
}
ExpRun expRun = data.getRun();
Expand Down Expand Up @@ -226,7 +225,7 @@ private Map<String, Integer> ensureAnimalIds(Map<String, String> ids, Map<String
{
throw new ExperimentException("Unable to insert a row into the Animal table for " + animalKey);
}
row.put("rowid", insertedRow.get(0).get("RowId"));
row.put("rowid", insertedRow.getFirst().get("RowId"));
}
}

Expand Down Expand Up @@ -299,7 +298,7 @@ private Map<HaplotypeIdentifier, Integer> ensureHaplotypeNames(List<HaplotypeIde
{
throw new ExperimentException("Unable to insert a row into the Haplotype table for " + haplotypeName);
}
row.put("rowid", insertedRow.get(0).get("RowId"));
row.put("rowid", insertedRow.getFirst().get("RowId"));
}
}

Expand Down Expand Up @@ -462,7 +461,7 @@ private void throwFirstError(BatchValidationException errors) throws ExperimentE
{
if (errors.hasErrors())
{
throw new ExperimentException(errors.getRowErrors().get(0));
throw new ExperimentException(errors.getRowErrors().getFirst());
}
}

Expand Down
14 changes: 7 additions & 7 deletions genotyping/src/org/labkey/genotyping/IlluminaFastqParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public Map<Pair<Integer, Integer>, FileInfo> parseFastqFiles(PipelineJob job) th
long length = f.length();
if (length == 0)
{
_logger.info("File " + f.getName() + " has no content to parse.");
_logger.info("File {} has no content to parse.", f.getName());
continue;
}

Expand All @@ -138,10 +138,10 @@ public Map<Pair<Integer, Integer>, FileInfo> parseFastqFiles(PipelineJob job) th
// good way to check if a file is truly local
tempFile = FileUtil.createTempFile(FileUtil.getBaseName(f) + ".", "." + FileUtil.getExtension(f));
tempFile.deleteOnExit();
_logger.debug("Copying to temp file " + tempFile + ", size is " + f.length() + " bytes");
_logger.debug("Copying to temp file {}, size is {} bytes", tempFile, f.length());
FileUtil.copyFile(f, tempFile);

_logger.info("Beginning to parse file: " + f.getName());
_logger.info("Beginning to parse file: {}", f.getName());
try (FastqReader reader = new FastqReader(tempFile))
{
File targetDir = f.getParentFile();
Expand Down Expand Up @@ -197,7 +197,7 @@ public Map<Pair<Integer, Integer>, FileInfo> parseFastqFiles(PipelineJob job) th
}
else if (reader.getLineNumber() == 1 && totalReads == 0 && !f.getName().contains("null"))//empty file
{
_logger.warn("File " + fileName + " has no content to parse.");
_logger.warn("File {} has no content to parse.", fileName);
reader.close();
continue;
}
Expand All @@ -223,7 +223,7 @@ else if (reader.getLineNumber() == 1 && totalReads == 0 && !f.getName().contains
Pair<Integer, Integer> key = Pair.of(sampleId, pairNumber);
_fileInfo.put(key, new FileInfo(newFile, totalReads));

_logger.info("Finished parsing file: " + f.getName());
_logger.info("Finished parsing file: {}", f.getName());
}
}
}
Expand Down Expand Up @@ -252,7 +252,7 @@ else if (reader.getLineNumber() == 1 && totalReads == 0 && !f.getName().contains
File oldFile = entry.getKey();
File newFile = entry.getValue();
FileUtils.moveFile(oldFile, newFile);
_logger.info("Moved file " + oldFile.getName() + " to " + newFile.getName() );
_logger.info("Moved file {} to {}", oldFile.getName(), newFile.getName());
}
}
catch (IOException e)
Expand Down Expand Up @@ -317,7 +317,7 @@ private void checkForDuplicateTargets(Map<File, File> filesToMove) throws Pipeli
if (sourceFiles.size() > 1)
{
error = true;
_logger.error("Multiple input files map to the target file " + targetFile + " - they are: " + sourceFiles);
_logger.error("Multiple input files map to the target file {} - they are: {}", targetFile, sourceFiles);
}
}
if (error)
Expand Down
Loading
Loading