generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #320 from shivam71/MoveRefactoring_Fix_Update
Patch Update Move Refactoring Null Fix
- Loading branch information
Showing
1 changed file
with
27 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,36 @@ | ||
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/refactoring/MoveRefactoring.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/refactoring/MoveRefactoring.java | ||
index a72abd44ef..199ffad108 100644 | ||
index a72abd44ef..72e8bd68ec 100644 | ||
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/refactoring/MoveRefactoring.java | ||
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/refactoring/MoveRefactoring.java | ||
@@ -423,7 +423,7 @@ public final class MoveRefactoring extends CodeRefactoring { | ||
@@ -420,18 +420,26 @@ public final class MoveRefactoring extends CodeRefactoring { | ||
} | ||
|
||
private static Project getSelectedProject(NamedPath selectedProject) { | ||
+ String path = selectedProject == null ? null : selectedProject.getPath(); | ||
+ if (path == null) { | ||
+ return null; | ||
+ } | ||
+ FileObject file; | ||
try { | ||
String path = selectedProject.getPath(); | ||
return path != null ? FileOwnerQuery.getOwner(Utils.fromUri(path)) : null; | ||
- } catch (MalformedURLException ex) { | ||
+ } catch (MalformedURLException | NullPointerException ex) { | ||
return null; | ||
- String path = selectedProject.getPath(); | ||
- return path != null ? FileOwnerQuery.getOwner(Utils.fromUri(path)) : null; | ||
+ file = Utils.fromUri(path); | ||
} catch (MalformedURLException ex) { | ||
- return null; | ||
+ file = null; | ||
} | ||
+ return file == null ? null : FileOwnerQuery.getOwner(file); | ||
} | ||
@@ -432,7 +432,7 @@ public final class MoveRefactoring extends CodeRefactoring { | ||
|
||
private static FileObject getSelectedRoot(NamedPath selectedRoot) { | ||
+ String path = selectedRoot == null ? null : selectedRoot.getPath(); | ||
+ if (path == null) { | ||
+ return null; | ||
+ } | ||
try { | ||
String path = selectedRoot.getPath(); | ||
return path != null ? Utils.fromUri(path) : null; | ||
- } catch (MalformedURLException ex) { | ||
+ } catch (MalformedURLException | NullPointerException ex) { | ||
- String path = selectedRoot.getPath(); | ||
- return path != null ? Utils.fromUri(path) : null; | ||
+ return Utils.fromUri(path); | ||
} catch (MalformedURLException ex) { | ||
return null; | ||
} | ||
} |