Skip to content

Commit

Permalink
Upgrade to Java 21
Browse files Browse the repository at this point in the history
  • Loading branch information
santiagolizardo committed Dec 19, 2024
1 parent 69b3855 commit a554723
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ MadCommander.log*
*.iml
pom.xml.versionsBackup
tags
.vscode/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ NeoCommander

### Requirements

* Java SE 17
* Java 21
* Graphical user interface environment

### How to build
Expand All @@ -19,8 +19,8 @@ mvn package

### How to run

```sh
java -jar target/NeoCommander-1.4.11-jar-with-dependencies.jar
```shell
java -jar target/NeoCommander-1.4.12-jar-with-dependencies.jar
```

or double click on the jar file using your default file manager.
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.santiagolizardo.neocommander</groupId>
<artifactId>NeoCommander</artifactId>
<version>1.4.11</version>
<version>1.4.12</version>
<packaging>jar</packaging>
<name>NeoCommander</name>
<url>https://github.com/santiagolizardo/neocommander</url>
Expand Down Expand Up @@ -35,13 +35,13 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>17</release>
<release>21</release>
<compilerArgs>
<arg>-Xlint:deprecation</arg>
<arg>-Xlint:unchecked</arg>
</compilerArgs>
<source>17</source>
<target>17</target>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
<plugin>
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/santiagolizardo/madcommander/AppConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

public final class AppConstants {

private AppConstants() {
}
public final static String APP_NAME = "NeoCommander";
public final static String APP_VERSION = "1.4.9";
public final static String APP_URL = "https://github.com/santiagolizardo/neocommander";
public final static String DOWNLOAD_URL = "https://github.com/santiagolizardo/neocommander/releases";
private AppConstants() {

}

public final static String APP_NAME = "NeoCommander";
public final static String APP_VERSION = "1.4.12";
public final static String APP_URL = "https://github.com/santiagolizardo/neocommander";
public final static String DOWNLOAD_URL = "https://github.com/santiagolizardo/neocommander/releases";

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
*/
package com.santiagolizardo.madcommander.resources.languages;

import org.xnap.commons.i18n.I18n;
import org.xnap.commons.i18n.I18nFactory;

import java.util.Locale;
import java.util.MissingResourceException;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.xnap.commons.i18n.I18n;
import org.xnap.commons.i18n.I18nFactory;

public class Translator {

private static final Logger logger = Logger.getLogger(Translator.class
Expand All @@ -32,7 +32,7 @@ public class Translator {
private static I18n i18n;

public static void start(String language) {
Locale locale = new Locale(language);
Locale locale = Locale.forLanguageTag(language);

try {
i18n = I18nFactory.getI18n(Translator.class, locale);
Expand All @@ -52,7 +52,7 @@ public static String tr(String text) {
return text;
}
}

public static String trn(String text, String pluralText, long number) {
if (null == i18n)
return text;
Expand All @@ -63,5 +63,5 @@ public static String trn(String text, String pluralText, long number) {
logger.log(Level.WARNING, "Missing translation: {0}", mre.getKey());
return text;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
*/
package com.santiagolizardo.madcommander.util;

import com.santiagolizardo.madcommander.AppConstants;
import com.santiagolizardo.madcommander.util.gui.DialogFactory;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

import com.santiagolizardo.madcommander.AppConstants;
import com.santiagolizardo.madcommander.util.gui.DialogFactory;

public final class UpdateManager extends Thread {

public static void checkForUpdate() {
UpdateManager updateManager = new UpdateManager();
updateManager.start();
Expand All @@ -39,9 +40,10 @@ private UpdateManager() {
@Override
public void run() {
try {
URL url = new URL("http://madcommander.sourceforge.net/version.html");
URL url = new URI("http://madcommander.sourceforge.net/version.html").toURL();
String version;
try (InputStreamReader reader = new InputStreamReader(url.openStream()); BufferedReader buffer = new BufferedReader(reader)) {
try (InputStreamReader reader = new InputStreamReader(url.openStream());
BufferedReader buffer = new BufferedReader(reader)) {
version = buffer.readLine();
}
int serverVersion = Integer
Expand All @@ -61,7 +63,7 @@ public void run() {
"There are no updates availables.");
}

} catch (IOException | NumberFormatException e) {
} catch (IOException | NumberFormatException | URISyntaxException e) {
DialogFactory.showErrorMessage(null, e.getMessage());
}

Expand Down

0 comments on commit a554723

Please sign in to comment.