Bug 118937 - Tutorial: Currency converter fails
Tutorial: Currency converter fails
Status: RESOLVED FIXED
Product: obsolete
Classification: Unclassified
Component: visualweb
6.x
All All
: P1 (vote)
: 6.x
Assigned To: _ potingwu
issues@obsolete
: REGRESSION
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-15 20:53 UTC by Lark Fitzgerald
Modified: 2007-11-07 21:24 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
Patch that removes the locale setting in faces-config.xml (917 bytes, text/plain)
2007-11-06 18:05 UTC, _ potingwu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lark Fitzgerald 2007-10-15 20:53:50 UTC
Product Version: NetBeans IDE Dev (Build 200710150000)
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b06
System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb)

Running converters and validators tutorial:
http://bookshelf.sfbay.sun.com/jets/Rave/Tutorials/NB-Web/kb/60/web/convert-validate.html

Steps:
1. Do section: Doing More: Using the Number and Date Time Converters
during testing, when you enter $100.00 and press converter.  You get error:

Dollar Amount:: '$100.00' could not be understood as a currency value.

The glassfish log had this excetion (though I'm not sure its relevant):

setTcpNoDelay exception 
java.net.SocketException: Invalid argument: sun.nio.ch.Net.setIntOption
        at sun.nio.ch.Net.setIntOption0(Native Method)
        at sun.nio.ch.Net.setIntOption(Net.java:154)
        at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:406)
        at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
        at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
        at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
        at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
        at com.sun.enterprise.web.connector.grizzly.SelectorThread.setSocketOptions(SelectorThread.java:1880)
        at com.sun.enterprise.web.connector.grizzly.SelectorThread.handleAccept(SelectorThread.java:1453)
        at com.sun.enterprise.web.connector.grizzly.SelectorThread.handleConnection(SelectorThread.java:1417)
        at com.sun.enterprise.web.connector.grizzly.SelectorThread.doSelect(SelectorThread.java:1329)
        at com.sun.enterprise.web.connector.grizzly.SelectorThread.startListener(SelectorThread.java:1263)
        at com.sun.enterprise.web.connector.grizzly.SelectorThread.startEndpoint(SelectorThread.java:1226)
        at com.sun.enterprise.web.connector.grizzly.SelectorThread.run(SelectorThread.java:1202)
Comment 1 Lark Fitzgerald 2007-10-15 20:59:06 UTC
One thing I noticed, is that the maxFractionDigits keep resetting to 3, when the tutorial has you change them to 2.

My private init looks like:
    private void _init() throws Exception {
        numberConverter1.setMinIntegerDigits(1);
        numberConverter1.setMaxIntegerDigits(40);
        numberConverter1.setMaxFractionDigits(3);
        numberConverter1.setType("currency");
        numberConverter1.setCurrencyCode("USD");
        numberConverter2.setMinIntegerDigits(1);
        numberConverter2.setMaxIntegerDigits(40);
        numberConverter2.setMaxFractionDigits(2);
        numberConverter2.setType("currency");
        numberConverter2.setLocale(new java.util.Locale("de", "DE", ""));
        numberConverter2.setCurrencyCode("EUR");
        dateTimeConverter1.setTimeZone(null);
        dateTimeConverter1.setPattern("EEE, d MMM yyyy HH:mm:ss zzzz");
    }
Comment 2 _ gowri 2007-10-17 02:42:09 UTC
Using the latest trunk bits I am able to reproduce the same. 
But there is a workaround to this problem.
When the numberconverter is dropper, in the customizer dialog, select the currency symbol instead of currency code.
After I changed the selection from currency code to currency symbol, the tutorial started working for me.

Since there is a workaround I am downgrading the priority to 3.

I will look into this more closely and see whats causing the problem in setting the currency code.


Comment 3 James Branam 2007-10-17 13:10:36 UTC
I have added a note and workaround to the tutorial.
Comment 4 Lark Fitzgerald 2007-10-17 14:42:48 UTC
reopening.  This still needs a dev fix, not just a workaround in a tutorial.  Also, this should be fixed for fcs, even 
if it has a workaround.
Comment 5 _ gowri 2007-10-17 18:54:21 UTC
Yes, this still needs to be fixed. Thanks for reopening Lark.

