Skip to content

Commit 131e5df

Browse files
authored
Cleaning some warnings up, very slowly (#933)
* Cleaning some warnings up, very slowly * Updating to Gradle 9 * Updating to Gradle 9.2
1 parent 6af1e29 commit 131e5df

File tree

12 files changed

+151
-101
lines changed

12 files changed

+151
-101
lines changed

build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ jacoco {
2626
toolVersion = '0.8.10'
2727
}
2828

29-
targetCompatibility = JavaVersion.VERSION_21
30-
sourceCompatibility = JavaVersion.VERSION_21
31-
3229
group = "org.codeforamerica.platform"
3330
version = "1.6.43-SNAPSHOT"
3431
ext.admin = System.getenv("SONATYPE_USERNAME")
@@ -129,6 +126,8 @@ jacocoTestReport {
129126
}
130127

131128
java {
129+
sourceCompatibility = JavaVersion.VERSION_21
130+
targetCompatibility = JavaVersion.VERSION_21
132131
withJavadocJar()
133132
withSourcesJar()
134133
}

gradle/wrapper/gradle-wrapper.jar

-16.2 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

gradlew

Lines changed: 19 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 14 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
*/
99

1010
rootProject.name = "formflow-library"
11-
include("lib")
1211

1312
buildCache {
1413
local {
1514
directory = new File(rootDir, 'build-cache')
16-
removeUnusedEntriesAfterDays = 30
1715
}
1816
}

src/main/java/formflow/library/ScreenController.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,15 @@
6666
@RequestMapping(ScreenController.FLOW)
6767
public class ScreenController extends FormFlowController {
6868

69+
/**
70+
* Base path for all FFL flows
71+
*/
6972
public static final String FLOW = "/flow";
70-
public static final String FLOW_SCREEN_PATH = "{flow}/{screen}";
7173

72-
private static final String SUBFLOW_UUID = "uuid";
74+
/**
75+
* Default path pattern for all FFL flows
76+
*/
77+
public static final String FLOW_SCREEN_PATH = "{flow}/{screen}";
7378

7479
private static final String REPEAT_FOR_UUID = "repeatForIterationUuid";
7580
private final ValidationService validationService;
@@ -81,6 +86,22 @@ public class ScreenController extends FormFlowController {
8186
private final ShortCodeConfig shortCodeConfig;
8287
private final SubflowManager subflowManager;
8388

89+
/**
90+
* A controller to render any screen in flows, including subflows.
91+
*
92+
* @param flowConfigurations flow configurations
93+
* @param userFileRepositoryService UserFileRepositoryService
94+
* @param submissionRepositoryService SubmissionRepositoryService
95+
* @param validationService ValidationService
96+
* @param addressValidationService AddressValidationService
97+
* @param formFlowConfigurationProperties FormFlowConfigurationProperties
98+
* @param conditionManager ConditionManager
99+
* @param actionManager ActionManager
100+
* @param fileValidationService FileValidationService
101+
* @param messageSource MessageSource
102+
* @param shortCodeConfig ShortCodeConfig
103+
* @param subflowManager SubflowManager
104+
*/
84105
public ScreenController(
85106
List<FlowConfiguration> flowConfigurations,
86107
UserFileRepositoryService userFileRepositoryService,

src/main/java/formflow/library/data/SubmissionRepositoryService.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -160,27 +160,22 @@ public synchronized void generateAndSetUniqueShortCode(Submission submission) {
160160
// set this submission's shortcode, and persist it
161161
submission.setShortCode(newCode);
162162
save(submission);
163+
log.info("Created short code {} for submission {}", newCode, submission.getId());
163164
} else {
164165
log.warn("Confirmation code {} already exists", newCode);
165166
}
166167
} while (submission.getShortCode() == null);
167168
}
168169

169170
private static String generateRandomCode(int length, ShortCodeType type) {
170-
RandomStringGenerator.Builder builder = new RandomStringGenerator.Builder().withinRange('0', 'z');
171-
172-
switch (type) {
173-
case alphanumeric:
174-
builder.filteredBy(Character::isLetterOrDigit);
175-
break;
176-
case alpha:
177-
builder.filteredBy(Character::isLetter);
178-
break;
179-
case numeric:
180-
builder.filteredBy(Character::isDigit);
181-
break;
182-
}
171+
RandomStringGenerator.Builder builder = RandomStringGenerator.builder().withinRange('0', 'z');
172+
173+
builder = switch (type) {
174+
case alphanumeric -> builder.filteredBy(Character::isLetterOrDigit);
175+
case alpha -> builder.filteredBy(Character::isLetter);
176+
case numeric -> builder.filteredBy(Character::isDigit);
177+
};
183178

184-
return builder.build().generate(length);
179+
return builder.get().generate(length);
185180
}
186181
}

0 commit comments

Comments
 (0)