Long.parseLong("2") returned 6001

I ran into a really strange issue where Long.parseLong("2") started returning 6001. Here is what happened:
- This happened on windows 7 - 64 bit OS and in an application running on the weblogic server - v10.3.2. Weblogic was set to use jdk160_14_R27.6.5-32 that comes along with it.
- When this started happening, I debugged the server using eclipse and entered the expression Long.parseLong("2") in the eclipse-debug expression window. This itself was returning 6001.
- Even Long.valueOf("2") returned 6001.
- Other values - like Long.parseLong("1"), Long.parseLong("3"), Long.parseLong("4"), Long.parseLong("8"), etc were fine.
- I tried giving a radix of 10, etc but nothing helped
I suspect there was some corruption in the JVM due to which the representation of 2 got screwed.
Do note 1 thing, this started happening on a morning when I had resumed the machine from a hibernation that I had done the previous night.
It so happened that when I had hibernated the machine the previous night, the debugger was attached to the JVM and thats the state the machine was hibernated in.
I have done this many times on previous occasions but never came across any issues. I am not sure if this could be the cause of the issue.
I restarted the server and all was well after that.
Anyone having any clue what could have happened here ?

EJP wrote:
Well an application couldn't actually do that without a hardware fault.Not sure what scenario you are referring to.
But one application can certainly mess with the application space of another on any modern desktop OS.
For example the following windows method.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms681674%28v=vs.85%29.aspx
And if it does it incorrectly then it would cause some really odd error in the target app.

