Skip to content

Commit a40c11f

Browse files
committed
adapted logging statements to be more accurate. reverted pom version property to be set again via CI
1 parent 9fb21c4 commit a40c11f

File tree

6 files changed

+33
-35
lines changed

6 files changed

+33
-35
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ You should put the .jar in an extra folder as a *logs* and a *db* folder will be
6464
7. To see the changes just start the new KeepTime again
6565

6666
## Requirements
67-
68-
* Windows 7, 10
69-
* Linux (tested on Ubuntu 18.04)
70-
* Java 11
67+
* Operating System
68+
* Windows 7, 10, 11
69+
* Linux (tested on Ubuntu 18.04)
70+
* Mac (tested on MacBook M2 Pro (ARM based CPU))
71+
* Java 17

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</parent>
1313
<groupId>de.doubleslash</groupId>
1414
<artifactId>keeptime</artifactId>
15-
<version>2.0.0-SNAPSHOT</version>
15+
<version>${project.version}</version>
1616

1717
<packaging>jar</packaging>
1818
<name>KeepTime</name>
@@ -33,6 +33,7 @@
3333
</licenses>
3434

3535
<properties>
36+
<project.version>2.0.0-SNAPSHOT</project.version>
3637
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3738
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
3839
<java.version>17</java.version>

src/main/java/de/doubleslash/keeptime/common/BrowserHelper.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public static void openURL(final String url) {
3535
} else if (OS.isLinux()) {
3636
openUrlLinux(rt, url);
3737
} else {
38-
LOG.warn("OS is not supported");
38+
// TODO implement for MAC
39+
LOG.warn("OS '{}' is not supported", OS.getOSName());
3940
}
4041
}
4142

@@ -45,7 +46,7 @@ private static void openUrlWindows(final Runtime rt, final String url) {
4546
LOG.debug("Executing command: {}", command);
4647
rt.exec(command);
4748
} catch (final Exception e) {
48-
LOG.error("Could not open url '" + url + "' with command '" + command + "'.", e);
49+
LOG.error("Could not open url '{}' with command '{}'.", url, command, e);
4950
}
5051
}
5152

@@ -57,7 +58,7 @@ private static void openUrlLinux(final Runtime rt, final String url) {
5758
LOG.debug("Executing command: {}", Arrays.toString(command));
5859
rt.exec(command);
5960
} catch (final Exception e) {
60-
LOG.error("Could not open url '" + url + "' with command '" + Arrays.toString(command) + "'.", e);
61+
LOG.error("Could not open url '{}' with command '{}'.", url, Arrays.toString(command), e);
6162
}
6263
}
6364
}

src/main/java/de/doubleslash/keeptime/common/FileOpenHelper.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,20 @@ public static boolean openFile(final String filePath) {
3232
final File file = new File(filePath);
3333
final Runtime rt = Runtime.getRuntime();
3434

35-
if (file.exists() && file.isFile()) {
36-
if (OS.isWindows()) {
37-
openFileWindows(rt, file);
38-
} else if (OS.isLinux()) {
39-
openFileLinux(rt, filePath);
40-
} else {
41-
LOG.warn("OS is not supported");
42-
}
43-
return true;
44-
} else {
35+
if (!file.exists() || file.isFile()) {
36+
LOG.warn("Filepath does not seem to exist or does not point to a file: '{}'.", filePath);
4537
return false;
4638
}
39+
40+
if (OS.isWindows()) {
41+
openFileWindows(rt, file);
42+
} else if (OS.isLinux()) {
43+
openFileLinux(rt, filePath);
44+
} else {
45+
// TODO implement for MAC
46+
LOG.warn("OS '{}' is not supported", OS.getOSName());
47+
}
48+
return true;
4749
}
4850

4951
private static void openFileWindows(final Runtime rt, final File file) {
@@ -52,7 +54,7 @@ private static void openFileWindows(final Runtime rt, final File file) {
5254
LOG.debug("executing command: {}", command);
5355
rt.exec(command);
5456
} catch (final Exception e) {
55-
LOG.error("Could not open file '" + file + "' with command '" + command + "'.", e);
57+
LOG.error("Could not open file '{}' with command '{}'.", file, command, e);
5658
}
5759
}
5860

@@ -64,7 +66,8 @@ private static void openFileLinux(final Runtime rt, final String filePath) {
6466
LOG.debug("executing command: {}", Arrays.toString(command));
6567
rt.exec(command);
6668
} catch (final Exception e) {
67-
LOG.error("Could not open file '" + filePath + "' with command '" + Arrays.toString(command) + "'.", e);
69+
LOG.error("Could not open file '{}' with command '{}'.", filePath, Arrays.toString(command),
70+
e);
6871
}
6972
}
7073
}

src/main/java/de/doubleslash/keeptime/common/OS.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,14 @@ private OS() {
2525
}
2626

2727
public static boolean isWindows() {
28-
if (System.getProperty(OS_PROPERTY).toLowerCase().contains("windows")) {
29-
return true;
30-
}
31-
32-
return false;
28+
return System.getProperty(OS_PROPERTY).toLowerCase().contains("windows");
3329
}
3430

3531
public static boolean isLinux() {
36-
if (System.getProperty(OS_PROPERTY).toLowerCase().contains("linux")) {
37-
return true;
38-
}
39-
40-
return false;
32+
return System.getProperty(OS_PROPERTY).toLowerCase().contains("linux");
4133
}
4234

43-
public static String getOSname() {
35+
public static String getOSName() {
4436
return System.getProperty(OS_PROPERTY);
4537
}
4638

src/main/java/de/doubleslash/keeptime/view/SettingsController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ public SettingsController(final Model model, final Controller controller,
177177
@FXML
178178
private void initialize() {
179179
LOG.debug("start init");
180-
LOG.info("OS: {}", OS.getOSname());
180+
LOG.info("OS: {}", OS.getOSName());
181181
LOG.debug("set versionLabel text");
182182
LOG.debug("load substages");
183183
LOG.debug("set version label text");
184184

185185
if (!OS.isWindows()) {
186-
LOG.info("Disabling unsupported settings for Linux.");
186+
LOG.info("Disabling unsupported settings (hotkey) for non windows feature.");
187187
useHotkeyCheckBox.setDisable(true);
188188
hotkeyLabel.setDisable(true);
189189
globalKeyloggerLabel.setDisable(true);
@@ -217,7 +217,7 @@ private void initialize() {
217217
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
218218
alert.setHeaderText("Color setting not supported!");
219219
alert.setContentText(
220-
"The level of opacity on your hover background is to high for Linux. Resetting it.");
220+
"The level of opacity on your hover background is to low (<0.5) for non Windows system. Resetting it.");
221221

222222
alert.showAndWait();
223223
}
@@ -230,7 +230,7 @@ private void initialize() {
230230
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
231231
alert.setHeaderText("Color settings not supported!");
232232
alert.setContentText(
233-
"The level of opacity on your hover background is to high for Linux. Resetting it.");
233+
"The level of opacity on your default background is to low (<0.5) for non Windows system. Resetting it.");
234234

235235
alert.showAndWait();
236236
}

0 commit comments

Comments
 (0)