Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Commit

Permalink
Update dependencies and make code improvements
Browse files Browse the repository at this point in the history
Updated various dependency versions in the pom.xml file for better compatibility and performance. Utilized more efficient methods in the ExpressionUtils.java and StringUtils.java classes such as using isEmpty() instead of checking if the length is 0 and methods like getFirst() which is more intuitive. Also, handled version details better in application.yml and adjusted the version fetching mechanism in version_pom.
  • Loading branch information
martin committed Dec 6, 2023
1 parent 6321274 commit 17200c9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.0</version>
<version>3.1.5</version>
<!-- lookup parent from repository -->
<relativePath/>
</parent>
<groupId>com.github</groupId>
<artifactId>martials</artifactId>
<version>2.1.1</version>
<version>2.1.2</version>
<packaging>war</packaging>
<name>simplify_truths_api</name>
<description>simplify_truths_api</description>
<properties>
<java.version>17</java.version>
<java.version>21</java.version>
</properties>
<distributionManagement>
<repository>
Expand All @@ -32,36 +32,36 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>3.0.4</version>
<version>3.1.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>3.0.4</version>
<version>3.1.5</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>3.0.4</version>
<version>3.1.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>3.0.4</version>
<version>3.1.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.4</version>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
<version>2.14.2</version>
<version>2.15.3</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Expand All @@ -82,7 +82,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>3.0.4</version>
<version>3.1.5</version>
</dependency>
</dependencies>
<build>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/no/martials/api/utils/ExpressionUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ else if (c == ')') {
}
}

CenterOperator op = operators.get(0);
CenterOperator op = operators.getFirst();
boolean allEqual = true;

// Finds the rightmost operator with the lowest weight, if all the operators are equal, pick the center most
Expand Down Expand Up @@ -253,7 +253,7 @@ public void isValid() throws ExpressionInvalidException, MissingCharacterExcepti
if (matcher.find()) {
throw new ExpressionInvalidException(language, matcher.group(), matcher.start());
}
else if (expression.length() == 0) {
else if (expression.isEmpty()) {
throw new MissingCharacterException(language, 'A', 0);
}

Expand Down Expand Up @@ -284,7 +284,7 @@ else if (charAtI == ')') {
}
}
}
if (brackets.size() > 0) {
if (!brackets.isEmpty()) {
throw new MissingCharacterException(language, ')', expression.length());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/no/martials/api/utils/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static String replaceOperators(@NotNull String exp) {

@NotNull
public static String capitalizeFirstLetter(@NotNull String string) {
if (string.length() == 0) {
if (string.isEmpty()) {
return "";
}
return string.substring(0, 1).toUpperCase() + (string.length() > 1 ? string.substring(1) : "");
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ server:
port: 8080

martials:
version: 2.1.1
version: 2.1.2
api:
dev-url: http://localhost:8080
prod-url: https://api.martials.no/simplify-truths/do
Expand Down
2 changes: 1 addition & 1 deletion version_pom
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

version=$(cat src/main/resources/application.yml | grep version: | awk -F ': ' '{print $2}')
version=$(< src/main/resources/application.yml grep version: | awk -F ': ' '{print $2}')
echo "Current version: $version, writing to pom.xml."
xmlstarlet ed --inplace -N N="http://maven.apache.org/POM/4.0.0" -u '//N:project/N:version' -v "$version" pom.xml

0 comments on commit 17200c9

Please sign in to comment.