Similar Messages

  • How does this work: Long.parseLong(String)

    I am passing a string: "MM/DD/YYYY HH:MM:SS:MM" into the method Long.parseLong and it correctly gives me the epoch time as a long. Is this suppose to do this, or is this a freak thing? Does parseLong know that this is formatted as a date and correctly translates it to epoch? I searched api and cannot find anything.
    Thanks!

    Sorry, I am apparently an idiot. I am using a servlet. When the user clicks on a link it sends the time to a servlet which retrieves it from a database. The link is formatted as a date, but the actual href sends the epoch time. So it is a simple conversion to a long. Thanks anyways!

  • Problem with a ColdFusion (Queries spend a long time to return)

    Hy guys
    My team have a problem with a Coldfusion (version 8,0,0,176276). Apparently this issue has a relation with queries that spend a long time to return some result, making the poll to open more connexions with the database until stop the application.
    Actually the high number of connexions is a reflex of this issue, a consequence and the same way that is the fail on the application.
    I would like to know if exist a way to debug the calls to database? this information will help my team a lot.
    Thank you.
    Herbert Dias

    Reader has a different forum http://forums.adobe.com/community/adobe_reader_forums

  • How long before user returns chart in azure preview portal

    Hi,
    I am trying to figure out how to add "How long before user returns" chart from VS Online AI dashboard to the azure preview portal. Any advice how to do that?
    Thanks,
    PV

    Try out these steps on Azure Preview Portal:
    1. On Application Overview blade select Users chart
    2. On opened Metrics Explorer blade select grid under charts
    4. In "Group by" combobox select a property by which to group the average time before user returns.
    3. In chart details select metric "Time between sessions (Avg)"
    Mihail Smacinih

  • Long delay before returning to menu

    I've made several movies and burned them using iDVD in the past, but I've never had this problem. After the movie is done playing, it takes at least a good minute to two minutes for the main menu to come back up. Any idea what is wrong or how to fix it?

    It sounds like you miight have some extra space at the end of your movie. Sometimes a stray fragment of audio or video left over from editing gets located down the time line from the end of your movie. They can be tiny and hard to see. The movie will then play out with a dark screen until it reaches the "end" at that stray fragment, before returning to the menu. Expand your time line as wide as it will go and do a careful search for any such fragments and delete them.
    Also, if you have music that has been muted but extends out past the end of your movie, the dark screen will play out until the end of the muted song before switching back to the menu.
    Although unlikely, for some reason you may have left an extra long black clip at the end of your movie. (It happened to me once,)
    If none of the above resolves your problem, try using the search function of this forum. I have seen your issue come up a lot.

  • Query takes long time to return results.

    I am on Oracle database 10g Enterprise Edition Release 10.2.0.4.0 – 64 bit
    This query takes about 58 seconds to return 180 rows...
             SELECT order_num,
                    order_date,
                    company_num,
                    customer_num,
                    address_type,
                    create_date as address_create_date,
                    contact_name,
                    first_name,
                    middle_init,
                    last_name,
                    company_name,
                    street_address_1,
                    customer_class,
                    city,
                    state,
                    zip_code,
                    country_code,
                    MAX(decode(media_type,
                               'PHH',
                               phone_area_code || '''' || phone_number,
                               NULL)) home_phone,
                    MAX(decode(media_type,
                               'PHW',
                               phone_area_code || '''' || phone_number,
                               NULL)) work_phone,
                    address_seq_num,
                    street_address_2
               FROM (SELECT oh.order_num order_num,
                            oh.order_datetime order_date,
                            oh.company_num company_num,
                            oh.customer_num customer_num,
                            ad.address_type address_type,
                            c.create_date create_date,
                            con.first_name || '''' || con.last_name contact_name,
                            con.first_name first_name,
                            con.middle_init middle_init,
                            con.last_name last_name,
                            ad.company_name company_name,
                            ad.street_address_1 street_address_1,
                            c.customer_class customer_class,
                            ad.city city,
                            ad.state state,
                            ad.zip_code zip_code,
                            ad.country_code,
                            cph.media_type media_type,
                            cph.phone_area_code phone_area_code,
                            cph.phone_number phone_number,
                            ad.address_seq_num address_seq_num,
                            ad.street_address_2 street_address_2
                       FROM reporting_base.gt_gaft_orders gt,
                            doms.us_ordhdr   oh,
                            doms.us_address  ad,
                            doms.us_customer c,
                            doms.us_contact  con,
                            doms.us_contph   cph
                      WHERE oh.customer_num = c.customer_num(+)
                        AND oh.customer_num = ad.customer_num(+)
                        AND (
                               ad.customer_num = c.customer_num
                        AND
                               ad.address_type = 'B'
                         OR   (
                                ad.customer_num = c.customer_num
                        AND
                                ad.address_type = 'S'
                        AND
                            ad.address_seq_num = oh.ship_to_seq_num
                        AND ad.customer_num = con.customer_num(+)
                        AND ad.address_type = con.address_type(+)
                        AND ad.address_seq_num = con.address_seq_num(+)
                        AND con.customer_num = cph.customer_num(+)
                        AND con.contact_id = cph.contact_id(+)
                        AND oh.order_num = gt.order_num
                        AND oh.business_unit_id = gt.business_unit_id)
              GROUP BY order_num,
                       order_date,
                       company_num,
                       customer_num,
                       address_type,
                       create_date,
                       contact_name,
                       first_name,
                       middle_init,
                       last_name,
                       company_name,
                       street_address_1,
                       customer_class,
                       city,
                       state,
                       zip_code,
                       country_code,
                       address_seq_num,
                       street_address_2;This is the explain plan for the query:
    Plan
    SELECT STATEMENT FIRST_ROWS Cost: 21 Bytes: 207 Cardinality: 1
         18 HASH GROUP BY Cost: 21 Bytes: 207 Cardinality: 1
               17 NESTED LOOPS OUTER Cost: 20 Bytes: 207 Cardinality: 1
                     14 NESTED LOOPS OUTER Cost: 16 Bytes: 183 Cardinality: 1
                           11 FILTER
                                 10 NESTED LOOPS OUTER Cost: 12 Bytes: 152 Cardinality: 1
                                       7 NESTED LOOPS OUTER Cost: 8 Bytes: 74 Cardinality: 1
                                             4 NESTED LOOPS OUTER Cost: 5 Bytes: 56 Cardinality: 1
                                                   1 TABLE ACCESS FULL TABLE (TEMP) REPORTING_BASE.GT_GAFT_ORDERS Cost: 2 Bytes: 26 Cardinality: 1
                                                   3 TABLE ACCESS BY INDEX ROWID TABLE DOMS.US_ORDHDR Cost: 3 Bytes: 30 Cardinality: 1
                                                         2 INDEX UNIQUE SCAN INDEX (UNIQUE) DOMS.USORDHDR_IXUPK_ORDNUMBUID Cost: 2 Cardinality: 1
                                             6 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE DOMS.US_CUSTOMER Cost: 3 Bytes: 18 Cardinality: 1 Partition #: 11
                                                   5 INDEX UNIQUE SCAN INDEX (UNIQUE) DOMS.USCUSTOMER_IXUPK_CUSTNUM Cost: 2 Cardinality: 1
                                       9 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE DOMS.US_ADDRESS Cost: 4 Bytes: 156 Cardinality: 2 Partition #: 13
                                             8 INDEX RANGE SCAN INDEX (UNIQUE) DOMS.USADDR_IXUPK_CUSTATYPASEQ Cost: 3 Cardinality: 2
                           13 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE DOMS.US_CONTACT Cost: 4 Bytes: 31 Cardinality: 1 Partition #: 15
                                 12 INDEX RANGE SCAN INDEX DOMS.USCONT_IX_CNATAS Cost: 3 Cardinality: 1
                     16 TABLE ACCESS BY GLOBAL INDEX ROWID TABLE DOMS.US_CONTPH Cost: 4 Bytes: 24 Cardinality: 1 Partition #: 17
                           15 INDEX RANGE SCAN INDEX (UNIQUE) DOMS.USCONTPH_IXUPK_CUSTCONTMEDSEQ Cost: 3 Cardinality: 1 Cost is good. All indexes are used. However the time to return the data is very high.
    Any ideas to make the query faster?.
    Thanks

    Hi, here is the tkprof output as requested by Rob..
    TKPROF: Release 10.2.0.4.0 - Production on Mon Jul 13 09:07:09 2009
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Trace file: axispr1_ora_15293.trc
    Sort options: default
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    SELECT ORDER_NUM, ORDER_DATE, COMPANY_NUM, CUSTOMER_NUM, ADDRESS_TYPE,
      CREATE_DATE AS ADDRESS_CREATE_DATE, CONTACT_NAME, FIRST_NAME, MIDDLE_INIT,
      LAST_NAME, COMPANY_NAME, STREET_ADDRESS_1, CUSTOMER_CLASS, CITY, STATE,
      ZIP_CODE, COUNTRY_CODE, MAX(DECODE(MEDIA_TYPE, 'PHH', PHONE_AREA_CODE ||
      '''' || PHONE_NUMBER, NULL)) HOME_PHONE, MAX(DECODE(MEDIA_TYPE, 'PHW',
      PHONE_AREA_CODE || '''' || PHONE_NUMBER, NULL)) WORK_PHONE, ADDRESS_SEQ_NUM,
       STREET_ADDRESS_2
    FROM
    (SELECT OH.ORDER_NUM ORDER_NUM, OH.ORDER_DATETIME ORDER_DATE, OH.COMPANY_NUM
      COMPANY_NUM, OH.CUSTOMER_NUM CUSTOMER_NUM, AD.ADDRESS_TYPE ADDRESS_TYPE,
      C.CREATE_DATE CREATE_DATE, CON.FIRST_NAME || '''' || CON.LAST_NAME
      CONTACT_NAME, CON.FIRST_NAME FIRST_NAME, CON.MIDDLE_INIT MIDDLE_INIT,
      CON.LAST_NAME LAST_NAME, AD.COMPANY_NAME COMPANY_NAME, AD.STREET_ADDRESS_1
      STREET_ADDRESS_1, C.CUSTOMER_CLASS CUSTOMER_CLASS, AD.CITY CITY, AD.STATE
      STATE, AD.ZIP_CODE ZIP_CODE, AD.COUNTRY_CODE, CPH.MEDIA_TYPE MEDIA_TYPE,
      CPH.PHONE_AREA_CODE PHONE_AREA_CODE, CPH.PHONE_NUMBER PHONE_NUMBER,
      AD.ADDRESS_SEQ_NUM ADDRESS_SEQ_NUM, AD.STREET_ADDRESS_2 STREET_ADDRESS_2
      FROM REPORTING_BASE.GT_GAFT_ORDERS GT, DOMS.US_ORDHDR OH, DOMS.US_ADDRESS
      AD, DOMS.US_CUSTOMER C, DOMS.US_CONTACT CON, DOMS.US_CONTPH CPH WHERE
      OH.ORDER_NUM = GT.ORDER_NUM AND OH.BUSINESS_UNIT_ID = GT.BUSINESS_UNIT_ID
      AND OH.CUSTOMER_NUM = C.CUSTOMER_NUM(+) AND OH.CUSTOMER_NUM =
      AD.CUSTOMER_NUM(+) AND AD.CUSTOMER_NUM = C.CUSTOMER_NUM AND (
      AD.ADDRESS_TYPE = 'B' OR ( AD.ADDRESS_TYPE = 'S' AND AD.ADDRESS_SEQ_NUM =
      OH.SHIP_TO_SEQ_NUM ) ) AND AD.CUSTOMER_NUM = CON.CUSTOMER_NUM(+) AND
      AD.ADDRESS_TYPE = CON.ADDRESS_TYPE(+) AND AD.ADDRESS_SEQ_NUM =
      CON.ADDRESS_SEQ_NUM(+) AND CON.CUSTOMER_NUM = CPH.CUSTOMER_NUM(+) AND
      CON.CONTACT_ID = CPH.CONTACT_ID(+) ) GROUP BY ORDER_NUM, ORDER_DATE,
      COMPANY_NUM, CUSTOMER_NUM, ADDRESS_TYPE, CREATE_DATE, CONTACT_NAME,
      FIRST_NAME, MIDDLE_INIT, LAST_NAME, COMPANY_NAME, STREET_ADDRESS_1,
      CUSTOMER_CLASS, CITY, STATE, ZIP_CODE, COUNTRY_CODE, ADDRESS_SEQ_NUM,
      STREET_ADDRESS_2
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch      257      0.04       0.05         45          0          0        6421
    total      257      0.04       0.05         45          0          0        6421
    Misses in library cache during parse: 0
    Parsing user id: 126
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch      257      0.04       0.05         45          0          0        6421
    total      257      0.04       0.05         45          0          0        6421
    Misses in library cache during parse: 0
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        0      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
        1  user  SQL statements in session.
        0  internal SQL statements in session.
        1  SQL statements in session.
    Trace file: axispr1_ora_15293.trc
    Trace file compatibility: 10.01.00
    Sort options: default
           1  session in tracefile.
           1  user  SQL statements in trace file.
           0  internal SQL statements in trace file.
           1  SQL statements in trace file.
           1  unique SQL statements in trace file.
         289  lines in trace file.
          83  elapsed seconds in trace file.Thanks in advance!

  • Long run report returns a empty page?

    Hi,
    My report takes about 10 minute to run, it worked on report developer (local pc), but return a empty report if run from URL against the report server (on Unix box). What might be the problem and how to fix it?
    Thanks

    hello,
    what desformat did you use ? does that reproduce with all desformats ?
    sometimes, if you use PDF as the desformat, Adobe Acrobat Reader is not invoked correctly, which results in an empty page.
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • This may sound stupid but for some reason I can no longer use the return button after typing in a url to go to that site. Does anyone know how to fix this?

    For some reason this stopped working on firefox a week or so ago. I have tried to uninstall and install firefox again but the problem still persists. I've tried both chrome and explorer and they don't seem to have this problem.
    I'd hate to stop using firefox but this so annoying that in less i can fix it, i'll have to change my browser!

    Hi larryhall,
    I'd try starting Firefox in [[Safe Mode]]. If you don't have the issue while all of your add-ons, extensions, and themes are disabled, you can try adding them back in one by one until you find the culprit. You should look at the [https://support.mozilla.org/en-US/kb/Troubleshooting-extensions-themes Extensions and Themes troubleshooting guide ] and the [[Troubleshooting plugins]] article as well.
    Hopefully this helps!

  • Downloads take to long, had to return it.

    Well I was really hoping that my new TV would allow me to not have to rent movies from Com?????ast, But, i went online (via TV) and rented and HD movie. 5 hours later, it was at 23% downloaded and what is odd is that I have rather fast broadband. Anyway, I have no idea what make me think that I could actually see the movie right after I rented it. Well perhaps I'll just save the money and wait for a MBP refresh.

    Unfortunately I see both sides of this issue. I wish I could view the movie sooner but at the same time I want high quality audio and video. I guess in most cases the two can't go together,
    I just rented The Brave One and it appears it will take a total of six hours via my T1 (my connection is the bottleneck not their servers). I can live with the download speed but movie renting certainly won't be an impulse purchase.
    I do wish they would increase the viewing time from 24 hours to at least 48 hours and also offer a monthly subscription.
    This would provide two benefits. Hopefully I could watch more movies at a reduced rate and would allow me to download movies that I think I might want to watch. This way I wouldn't have to wait on the download if I decide I want to watch the movie.
    If possible being able to download the movie before purchasing and only paying if you decide to view it would be great (I think DirecTV or someone else is doing something similar). This way I could always have three or four movies ready for viewing. Just like tonight if we could have sat down and watched a movie they would have gotten an additional rental. One my wife wanted to watch plus the one I was willing to wait on.
    It's still early in the online movie rental game and I'm sure there will be a lot of changes. Hopefully a subscription plan (perhaps two or three) and pre-purchase downloading will get a turn at bat.

  • Personalization Scheduling Engine does not start -- Bug?

    Hi there. I don't know if it's the correct forum to post my question. If I'm wrong I ask you to redirect to
    the correct one.
    I've correctly installed Oracle AS 10g release 1 according to the following topology, on the production
    environment :
    Server 1 --> Here we are three oracle homes : Identity Management , Middle Tier (Portal and Wireless) ,
    Personalization.
    Server 2 --> MetadataRepository
    My problem focuses on Personalization. I advise that in my developing environment I've not got any problem.
    So , I've installed Oracle AS Personalization without wornings. I've created RE,MOR and MTR schemas as the
    procedure dictates. Problem's that Personalization Scheduling Engine does not start. It should start
    automatically but It didn't. So I tried to start it by hand following "Oracle Application Server Hi there.
    I don't know if it's the correct forum to post my question. If I'm wrong I ask you to redirect to the
    correct one.
    I've correctly installed Oracle AS 10g release 1 according to the following topology, on the production
    environment :
    Server 1 --> Here we are three oracle homes : Identity Management , Middle Tier (Portal and Wireless) ,
    Personalization.
    Server 2 --> MetadataRepository
    My problem focuses on Personalization. I advise that in my developing environment I've not got any problem.
    So , I've installed Oracle AS Personalization without wornings. I've created RE,MOR and MTR schemas as the
    procedure dictates. Problem's that Personalization Scheduling Engine does not start. It should start
    automatically but It didn't. So I tried to start it by hand following "Oracle Application Server
    Personalization Administrator's Guide 10g(9.0.4)". Specifically , when I try to start the scheduling engine
    with the command "execute OP_START_ENGINE" in the MOR schema I obtain an error linked to DBMS_JOB.run()
    method. Digging deep into the Oracle alert log file I found this brief linked to the error executin the
    script :
    Thu Apr 14 17:57:28 2005
    Errors in file E:\MetadataRepositoryHome\admin\asdb\udump\ORA01860.TRC:
    ORA-12012: error on auto execute of job 119
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.Exception: Scheduler Workflow Error:
    9756161113494248343 java.lang.NumberFormatException: 9756161113494248343
    at java.lang.Long.parseLong(Long.java)
    at java.lang.Long.parseLong(Long.java)
    at oracle.dmt.op.util.messagelog.MessageLog.getExecutionContextID(MessageLog.java:857)
    at oracle.dmt.op.workflow.SchedulerWorkflowClass.main_method(SchedulerWorkflowClass.java:101)
    at oracle.dmt.op.workflow.SchedulerWorkflowClass.SchedulerWorkflowJava(SchedulerWorkflowClass.java:91)
    ORA-06512: at "MOR_PORTALE.DMT_CLIENT_IDARWIN_WORKFLOW", line 0
    ORA-06512: at line 1
    So as the main error is "NumberFormatException" , I executed reverse engineering decompiling two Oracle
    classes , just to know the origin of the error :
    oracle.dmt.op.util.messagelog.MessageLog and
    oracle.dmt.op.workflow.SchedulerWorkflowClass
    After simple tracing I think I reached the origin and I shocked myself to see it!! The problem starts in the
    main_method of oracle.dmt.op.workflow.SchedulerWorkflowClass, i.e. :
    private void main_method()
    throws Exception
    String event_msg_args[];
    traceMsg += "Start";
    moduleID = "SchedulerWorkflowClass.main_method";
    traceMsg += "-executionContextID";
    executionContextID = MessageLog.getExecutionContextID();
    The problem resides in the getExectiongContextID() method of oracle.dmt.op.util.messagelog.MessageLog class.
    Code of this method is this :
    public static long getExecutionContextID()
    String hostIP = null;
    try
    InetAddress host = InetAddress.getLocalHost();
    hostIP = host.getHostAddress();
    catch(UnknownHostException ex) { }
    StringBuffer buf = new StringBuffer(20);
    if(hostIP != null)
    for(StringTokenizer st = new StringTokenizer(hostIP, "."); st.hasMoreTokens(); buf.append
    (st.nextToken()));
    buf.append((new Date()).getTime());
    String tmpString = buf.toString();
    String idString = tmpString.replace('?', ' ');
    idString = idString.trim();
    int len = idString.length();
    if(len > 19)
    idString = idString.substring(len - 19);
    long id = Long.parseLong(idString);
    return id;
    Simply , code obtains IP address of the Host , concats it with the current time and if the length of the
    result string is longer than 19 it obtains substring of (len -19) length!! I think , Oracle programmer
    thought to prevent NumberFormatException with the control "if(len > 19)
    idString = idString.substring(len - 19);"
    but that's strange , very strange!! In fact , in my case(with my IP Address 160.97.*.*) , method outputs
    NumberFormatExceptio 'couse long "id = Long.parseLong(idString);" is not able to convert the String
    "9756161113494248343" to java.lang.Long!!! 'couse it exceedes maximum value ( 2EXP(63)-1)!! So , I think
    it's bug but I don't know how to solve it!! Problem's in method's semantic. It should control that the
    String it creates is lower that the maximum value allowed for a long , not its length lower or equal 19!!!
    I mean , I cannot modify Oracle Java Class file.
    With kind regards,
    Nicola

    Fix in OracleAS 10.1.2.0.2 if you file a bug referencing bug 4397235 a backport of the fix can be provided on metalink.

  • Can no longer return to iOS app in AIR 4.0 Beta

    Is it me or is it no longer possible to return to an iOS app in AIR 4.0 beta? An app I just compiled restarts every time you launch it. No such problem in AIR 3.9.

    Just yesterday I saw a problem where going to the home screen and back would either crash the app or would leave it in a frozen state. It only happened if by that time I had been via a part of the app that played an animation that used stream audio.
    Might you be seeing the same kind of thing, where you can go in and out of your first screen, but get crashes or hangs when going from another screen?
    I didn’t log a bug yet because it’s a hard problem to narrow down, because the crashing happens when you return to the app, and so doing a debug session won’t help, the session closes when you go to the home screen.

  • Return arrow no longer available

    I no longer have a return arrow showing on any of my displays. I used to have it and it no longer shows up. It's very inconvenient. Why is this and how can I get it back?

    In the Safari menu at the very top of the screen,
    choose View > Customize Menu Bar.
    Pick the back arrow, and drag it onto your menu bar.
    Hope this helps.

  • Warning this is very long code but i need help to see if I am on right trac

    I have done all the following code myself and it is the buisiness layer for my application. I have tried to follow recommendations on previous posts and I would like to be told where I can clean up my code and how? This is not complete and it looks very long to me but I need help in order to be better. There are 4 button vlivks and I have not completed them all. The criteria for application is that phonebook will accept new entries if they have names surnames and phone numbers that are not longer than 10 characters for display purposes but can change this. No duplicates are allowed. No editing of a existing entry must lead to a duplicate entry either. No new entry or edit may result in a new contact having no phone numbers.
    Many thanks for your time in advance,.....
    import javax.swing.JOptionPane;
    import java.util.ArrayList;
    public class Contact
    {// Start of the Contact class
         ArrayList<ContactDetails> phoneList = new ArrayList<ContactDetails>();          // To hold all the contacts
         ArrayList<ContactDetails> searchList = new ArrayList<ContactDetails>();          // To hold all contacts that return true on search
         ArrayList<ContactDetails> list = new ArrayList<ContactDetails>();
         String newName;                                                                                // To hold the new name
         String newSurname;                                                                           // to hold the new surname
         String newHome;                                                                                // To hold the new home number if any
         String newWork;                                                                                // To hold the new work number
         String newCell;                                                                                // To hold the new cell number
         final int MAX_LENGTH = 10;
         public boolean addToPhoneList;                                                            // Sets to false if there is an invalid entry
         public boolean addToSearchList;                                                            // Sets to false if there is an invlid search
         public boolean modifyContact;                                                            // Sets to false if there is an invalid modification
         // Method to create a new contact
         public void createNew()
         {// Start of create new()
              addToPhoneList = true;                                                                 // Set boolean to true each time the method is executed
              getNewContactsName();                                                                 // Get new name
              if(addToPhoneList == false)
                   createNew();
                   return;
              getNewContactsSurname();                                                            //Get new surname
              if(addToPhoneList == false)
                   createNew();
                   return;
              String checkName = newName;                                                            //Creates copies to be used in the checkIfDuplicate method
              String checkSurname = newSurname;
              addToPhoneList = checkIfDuplicate(checkName, checkSurname);                    //Check if the entries are duplicate
              if(addToPhoneList == false)
                   createNew();
                   return;
              getNewContactsHomeNum();                                                            // Get new home number
              if(addToPhoneList == false)
                   createNew();
                   return;
              getNewContactsWorkNum();                                                            // Get new work number
              if(addToPhoneList == false)
                   createNew();
                   return;
              getNewContactsCellNum();                                                            // Get new cell number
              if(addToPhoneList == false)
                   createNew();
                   return;
              checkAtLeastOneNumEntered();                                                       // Check that at least one phone number was entered
              if(addToPhoneList == true)
                   updateListWithNew();
         }// End of createNew()
         // Method to search for an existing contact
         public void searchExisting()
         {// Start of searchExisting()
              addToSearchList = true;                                                                 // Set the boolean true
              searchList.clear();                                                                      // Clear list from any previous searches
              if(phoneList.size() > 0)                                                            // Check if any contacts are in the list
                   getExistingDetailsAndSearch();                                                  // If there are entries then continue to search
              else
                   JOptionPane.showMessageDialog(null,"There are no contacts to search for. Please use this option when you have added a contact to the list.","Error",JOptionPane.ERROR_MESSAGE);
         }// End of searchExisting()
         // Method to modify an existing contact
         public void modifyExisting()
         {// Start of modifyExisting()
              modifyContact = true;                                                                 // Set the boolean to true
              if(phoneList.size() <= 0)                                                            // Check if the phonelist is not empty
                   JOptionPane.showMessageDialog(null,"There are no contacts to modify. Please use this option when there have been contacts added to the list.","Error",JOptionPane.ERROR_MESSAGE);
              else
                   getExistingDetailsAndModify();                                                  // If phonelist not emty continue to modify method
         }// End of modifyExisting()
         //Method to delete a contact from the list
         public void deleteExisting()
         //Method to get new contacts name
         public void getNewContactsName()
              newName = JOptionPane.showInputDialog("Please enter the new contacts name or press cancel to exit without saving.");
              if(newName == null)
                   finish();
              if(newName.trim().length()<=0)
                   JOptionPane.showMessageDialog(null,"You have not entered a name. Please try again.","Error",JOptionPane.ERROR_MESSAGE);
                   addToPhoneList = false;
                   return;
              addToPhoneList = checkLengthValid(newName, "name");
         //Method to get a new contacts surname
         public void getNewContactsSurname()
              newSurname = JOptionPane.showInputDialog("Please enter the new contacts surnname or press cancel to exit without saving.");
              if(newSurname == null)
                   finish();
              addToPhoneList = checkLengthValid(newSurname, "surname");
         //Method to get a new contacts home number
         public void getNewContactsHomeNum()
              newHome = JOptionPane.showInputDialog("Please enter the new contacts home number or press cancel to exit without saving.");
              if(newHome == null)
                   finish();
              if(newHome.trim().length() > 0)
                   try
                        Long homeNum = Long.parseLong(newHome);
                   catch(Exception e)
                        JOptionPane.showMessageDialog(null,"You may only use numbers for a valid phone number. Please try again.","Error",JOptionPane.ERROR_MESSAGE);
                        addToPhoneList = false;
                        return;
              addToPhoneList = checkLengthValid(newHome, "home number");
         //Method to get a new contacst work number
         public void getNewContactsWorkNum()
              newWork = JOptionPane.showInputDialog("Please enter the new contacts work number or press cancel to exit without saving");
              if(newWork == null)
                   finish();
              if(newWork.trim().length()> 0)
                   try
                        Long workNum = Long.parseLong(newWork);
                   catch(Exception e)
                        JOptionPane.showMessageDialog(null,"You may only use numbers for a valid number. Please try again.","Error",JOptionPane.ERROR_MESSAGE);
                        addToPhoneList = false;
                        return;
              addToPhoneList = checkLengthValid(newWork, "work number");
         //Method to get a new contacts cell number
         public void getNewContactsCellNum()
              newCell = JOptionPane.showInputDialog("Please enter the new contacts cell number or press cancel to exit without saving");
              if(newCell == null)
                   finish();
              if(newCell.trim().length() > 0)
                   try
                        Long cellNum = Long.parseLong(newCell);
                   catch(Exception e)
                        JOptionPane.showMessageDialog(null,"You may only use numbers for a valid number. Please try again.","Error",JOptionPane.ERROR_MESSAGE);
                        addToPhoneList = false;
                        return;
              addToPhoneList = checkLengthValid(newCell, "cell number");
         //Method to get the details for an existing contact
         public void getExistingDetailsAndSearch()
              String existingName = getExistingName("search for");
              if(existingName == null)
                   addToSearchList = false;
                   return;
              if(existingName.length()<=0)
                   JOptionPane.showMessageDialog(null,"You have not entered a name please try again","Error",JOptionPane.ERROR_MESSAGE);
                   addToSearchList = false;
                   searchExisting();
              String existingSurname = getExistingSurname();
                   if(existingSurname == null)
                        return;
              if(addToSearchList == true)
                   searchAndAddIfFound(existingName, existingSurname);
         //Method to get existing details and modify contact
         public void getExistingDetailsAndModify()
              String existingName = getExistingName("modify");
              if(existingName == null)
                   modifyContact = false;
                   return;
              if(existingName.length()<=0)
                   JOptionPane.showMessageDialog(null,"You have not entered a name please try again","Error",JOptionPane.ERROR_MESSAGE);
                   modifyContact = false;
                   modifyExisting();
              String existingSurname = getExistingSurname();
                   if(existingSurname == null)
                        return;
              if(modifyContact == true)
                   getContactBySearch(existingName.trim().toUpperCase(), existingSurname.trim().toUpperCase());
         //Method to get the contact from list and modify details
         public void getContactBySearch(String currentName, String currentSurname)
              int count = 0;
              int numFound = 0;
              for(ContactDetails cd: phoneList)
                   cd = phoneList.get(count);
                   if((cd.name.equals(currentName))&&(cd.surname.equals(currentSurname)))
                        numFound ++;
                        changeDetails(cd);
                   count ++;
              if(numFound <= 0)
                   JOptionPane.showMessageDialog(null,"No contacts matching the name and surname you entered found. Press the modify button to try again.","Information",JOptionPane.INFORMATION_MESSAGE);
         //Method to get existing contacts name
         public String getExistingName(String whatWasClicked)
              String name = JOptionPane.showInputDialog("Please enter the contacts name that you wish to "+whatWasClicked);
              return name;
         //Method to get an existing contacts surname
         public String getExistingSurname()
              String surname = JOptionPane.showInputDialog("Please enter the contacts surname.");
              return surname;
         //Method to change the details of contact
         public void changeDetails(ContactDetails conToChange)
              String currentName = conToChange.name;
              String currentSurname = conToChange.surname;
              String currentHome = conToChange.home;
              String currentWork = conToChange.work;
              String currentCell = conToChange.cell;
              String newNameForContact = getNewModName(currentName);
              if(modifyContact == false)
                   modifyExisting();
                   return;
              String newSurnameForContact = getNewModSurname(currentSurname);
              if(modifyContact == false)
                   modifyExisting();
                   return;
              String newHomeForContact = getNewModHome(currentHome);
              if(modifyContact == false)
                   modifyExisting();
                   return;
              String newWorkForContact = getNewModWork(currentWork);
              if(modifyContact == false)
                   modifyExisting();
                   return;
              String newCellForContact = getNewModCell(currentCell);
              if(modifyContact == false)
                   modifyExisting();
                   return;
              if(modifyContact == true)
                   conToChange.name = newNameForContact;
         //Method to get the modified name
         public String getNewModName(String currentName)
              String newModifiedName = JOptionPane.showInputDialog("Please enter the new name for contact or press cancel to keep it as is.");
              if(newModifiedName == null)
                   return currentName;
              if(newModifiedName.trim().length() <= 0)
                   JOptionPane.showMessageDialog(null,"You may not replace the existing name with a blank name. Please try again.","Error",JOptionPane.ERROR_MESSAGE);
                   modifyContact = false;
                   return currentName;
              modifyContact = checkLengthValid(newModifiedName, "modified name");
              return newModifiedName;
         //Method to get the modified surname
         public String getNewModSurname(String currentSurname)
              String newModifiedSurname = JOptionPane.showInputDialog("Please enter the new surname for the contact or press cancel to keep it as is.");
              if(newModifiedSurname == null)
                   return currentSurname;
              modifyContact = checkLengthValid(newModifiedSurname, "modified surname");
              if(modifyContact == false)
                   JOptionPane.showMessageDialog(null,"Surname not changed.","Information",JOptionPane.INFORMATION_MESSAGE);
                   return currentSurname;
              modifyContact = checkLengthValid(newModifiedSurname, "modified surname");
              return newModifiedSurname;
         //Method to search and update the list with a succesfull search
         private void searchAndAddIfFound(String name, String surname)
              int count = 0;
              int numFound = 0;
              for(ContactDetails cd: phoneList)
                   cd = phoneList.get(count);
                   if(cd.name.equals(name.trim().toUpperCase()))
                        numFound ++;
                        searchList.add(cd);
                   count ++;
              if(numFound <= 0)
                   JOptionPane.showMessageDialog(null,"No contacts were found matching the dat you entered.","Information",JOptionPane.INFORMATION_MESSAGE);
              else
                   list.clear();
                   list.addAll(searchList);
         //Method that check all entries are a valid logical length
         //Method is based on assumption that a normal name, surname, and phone numbers are not longer than 10 characters long.
         //IF This method is changed please change the layout in the GUI as this is also set to fit with the layout that gives a neat //apperance
         private boolean checkLengthValid(String detailEntered, String whatWasEntered)
              boolean validLength = true;
              if(detailEntered.trim().length() >= MAX_LENGTH)
                   JOptionPane.showMessageDialog(null,"The " +whatWasEntered+" you entered is too long. Please try again and use a "+whatWasEntered+" that is less than "+MAX_LENGTH+" characters long.","Error",JOptionPane.ERROR_MESSAGE);
                   validLength = false;
              return validLength;
         private void finish()
              System.exit(0);
         //Method to update the list with a new entry
         private void updateListWithNew()
              try
                   ContactDetails cd = new ContactDetails();
                   cd.name = newName.trim().toUpperCase();
                   cd.surname = newSurname.trim().toUpperCase();
                   cd.home = newHome.trim();
                   cd.work = newWork.trim();
                   cd.cell = newCell.trim();
                   phoneList.add(cd);
                   JOptionPane.showMessageDialog(null,"Contact succesfully entered. To save this change press exit to save or use the save option in the toolbar menu.","Information",JOptionPane.INFORMATION_MESSAGE);
              catch(Exception e)
                   JOptionPane.showMessageDialog(null,"Failed to add contact to list. If problem persists please contact the software developer.","Error",JOptionPane.ERROR_MESSAGE);
              list.clear();
              list.addAll(phoneList);
         //Method to check for duplicate
         public boolean  checkIfDuplicate(String nameToCheck, String surnameToCheck)
              int count = 0;
              boolean valid = true;
              for(ContactDetails cd : phoneList)
                   cd = phoneList.get(count);
                   if(((nameToCheck.trim().toUpperCase()).equals(cd.name))&&((surnameToCheck.trim().toUpperCase()).equals(cd.surname)))
                        JOptionPane.showMessageDialog(null,"You may not enter a duplicate contact. Please try again and change the name and surname.","Error",JOptionPane.ERROR_MESSAGE);
                        valid = false;
                        break;
                   count ++;
              return valid;
         //Method to check that at least one phone number exists for contact
         public void checkAtLeastOneNumEntered()
              if((newHome.trim().length()<=0)&&(newWork.trim().length()<=0)&&(newCell.trim().length()<=0))
                   JOptionPane.showMessageDialog(null,"You have not entered any phone number at all. You must enter at least one phone number for a new contact.","Error",JOptionPane.ERROR_MESSAGE);
                   addToPhoneList = false;
         //Method that returns the list to the GUI
         public ArrayList<ContactDetails> getList()
              return list;
    }

    Should I start over from scratch? Can I get help with links to tutorials on following? How to create a java CRUD application (google not useful) and how to layer in java(google not useful)
    This is my pres layer as is is this wrong too?
         Filename:     ContactsListInterface.java
         Date:           16 March 2008
         Programmer:     Yucca Nel
         Purpose:     Provides a GUI for entering names and contact numbers into a telephone directory.
                        Also allows options for searching for a specific name and deleting of data from the record
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    public class Phonebook1 extends JFrame implements ActionListener
    { //start of class
         // construct fields, buttons, labels,text boxes, ArrayLists etc
         JTextPane displayPane = new JTextPane();
         JLabel listOfContacts = new JLabel("List Of Contacts");               // creates a label for the scrollpane
         JButton createButton = new JButton("Create");
         JButton searchButton = new JButton("Search");
         JButton modifyButton = new JButton("Modify");
         JButton deleteButton = new JButton("Delete");
         Contact c = new Contact();
         ArrayList<ContactDetails> contactList = c.getList();
         // create an instance of the ContactsListInterface
         public Phonebook1()
         { // start of cli()
              super("Phonebook Interface");
         } // end of cli()
         public JMenuBar createMenuBar()
         { // start of the createMenuBar()
              // construct and populate a menu bar
              JMenuBar mnuBar = new JMenuBar();                              // creates a menu bar
              setJMenuBar(mnuBar);
              JMenu mnuFile = new JMenu("File",true);                         // creates a file menu in the menu bar which is visible
                   mnuFile.setMnemonic(KeyEvent.VK_F);
                   mnuFile.setDisplayedMnemonicIndex(0);
                   mnuFile.setToolTipText("File Options");
                   mnuBar.add(mnuFile);
              JMenuItem mnuFileExit = new JMenuItem("Save And Exit");     // creates an exit option in the file menu
                   mnuFileExit.setMnemonic(KeyEvent.VK_X);
                   mnuFileExit.setDisplayedMnemonicIndex(1);
                   mnuFileExit.setToolTipText("Close Application");
                   mnuFile.add(mnuFileExit);
                   mnuFileExit.setActionCommand("Exit");
                   mnuFileExit.addActionListener(this);
              JMenu mnuEdit = new JMenu("Edit",true);                         // creates a menu for editing options
                   mnuEdit.setMnemonic(KeyEvent.VK_E);
                   mnuEdit.setDisplayedMnemonicIndex(0);
                   mnuEdit.setToolTipText("Edit Options");
                   mnuBar.add(mnuEdit);
              JMenu mnuEditSort = new JMenu("Sort",true);                    // creates an option for sorting entries
                   mnuEditSort.setMnemonic(KeyEvent.VK_S);
                   mnuEditSort.setDisplayedMnemonicIndex(0);
                   mnuEdit.add(mnuEditSort);
              JMenuItem mnuEditSortByName = new JMenuItem("Sort By Name");          // to sort entries by name
                   mnuEditSortByName.setMnemonic(KeyEvent.VK_N);
                   mnuEditSortByName.setDisplayedMnemonicIndex(8);
                   mnuEditSortByName.setToolTipText("Sort entries by first name");
                   mnuEditSortByName.setActionCommand("Name");
                   mnuEditSortByName.addActionListener(this);
                   mnuEditSort.add(mnuEditSortByName);
              JMenuItem mnuEditSortBySurname = new JMenuItem("Sort By Surname");     // to sort entries by surname
                   mnuEditSortBySurname.setMnemonic(KeyEvent.VK_R);
                   mnuEditSortBySurname.setDisplayedMnemonicIndex(10);
                   mnuEditSortBySurname.setToolTipText("Sort entries by surname");
                   mnuEditSortBySurname.setActionCommand("Surname");
                   mnuEditSortBySurname.addActionListener(this);
                   mnuEditSort.add(mnuEditSortBySurname);
              JMenu mnuHelp = new JMenu("Help",true);                                        // creates a menu for help options
                   mnuHelp.setMnemonic(KeyEvent.VK_H);
                   mnuHelp.setDisplayedMnemonicIndex(0);
                   mnuHelp.setToolTipText("Help options");
                   mnuBar.add(mnuHelp);
              JMenuItem mnuHelpHelp = new JMenuItem("Help");                              // creates a help option for help topic
                   mnuHelpHelp.setMnemonic(KeyEvent.VK_P);
                   mnuHelpHelp.setDisplayedMnemonicIndex(3);
                   mnuHelpHelp.setToolTipText("Help Topic");
                   mnuHelpHelp.setActionCommand("Help");
                   mnuHelpHelp.addActionListener(this);
                   mnuHelp.add(mnuHelpHelp);
              JMenuItem mnuHelpAbout = new JMenuItem("About");                         // creates a about option for info about api
                   mnuHelpAbout.setMnemonic(KeyEvent.VK_T);
                   mnuHelpAbout.setDisplayedMnemonicIndex(4);
                   mnuHelpAbout.setToolTipText("About this program");
                   mnuHelpAbout.setActionCommand("About");
                   mnuHelpAbout.addActionListener(this);
                   mnuHelp.add(mnuHelpAbout);
              return mnuBar;
         } // end of the createMenuBar()
         // create the content pane
         public Container createContentPane()
         { // start of createContentPane()
              //construct and populate panels and content pane
              JPanel labelPanel = new JPanel(); // panel is only used to put the label for the textpane in
                   labelPanel.setLayout(new FlowLayout());
                   labelPanel.add(listOfContacts);
              JPanel displayPanel = new JPanel();// panel is used to display all the contacts and thier numbers
                   setTabsAndStyles(displayPane);
                   displayPane = addTextToTextPane();
                   displayPane.setEditable(false);
              JScrollPane scrollPane = new JScrollPane(displayPane);
                   scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); // pane is scrollable vertically
                   scrollPane.setWheelScrollingEnabled(true);// pane is scrollable by use of the mouse wheel
                   scrollPane.setPreferredSize(new Dimension(400,320));
              displayPanel.add(scrollPane);
              JPanel workPanel = new JPanel();// panel is used to enter, edit and delete data
                   workPanel.setLayout(new FlowLayout());
                   workPanel.add(createButton);
                        createButton.setToolTipText("Create a new entry");
                        createButton.addActionListener(this);
                   workPanel.add(searchButton);
                        searchButton.setToolTipText("Search for an entry by name number or surname");
                        searchButton.addActionListener(this);
                   workPanel.add(modifyButton);
                        modifyButton.setToolTipText("Modify an existing entry");
                        modifyButton.addActionListener(this);
                   workPanel.add(deleteButton);
                        deleteButton.setToolTipText("Delete an existing entry");
                        deleteButton.addActionListener(this);
              labelPanel.setBackground(Color.red);
              displayPanel.setBackground(Color.red);
              workPanel.setBackground(Color.red);
              // create container and set attributes
              Container c = getContentPane();
                   c.setLayout(new BorderLayout(30,30));
                   c.add(labelPanel,BorderLayout.NORTH);
                   c.add(displayPanel,BorderLayout.CENTER);
                   c.add(workPanel,BorderLayout.SOUTH);
                   c.setBackground(Color.red);
              // add a listener for the window closing and save
              addWindowListener(
                   new WindowAdapter()
                        public void windowClosing(WindowEvent e)
                             int answer = JOptionPane.showConfirmDialog(null,"Are you sure you would like to save all changes and exit?","File submission",JOptionPane.YES_NO_OPTION);
                             if(answer == JOptionPane.YES_OPTION)
                                  System.exit(0);
              return c;
         } // end of createContentPane()
         protected void setTabsAndStyles(JTextPane displayPane)
         { // Start of setTabsAndStyles()
              // set Font style
              Style fontStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
              Style regular = displayPane.addStyle("regular", fontStyle);
              StyleConstants.setFontFamily(fontStyle, "SansSerif");
              Style s = displayPane.addStyle("bold", regular);
              StyleConstants.setBold(s,true);
         } // End of setTabsAndStyles()
         public JTextPane addTextToTextPane()
         { // start of addTextToTextPane()
              int numberOfEntries = contactList.size();
              int count = 0;
              Document doc = displayPane.getDocument();
              try
              { // start of tryblock
                   // clear previous text
                   doc.remove(0,doc.getLength());
                   // insert titles of columns
                   doc.insertString(0,"NAME\tSURNAME\tHOME NO\tWORK NO\tCELL NO\n",displayPane.getStyle("bold"));
                   for(ContactDetails cd : contactList)
                        cd = contactList.get(count);
                        doc.insertString(doc.getLength(),cd.name+"\t"+cd.surname+"\t"+cd.home+"\t"+cd.work+"\t"+cd.cell+"\n",displayPane.getStyle("regular"));
                        count ++;
              } // end of try block
              catch(BadLocationException ble)
              { // start of ble exception handler
                   System.err.println("Could not insert text.");
              } // end of ble exception handler
              return displayPane;
         } // end of addTextToTextPane()
         // code to process user clicks
         public void actionPerformed(ActionEvent e)
         { // start of actionPerformed()
              String arg = e.getActionCommand();
              // user clicks create button
              if(arg.equals("Create"))
                   c.createNew();                                                  // method to create a new Contact
                   addTextToTextPane();
              if(arg.equals("Search"))
                   c.searchExisting();                                             // method to search for an existing entry
                   addTextToTextPane();
              if(arg.equals("Modify"))
                   c.modifyExisting();                                             // method to modify contact
                   addTextToTextPane();
              if(arg.equals("Delete"))
                   c.deleteExisting();
                   addTextToTextPane();
              if(arg.equals("Exit"))
         } // end of actionPerformed()
         // method to create a new contact
         public static void main(String[] args)
         { // start of main()
              // Set look and feel of interface
              try
              { // start of try block
                   UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              } // end of try block
              catch(Exception e)
              { // start of catch block
                   JOptionPane.showMessageDialog(null,"There was an error in setting the look and feel of this application","Error",JOptionPane.INFORMATION_MESSAGE);
              } // end  of catch block
              Phonebook1 pb = new Phonebook1();
              pb.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
              pb.setJMenuBar(pb.createMenuBar());
              pb.setContentPane(pb.createContentPane());
              pb.setSize(520,500);
              pb.setVisible(true);
              pb.setResizable(false);
         } // end of main()
    } //end of class

  • Date(0) returns 19:00h !!!

    Hi,
    Im formatting a Date using a SimpleDateFormatter and it always add 19:00h to the time....
    SimpleDateFormat sdf = new SimpleDateFormat("h:mm:ss", getLocale());
    Date d = new Date(0);
    sdf.format(d);it gives me 19:00:00 instead of 00:00:00
    I think this is a matter of time zone... like if the hours added to adjust time to my time zone were always added to the time! What i want to do is simply display a number of miliseconds in h:mm:ss
    thanks

    Thanks i used a similar formula and it does the job
            // The method i use
         public static String longToMediumTimeString(long milliseconds) {
              long hh = milliseconds / (1000L*60*60);
              long mm = (milliseconds-(hh*(1000L*60*60))) / (1000L*60);
              long ss = (milliseconds-(hh*(1000L*60*60))-(mm*(1000L*60))) / 1000L;          
            return leftZeroFillInteger(""+hh, 2)+":"+leftZeroFillInteger(""+mm, 2)+":"+leftZeroFillInteger(""+ss, 2);
        // I also put here other methods i already have and i used to format the final string
        public static boolean isNumeric(String str, Class<? extends Number> clazz) {
            try {
                if (clazz.equals(Byte.class)) {
                    Byte.parseByte(str);
                else if (clazz.equals(Double.class)) {
                    Double.parseDouble(str);
                else if (clazz.equals(Float.class)) {
                    Float.parseFloat(str);
                else if (clazz.equals(Integer.class)) {
                    Integer.parseInt(str);
                else if (clazz.equals(Long.class)) {
                    Long.parseLong(str);
                else if (clazz.equals(Short.class)) {
                    Short.parseShort(str);
            } catch (NumberFormatException nfe) {
                System.out.println(str + " is not a valid number.");
                return false;
            return true;
        public static String leftZeroFillInteger(String aNumericString, int lengthOfFinalString) {
             if ((isNumeric(aNumericString, Integer.class) ||
                       isNumeric(aNumericString, Long.class) ||
                       isNumeric(aNumericString, Float.class) ||
                       isNumeric(aNumericString, Short.class) ||
                       isNumeric(aNumericString, Double.class)) &&
                       aNumericString.length()<lengthOfFinalString) {
                  for (int i=0; aNumericString.length()!=lengthOfFinalString; i++) {
                       aNumericString = "0"+aNumericString;
             return aNumericString;
        }

  • PageDef operatingBinding is not visible or returning null

    Hi,
    I have an ADF application with taskflow which contains a page fragement which has some methodAction bindings in its pageDef.
    I dragged this taskflow as a region in a Webcenter Portal application project page which has a pageTemplate. When that page opens, it opens fine by initializing the page which involves invoking some methodAction bindings.
    After the page got loaded, I click on a button, this again requires methodAction bindings but this time that operationBinding is returning null. so, I am not able to invoke the method.
    I am getting the operatingBinding in my managed bean as below. operatingBinding is fine while loading the page (init method) but it is giving null when I click on any button in the page after page load.
    OperationBinding operationBinding = getBindings().getOperationBinding("getPersonId")
    public BindingContainer getBindings() {
    if(this.bindings == null){
    FacesContext fc = FacesContext.getCurrentInstance();
    this.bindings = (BindingContainer)fc.getApplication().evaluateExpressionGet(fc, "#{bindings}", BindingContainer.class);
    return bindings;
    I dragged the same taskflow to an other ADF application and it worked fine before and after loading the page. I do not understand why it is not working in portal application. But it is nothing to do with Webcenter I believe. I just wanted to know if anyone faced this issue before. Please give some pointers if you have any.
    regards
    Vinay Kumar

    Page Definition is
    *<?xml version="1.0" encoding="UTF-8" ?>*
    *<pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"*
    version="11.1.1.59.23" id="SearchFragmentPageDef"
    Package="com.johnlewis.cpl.wcportal.ui">
    *<parameters/>*
    *<executables>*
    *<variableIterator id="variables"/>*
    *<iterator Binds="PartnerHrchy" RangeSize="25"*
    DataControl="PartnerSearchAMDataControl"
    id="PartnerHrchyIterator"/>
    *<iterator Binds="PartnerSearchTempVO1" RangeSize="25"*
    DataControl="PartnerSearchAMDataControl"
    id="PartnerSearchTempVO1Iterator"/>
    *<searchRegion Binds="PartnerSearchTempVO1Iterator" Criteria=""*
    Customizer="oracle.jbo.uicli.binding.JUSearchBindingCustomizer"
    id="PartnerSearchTempVO1Query"/>
    *</executables>*
    *<bindings>*
    *<methodAction id="getPersonId"*
    InstanceName="PartnerSearchAMDataControl.dataProvider"
    DataControl="PartnerSearchAMDataControl"
    RequiresUpdateModel="true" Action="invokeMethod"
    MethodName="getPersonId" IsViewObjectMethod="false"
    ReturnName="data.PartnerSearchAMDataControl.methodResults.getPersonId_PartnerSearchAMDataControl_dataProvider_getPersonId_result">
    *<NamedData NDName="uname" NDType="java.lang.String"/>*
    *</methodAction>*
    *<methodAction id="initPartnerSearch"*
    InstanceName="PartnerSearchAMDataControl.dataProvider"
    DataControl="PartnerSearchAMDataControl"
    RequiresUpdateModel="true" Action="invokeMethod"
    MethodName="initPartnerSearch" IsViewObjectMethod="false"
    ReturnName="data.PartnerSearchAMDataControl.methodResults.initPartnerSearch_PartnerSearchAMDataControl_dataProvider_initPartnerSearch_result">
    *<NamedData NDName="uname" NDType="java.lang.String"/>*
    *</methodAction>*
    *<methodAction id="searchPartnerTempTable"*
    InstanceName="PartnerSearchAMDataControl.dataProvider"
    DataControl="PartnerSearchAMDataControl"
    RequiresUpdateModel="true" Action="invokeMethod"
    MethodName="searchPartnerTempTable"
    IsViewObjectMethod="false">
    *<NamedData NDName="uname" NDType="java.lang.String"/>*
    *<NamedData NDName="param" NDType="java.lang.String"/>*
    *<NamedData NDName="leavers" NDType="java.lang.String"/>*
    *</methodAction>*
    *<tree IterBinding="PartnerHrchyIterator" id="PartnerHrchy">*
    *<nodeDefinition DefName="com.johnlewis.cpl.wcportal.model.view.PartnerHrchy"*
    Name="PartnerHrchy0">
    *<AttrNames>*
    *<Item Value="FullName"/>*
    *<Item Value="Position"/>*
    *<Item Value="LocationCode"/>*
    *</AttrNames>*
    *<Accessors>*
    *<Item Value="PositionIdPartnerHrchy"/>*
    *</Accessors>*
    *</nodeDefinition>*
    *</tree>*
    *<tree IterBinding="PartnerSearchTempVO1Iterator" id="PartnerSearchTempVO1">*
    *<nodeDefinition DefName="com.johnlewis.cpl.wcportal.model.view.PartnerSearchTempVO"*
    Name="PartnerSearchTempVO10">
    *<AttrNames>*
    *<Item Value="PartnerName"/>*
    *<Item Value="EmployeeNumber"/>*
    *<Item Value="SecurityProfileName"/>*
    *<Item Value="ResponsibilityName"/>*
    *<Item Value="PositionCode"/>*
    *<Item Value="LocationCode"/>*
    *</AttrNames>*
    *</nodeDefinition>*
    *</tree>*
    *</bindings>*
    *</pageDefinition>*
    Managed Bean code to invoke methodAction is
    *public void myTimeCard(ActionEvent actionEvent) {*
    *// Add event code here...*
    String uname = null;
    uname = ADFContext.getCurrent().getSecurityContext().getUserName();
    System.out.println("User name is " + uname);
    OperationBinding operationBinding = getBindings().getOperationBinding("getPersonId");
    System.out.println("Before setting parameters");
    System.out.println("operationBinding is " + operationBinding);
    *if(operationBinding != null){*
    operationBinding.getParamsMap().put("uname", uname);
    System.out.println("After setting parameters");
    String out = (String)operationBinding.execute();
    System.out.println("After invoking method");
    System.out.println("Person Id from getPersonId is " + out);
    if(out != null)
    personId = Long.parseLong(out);
    System.out.println("Person Id of search is " + personId);
    System.out.println("User name is " + uname);
    ADFContext.getCurrent().getPageFlowScope().put("personId", personId);
    ADFContext.getCurrent().getPageFlowScope().put("respId", null);
    ADFContext.getCurrent().getPageFlowScope().put("type", "ess");
    ADFContext.getCurrent().getPageFlowScope().put("userName",uname); //TODO username need to be passed from security Context
    *}*

Maybe you are looking for

  • How can I customize Waveform Chart?

    I want a routine to display selected waveforms on a chart. The input is a waveform array.  The chart should have the following: 1. Y axis labels using the waveform names 2. Legend plot labels using the waveform names 3. X axis in seconds from the sta

  • Adding data from an array to a table

    How can i add information from an array to a table via JDBC? I have tried: stmt.executeUpdate("INSERT INTO TEMP " + "VALUES (" + carData[0] + ", " + carData[1]); but i get the error: SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax erro

  • Mpeg-2 Preset Ignores Frame Size settings

    Trying to export a 720 x 486 FCP sequence to an mpeg-2 @ 720 x 480. Using the mpeg-2 Program Stream preset MODIFIED to set the video format to NTSC. But I keep getting a 640 x 480 file (both Quicktime and FCP recognize it as 640 x 480 and it is clear

  • Home Movies over Apple TV

    Greetings: I have a significant amount of home movies on my windows computer in AVI format.  I want to save a copy of all AVI files.  I also have Quicktime Pro. What is the most efficient (space saving with best resolution) way of playing the AVI mov

  • Alv event on keyboard arrow (up or down)

    Hello, i hope that someone can help me with my problem. i am looking for an event in alv that reacts on the keyboard arrows: cursor up or down. i know that i can use doubleclick or hotspot event, but my customer wants it by cursor up or down. i habe