Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f69f811

Browse files
authored
Fix 'findExecutable...' bug for full-path spec (#35)
1 parent 0fff7d9 commit f69f811

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

‎src/main/java/com/nordstrom/common/file/PathUtils.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public String getNewName() {
267267
*/
268268
public static String findExecutableOnSystemPath(final String nameOrPath) {
269269
List<String> paths = getSystemPathList();
270-
paths.add(0, "");
270+
paths.add(0, null); // check full path first
271271
for (String path : paths) {
272272
for (String ending : ENDINGS) {
273273
File file = new File(path, nameOrPath + ending);

‎src/test/java/com/nordstrom/common/file/PathUtilsTest.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ public void testFindExecutableOnSystemPath() {
146146
assertNotNull(path);
147147
}
148148

149+
@Test
150+
public void testFindExecutableByFullPath() {
151+
String javaPath = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
152+
String path = PathUtils.findExecutableOnSystemPath(javaPath);
153+
assertNotNull(path);
154+
}
155+
149156
@Test
150157
public void testGetSystemPath() {
151158
String systemPath = PathUtils.getSystemPath();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /