Skip to content

Commit 3e6b4fc

Browse files
committed
bug fixes. version update
1 parent f8e892c commit 3e6b4fc

File tree

9 files changed

+41
-27
lines changed

9 files changed

+41
-27
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ keyboard-light-composer-device-logitech/lib/logiled.jar
22
**/.settings
33
**/.project
44
**/.classpath
5-
**/target
5+
**/target
6+
/keyboard-light-composer-application/plugins

keyboard-light-composer-application/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.enoy</groupId>
66
<artifactId>keyboard-light-composer</artifactId>
7-
<version>1.0.0-ALPHA</version>
7+
<version>1.0.1-ALPHA</version>
88
</parent>
99
<artifactId>keyboard-light-composer-application</artifactId>
1010

@@ -20,6 +20,7 @@
2020
<dependency>
2121
<groupId>org.enoy</groupId>
2222
<artifactId>keyboard-light-composer-device-logitech</artifactId>
23+
<scope>provided</scope>
2324
</dependency>
2425
<dependency>
2526
<groupId>org.enoy</groupId>

keyboard-light-composer-application/src/main/java/org/enoy/klc/app/KeyboardLightComposerApplication.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,32 @@
1919
import javafx.stage.Stage;
2020

2121
public class KeyboardLightComposerApplication extends Application {
22-
22+
2323
private Updater updater;
24-
24+
2525
private LayerRenderer layerRenderer;
2626

2727
@Override
2828
public void start(Stage primaryStage) throws Exception {
29-
Thread.currentThread()
30-
.setUncaughtExceptionHandler(this::showJavaFxException);
29+
Thread.currentThread().setUncaughtExceptionHandler(this::showJavaFxException);
3130
registerPropertyValueEditors();
3231

3332
updater = new Updater();
3433
updater.setUpdatableRegister(UpdatableRegister.getInstance());
3534
Thread updateThread = new Thread(updater, "Update Thread");
3635
updateThread.setDaemon(true);
3736
updateThread.start();
38-
37+
3938
layerRenderer = new DefaultRenderer();
4039
Thread renderThread = new Thread(layerRenderer, "Render Thread");
4140
renderThread.setDaemon(true);
4241
renderThread.start();
43-
42+
4443
ResourceBundle resources = ResourceBundle.getBundle("fxml/i18n/klc");
4544
URL location = this.getClass().getResource("/fxml/KlcApplication.fxml");
4645
FXMLLoader loader = new FXMLLoader(location, resources);
4746
loader.load();
48-
47+
4948
KlcApplication controller = loader.getController();
5049
controller.setUpdater(updater);
5150
controller.setRenderer(layerRenderer);

keyboard-light-composer-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.enoy</groupId>
66
<artifactId>keyboard-light-composer</artifactId>
7-
<version>1.0.0-ALPHA</version>
7+
<version>1.0.1-ALPHA</version>
88
</parent>
99
<artifactId>keyboard-light-composer-common</artifactId>
1010
<name>Keyboard Light Composer Common</name>

keyboard-light-composer-controller/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.enoy</groupId>
66
<artifactId>keyboard-light-composer</artifactId>
7-
<version>1.0.0-ALPHA</version>
7+
<version>1.0.1-ALPHA</version>
88
</parent>
99
<artifactId>keyboard-light-composer-controller</artifactId>
1010

keyboard-light-composer-controller/src/main/java/org/enoy/klc/control/PluginClassLoader.java

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,50 @@
99

1010
public class PluginClassLoader {
1111

12-
private static final File PLUGIN_DIR = new File("./plugins");
12+
private static final File PLUGIN_DIR = new File("plugins");
1313

1414
public static final void setupPluginClassLoader() throws PluginLoadingException {
1515
Thread currentThread = Thread.currentThread();
1616
ClassLoader contextClassLoader = currentThread.getContextClassLoader();
17-
currentThread.setContextClassLoader(getPluginClassLoader(contextClassLoader));
17+
ClassLoader pluginClassLoader = getPluginClassLoader(contextClassLoader);
18+
19+
currentThread.setContextClassLoader(pluginClassLoader);
1820
}
1921

20-
public static final ClassLoader getPluginClassLoader(ClassLoader parent)
21-
throws PluginLoadingException {
22+
private static final ClassLoader getPluginClassLoader(ClassLoader parent) throws PluginLoadingException {
2223

2324
createPluginDirectoryIfNotExists();
2425

25-
URL pluginUrl;
26+
URL[] jarUrls;
2627
try {
27-
pluginUrl = PLUGIN_DIR.toURI().toURL();
28-
return new URLClassLoader(new URL[]{pluginUrl}, parent);
28+
29+
File[] jars = PLUGIN_DIR.listFiles((dir, name) -> {
30+
return dir.equals(PLUGIN_DIR) && name.endsWith(".jar");
31+
});
32+
33+
jarUrls = new URL[jars.length];
34+
35+
for (int i = 0; i < jars.length; i++) {
36+
jarUrls[i] = jars[i].toURI().toURL();
37+
}
38+
39+
if(jarUrls.length > 0){
40+
return new URLClassLoader(jarUrls, parent);
41+
}
42+
43+
return parent;
2944
} catch (MalformedURLException e) {
3045
e.printStackTrace();
31-
throw new PluginLoadingException("failed to parse file to url", e);
46+
throw new PluginLoadingException("could not load plugin", e);
3247
// TODO: logging
3348
}
3449

3550
}
3651

37-
private static void createPluginDirectoryIfNotExists()
38-
throws PluginLoadingException {
52+
private static void createPluginDirectoryIfNotExists() throws PluginLoadingException {
3953
if (!PLUGIN_DIR.exists()) {
4054
if (!PLUGIN_DIR.mkdirs()) {
41-
throw new PluginLoadingException(
42-
"Failed to create plugin directory");
55+
throw new PluginLoadingException("Failed to create plugin directory");
4356
}
4457
}
4558
}

keyboard-light-composer-device-logitech/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.enoy</groupId>
66
<artifactId>keyboard-light-composer</artifactId>
7-
<version>1.0.0-ALPHA</version>
7+
<version>1.0.1-ALPHA</version>
88
</parent>
99
<artifactId>keyboard-light-composer-device-logitech</artifactId>
1010
<name>Device Provider for Logitech Keyboards</name>

keyboard-light-composer-standard-effects/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.enoy</groupId>
66
<artifactId>keyboard-light-composer</artifactId>
7-
<version>1.0.0-ALPHA</version>
7+
<version>1.0.1-ALPHA</version>
88
</parent>
99
<artifactId>keyboard-light-composer-standard-effects</artifactId>
1010

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.enoy</groupId>
55
<artifactId>keyboard-light-composer</artifactId>
6-
<version>1.0.0-ALPHA</version>
6+
<version>1.0.1-ALPHA</version>
77
<packaging>pom</packaging>
88
<name>Keyboard Light Composer</name>
99
<modules>
1010
<module>keyboard-light-composer-common</module>
1111
<module>keyboard-light-composer-controller</module>
1212
<module>keyboard-light-composer-device-logitech</module>
13-
<module>keyboard-light-composer-application</module>
1413
<module>keyboard-light-composer-standard-effects</module>
14+
<module>keyboard-light-composer-application</module>
1515
</modules>
1616

1717
<build>

0 commit comments

Comments
 (0)