This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 225911

Summary: jpql editor issue for projects with path with spaces
Product: javaee Reporter: joordaz
Component: PersistenceAssignee: Sergey Petrov <sj-nb>
Status: RESOLVED FIXED    
Severity: normal CC: pjiricka
Priority: P2    
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description joordaz 2013-02-08 18:01:23 UTC
7.3rc2
working on imported project (java web app, created with 7.2.1), when i open the jpql query and try to run a query i get:

java.lang.Exception: You project either have no sources or you need to rebuild your project


BUT no matter how many times y do "build" or "clean and build" i get the same error... build before opening the jpql query window, build after opening the window but before trying the query, same result.


BUT

i had another imported project (also java web app, created with 7.2.1) with NO db support on it, i added the persistence unit, generated some entities from the same database i'm using on my other project, tried the jpql query and it works.

not sure if bug? missing config? missing refactoring to some file inside my project? i'll appreciate any help

thanks.
Comment 1 Sergey Petrov 2013-02-08 18:22:30 UTC
Editor tries to check is there is any valid build source path, may be some project configuration, may be with custom build script may be handled incorrectly in this case. I'm not sure it can be fixed automatically if it's the case, may be an option  'try to run anyway' can be added.
It's nice if you can share sample project with a problem for evaluation.
Comment 2 Sergey Petrov 2013-02-08 20:19:21 UTC
also as you said you have two projects from 7.2.1 and it isn't related to failure.
do you have nay unresolved references, warnings etc on "bad" project?
is clean on the project working as expected (clean everything)?
Comment 3 Sergey Petrov 2013-02-08 20:20:06 UTC
one more, do you use the same jdk for both projects in 7.2.1 and in 7.3?
Comment 4 joordaz 2013-02-08 21:41:35 UTC
Thank you for the response Sergey... answering your questions:
- the project builds and runs without errors (in 7.2.1 and 7.3rc2) and pretty much everuthing works except the jpql query on that particular project.
- i upgraded the jdk from 1.7.0_09 to 1.7.0_13 before installing the RC because the 7.3 installer told me that an upgrade was needed.
- no unresolved references.

also:
- i can query the database from the "classic" sql command window, the persistence... so, i'm assuming no connection problem
- the persistence.xml are identical in both projects
Comment 5 Sergey Petrov 2013-02-10 07:26:18 UTC
is there any difference between projects?

can you try last comment from issue 219805? unfortunately if it will work it may be hard to fix/evaluate as it's heavily dependent on specific cache state.
Comment 6 joordaz 2013-02-11 07:08:04 UTC
not sure whats the equivalent on osx but i removed

/Applications/NetBeans/NetBeans 7.3 RC2.app/Contents/Resources/NetBeans/nb/var/cache

the projects are indeed different, on the one i'm getting the error i have my full app, entities, controllers, utility classes, etc.

on the one where jpql query works i only have the persistence unit and the entities.
Comment 7 Sergey Petrov 2013-02-12 14:17:54 UTC
Is it proprietary project? can you remove some extra parts except entities and try if the issue is reproducible and if the issue is reproducible attach the project to the issue?
Comment 8 joordaz 2013-02-12 22:07:53 UTC
indeed it is proprietary, i'll ask my client if i can sent it to you guys, i hope there's no problem with that.
in the meantime let me tell you about something i found... to do what you suggested i copied the project folder to ~/trash/myproyect, first i removed all items from "web pages", build, run jpql query and it ran like a charm, i know that makes no sense AT ALL, i deleted the folder and copied it again from it's original location, then i did a build without removing anything, and the jpql query ran w/o problem again.
tried to run the query on the original folder and still ERROR (java.lang.Exception: You project either have no sources or you need to rebuild your project).
the only noticeable difference was that the path where my project is located has one space in it,  i doubted that was the cause (it's silly, right?)... so i made a new test:
- created two folders under /tmp, named "test1" and "test 1" (notice the space on second one
- copied the project to each folder
- build and tried jpql query (the same query on both cases)
- query ran on the folder w/o spaces in it's name, got error on project with a space in it's path.

 TLDR... looks like spaces in the path are the cause for this, so renaming my folder will solve this issue for me but idk if this is supposed do be this way or there's something broken/missing somewhere.

thanks!
Comment 9 Sergey Petrov 2013-02-13 04:34:35 UTC
thanks, will try your suggestion regarding spaces and if I'll be able to reproduce no project is needed
Comment 10 Sergey Petrov 2013-03-25 11:37:56 UTC
as all project with spaces are affected it may be P2.
http://hg.netbeans.org/web-main/rev/fad3e79c772e