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 100237 - I18N - web jsf project with multibyte in the name - pallette components and desgn area do not show
Summary: I18N - web jsf project with multibyte in the name - pallette components and d...
Status: VERIFIED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: _ deva
URL:
Keywords: I18N
Depends on:
Blocks:
 
Reported: 2007-04-06 15:36 UTC by kaa
Modified: 2007-07-16 18:56 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
exception (3.33 KB, text/plain)
2007-05-21 17:15 UTC, Ken Frank
Details
exception (2.72 KB, text/plain)
2007-05-21 17:57 UTC, Ken Frank
Details
exception (1.33 KB, text/plain)
2007-05-21 17:58 UTC, Ken Frank
Details
exception (3.91 KB, text/plain)
2007-05-21 17:59 UTC, Ken Frank
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kaa 2007-04-06 15:36:42 UTC
1. running recent nb6 with vwp6; not using pseudo localized files
but in ja locale.

2. create a web project and give it a name that has multibyte as part of it.

3. on third wizard page, choose the visual web javaserver faces checkbox

4. choose finish


5. after some time, exception window appears with:

java.lang.NullPointerException
	at
org.netbeans.modules.visualweb.designer.SelectionManager.selectTextBetweenSelectedNodes(SelectionManager.java:2197)
	at
org.netbeans.modules.visualweb.designer.SelectionManager.updateNodesImmediate(SelectionManager.java:2152)
	at
org.netbeans.modules.visualweb.designer.SelectionManager$2.actionPerformed(SelectionManager.java:2019)
	at javax.swing.Timer.fireActionPerformed(Timer.java:271)
[catch] at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)


6. the project opens but the design window is blank and there is no
vwp component pallette.

happens on solaris and windows.

7. creating a web project and choosing no frameworks or the
java server faces framework for example, the exception does not appear.

- it is legal to have nb project with multibyte or characters from the locale
the user is in as part of project name.


8. creator did not allow project with mbyte in its name and this
had been filed as an issue in creator; but now that vwp is a 
web project, it seems that this should be allowed.
Comment 1 _ potingwu 2007-05-01 19:18:08 UTC
As I tested, using multibyte for project name will have 2 issues here:

1. The context path for the 'Web Project' will show '/___' that will cause the
web project can't be deployed. Please file another bug against 'web/project' and
CC me.

2. The package name for Visual Web beans will show the correct multibyte name.
And as I tried, the project can be compiled without any issue. But the designer
cannot get the correct insync model and failed. I.e., reassign to insync.
Comment 2 _ sandipchitale 2007-05-01 19:22:54 UTC
NPE is in designer. No insync code on the stack.
Comment 3 Ken Frank 2007-05-01 21:51:06 UTC
For the comment below:

1. The context path for the 'Web Project' will show '/___' that will cause the
web project can't be deployed. Please file another bug against 'web/project' and
CC me.

web projects can be deployed with this notation if you are talking about the
mutlibyte chars in project name being replaced with underscore - web team
explicitly substututed the
underscore for each multibyte (or perhaps also ascii > 127) character to avoid
problems
of browsers that cant process the actual mbyte in the uri.  j2ee/web team could
tell you
more about this at lower level.

that is, the context root/path is seeded with the project name.

 ---> When you did a regular web project with no framework chosen but using mbyte
chars in the project name, and thus the substitution -- did it not deploy ?


ken.frank@sun.com
Comment 4 Peter Zavadsky 2007-05-02 09:20:37 UTC
The NPE in designer comes from code, which was changed already, and this NPE
shouldn't occur anymore.

However if that NPE occured it means, there could have been some underlying
bigger issue (corrupted model most probably).

Marking this as fixed (the NPE from designer). 

If there is something else, like mentioned above, please file a new bug to
appropriate subcomponent.
Comment 5 Ken Frank 2007-05-21 17:14:55 UTC
This still happens.  I don't see exception anymore but it does still happen.
Am modifying the summary to be more clear and adding additional details and
latest npe.

