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 226874 - [regression] background scanning stops in PHP project when different encoding is included
Summary: [regression] background scanning stops in PHP project when different encoding...
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: All All
: P2 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-01 07:30 UTC by Masaki Katakai
Modified: 2013-07-12 02:32 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
project file (1.31 KB, application/zip)
2013-03-01 07:30 UTC, Masaki Katakai
Details
Snapshot taken during scan (120.90 KB, application/octet-stream)
2013-03-04 08:12 UTC, Ondrej Brejla
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Masaki Katakai 2013-03-01 07:30:51 UTC
Created attachment 132044 [details]
project file

I got a report from community member in Japan. Background
scanning always stops when PHP project is opened on NetBeans 7.3.
It seems that it's regression. This does not happen on NetBeans 7.2.

PHP project is:
 - project encoding is UTF-8
 - there is one php file but contains different encoding "EUC-JP" 

I got a zip file from the report and I could reproduce it quickly
on my environment.

1. Unzip PHP project zip file
2. Start NetBeans 7.3 and open it
  progress bar for background scanning is always
  showing 100%, but never finished

3. Start NetBeans 7.2 and open it
  it can be finished without any problem.

Here is my env:

Product Version: NetBeans IDE 7.3 (Build 201302132200)
Java: 1.7.0_11; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_11-b21
System: SunOS version 5.11 running on x86; ISO646-US; en (nb)

This case that including EUC encoding in UTF-8 project
should not happen often, however, actually happened in
user side. A user is using the project and some old files
are included in it. It should not stop at scanning in
any cases.

This is a regression from 7.2 So please evaluate and fix it.
Comment 1 Tomas Mysik 2013-03-01 12:21:13 UTC
Reassigning, please evaluate. Thanks.
Comment 2 Ondrej Brejla 2013-03-01 14:21:52 UTC
Imho it will not be an issue of PHP...I think that we don't care of encoding during scan (I think that we don't anyhow block the scanning). Tomasi, can you look at it please? Thanks a lot!
Comment 3 Ondrej Brejla 2013-03-04 08:12:13 UTC
Created attachment 132135 [details]
Snapshot taken during scan
Comment 4 Ondrej Brejla 2013-03-04 08:13:00 UTC
Sorry, it's a JavaScript issue (probably Nashorn issue). Reassigning.
Comment 5 Tomas Zezula 2013-03-04 09:45:39 UTC
Right, the problem is a livelock in the jdk.nashorn.internal.parser.AbstractParser.
Comment 6 Petr Pisl 2013-03-06 13:39:56 UTC
The problem is really in Nashorn parser. It tries to recover from error after reading the chars that are not compatible with the project ending in this case and the recovery  never finished. The fix has to be done on the Nashorn site.
Comment 7 Petr Pisl 2013-07-10 12:30:50 UTC
Still it's not fixed in Nashorn. I have decide to create a patch for our patched version. One possible fix is in  jdk.nashorn.internal.parser.AbstractParser:

@@ -173,8 +173,12 @@
 
             // do this before the start is changed below
             if (last != EOL) {
-                finish = start + Token.descLength(lastToken);
+                int lenght = Token.descLength(lastToken);
+                if (lenght == 0) {
+                    return EOF;
             }
+                finish = start + lenght;
+            }
 
             if (type == EOL) {
                 line = Token.descLength(token);

But for applying the patch, we need to upgrade our libs.nashorn to use newer version of nashorn build infrastructure.
Comment 8 Petr Pisl 2013-07-11 13:41:58 UTC
Fixed in web-main, through patching nashorn
http://hg.netbeans.org/web-main/rev/99a38803bc05
Comment 9 Quality Engineering 2013-07-12 02:32:37 UTC
Integrated into 'main-silver', will be available in build *201307112300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/99a38803bc05
User: Petr Pisl <ppisl@netbeans.org>
Log: #226874 - [regression] background scanning stops in PHP project when different encoding is included