summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Filion2013-08-22 12:34:22 (EDT)
committer Neil Hauge2013-08-22 12:35:15 (EDT)
commit73dec9e400c64b2d1ca7376512367abd3136f2ea (patch)
tree61564af08e193faf775608a54a64d663ba69fe38
parent4aebbf86ad37eacd4a19aaa528ba634526109ede (diff)
downloadwebtools.dali-73dec9e400c64b2d1ca7376512367abd3136f2ea.zip
webtools.dali-73dec9e400c64b2d1ca7376512367abd3136f2ea.tar.gz
webtools.dali-73dec9e400c64b2d1ca7376512367abd3136f2ea.tar.bz2
379997 - Fix possible NPE in JPQL content assist
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
index 5d2ed14..8410f36 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
@@ -77,7 +77,6 @@ import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
@@ -608,11 +607,17 @@ public final class JpaJpqlContentProposalProvider extends JpqlCompletionProposal
*/
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
+ NamedQuery namedQuery = query();
+
+ if (namedQuery == null) {
+ return new ICompletionProposal[0];
+ }
+
JpaJpqlContentProposalProvider.this.position = offset;
String jpqlQuery = viewer.getDocument().get();
List<ICompletionProposal> proposals = buildProposals(
- query(),
+ namedQuery,
jpqlQuery,
0,
jpqlQuery.length(),