please change to correct subcategory.


1. details from original issue are stil l the same but dont see exception mentioned

2. during project creation (of the project with multibyte as part of the name),
ide locks up and must be
manually exited.

3. then restart it - you can see this new project in explorer but as mentioned
in original issue,
the design area is not active that can have components dropped to it, nor is the
vwp pallete populated with components.

4. and there is an exception (there is not the same exception as below now)
java.lang.IllegalArgumentException: Type \244\310\344\356jot\344\356webap
plication9\344\345\244\355.SessionBean1 cannot be found
        at org.netbeans.modules.visualweb.insync.java.TreeMakerUtils.crea
teType(TreeMakerUtils.java:241)
        at org.netbeans.modules.visualweb.insync.java.TreeMakerUtils.crea
teImport(TreeMakerUtils.java:252)
        at org.netbeans.modules.visualweb.insync.java.JavaUnit.addImport(
JavaUnit.java:213)
        at org.netbeans.modules.visualweb.insync.java.JavaUnit.access$200
(JavaUnit.java:52)
        at org.netbeans.modules.visualweb.insync.java.JavaUnit$3.run(Java
Unit.java:193)
        at org.netbeans.modules.visualweb.insync.java.WriteTaskWrapper.ru
n(WriteTaskWrapper.java:53)
        at org.netbeans.modules.visualweb.insync.java.WriteTaskWrapper.ru
n(WriteTaskWrapper.java:36)
        at org.netbeans.api.java.source.JavaSource.runModificationTask(Ja
vaSource.java:711)
        at org.netbeans.modules.visualweb.insync.java.WriteTaskWrapper.ex
ecute(WriteTaskWrapper.java:70)
        at org.netbeans.modules.visualweb.insync.java.WriteTaskWrapper.ex
ecute(WriteTaskWrapper.java:58)
        at org.netbeans.modules.visualweb.insync.java.JavaUnit.ensureImpo
rt(JavaUnit.java:189)
        at org.netbeans.modules.visualweb.insync.beans.BeanStructureScann
er.ensureXRefAccessor(BeanStructureScanner.java:335)
        at org.netbeans.modules.visualweb.insync.faces.FacesBeanStructure
Scanner.scan(FacesBeanStructureScanner.java:62)
        at org.netbeans.modules.visualweb.insync.beans.BeansUnit.scan(Bea
nsUnit.java:233)

where the \244\310\344\356jot\344\356 represents the multibyte part of the
project name.
Comment 6 Ken Frank 2007-05-21 17:15:59 UTC
Created attachment 42604 [details]
exception
Comment 7 Ken Frank 2007-05-21 17:18:23 UTC
full exception reported in previous comment is attached; I should not have
pasted it in comments
area and its not complete in any case.

ken.frank@sun.com
Comment 8 Peter Zavadsky 2007-05-21 17:20:38 UTC
Now the exception comes from insync, passing there.
Comment 9 Ken Frank 2007-05-21 17:52:11 UTC
additional information

1. new userdir, create the project that has mbyte in its name and in the package
name
that is on the wizard pane where vwp choice is


exception is attached as vwpexception.projectcreation

2. need to manually close the ide since it locks up

3. restart using same userdir - project is shown in explorer but with not active
design area
and empty vwp pallette

4. click the project node in explorer and following 2 exceptions happen

vwprestart.openproj
vwprestart.openproj.2

ken.frank@sun.com
Comment 10 Ken Frank 2007-05-21 17:57:22 UTC
Created attachment 42606 [details]
exception
Comment 11 Ken Frank 2007-05-21 17:58:22 UTC
Created attachment 42607 [details]
exception
Comment 12 Ken Frank 2007-05-21 17:59:02 UTC
Created attachment 42608 [details]
exception
Comment 13 _ sandipchitale 2007-05-29 17:26:57 UTC
Deva, this may be a problem in Retouche code in termns of not being able to 
handle multibyte names? See the last exception.
Comment 14 Ken Frank 2007-06-05 22:18:18 UTC
please consider fixing this soon - new nb project encoding property has been
done for web 
projects but it means we can't use multibyte in name of web project when its a
vwp one,
and we want to test that situation also.

