Tokenizer not retaining its value

Again another issue I do not understand! Would anybody understand this?
The Tokenizer does not retain its value!? Why it does not?
15,XCV, Some Other String, 10',389.5,4194.0
while ((rec = aPrintData[rIndex].toString()) != null){
     Iterator tokZ = new myNewGetToken(rec, patS, retD);
         for(; tokZ.hasNext();){               // here I got the value 15
              tokZorRetD = (String)tokZ.next();     // here I got "NULL"???
              if (tokZorRetD == null) {
                   patScount--;
                   mCount--;
              }else{
                   switch(patScount){
public class myNewGetToken implements Iterator{
//          class RETokenizer implements Iterator{
          private CharSequence in;
          private Matcher mt;
          boolean retD;
          private String delim;
          private String match;
          private int lastEnd = 0;
          public myNewGetToken(CharSequence in, String patS, boolean retD){
              this.in = in;
              this.retD = retD;
              Pattern pattern = Pattern.compile(patS);
              mt = pattern.matcher(in);
          public boolean hasNext(){
               if(mt == null){
                    return false;
               if(delim != null || match != null){
                    return true;
               if(mt.find()){
                    if(retD){
                         delim = in.subSequence(lastEnd, mt.start()).toString();
                    match = mt.group();
                    lastEnd = mt.end();
               }else if(retD && lastEnd < in.length()){
                    delim = in.subSequence(lastEnd, in.length()).toString();
                    lastEnd = in.length();
                    mt = null;
               return delim != null || mt != null;
          public Object next(){    // the value is not there anymore
               String result = null;
               if(delim != null){
                    result = delim;
                    delim = null;
               }else if(match != null){
                    result = match;
                    match = null;
               return result;
          public boolean isNextToken(){
               return delim == null && match != null;
          public void remove(){
               throw new UnsupportedOperationException();
     }I renamed it because I might need to modify or find out why it does not keeps the value!

dubwai, I am sure you doubt the programming solutions
that I come up with BUT while I run into many problems
to get the results right it seems like that has to be
done what the man has to do!I don't doubt it. I'm 100% absolutely sure that your 'fix' doesn't change anything.
Let me explain line by line:
tempToken = tokZ.next();   //  do Not convert do Not cast, keep it as ObjectThe Object is what it is. Casting the Object doesn't change it. All it does at runtime is check to see
that the given Object is String or what ever you cast it to: Try the following:
Object o = "test";
String s = (String) o;
System.out.println("o and s are the same Object? " + o == s);
tokZorRetD = (String)tempToken.toString();  // Now, convert and cast
// would that have to do anything with StrongTyping?Given that your previous code was not throwing a ClassCastException, the Iterator is already
a String. Calling toString on a String just returns this:
String s = "test"
System.out.println("s.toString returns s? " + s == s.toString());Also, toString returns a String. There's no need to cast a String to String.
And if s is null (which it appears to sometimes be) calling toString() will throw a NullPointerException.
In short, if your code has been fixed, it was something else.

Similar Messages

  • Uploadedfile does not retain its value

    Hi,
    I am using the following to upload a Excel file:
    *<af:inputFile label="File to Upload" columns="30" value="#{backing_dataUpload.file}"/>*
    Here is how I 'put' save the file for later use, in hte sesion:
    **public void processExcelHeader() {**
    UploadedFile file = getFile();
    AdfFacesContext.getCurrentInstance().getViewScope().put("uploadedFileKey",file);//
    Here is how I retrieve it:
    *public void beginUpload() {//=======TBD=======*
    UploadedFile uploadFile = (UploadedFile)AdfFacesContext.getCurrentInstance().getViewScope().get("uploadedFileKey");
    if (uploadFile != null)
    *try {*
    ProcessExcelWorksheet pexcel = new ProcessExcelWorksheet();
    java.io.InputStream in = uploadFile.getInputStream();
    PROBLEM is the value java.io.InputStream in returns NULL. PLease note that the scope tof the Bean is 'Session'.
    I Looked into the debugger the 'uploadFile' in hte beginUpload() has all the entries except the 'buffer' is NULL, and hte length is zero.
    Please note that after the out there is some processing and the control exits back to screen, and on pressing another Command Button it returns to the
    beginUoload() function.
    Any Ideas......
    Thanks......

    Anil:
    No, I don't think the 2 backing bean method is out of scope. I guess the framework implicitly close the stream in the first event handler. Because the framework might think you're done with it. After all the Session scope is the second largest scope and only shorter than Application scope.
    The behavior may be related how the framework dispatch the servicing back bean to handle your event. Even thoug it might be using the same backing bean instance, the framework may clean it up after the completion of each round of servicing.
    Your probably need to put the instance of the opened InputStream into ViewScope so that the inputstream will not be closed since it is still referenced. But you need to remember to close it after using in the second method which is beginUpload().
    So in
    public void processExcelHeader() {**
    UploadedFile file = getFile();
    InputStream is = file.getInputStream();
    AdfFacesContext.getCurrentInstance().getViewScope().put("uploadedFileStream",is);//
    Then:
    public void beginUpload() {//=======TBD=======
    InputStream inputStream = (UploadedFile)AdfFacesContext.getCurrentInstance().getViewScope().get("uploadedFileStream");
    inputStream.close();
    If you don't close it after using, you should experience serious memory leak.
    Good luck,
    Alex

  • Scroll bar does not retain its position after or before pack

    Hi
    My Scroll bar does not retain its position after pack in my application.
    But i need to retain its state.
    My code snippet is :
    System.out.println("VAlue--->" + getHXValue());
    scrollPane.getHorizontalScrollBar().setValue(getHXValue());
    pack();
    My VAlue printed is 100.
    But my positon of scroll bar is at 0 th location.
    Can any one help me.....

    Swing related questions should be posted in the Swing forum.
    My code snippet is :Snippets don't help.
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",
    see http://homepage1.nifty.com/algafield/sscce.html,
    that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    Don't forget to use the "Code Formatting Tags",
    see http://forum.java.sun.com/help.jspa?sec=formatting,
    so the posted code retains its original formatting.

  • I am using CS6 and when I go to save an image for Web the image does not retain its quality

    I am using CS6 and when I go to save an image for Web the image does not retain its quality. The first week I did this it worked just fine and now the images save very pixely.
    Here is a screenshot of my image on the artboard as I am editing it
    Here is a screenshot of the image as I'm trying to save it for Web
    As you can see, the image becomes pixely. I have tried to save it as every type of png and jpeg but nothing seems to work. I have no idea why it has started to do this. Please help!

    Change None to Art optimized then click apply(alteast in CS5 there was an apply, believe they removed that in CS6 as so many people missed that part).

  • Drop-Down menu not retaining selected value

    I'm using LiveCycle Designer ES 8.1.1 with LiveCycle Forms and I render my forms in HTML.  When Google Chrome or Safari are the user's browser the drop-down menus do not retain their selected value when going from page to page.  For example I have a state drop-down on page 1.  The user selects Ohio and then continues on to page 2.  Then the user goes back to page 1 and the state drop-down now has Alabama selected.  If the user is on IE there is no problem.
    Any help would be much appreciated.
    Thank you
    Dennis

    hi...i would like to thank u for the help...the problem has already been resolved though..
    thanks,
    vitish

  • Multiple select list not retaining the value for the first time

    Hi,
    I have a 3 select list depends on each other. select_list1 -- > select_list2 --> multiselect3. I have use denes example to create them.
    For the first time when I select values from 1,2,3 and runs a report based on it, it works fine but *does not retain the selected value in multiselect3.
    for the second time submit the process, it retails value in multiselect3. Please tell me if you came across this issue before
    Here is the code.
    function get_select_list_xml_VL(pThis,pSelect,pSelect1,pSelect2){
    var l_Return = null;
    var l_Select = html_GetElement(pSelect);
    var l_Select1 = html_GetElement(pSelect1);
    var l_Select2 = html_GetElement(pSelect2);
    var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
    'APPLICATION_PROCESS=Cascading_Select_List_VL',0);
    get.add('F660_CASCADING_TEST',l_Select1.value + '_' + pThis.value + '_' + l_Select2.value);
    alert(l_Select1.value + '_' + pThis.value + '_' + l_Select2.value);
    // alert(document.getElementById("F660_CASCADING_TEST").value);
    gReturn = get.get('XML');
    if(gReturn && l_Select ){
    var l_Count = gReturn.getElementsByTagName("option").length;
    l_Select.length = 0;
    for(var i=0;i<l_Count;i++){
    var l_Opt_Xml = gReturn.getElementsByTagName("option");
    appendToSelect(l_Select, l_Opt_Xml.getAttribute('value'),
    l_Opt_Xml.firstChild.nodeValue)
    get = null;
    function appendToSelect(pSelect, pValue, pContent) {
    var l_Opt = document.createElement("option");
    l_Opt.value = pValue;
    if(document.all){
    pSelect.options.add(l_Opt);
    l_Opt.innerText = pContent;
    }else{
    l_Opt.appendChild(document.createTextNode(pContent));
    pSelect.appendChild(l_Opt);

    Please ask any question if you dont understand about the problem.
    Thanks

  • Immediate postback does not retain field values under a dataTable

    A fairly common input dialog requirement is allowing the user to enter a variable number of rows of data -- as a concrete example say the form has one <h:inputText/> for a subject followed by a <h:dataTable/> initially with one <h:inputText/> for a URL, with a <h:commandButton immediate="true"/> called "Add Row". The user fills in subject, enters a URL, and then pushes "Add Row" to allow the entry of a second URL. This is an "immediate" button, and the action just adds a new element to the backing bean property which is a list of URL's.
    This almost+ does what the developer wants -- the form is redisplayed with a new empty URL row, the subject field remains filled in with what the user already entered, but the problem is the already filled in URL field is reset to blank.
    So it appears that input fields inside of a <h:dataTable/> do not retain user input if the form is submitted in immediate mode, but fields outside of <h:dataTable/> are preserved.
    I am using Sun's RI JSF 1.2, and it is not clear if this is just a bug, or some fundamental limitation. Given that the input fields in a data table have unique names that include the row index it seems possible that the posted parameters for the rows in a data table that remain after the action method adds or removes a row can be applied to the new view, just like for fields outside of the data table, and furthermore, this is what the user and developer would expect.
    The questions are:
    <ol><li>Is this a bug?</li>
    <li>If it is not a bug, what is another way to achieve the desired behavior?</li>
    </ol>

    EEG wrote:
    Hello.
    I'm using Apex 4.1.0 on Oracle 10.2.0.5 and Oracle app server (mod_plsq).
    Unfortunately, whenever I change this field to "InActive" in an existing row and then click my "Add Row" button, the tabular form re-appears with a new row but the modified row still has "Active" as the setting.
    I checked the values in my COL_CHOICES collection to be sure that the "active_status" field actually changed from "Active" to "InActive" for the existing/modified row. And it did. The modified row in the collection shows "InActive" as the value, even though the page displays "Active" for the value.
    How then can I make this drop down show the actual modified value?
    I've looked at the APEX_ITEM docs and have tried various combinations of the parameters but nothing works.The second parameter to <tt>apex_item.select_list</tt> is the value for the control. Your code has
    apex_item.select_list(16, null, 'Active;Y,InActive;N', 'style="color:darkred;"', 'NO', '%NULL%', '%', 'f16_' || '#ROWNUM#', NULL, 'NO') active_statusThis will always have the value NULL and thus default to the first option "Active". You need to use the appropriate column from the collection here instead of NULL:
    apex_item.select_list(16, c021, 'Active;Y,InActive;N', 'style="color:darkred;"', 'NO', '%NULL%', '%', 'f16_' || '#ROWNUM#', NULL

  • IWeb header does not retain its altered width when publishing to a folder

    I already had assistance to widen the web page header, and thought the problem was solved as below:
    I want to use Watercolor template in iWeb 3.0.4 but when I widen the page the full image does not follow.  Is there anything that can be done?
    iMac 7,1 Intel Core 2 Duo, Mac OS X (10.6.8), 2.4Ghz
    This solved my question by Roddy  on Apr 6, 2012 1:04 PM 
    If, for example, you mean the header background image you would need to go into the iWeb package contents and replace the image with a wider one.
    Here's an example of a page that's the "standard" 980 px wide instead of the iWeb default of 700px.
    Control click the iWeb application and select "Show Package Contents"
    Drill down through Contents/Resources/Themes
    Control click  "Watercolor.webtheme" and "Show Package Contents"
    Open the "Shared" folder to get the image
    I used EasyCrop to crop and resize the image to 980px X 90px and replaced the original with this wider one.
    However, when I publish the site to a folder, the old size is retained.  I have created new pages using the new enlarged header, but alas it is not retained when I publish.
    I have noticed the privileges of the altered file have changed. Originally it was assigned to be read by Wheel. But as soon as the file is altered, Wheel no longer exists.  Could this be the problem?  Is there a work around?
    Thanks

    Is there a work around?
    you can change it with javascript:
    http://temp.cyclosaurus.com/revolving/1px_line_border2.html
    copy the code in my page.
    add an html snippet to your page, paste in the code, click apply button.

  • Text Fields not retaining passed values.

    I've tried several options to fix this issue, to be more descriptive, I pass a value to the textfield and the page refreshes, after the page refreshes the value is gone. I stepped through the code and the value is there for the time being until the page refresh. I.e:
    public String test () {
    txtTest.setText("asdas");
    String temp = txtTest.getText();
    return null;
    }When i get the value of temp when stepping through the code... temp = asdas meaning it was correct. However when the page refreshes from the return null statment it clears the values, I've used this type of code several times before and it has never given me this issue.

    This has me really stumped, the only thing I really changed from the previous forms where I've done this before is the fact that I put some of the database calls into seperate methods instead of embedding them directly within the action call events.

  • Routine does not get its value from: quantity* net price

    Dear all,
    I have a problem with routine. Could you suggest me any solution for it.
    If quantity =1 there is no problem. But if quantity different than 1 routine still calculates as quantity 1.
    What migh be problem here?
    I have routine as:xkwert = xworkk - xworki.
    I assigned it YODI condition.
    To give an example: xkwert = xworkk - xworki.
    NETW                                              200,00
    OWST                         16,00
         Sub Total                               216,00 = XWORKK
    YOFI                         100,00 =XWORKI
    YODI                                                   8,00 =XKWERT*Here routine calculates as XWORKK=108 and XWORKI= 100.
    How can  I fix it?
    Kind Regards,
    Edited by: Fsmehmet on May 13, 2011 7:02 AM

    Dear Amit,
    My routine: xkwert = xworkk - xworki. And it works when quantity is 1.
    But when quantity is different then one, calclation is wrong.
    For example;
    Quantity=2 Net Price=100 And NETW=2100=200*
    OWST 16,00
    Sub Total 216,00 = XWORKK
    YOFI 100,00 =XWORKI
    YODI 8,00 =XKWERT*Here routine calculates as XWORKK=108 and XWORKI= 100.
    Regards,

  • Field not retaining the value

    we have a report that we copied from a standard program and made some modifications, when we run that report it provides the list of the accounting documents and the user has the ability to modify the doc and then post it. we are expreiencing a problem now, when user generates the list of the documents and select one and try to make a change to it ... like changing the amount, g/l account.. evrything worked fine but when user tried to change one of the field like order number and hit enter after that... the field is getting cleared out after that.
    Can you please suggets something.

    thnks for the reply... I found that the issue is in SAP std tcode as well.

  • Numbers is not retaining the values of my sorted SUMs in a column.

    I just switched to Numbers 3.0.1
    I have a two tables: Table 1 has a large set of data. Table 2 has various sums of the data from Table 1 (added by using the SUM function). Pretty simple stuff.
    My problem is when I go to sort the data (SUMs from Table 1) in Table 2 using the ascending/descending option all of the data in the column changes and makes no sense.
    Older version of Numbers just sorted the data in the column numerically (ascending or descending).
    Does anyone have a fix for this?

    I find the new way Numbers handles cell references during a sort to be a little odd.  First let's talk your problem then I'll mention another.
    I think for your problem, you need to use "preserve row" on all your cell references.  Otherwise the references become "relative".  For example, if you have =SUM(Table 1::A2:A3) in cell B4 of Table 1 before the sort and it moves to cell B5 after the sort, the formula will become =SUM(Table 1::A3:A4). The formula moved down one row so the cell references also moved down one row.  Seems like a strange result but you can prevent it by using =SUM(Table 1::A$2:A$3)
    For the other problem, let's say you leave Table 2 (the sums) alone and sort Table 1 instead. This also changes all the sums. It makes sense what it is doing but I haven't yet figured out a way to make it do what it used to do.
    If you look at your SUM formulas, they will stay exactly the same after the sort.  If it was =SUM(Table 1::A1:A10) before the sort it will still be exactly that after the sort.  But now you have different numbers in those cells in Table 1 so your sum is different.  In Numbers '09, it would have turned into something like =SUM(A5,A9,A2:A3,A19,.....) as it readjusted to sum up the exact same cells as before. I can''t figure out how to make a SUM or an addition or any other calculation follow a cell around during a sort.

  • Ipod not retaining its charge

    I have an 80gb ipod, purchased in 2006. When I charge it the indicator shows the battery as charged but it fails to hold it. Is it possible to get a new battery installed?

    Yes.  Apple will replace your battery for the fee indicated on this page.
    http://www.apple.com/batteries/replacements.html
    A third party service may be less expensive.  Google for "iPod battery replacement" for a few possibilities.
    B-rock

  • Overridden fields' values not retained after form is saved/reopened

    Hi Everyone,
    Thanks in advance for any help you can provide. I've searched the net, but can't seem to resolve my problem.
    The form itself is somewhat complex. If needed, I can get into the details of how the calculation is done, but may save some time if I just explain the problem:
    I have 3 drop down boxes on my form that are auto-populated based on what is entered in a series of other dropdown boxes. The user is allowed to change the calculated drop downs to another option if they want.
    When the form is saved and reopened, 2 of the 3 drop downs are not retaining the value the user selected if they overrode it. Instead, it's recalculating against the calculation script that's written. Strange thing is that there is 1 of the three drop down retaining it's value perfectly.
    Is there anyway I can save the overridden values, or stop it from recalculating and reverting when the form is saved then reopened? I can't set the fields to disabled/read-only either, in case the user needs to override and save again to something else later.
    Thanks for any help you can provide!!

    Can you email me the document to [email protected] ?

  • Premiere Pro CS6 - Project frame won't retain its layout or location between opening and closing?

    I filed this as a bug, but perhaps I'm thinking through this wrong and would like to seek help.
    I'm finding that the Project frame in Premiere Pro CS6 does not retain its layout between opening and closings.
    Here's what I do:
    1) Open a project.
    2) Create several bins and populate them with media. Expand the contents of a bin by clicking the disclosure triangle to the left of the folder.
    3) Undock the Project frame only.
    4) Close the Project frame with Command-W
    5) Use ****-1 to reopen the Project frame.
    Repeat steps 4 and 5. The result is that the Project frame does not remember which bin was open. Furstratingly, it also does not retain which bins were expanded or collapsed.
    And worst of all, it will also open in random areas of the screen. (The expected result is that it would reopen in the same spot of the desktop where you last closed it, no?)
    I'm a big organizer -- tons of footage across many different bins. I open bins, close them, keep some open, close others... easily dozens or hundreds of times during an edit session. I'm beginnging to feel like I'm swatting flies or playing whack-a-mole just to get my bin views correct!
    Or mm I approaching this wrong?

    But really, the real solution for me was to not update Premiere Pro CS6 after a reinstall. The most recent updates just do not like my computer, I guess.
    Figured I should post this solution here in case anyone in the future has this problem. (relevant: xkcd: Wisdom of the Ancients)
    -Sam

Maybe you are looking for

  • Inspection lot with Production Order

    Hi friends, I am PP consultant and need some help in setting up a scanario of Production order with inspection lot. I need to setup a scenario where a inpspection lot is created from production order manually (not at the time of release). The purpose

  • Touch not being recognised by itunes only autoplay, frustrating!

    Ever since I downloaded Itunes 8 my ipod hasn't been recognised by itunes and keeps coming up with autoplay or digital camera whenever I plug it in. I have tried uninstalling itunes, reinstalling it, resetting my touch, stoping and starting the devic

  • Itunes has made a mess of my music

    ok, i keep all my music on an external hard drive. i have changed the location of my music to a folder on the drive in preferences. after loading all the music to the drive, 244gb, i conected to itunes and itunes started 'organising' my music. now i

  • Dyanamic Date Selection in variants

    Hi.... In select-options i have declared one field for Posting Date. my requirement is in TO : Today - 1. based on that FROM : start of month date for that what i hv to change in variant. I hv select for date selection variable as D and Name of Varia

  • How to call a JavaScript in Photoshop?

    Hello, I created 3 simple scripts (converted PS Actions to JavaScript) as a test:   Script1.jsx,  Script2.jsx,  Script3.jsx How would I go about creating another  JavaScript that runs these three JavaScript consecutively (while in photoshop) ..I can