Comment 6 Lark Fitzgerald 2007-10-22 20:54:11 UTC
please fix for fcs (updgraded priority).
Comment 7 _ gowri 2007-10-24 01:52:49 UTC
The number converter is setting the currency code and symbol correctly in the backing bean.
Hence there is no problem during the design-time. The problem exists only during runtime. 
Investigating more to see if its the component's runtime renderer issue or 
JSF issue.
Comment 8 _ gowri 2007-10-26 19:19:29 UTC
This is caused due to a bug fix (http://www.netbeans.org/issues/show_bug.cgi?id=103085) that went in Beta2.
I have a fix ready and talking with Po-Ting and Ken about it.
Comment 9 _ gowri 2007-10-26 20:19:07 UTC
I have fixed this issue and integrated the code and here is the code diff:

Directory: /visualweb/project/jsf/src/org/netbeans/modules/visualweb/project/jsf/framework/
===========================================================================================

File [changed]: JSFFrameworkProvider.java
Url:
http://visualweb.netbeans.org/source/browse/visualweb/project/jsf/src/org/netbeans/modules/visualweb/project/jsf/framework/JSFFrameworkProvider.java?r1=1.58&r2=1.59
Delta lines:  +3 -2
-------------------
--- JSFFrameworkProvider.java	8 Oct 2007 18:50:10 -0000	1.58
+++ JSFFrameworkProvider.java	26 Oct 2007 19:16:09 -0000	1.59
@@ -84,6 +84,7 @@
 import org.openide.util.NbBundle;
 import org.openide.loaders.DataObject;
 import org.openide.cookies.OpenCookie;
+import java.util.Locale;
 
 /**
  *
@@ -99,9 +100,9 @@
     private static final String FACES_VALIDATE_XML = "com.sun.faces.validateXml"; // NOI18N
     private static final String FACES_VERIFY_OBJECTS = "com.sun.faces.verifyObjects"; // NOI18N
     
-    private static final String DEFAULT_LOCALE = "en"; // NOI18N
+    private static final String DEFAULT_LOCALE = Locale.getDefault().toString();  // NOI18N
     private static final String[] SUPPORTED_LOCALES = {
-                    "en", // NOI18N
+                    "de", // NOI18N
                     "ja", // NOI18N
                     "zh_CN", // NOI18N
                     "pt_BR", // NOI18N


Comment 10 Lark Fitzgerald 2007-11-06 15:40:57 UTC
Reopening and raising priority.  This issue is still reproducible in build:
Product Version: NetBeans IDE Dev (Build 200711060000)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb)
Comment 11 Petr Blaha 2007-11-06 17:27:02 UTC
Maybe, related:
User: potingwu
Date: 2007/11/02 13:56:07

Modified:
   visualweb/project/jsf/src/org/netbeans/modules/visualweb/project/jsf/framework/JSFFrameworkProvider.java

Log:
 Should be 'en' instead of 'de' here for supported locale.
 

File Changes:

Directory: /visualweb/project/jsf/src/org/netbeans/modules/visualweb/project/jsf/framework/
===========================================================================================

File [changed]: JSFFrameworkProvider.java
Url:
http://visualweb.netbeans.org/source/browse/visualweb/project/jsf/src/org/netbeans/modules/visualweb/project/jsf/framework/JSFFrameworkProvider.java?r1=1.59&r2=1.60
Delta lines:  +1 -1
-------------------
--- JSFFrameworkProvider.java	26 Oct 2007 19:16:09 -0000	1.59
+++ JSFFrameworkProvider.java	2 Nov 2007 20:56:04 -0000	1.60
@@ -102,7 +102,7 @@
     
     private static final String DEFAULT_LOCALE = Locale.getDefault().toString();  // NOI18N
     private static final String[] SUPPORTED_LOCALES = {
-                    "de", // NOI18N
+                    "en", // NOI18N
                     "ja", // NOI18N
                     "zh_CN", // NOI18N
                     "pt_BR", // NOI18N
Comment 12 Winston Prakash 2007-11-06 17:38:06 UTC
Po-Ting, please remove the code we inject in to the faces-config
file. As I mentioned earlier it is asking for trouble. We are doing
more harm than helping out people. 
Let us release note or FAQ on how to add the information about default
locale and supported locale.  
Comment 13 _ potingwu 2007-11-06 17:55:42 UTC
Winston, please code-review the following diff that disable the locale settings:

Index: JSFFrameworkProvider.java
===================================================================
RCS file: /cvs/visualweb/project/jsf/src/org/netbeans/modules/visualweb/project/jsf/framework/JSFFrameworkProvider.java,v
retrieving revision 1.60
diff -u -r1.60 JSFFrameworkProvider.java
--- JSFFrameworkProvider.java	2 Nov 2007 20:56:04 -0000	1.60
+++ JSFFrameworkProvider.java	6 Nov 2007 17:54:20 -0000
@@ -541,6 +541,7 @@
             }
 
             // set locale in faces-config.xml
+            /* Not ready yet, comment out for issue#118937, Tutorial: Currency converter fails
             final FileObject facesConfig = FileUtil.toFileObject(fileConfig);
             if (facesConfig != null) {
                 ProjectManager.mutex().postReadRequest(new Runnable() {
@@ -575,6 +576,7 @@
                     }
                 }); 
             }
+            */
         }
     }
 