this is not related to localization, so even users of milestones and beta can
run into it.

ken.frank@sun.com
Comment 15 _ sandipchitale 2007-06-19 01:27:05 UTC
In today's build I see:

java.lang.NullPointerException
	at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.findMarkupSectionElement(FacesPageUnit.java:644)
	at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.newBoundBean(FacesPageUnit.java:526)
	at org.netbeans.modules.visualweb.insync.beans.BeansUnit.bindBean(BeansUnit.java:476)
	at org.netbeans.modules.visualweb.insync.beans.BeansUnit.bindBeans(BeansUnit.java:449)
	at org.netbeans.modules.visualweb.insync.beans.BeansUnit.bind(BeansUnit.java:248)
	at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.bind(FacesPageUnit.java:393)
	at org.netbeans.modules.visualweb.insync.beans.BeansUnit.sync(BeansUnit.java:189)
	at org.netbeans.modules.visualweb.insync.live.LiveUnit.sync(LiveUnit.java:315)
	at org.netbeans.modules.visualweb.insync.live.LiveUnitWrapper.getLiveUnit(LiveUnitWrapper.java:92)
	at org.netbeans.modules.visualweb.insync.models.FacesModel.getLiveUnit(FacesModel.java:564)
	at org.netbeans.modules.visualweb.insync.models.FacesModel.getRootBean(FacesModel.java:658)
	at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.renderHtml(FacesPageUnit.java:1621)
	at org.netbeans.modules.visualweb.insync.models.FacesModel.getHtmlDomFragment(FacesModel.java:1569)
	at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.findMarkupSectionElement(FacesPageUnit.java:642)
	at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.newBoundBean(FacesPageUnit.java:526)
	at org.netbeans.modules.visualweb.insync.beans.BeansUnit.bindBean(BeansUnit.java:476)
	at org.netbeans.modules.visualweb.insync.beans.BeansUnit.bindBeans(BeansUnit.java:449)
	at org.netbeans.modules.visualweb.insync.beans.BeansUnit.bind(BeansUnit.java:248)
	at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.bind(FacesPageUnit.java:393)
	at org.netbeans.modules.visualweb.insync.beans.BeansUnit.sync(BeansUnit.java:189)
	at org.netbeans.modules.visualweb.insync.live.LiveUnitWrapper.sync(LiveUnitWrapper.java:130)
	at org.netbeans.modules.visualweb.insync.models.FacesModel.syncImpl(FacesModel.java:1048)
	at org.netbeans.modules.visualweb.insync.Model.sync(Model.java:197)
	at org.netbeans.modules.visualweb.insync.ModelSet.syncAll(ModelSet.java:770)
	at org.netbeans.modules.visualweb.insync.models.FacesModelSet.syncAll(FacesModelSet.java:1301)
	at org.netbeans.modules.visualweb.insync.models.FacesModelSet.<init>(FacesModelSet.java:356)
Caused: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
	at org.netbeans.modules.visualweb.insync.ModelSet.getInstance(ModelSet.java:372)
Caused: java.lang.RuntimeException
	at org.netbeans.modules.visualweb.insync.ModelSet.getInstance(ModelSet.java:378)
	at org.netbeans.modules.visualweb.insync.ModelSet$1$1.run(ModelSet.java:343)
	at org.netbeans.modules.visualweb.insync.java.ReadTaskWrapper.run(ReadTaskWrapper.java:51)
	at org.netbeans.modules.visualweb.insync.java.ReadTaskWrapper.run(ReadTaskWrapper.java:34)
	at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:564)
	at org.netbeans.modules.visualweb.insync.java.ReadTaskWrapper.execute(ReadTaskWrapper.java:58)
	at org.netbeans.modules.visualweb.insync.ModelSet$1.run(ModelSet.java:340)
