Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve diagnose for invalide environment/command line arguments #19

Conversation

hduelme
Copy link
Collaborator

@hduelme hduelme commented Nov 22, 2024

Improved error messaging for read interruptions:
While working on haumacher/phoneblock#97, I noticed that it is currently difficult to identify the cause of interruptions when reading from environment variables or command-line arguments. To address this, I have added a warning to make these issues more transparent.

Added support for non-Linux systems:
Additionally, I implemented support for systems that use a different pathSeparator than Linux.

@hduelme hduelme requested a review from haumacher November 22, 2024 15:52
@hduelme hduelme self-assigned this Nov 22, 2024
}

String argFile = metaConfig.configFile;

File file;
if (argFile != null && !argFile.isBlank()) {
if ("none".equals(argFile.toLowerCase())) {
if ("none".equalsIgnoreCase(argFile)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gute Idee - wird das an anderen Stellen der Konfigurationsverarbeitung eigentlich auch so gemacht?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aktuell wird in phoneblock recordings noch nur mit equals geprüft und die Methode getConfigFile aus MetaConfig ist auch noch nicht angepasst.

@@ -87,7 +93,7 @@ public static MetaConfig parseOptions(String[] args, String defaultConfigFile, O
}
}
} else if (defaultConfigFile != null) {
String fileName = System.getProperty("user.home") + "/" + defaultConfigFile;
String fileName = System.getProperty("user.home") + File.pathSeparator + defaultConfigFile;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Top! Was für ein Anfängerfehler von mir....

LOG.warn("Reading options from: {}", file.getAbsolutePath());
} else {
LOG.debug("Reading options from: {}", file.getAbsolutePath());
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das eigentliche Problem ist aber wohl, dass beim zweiten Durchlauf, wenn die Konfigurationsdatei gelesen wird, die Umgebungsvariablen komplett ignoriert werden. Die Argumente werden wieder hinzugefügt, die Umgebungsvariablen aber nicht.

@haumacher
Copy link
Owner

3e10ba0 hier wurde nur der erste "Parse-Durchgang" angepasst, der zweite aber vergessen.

@haumacher haumacher merged commit 3d92bad into haumacher:master Nov 22, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants