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 205695

Summary: IDE ignores encoding in source based project, if project location is not equal to source location
Product: cnd Reporter: soldatov <soldatov>
Component: EditorAssignee: Alexander Simon <alexvsimon>
Status: VERIFIED FIXED    
Severity: normal CC: apepin, mmirilovic
Priority: P2    
Version: 7.1   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Attachments: stack

Description soldatov 2011-11-30 08:43:06 UTC
More exotic scenario than issue 205583

Scenario:
- Makefile and test.c in C:\test_projects_other_test_src
- Launch IDE on localized (Russian) Windows XP
- Call "C/C++ Project with Existing Source" wizard and create project in C:\test_projects_other_test_src_project
- Select "other_test_src - C:\test_projects_other_test_src" and call Create Main File wizard
- Press Finish button
===>
org.openide.text.DataEditorSupport$1: The file cannot be safely opened with encoding UTF-8. Do you want to continue opening it?
	at org.openide.text.DataEditorSupport.createAndThrowIncorrectCharsetUQE(DataEditorSupport.java:505)
	at org.openide.text.DataEditorSupport.loadFromStreamToKit(DataEditorSupport.java:496)
	at org.netbeans.modules.cnd.source.CppEditorSupport.loadFromStreamToKit(CppEditorSupport.java:214)
	at org.openide.text.CloneableEditorSupport.loadDocument(CloneableEditorSupport.java:2128)
	at org.openide.text.CloneableEditorSupport.access$2800(CloneableEditorSupport.java:129)
	at org.openide.text.CloneableEditorSupport$Listener.run(CloneableEditorSupport.java:2929)
	at org.openide.text.CloneableEditorSupport$3.doRun(CloneableEditorSupport.java:722)
	at org.openide.text.CloneableEditorSupport$3.run(CloneableEditorSupport.java:689)
	at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:317)
	at org.openide.text.NbDocument.runAtomic(NbDocument.java:422)
	at org.openide.text.CloneableEditorSupport$3.doRun(CloneableEditorSupport.java:699)
[catch] at org.openide.text.CloneableEditorSupport$3.run(CloneableEditorSupport.java:689)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1411)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1991)
Comment 1 Alexander Simon 2011-11-30 11:02:02 UTC
fixed, change set:
http://hg.netbeans.org/cnd-main/rev/8875ccdf4519
Comment 2 Alexander Simon 2011-11-30 11:04:23 UTC
review: fix is safe and correct
Comment 3 soldatov 2011-11-30 11:43:42 UTC
Created attachment 113654 [details]
stack
Comment 4 Alexander Simon 2011-11-30 15:04:21 UTC
additional fix, change set:
http://hg.netbeans.org/cnd-main/rev/8c9f1df97a11
Comment 5 soldatov 2011-11-30 16:22:31 UTC
verified in build with 2 new *.jar files.
Comment 6 Vladimir Voskresensky 2011-12-01 12:11:15 UTC
to be sure all paths are in the same format, I'd expect srcPath to be normalizeSlash'ed before 'for' loop as well
Comment 7 Alexander Simon 2011-12-01 12:24:24 UTC
additional fix:
http://hg.netbeans.org/cnd-main/rev/a974ad9f93e0
Comment 8 Vladimir Voskresensky 2011-12-01 14:09:45 UTC
reviewed
Comment 9 Vladimir Voskresensky 2011-12-01 14:19:23 UTC
please, check for real sub path (considering '/' as delimeter) to prevent situation when C:/pathAAA is recognized as source root for file C:/path/file.h
Comment 10 Alexander Simon 2011-12-01 14:59:21 UTC
additional fix:
http://hg.netbeans.org/cnd-main/rev/670b264e45ff
Comment 11 Vladimir Voskresensky 2011-12-01 15:42:07 UTC
reviewed
Comment 12 Alexander Simon 2011-12-01 15:46:31 UTC
fixed in release71 branch:
8875ccdf4519 transplanted to ca7e8c7d0b23
8c9f1df97a11 transplanted to 7f48eebdc25b
a974ad9f93e0 transplanted to 6e6f9671d137
670b264e45ff transplanted to a1ed9377d15e
Comment 13 Quality Engineering 2011-12-02 07:55:49 UTC
Integrated into 'releases'
Changeset: http://hg.netbeans.org/releases/rev/ca7e8c7d0b23
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixed #205695 - IDE ignores encoding in source based project, if project location is not equal to source location
(transplanted from 8875ccdf4519a5a0de6174c4548c761fc1a19617)
Comment 14 soldatov 2011-12-05 13:30:33 UTC
verified in NetBeans IDE 7.1 (Build 201112030901)
Comment 15 Quality Engineering 2011-12-08 12:11:31 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/8875ccdf4519
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixed #205695 - IDE ignores encoding in source based project, if project location is not equal to source location