[catch] at java.lang.Thread.run(Thread.java:595)

The cause seems to be that the template for JSP does not get instantiated correctly:

<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" 
xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
    <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
    <f:view>
        <webuijsf:page binding="#{Page1.page1}" id="page1">
            <webuijsf:html binding="#{Page1.html1}" id="html1">
                <webuijsf:head binding="#{Page1.head1}" id="head1">
                    <webuijsf:link binding="#{Page1.link1}" id="link1" url="/resources/stylesheet.css"/>
                </webuijsf:head>
                <webuijsf:body binding="#{Page1.body1}" id="body1" style="-rave-layout: grid">
                    <webuijsf:form binding="#{Page1.form1}" id="form1"/>
                </webuijsf:body>
            </webuijsf:html>
        </webuijsf:page>
    </f:view>
    <webuijsf:body binding="#{a\u65e5\u672c\u8a9eb$Page1.body1}" id="body1"/>
    <webuijsf:head binding="#{a\u65e5\u672c\u8a9eb$Page1.head1}" id="head1"/>
    <webuijsf:page binding="#{a\u65e5\u672c\u8a9eb$Page1.page1}" id="page1"/>
</jsp:root>

Somehow Insync does not account for the default package in computing binding attr.

Comment 16 _ sandipchitale 2007-06-19 01:43:41 UTC
Actually it turns out that the following code:

return (String)ReadTaskWrapper.execute( new ReadTaskWrapper.Read() {
            public Object run(CompilationInfo cinfo) {
                return cinfo.getCompilationUnit().getPackageName().toString();
            }
        }, fobj);

is returning unicode escaped package name like this:

"a\u65e5\u672c\u8a9eb"

for the Java source file (some code trimmed for brevity) that looks like this (the package name has japanese chars in 
it). The java editor displays the package name in Japanese corectly :

/*
 * Page1.java
 *
 * Created on Jun 18, 2007, 5:00:03 PM
 * Copyright sc32560
 */
package a日本語b;

import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.webui.jsf.component.Body;
import com.sun.webui.jsf.component.Form;
import com.sun.webui.jsf.component.Head;
import com.sun.webui.jsf.component.Html;
import com.sun.webui.jsf.component.Link;
import com.sun.webui.jsf.component.Page;
import javax.faces.FacesException;

/**
 * <p>Page bean that corresponds to a similarly named JSP page.  This
 * class contains component definitions (and initialization code) for
 * all components that you have defined on this page, as well as
 * lifecycle methods and event handlers where you may add behavior
 * to respond to incoming events.</p>
 */
public class Page1 extends AbstractPageBean {
    /**
     * <p>Construct a new Page bean instance.</p>
     */
    public Page1() {
    }

}





Comment 17 _ sandipchitale 2007-06-19 22:40:10 UTC
FYI:

I tried to get the package name using this approach which seems to return the package name without unicode escaping 
the multibyte chars:

CompilationUnitTree compilationUnit = cinfo.getCompilationUnit();
ExpressionTree packageNameTree = compilationUnit.getPackageName();
StringBuffer packageNameBuffer = new StringBuffer();

if (packageNameTree != null) {
    new TreeScanner<Void, StringBuffer>() {
        @Override
        public Void visitIdentifier(IdentifierTree node, StringBuffer p) {
            p.append(node.getName().toString());
            return null;
        }
        
        @Override
        public Void visitMemberSelect(MemberSelectTree node, StringBuffer p) {
            super.visitMemberSelect(node, p);
            p.append('.');
            p.append(node.getIdentifier().toString());
            return null;
        }
        
    }.scan(packageNameTree, packageNameBuffer);
    return packageNameBuffer.toString();
}
return "";