Comment 14 _ potingwu 2007-11-06 18:02:44 UTC
> Fixes must be integrated into trunk first, the issue in IZ should be marked as fixed, with target milestone set to Dev

The fix (committed at around 10:00AM, 11/06/2007) is in the trunk, please verify.
Comment 15 _ potingwu 2007-11-06 18:05:41 UTC
Created attachment 52615 [details]
Patch that removes the locale setting in faces-config.xml
Comment 16 Winston Prakash 2007-11-06 18:06:52 UTC
Po-ting thanks. You fix looks good to me. 
I've added gowri to this bug. From development side, she will verify this bug
when the next build is available.
Comment 17 _ gowri 2007-11-06 18:27:01 UTC
Thanks Po-Ting & Winston. I will verify the bug with the next build and let you know.
Comment 18 Ch Nguyen 2007-11-06 21:09:04 UTC
As a result of fixing this bug, the whole application locale-config section is gone instead of being commented out. This
would make things more difficult for the users to know how to set the locale for the application. 

Ken filed a related bug, issue 103085, to have the locale-config section added but commented out in the faces-config.xml
along with other FAQ, RELNOTEs, etc, just like how it was done in the older Creator/VWP.  Since we don't have a more
desirable solution with a new UI to assist the users to choose the locale for their app, it would be helpful at least to
maintain the section as comments in the faces-config.xml.

What do you think?
Comment 19 Ch Nguyen 2007-11-06 21:35:17 UTC
Oh, after talking to Winston, I now recall that Po-TIng also made similar remarks about this as well that it's not
possible because we're using NB API to make changes to this faces-config.xml file and the API won't let us add comments.
We don't have control over this file anymore as we did in previous releases. :-(.
Comment 20 _ potingwu 2007-11-06 21:44:58 UTC
Yes, currently there is no API for adding comments into faces-config.xml. Release note should be the right place instead.

BTW, the following build contains my fix. Could Gowri and QA test and verify it? Thanks!

    http://deadlock.netbeans.org/hudson/job/trunk/4331/
Comment 21 _ gowri 2007-11-06 21:56:39 UTC
I have updated the sources and built it locally and the bug is fixed. Thanks po-ting.
Comment 22 Lark Fitzgerald 2007-11-07 15:45:29 UTC
I am still seeing this with today's 200711070000 installer build.  Pulling a CB now.
Comment 23 Winston Prakash 2007-11-07 16:02:37 UTC
Lark, trunk or branch?. The fix is integrated in to trunk but not yet in to NB 6.0 branch
Comment 24 Lark Fitzgerald 2007-11-07 16:39:57 UTC
Fix Verified using zizala trunk cb, javaee.zip
http://zizala-z1.czech.sun.com:8080/hudson/job/NB6.0CB/6391/artifact/Repo/dist/zip/

Will not mark verified until the fix is in NB6.
Comment 25 _ gowri 2007-11-07 17:22:26 UTC
Po-Ting, can put back the fix in the branch so that Lark can verify -- Thanks
Comment 26 _ potingwu 2007-11-07 17:27:53 UTC
I still need to wait for one more hour for committing! (there is 24 hours waiting requirement after sending request to
reviewers@netbeans.org).
Comment 27 _ potingwu 2007-11-07 18:47:37 UTC
Next build (6393) will be ready soon for testing: (build not finished yet)
http://zizala-z1.czech.sun.com:8080/hudson/job/NB6.0CB/6393/artifact/Repo/dist/zip/
Comment 28 _ potingwu 2007-11-07 21:24:19 UTC
Build 6393 is just finished. Please use it for testing. It started exactly the same time I did the commit (??:52). If
you don't find the fix there, then please retry build 6394. Thanks!


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo