Improve CrashException handler, fix java encoding, updated junit dependencies, add private methods to javadoc, renamed Error to ErrorMessage
This commit is contained in:
parent
4305f8963b
commit
938eefe387
11
build.gradle
Normal file
11
build.gradle
Normal file
@ -0,0 +1,11 @@
|
||||
subprojects {
|
||||
apply plugin: 'java'
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
javadoc {
|
||||
options.memberLevel = JavadocMemberLevel.PRIVATE
|
||||
}
|
||||
compileJava {
|
||||
// options.encoding = "UTF-8"
|
||||
}
|
||||
}
|
@ -21,10 +21,6 @@ javafx {
|
||||
modules = [ 'javafx.controls', 'javafx.graphics' ]
|
||||
}
|
||||
|
||||
compileJava {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
application {
|
||||
// Define the main class for the application.
|
||||
mainClassName = 'fr.lnl.game.client.App'
|
||||
|
@ -24,6 +24,7 @@ public class App extends Application {
|
||||
private static ViewManager viewManager;
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
argsList = new LinkedList<>(Arrays.asList(args));
|
||||
argsList.removeIf(s -> s.startsWith("-D") || s.equals("fr.lnl.game.client.App")); // remove given parameters from gradle
|
||||
Class<? extends AbstractView> clazz;
|
||||
@ -37,6 +38,14 @@ public class App extends Application {
|
||||
} else {
|
||||
launch();
|
||||
}
|
||||
} catch(CrashException e) {
|
||||
System.err.println("Une erreur est survenue et l'application a été obligé de fermer");
|
||||
System.err.println(e.getCause().toString());
|
||||
for (StackTraceElement element : e.getStackTrace()) {
|
||||
System.err.println(" at " + element.toString());
|
||||
}
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void startGame(ViewLambda lambda) throws IllegalArgumentException, InvocationTargetException, NoSuchMethodException,
|
||||
|
@ -1 +1,2 @@
|
||||
org.gradle.jvmargs='-Dfile.encoding=utf-8'
|
||||
# org.gradle.jvmargs='-Dfile.encoding=UTF-8'
|
||||
systemProp.file.encoding=UTF-8
|
@ -8,8 +8,8 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
|
||||
}
|
||||
|
||||
compileJava {
|
||||
|
@ -4,7 +4,6 @@ public class CrashException extends RuntimeException {
|
||||
|
||||
public CrashException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package fr.lnl.game.server.utils;
|
||||
|
||||
public class Error {
|
||||
public class ErrorMessage {
|
||||
|
||||
public static final String Entry_Error_Message = "\033[0;31mErreur de saisie\033[0m : ";
|
||||
}
|
@ -6,7 +6,7 @@ public class Maths {
|
||||
|
||||
public static int testInteger(String entry, Scanner scanner, String error) {
|
||||
while (!isNumeric(entry)) {
|
||||
System.out.println(Error.Entry_Error_Message + error);
|
||||
System.out.println(ErrorMessage.Entry_Error_Message + error);
|
||||
entry = scanner.next();
|
||||
}
|
||||
return Integer.parseInt(entry);
|
||||
@ -14,7 +14,7 @@ public class Maths {
|
||||
|
||||
public static float testFloat(String entry, Scanner scanner, String error) {
|
||||
while (!isFloat(entry)) {
|
||||
System.out.println(Error.Entry_Error_Message + error);
|
||||
System.out.println(ErrorMessage.Entry_Error_Message + error);
|
||||
entry = scanner.next();
|
||||
}
|
||||
return Integer.parseInt(entry);
|
||||
|
Loading…
Reference in New Issue
Block a user