From d1bea49ea10b9d3c3e1a2d9f6216f76be937af7c Mon Sep 17 00:00:00 2001 From: Trey Chadick Date: Thu, 4 Jan 2024 11:00:42 -0800 Subject: [PATCH 1/6] Remove investigative logging from FileContentServiceImpl (#5099) --- .../src/org/labkey/filecontent/FileContentServiceImpl.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/filecontent/src/org/labkey/filecontent/FileContentServiceImpl.java b/filecontent/src/org/labkey/filecontent/FileContentServiceImpl.java index 20fd6e3a122..7cc6f91723b 100644 --- a/filecontent/src/org/labkey/filecontent/FileContentServiceImpl.java +++ b/filecontent/src/org/labkey/filecontent/FileContentServiceImpl.java @@ -331,10 +331,8 @@ public java.nio.file.Path getDefaultRootPath(Container c, boolean createDir) } else { - File fileRootFile = new File(parentRoot.toFile(), getRelativePath(c, firstOverride)); - _log.info("File root for '%s': '%s'".formatted(c.getPath(), fileRootFile.toString())); // For local, the path may be several directories deep (since it matches the LK folder path), so we should create the directories for that path - fileRootPath = fileRootFile.toPath(); + fileRootPath = new File(parentRoot.toFile(), getRelativePath(c, firstOverride)).toPath(); try { From 528bac53e66491e50167f580c4ca5c63371d1348 Mon Sep 17 00:00:00 2001 From: Karl Lum Date: Thu, 4 Jan 2024 19:02:03 -0800 Subject: [PATCH 2/6] fixes for automated test failures (#5100) --- .../labkey/study/controllers/publish/PublishController.java | 4 ++++ .../labkey/study/importer/CreateChildStudyPipelineJob.java | 2 ++ .../labkey/study/visitmanager/RelativeDateVisitManager.java | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/study/src/org/labkey/study/controllers/publish/PublishController.java b/study/src/org/labkey/study/controllers/publish/PublishController.java index e64baf31f4c..3ec53f7a405 100644 --- a/study/src/org/labkey/study/controllers/publish/PublishController.java +++ b/study/src/org/labkey/study/controllers/publish/PublishController.java @@ -374,6 +374,10 @@ public void run() { error("Failure", t); } + + if (getErrors() == 0) + setStatus(TaskStatus.complete); + info("Auto link to study complete"); } } diff --git a/study/src/org/labkey/study/importer/CreateChildStudyPipelineJob.java b/study/src/org/labkey/study/importer/CreateChildStudyPipelineJob.java index 7210ba5db5a..2104a42ad65 100644 --- a/study/src/org/labkey/study/importer/CreateChildStudyPipelineJob.java +++ b/study/src/org/labkey/study/importer/CreateChildStudyPipelineJob.java @@ -275,6 +275,7 @@ public boolean run(ViewContext context) // Save the snapshot RowId to the destination study StudyImpl mutableStudy = StudyManager.getInstance().getStudy(getDstContainer()).createMutable(); mutableStudy.setStudySnapshot(snapshot.getRowId()); + StudyManager.getInstance().updateStudy(user, mutableStudy); // export objects from the parent study, then import them into the new study getLogger().info("Exporting data from parent study."); @@ -311,6 +312,7 @@ public boolean run(ViewContext context) new TopLevelStudyPropertiesImporter().process(studyImportContext, studyDir, errors); // after the data has been imported, configure the new study setting for undefined timepoints + mutableStudy = StudyManager.getInstance().getStudy(getDstContainer()).createMutable(); if (sourceStudy.isFailForUndefinedTimepoints()) mutableStudy.setFailForUndefinedTimepoints(true); diff --git a/study/src/org/labkey/study/visitmanager/RelativeDateVisitManager.java b/study/src/org/labkey/study/visitmanager/RelativeDateVisitManager.java index 7de09e8b1a3..a646125a867 100644 --- a/study/src/org/labkey/study/visitmanager/RelativeDateVisitManager.java +++ b/study/src/org/labkey/study/visitmanager/RelativeDateVisitManager.java @@ -327,7 +327,7 @@ private void _updateVisitRowId() return errors; } - public @Nullable ValidationException recomputeDates(Date oldStartDate, User user) + public @NotNull ValidationException recomputeDates(Date oldStartDate, User user) { if (null != oldStartDate) { @@ -351,7 +351,7 @@ private void _updateVisitRowId() return updateParticipantVisits(user, getStudy().getDatasets()); } } - return null; + return new ValidationException(); } // Return sql for fetching all datasets and their visit sequence numbers, given a container From fd390cae414ed125f2bff3bd5c33d38e2ff5664a Mon Sep 17 00:00:00 2001 From: Karl Lum Date: Tue, 9 Jan 2024 17:25:52 -0800 Subject: [PATCH 3/6] fixes for automated test failures, bad overall logic (#5110) --- .../src/org/labkey/study/model/StudyManager.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/study/src/org/labkey/study/model/StudyManager.java b/study/src/org/labkey/study/model/StudyManager.java index d78c0893992..e5ea6136aea 100644 --- a/study/src/org/labkey/study/model/StudyManager.java +++ b/study/src/org/labkey/study/model/StudyManager.java @@ -1148,14 +1148,17 @@ public VisitImpl getVisit(Study study, User user, BigDecimal sequenceNum, Visit. for (BigDecimal sequencenum : sequencenums) { VisitImpl result = ensureVisitWithoutSaving(study, sequencenum, type, visits); - if (result.getRowId() == 0 && !failForUndefinedVisits) + if (result.getRowId() == 0) { - createVisit(study, user, result, visits); - // Refresh existing visits to avoid constraint violation, see #44425 - visits = getVisits(study, Visit.Order.SEQUENCE_NUM); + if (!failForUndefinedVisits) + { + createVisit(study, user, result, visits); + // Refresh existing visits to avoid constraint violation, see #44425 + visits = getVisits(study, Visit.Order.SEQUENCE_NUM); + } + else + seqNumFailures.add(String.valueOf(sequencenum)); } - else - seqNumFailures.add(String.valueOf(sequencenum)); } if (!seqNumFailures.isEmpty()) From fb5fcfe60da9f3c393a5042b346a33342e76f75f Mon Sep 17 00:00:00 2001 From: labkey-matthewb Date: Thu, 11 Jan 2024 08:09:06 -0800 Subject: [PATCH 4/6] consistency between jackson/org.json.JSONObject/PageFlowUtil (#5117) --- api/src/org/labkey/api/data/JsonTest.java | 2 + .../api/notification/notificationpanel.jsp | 2 +- .../labkey/api/reports/report/r/RReport.java | 40 ++++++++++++++++++- api/src/org/labkey/api/util/PageFlowUtil.java | 3 ++ core/src/org/labkey/core/CoreModule.java | 13 ++++++ .../org/labkey/core/user/securityAccess.jsp | 2 +- .../labkey/pipeline/startPipelineImport.jsp | 2 +- .../survey/view/customizeSurveysWebPart.jsp | 2 +- .../org/labkey/survey/view/surveyWizard.jsp | 6 +-- 9 files changed, 63 insertions(+), 9 deletions(-) diff --git a/api/src/org/labkey/api/data/JsonTest.java b/api/src/org/labkey/api/data/JsonTest.java index e5c77c55f4d..c71d7a09605 100644 --- a/api/src/org/labkey/api/data/JsonTest.java +++ b/api/src/org/labkey/api/data/JsonTest.java @@ -101,12 +101,14 @@ public void jsonOrgViaJackson() throws IOException obj.put("str", "hello"); obj.put("arr", new JSONArray(Arrays.asList("one", null, 3, new JSONObject(Collections.singletonMap("four", 4))))); obj.put("nul", (Object)null); + obj.put("key", " - +   diff --git a/api/src/org/labkey/api/reports/report/r/RReport.java b/api/src/org/labkey/api/reports/report/r/RReport.java index ddd87e0e3fa..9498d006c12 100644 --- a/api/src/org/labkey/api/reports/report/r/RReport.java +++ b/api/src/org/labkey/api/reports/report/r/RReport.java @@ -219,12 +219,48 @@ public static synchronized String getDefaultRPath() return DEFAULT_APP_PATH; } + public static String toR(String s) { - String r = PageFlowUtil.jsString(s); - return "\"" + StringUtils.strip(r, "'") + "\""; + if (s == null) + return "\"\""; + + StringBuilder r = new StringBuilder(s.length() + 10); + r.append("\""); + int len = s.length(); + for (int i = 0 ; i inputParameters) { diff --git a/api/src/org/labkey/api/util/PageFlowUtil.java b/api/src/org/labkey/api/util/PageFlowUtil.java index ea0719e355f..1622de38ee3 100644 --- a/api/src/org/labkey/api/util/PageFlowUtil.java +++ b/api/src/org/labkey/api/util/PageFlowUtil.java @@ -422,6 +422,9 @@ public static String jsString(String s) case '\\': js.append("\\\\"); break; + case '/': + js.append("\\/"); + break; case '\n': js.append("\\n"); break; diff --git a/core/src/org/labkey/core/CoreModule.java b/core/src/org/labkey/core/CoreModule.java index 2910d8ce61d..6e0e8a050f6 100644 --- a/core/src/org/labkey/core/CoreModule.java +++ b/core/src/org/labkey/core/CoreModule.java @@ -15,6 +15,7 @@ */ package org.labkey.core; +import com.fasterxml.jackson.core.io.CharTypes; import com.google.common.collect.Sets; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; @@ -308,6 +309,18 @@ public class CoreModule extends SpringModule implements SearchService.DocumentPr // Register dialect extra early, since we need to initialize the data sources before calling DefaultModule.initialize() SqlDialectRegistry.register(new PostgreSqlDialectFactory()); + + try + { + var field = CharTypes.class.getDeclaredField("sOutputEscapes128"); + field.setAccessible(true); + ((int[])field.get(null))['/'] = '/'; + field.setAccessible(false); + } + catch (NoSuchFieldException|IllegalArgumentException|IllegalAccessException x) + { + // pass + } } private CoreWarningProvider _warningProvider; diff --git a/core/src/org/labkey/core/user/securityAccess.jsp b/core/src/org/labkey/core/user/securityAccess.jsp index b14312c6923..641f0e9dd46 100644 --- a/core/src/org/labkey/core/user/securityAccess.jsp +++ b/core/src/org/labkey/core/user/securityAccess.jsp @@ -79,7 +79,7 @@ However, if this account were re-enabled, it would have the following permissions. <% } %> - lk-region-name=<%=q(accessRegion.getName())%> class="labkey-data-region-legacy labkey-show-borders"> +
diff --git a/pipeline/src/org/labkey/pipeline/startPipelineImport.jsp b/pipeline/src/org/labkey/pipeline/startPipelineImport.jsp index e8443444bc3..01fcaeccc1b 100644 --- a/pipeline/src/org/labkey/pipeline/startPipelineImport.jsp +++ b/pipeline/src/org/labkey/pipeline/startPipelineImport.jsp @@ -62,7 +62,7 @@ > - > +
diff --git a/survey/src/org/labkey/survey/view/customizeSurveysWebPart.jsp b/survey/src/org/labkey/survey/view/customizeSurveysWebPart.jsp index 833abb6289d..cb787d61612 100644 --- a/survey/src/org/labkey/survey/view/customizeSurveysWebPart.jsp +++ b/survey/src/org/labkey/survey/view/customizeSurveysWebPart.jsp @@ -40,7 +40,7 @@ %> This webpart displays a list of survey instances created by the end user. Select which survey design this webpart should use:

-
>
+
+