However I now get this exception in TreeMaker :(

java.lang.IllegalArgumentException: Type a???b.SessionBean1 cannot be found
	at org.netbeans.modules.visualweb.insync.java.TreeMakerUtils.createType(TreeMakerUtils.java:241)
	at org.netbeans.modules.visualweb.insync.java.TreeMakerUtils.createMethod(TreeMakerUtils.java:142)
	at org.netbeans.modules.visualweb.insync.java.JavaClass$10.run(JavaClass.java:329)
	at org.netbeans.modules.visualweb.insync.java.WriteTaskWrapper.run(WriteTaskWrapper.java:53)
	at org.netbeans.modules.visualweb.insync.java.WriteTaskWrapper.run(WriteTaskWrapper.java:36)
	at org.netbeans.api.java.source.JavaSource.runModificationTask(JavaSource.java:784)
	at org.netbeans.modules.visualweb.insync.java.WriteTaskWrapper.execute(WriteTaskWrapper.java:70)
	at org.netbeans.modules.visualweb.insync.java.WriteTaskWrapper.execute(WriteTaskWrapper.java:58)
	at org.netbeans.modules.visualweb.insync.java.JavaClass.addMethod(JavaClass.java:321)
	at org.netbeans.modules.visualweb.insync.java.JavaClass.addMethod(JavaClass.java:354)
	at org.netbeans.modules.visualweb.insync.beans.BeanStructureScanner.addXRefAccessor
(BeanStructureScanner.java:342)
	at org.netbeans.modules.visualweb.insync.beans.BeansUnit.addXRefAccessor(BeansUnit.java:739)
	at org.netbeans.modules.visualweb.insync.models.FacesModel.addXRefAccessors(FacesModel.java:1829)
	at org.netbeans.modules.visualweb.insync.models.FacesModelSet.<init>(FacesModelSet.java:377)
Caused: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
	at org.netbeans.modules.visualweb.insync.ModelSet.getInstance(ModelSet.java:372)
Caused: java.lang.RuntimeException
	at org.netbeans.modules.visualweb.insync.ModelSet.getInstance(ModelSet.java:378)
	at org.netbeans.modules.visualweb.insync.ModelSet$1$1.run(ModelSet.java:343)
	at org.netbeans.modules.visualweb.insync.java.ReadTaskWrapper.run(ReadTaskWrapper.java:51)
	at org.netbeans.modules.visualweb.insync.java.ReadTaskWrapper.run(ReadTaskWrapper.java:34)
	at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:564)
	at org.netbeans.modules.visualweb.insync.java.ReadTaskWrapper.execute(ReadTaskWrapper.java:58)
	at org.netbeans.modules.visualweb.insync.ModelSet$1.run(ModelSet.java:340)
[catch] at java.lang.Thread.run(Thread.java:595)

Looks like this could be an issue of file encoding?
Comment 18 Ken Frank 2007-07-07 18:16:34 UTC
just checking back about this issue - since IMO to be compatible with web projects
(ie can use mbyte in project name) - is needed to be provided.

ken.frank@sun.com
Comment 19 Jan Lahoda 2007-07-10 18:29:26 UTC
Sorry, but CompilationUnit.getPackageName().toString() is not going to work - the toString method on Trees is supposed
to be used only for debugging. Sorry.

The approach Sandip sketched in his last post should work - not sure why the exception is thrown, but this should be
first investigated in visualweb, IMO.
This could work too (untested though):
Element e = info.getTrees().getElement(new TreePath(info.getCompilationUnit()));
if (e != null && e.getKind() == ElementKind.PACKAGE) {
    String name = ((PackageElement) e).getQualifiedName().toString();
}
Comment 20 _ sandipchitale 2007-07-10 19:36:35 UTC
Deva, can you please follow this up.
Comment 21 _ deva 2007-07-12 02:30:21 UTC
Followed Jan's suggestion to compute package name and also fixed similar issue in the code which ensures import 
statement
Comment 22 kaa 2007-07-16 18:56:49 UTC
verified: build 0714, ja_JP
Visual Web app was created properly. Design view is availabe.