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

Fix #72 and optimize some code #73

Merged
merged 2 commits into from
Aug 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/com/melloware/jintellitype/HotkeyListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2005-2019 Emil A. Lefkof III, Melloware Inc.
*
* I always give it my best shot to make a program useful and solid, but
* remeber that there is absolutely no warranty for using this program as
* remember that there is absolutely no warranty for using this program as
* stated in the following terms:
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -39,7 +39,7 @@ public interface HotkeyListener
* Event fired when a WM_HOTKEY message is received that was initiated
* by this application.
* <p>
* @param identifier the unique Identifer the Hotkey was assigned
* @param identifier the unique Identifier the Hotkey was assigned
*/
void onHotKey( int identifier );
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2005-2019 Emil A. Lefkof III, Melloware Inc.
*
* I always give it my best shot to make a program useful and solid, but
* remeber that there is absolutely no warranty for using this program as
* remember that there is absolutely no warranty for using this program as
* stated in the following terms:
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
28 changes: 15 additions & 13 deletions src/main/java/com/melloware/jintellitype/JIntellitype.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2005-2019 Emil A. Lefkof III, Melloware Inc.
*
* I always give it my best shot to make a program useful and solid, but
* remeber that there is absolutely no warranty for using this program as
* remember that there is absolutely no warranty for using this program as
* stated in the following terms:
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -64,12 +64,12 @@ public final class JIntellitype implements JIntellitypeConstants {
private static JIntellitype jintellitype = null;

/**
* Static variable for double checked thread safety.
* Static variable for double-checked thread safety.
*/
private static boolean isInitialized = false;
private static volatile boolean isInitialized = false;

/**
* Static variable to hold the libary location if set
* Static variable to hold the library location if set
*/
private static String libraryLocation = null;

Expand Down Expand Up @@ -155,17 +155,19 @@ private static void fromJarToFs(String jarPath, String filePath) throws IOExcept
OutputStream os = null;
try {
File file = new File(filePath);
if (file.exists()) {
boolean success = file.delete();
if (!success) {
throw new IOException("Could not delete file: " + filePath);
}
if (file.exists() && !file.delete()) {
throw new IOException("Could not delete file: " + filePath);
}
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) {
throw new IOException("Could not create dirs for file: " + filePath);
}

is = ClassLoader.getSystemClassLoader().getResourceAsStream(jarPath);
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader == null)
loader = ClassLoader.getSystemClassLoader();
is = loader.getResourceAsStream(jarPath);
if (is == null)
throw new IOException("Could not find dll resource in JAR");
os = new FileOutputStream(filePath);
byte[] buffer = new byte[8192];
int bytesRead;
Expand Down Expand Up @@ -333,7 +335,7 @@ public void removeIntellitypeListener(IntellitypeListener listener) {
* Unregisters a previously registered Hotkey identified by its unique
* identifier.
* <p>
* @param identifier the unique identifer of this Hotkey
* @param identifier the unique identifier of this Hotkey
*/
public void unregisterHotKey(int identifier) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2005-2019 Emil A. Lefkof III, Melloware Inc.
*
* I always give it my best shot to make a program useful and solid, but
* remeber that there is absolutely no warranty for using this program as
* remember that there is absolutely no warranty for using this program as
* stated in the following terms:
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2005-2019 Emil A. Lefkof III, Melloware Inc.
*
* I always give it my best shot to make a program useful and solid, but
* remeber that there is absolutely no warranty for using this program as
* remember that there is absolutely no warranty for using this program as
* stated in the following terms:
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2005-2019 Emil A. Lefkof III, Melloware Inc.
*
* I always give it my best shot to make a program useful and solid, but
* remeber that there is absolutely no warranty for using this program as
* remember that there is absolutely no warranty for using this program as
* stated in the following terms:
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/melloware/jintellitype/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright 2005-2019 Emil A. Lefkof III, Melloware Inc.
*
* I always give it my best shot to make a program useful and solid, but
* remeber that there is absolutely no warranty for using this program as
* remember that there is absolutely no warranty for using this program as
* stated in the following terms:
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down