How to Overcome NullPointException

hi friends
I have a very basic Question. But i am not able to find out the Solution. Since Because i am a new Learner for Java.
my problem is I have a table. with 3 fields , ID,Name, Age. Now the ID Field is AutoField.
Now At the User Interface. i take the Maximum Value and add 1 with the Maximum value and show in the User Interface and allow the User to Enter the Next values Name and Age..
Now the Problem what i am facing is When there is no Record in the Table then it will show NullPointerException.
What i want is if there is no record in the Table. it should Initialize the starting Value 1 instead of giving NullPointerException.
Please give me a Suggestion.
Thank your for your service
Cheers
Jofin

Hi thank you for your reply
this is my code
String max;
          int max1=0;
          // Get the Book Maximum ID and Fix it in the TextBox
          try
               st = con.createStatement ();     
               rs=st.executeQuery("SELECT Max(BId) FROM Books");
               while(rs.next())
                         max = rs.getString(1);
                         System.out.println("Maximum Value is"+ max);
                         max1=Integer.parseInt(max);          
                         max1=max1+1;
                         System.out.println("After adding"+ max1);
txtBookId = new JTextField (""+max1);
     Actually what i am doing is i am tring to get the Maximum value of a Field and add 1 with that Value and show it On the JTextField Now when there is no record in the table. It won't be able to find out the Maximum value. So i want to want to show 1 when there is no record in the table.
when there is record it finds the Maximum value and adds 1 and show on the JTextField.
When there is no record it shows Error.
Please help me to come out of this Problem
Thank you for your service
Cheers
Jofin

Similar Messages

  • I am unable to load some web pages, I get an error message saying unable to load page due to invalid or unsupported form of compression, this happens on the BBC news page for example. Any ideas how to overcome???

    OS is Windows7. I'm using the latest version of Mozilla Firefox
    I am unable to load some web pages, I get an error message saying unable to load page due to invalid or unsupported form of compression, this happens on the BBC news page for example. Any ideas how to overcome???

    Reload web page(s) and bypass the cache.
    * Press and hold Shift and left-click the Reload button.
    * Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    * Press "Cmd + Shift + R" (MAC)
    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    * Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    * Tools > Options > Privacy > Cookies: "Show Cookies"

  • The latest update has resulted in a runtime error (R6034) and I keep being told Microsoft Visual C   Runtime Library is being accessed incorrectly.  Anyone know how to overcome the problem?  I am using a Dell Inspiron  9400 running Vista.

    The latest update to itunes has resulted in a whole series of runtime errors (R6034).  Microsoft Visual C++ Runtime Library states it is being accessed incorrectly.  I am also told that Apple Mobile Device Failed to Start.  Additional messages suggest the error is in itunes.exe and ituneshelper.exe.  I also get Error 7 (Windows error 1114).  Anyone got any ideas how to overcome this (these) problems?

    Click here and follow the instructions. You may need to completely remove and reinstall iTunes and all related components, or run the process multiple times; this won't normally affect its library, but that should be backed up anyway.
    (99527)

  • Reporting Services will not automatically use a different replica for the report server databases when a failover occurs. How to overcome this issue

    Reporting Services offers limited support for using AlwaysOn Availability Groups with report server databases. The report server databases can be configured in AG to be part of a replica; however Reporting Services will not automatically use a different
    replica for the report server databases when a failover occurs. How to overcome this issue? is there any workaround for that..
    Rahul

    Hi.
    With the AlwaysOn listener you should have a single DNS name to connect to regardless of which cluster node is active. Are you using the listener service? If not, please refer to the link below.
    http://msdn.microsoft.com/en-us/library/hh213417.aspx#AGlisteners

  • Adobe updater is crashing with adobe photoshop elements 6 and mac os version 10.9.4 (on a brand new install)  . How to overcome  this ?

    adobe updater is crashing with adobe photoshop elements 6 and mac os version 10.9.4 (on a brand new install)  . How to overcome  this ?

    Maybe I typed it wrong ...it is unchecked.
    This is the message I receive:
    Process:         Adobe Updater
    Path:            /Applications/Utilities/Adobe Utilities.localized/*/Adobe Updater.app/Contents/MacOS/Adobe Updater
    Identifier:      "com.Adobe.ESD.AdobeUpdaterApplication"
    Version:         Adobe Updater 5.1.0.1082 (5.1.0.1082)
    Code Type:       X86 (Native)
    Parent Process:  launchd
    Responsible:     Adobe Updater
    User ID:         501
    Date/Time:       2014-11-21 12:39:47.691 -0600
    OS Version:      Mac OS X 10.9.5 (13F34)
    Report Version:  11
    Anonymous UUID:  42CCAEE7-C520-BA70-4B27-711A184AB1A5
    Crashed Thread:  0  Dispatch queue: com.apple.main-thread
    Exception Type:  EXC_CRASH (SIGABRT)
    Exception Codes: 0x0000000000000000, 0x0000000000000000
    Application Specific Information:
    abort() called
    terminating with uncaught exception of type std::runtime_error: Unable to determine registration filepath!
    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
    0   libsystem_kernel.dylib        0x93982952 __pthread_kill + 10
    1   libsystem_pthread.dylib       0x96f15167 pthread_kill + 101
    2   libsystem_c.dylib             0x940f029c abort + 155
    3   libc++abi.dylib               0x99fe06c9 abort_message + 169
    4   libc++abi.dylib               0x9a00147d default_terminate_handler() + 264
    5   libc++abi.dylib               0x99ffec30 std::__terminate(void (*)()) + 14
    6   libc++abi.dylib               0x99ffe64b __cxa_throw + 116
    7   "com.Adobe.ESD.AdobeUpdaterApplication"0x0004e4a3 0x1000 + 316579
    8   "com.Adobe.ESD.AdobeUpdaterApplication"0x00056f19 0x1000 + 352025
    9   "com.Adobe.ESD.AdobeUpdaterApplication"0x00024499 0x1000 + 144537
    10  "com.Adobe.ESD.AdobeUpdaterApplication"0x000139c0 0x1000 + 76224
    11  "com.Adobe.ESD.AdobeUpdaterApplication"0x00002912 0x1000 + 6418
    12  "com.Adobe.ESD.AdobeUpdaterApplication"0x0000282d 0x1000 + 6189
    Thread 1:: Dispatch queue: com.apple.libdispatch-manager
    0   libsystem_kernel.dylib        0x93983992 kevent64 + 10
    1   libdispatch.dylib             0x96f1e899 dispatchmgr_invoke + 238
    2   libdispatch.dylib             0x96f1e532 dispatchmgr_thread + 52
    Thread 2:
    0   libsystem_kernel.dylib        0x93983046 __workq_kernreturn + 10
    1   libsystem_pthread.dylib       0x96f15dcf pthreadwqthread + 372
    2   libsystem_pthread.dylib       0x96f19cce start_wqthread + 30
    Thread 3:
    0   libsystem_kernel.dylib        0x93983046 __workq_kernreturn + 10
    1   libsystem_pthread.dylib       0x96f15dcf pthreadwqthread + 372
    2   libsystem_pthread.dylib       0x96f19cce start_wqthread + 30
    Thread 4:
    0   libsystem_kernel.dylib        0x93983046 __workq_kernreturn + 10
    1   libsystem_pthread.dylib       0x96f15dcf pthreadwqthread + 372
    2   libsystem_pthread.dylib       0x96f19cce start_wqthread + 30
    Thread 0 crashed with X86 Thread State (32-bit):
      eax: 0x00000000  ebx: 0xa10e2c0c  ecx: 0xbffff0dc  edx: 0x93982952
      edi: 0xa13a31a8  esi: 0x00000006  ebp: 0xbffff0f8  esp: 0xbffff0dc
       ss: 0x00000023  efl: 0x00000206  eip: 0x93982952   cs: 0x0000000b
       ds: 0x00000023   es: 0x00000023   fs: 0x00000000   gs: 0x0000000f
      cr2: 0x99fe3e46
    Logical CPU:     0
    Error Code:      0x00080148
    Trap Number:     132
    Binary Images:
        0x1000 -   0x24cff7 +"com.Adobe.ESD.AdobeUpdaterApplication" (Adobe Updater 5.1.0.1082 - 5.1.0.1082) <3D59867C-5698-4D46-AD1F-C357C48B75AA> /Applications/Utilities/Adobe Utilities.localized/*/Adobe Updater.app/Contents/MacOS/Adobe Updater
      0x3ce000 -   0x3d9fff  com.apple.CommerceCore (1.0 - 42) <D28DD970-4B69-3848-9BCC-3C67323B3D9C> /System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/Frameworks/CommerceCor e.framework/Versions/A/CommerceCore
    0x493f000 -  0x4964ff9  com.apple.framework.familycontrols (4.1 - 410) <A33A97EE-C735-38BA-9B49-5D78DAA3DEDA> /System/Library/PrivateFrameworks/FamilyControls.framework/Versions/A/FamilyControls
    0x8fea6000 - 0x8fed8417  dyld (239.4) <0F2176BD-4239-3506-BA41-3B885269520E> /usr/lib/dyld
    0x90008000 - 0x90023ff5  com.apple.openscripting (1.4 - 157) <5C161A52-8D2F-3D56-A988-05727BED7A59> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/OpenScripting.framework /Versions/A/OpenScripting
    0x90024000 - 0x90025fff  liblangid.dylib (117) <F18F76C6-7E4B-34AD-AE81-C1C031BF2F7D> /usr/lib/liblangid.dylib
    0x90026000 - 0x90109ff7  libcrypto.0.9.8.dylib (52) <D3AB1D26-30BA-36D3-956C-EC7D7185C396> /usr/lib/libcrypto.0.9.8.dylib
    0x9010a000 - 0x90135ff7  libsystem_network.dylib (241.3) <71EBA489-386D-3608-ADE6-CB50EBD1AB1B> /usr/lib/system/libsystem_network.dylib
    0x90136000 - 0x9052effb  com.apple.CoreGraphics (1.600.0 - 599.35.4) <2B46D887-CAED-30F3-B009-1EBF0C71DC2E> /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics
    0x9069c000 - 0x906a5fff  com.apple.audio.SoundManager (4.1 - 4.1) <68B7CEB7-AF09-3E24-8548-6ABF065B5186> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CarbonSound.framework/V ersions/A/CarbonSound
    ...and it goes on and on.
    Joy (Awbrey) Schichtl
    [email protected]

  • Got to end of trial period for Adobe reader XI and cannot revert back to old version or install another version b/c it says I have a newer more functional version, so now I've got no reader at all and cannot fix. Any ideas how to overcome this?.

    Got to end of trial period for Adobe reader XI and cannot revert back to old version or install another version b/c it says I have a newer more functional version, so now I've got no reader at all and cannot fix. Any ideas how to overcome this?.

    YOu need to be clear about the products you are using, so we can help you. In particular there is no trial of Adobe Reader, it is free and keeps running. Sounds like you are using some versions of Acrobat - which?
    YOu must properly uninstall the trial, don't just delete files or you may get a mess impossible to recover.

  • How To Overcome When User Incorrectly Opened The First Inventory Accounting Period As Next Month

    Hi,
    User has opened the wrong first inventory account period. Instead of Aug-14, next period Sep-14 has been opened. There are transactions which need to be posted in Aug-14. How can I rectify this?
    During my search in oracle support, I found below information but the note is not accessible.
    "Internal Note 400900.1 How To Overcome When User Incorrectly Opened The First Inventory Accounting Period As Next Month"
    Regards,
    Ahmed

    Hi ,
    Try This Way...
       If you want to use the uesr exit in two places...
          If area = xyz
           variable1
         else
             variable2.
    same function module you can use in different places...
    If still not clear send me the full details where you want to use then i can send it to you with sample code.
    Thanks..
    Siri N

  • HT1386 Sry for disturbing, but i would to ask that how to overcome the problem of synchronising ? Itune showing me that the sync session is failed to start with my Ipad mini. Any ideas about what is going on ?

    Sry for disturbing, but i would to ask that how to overcome the problem of synchronising ? Itune showing me that the sync session is failed to start with my Ipad mini. Any ideas about what is going on ?

    What are you trying to sync?
    I see you are on ios 7.
    I also had upgraded my iPad Mini to ios 7 & then the 1st time I tried to open a Numbers file that was set up to sync w my MacBookPro, I got a warning that I would not be able to sync it any more w my Mac until I upgraded to Mavericks.
    So if you are trying to sync Numbers, Pages or Keynote files between your iPad mini in ios 7 and a Mac that hasn't been upgraded to Mavericks that could be the problem.
    I was very shocked to get that message since I bought Numbers on the iPad so that I could have a particular file on both devices & keep them synced. I had no clue when I upgraded to ios 7 on the iPad Mini that it would make it so the files in the iWorks apps woudln't sync any more.
    So I finally decided to go ahead & upgrade to Mavericks after carefully preparing & updating other software so that it would work w Mavericks. But I got error messages so haven't even been able to download Mavericks & now having 2nd thoughts about doing so.
    iPad mini ios 7
    MacBookPro Mid 2012 Mountain Lion
    iphone 4S ios 6

  • How to overcome view changes in bdc session method  using recording ?

    how to overcome view changes in bdc session method  using recording ?
    ex-for mm01 in recording if i selected views basic data1 and basic data2.
    i seheduleded for background for after 3 days .
    if any body changes views by selecting other views also.
    how to overcome this with out programming ?
    is there any settings ?

    Hi,
    I am attaching few threads.Hope these will help you.
    If there are any error records in session, all those error records will get poulated in log .SM35 and after the session is completed , u can see error records which can be corrected and reprocessed again
    We have the structures BDCLD and BDCLM, which will capture the log details inthe session. Firstly, sesssion should be processed. After that log will be created. Then caputure the information into an internal table using BDCLM and BDCLD.
    and refer the link.
    error correction in bdc session
    regards
    Madhu

  • How to overcome the certificate error?

    Maximum Number Of Applications Are Getting certificate expired or error.how to overcome the problem.

    To add with above, you can change the date back to 2008 or 2009 in clock settings before installation and when installation finished change it to current 2010. this will only work with "Certificate expired".
    Previous Phones: 6600, 7610, 6230, 6230i, 1100, 1112, N70, N73, N95, N95 8GB, 5800XM, 5230, C5, iPhone 3GS, SE Xperia X10, N900, N8, SE Xperia Arc
    Current Phones: Nokia N9, iPhone 4

  • How to overcome looping problem in Table control?

    If the table control displays,say for eg 5 rows in the screen,it is looping the same in flow logic.
    What if the table control has 10 rows but only 5 rows are displayed? and i want to loop through all the records in the flow logic.
    how to overcome this problem?
    Points will be awarded for answers.
    Regards
    Raja

    Hi
    U need to insert a new LOOP for you internal table and store the data in a different headerline:
    PROCESS PAI (or PBO).
      LOOP AT ITAB.
         MODULE LOOP_ITAB.
      ENDLOOP.
      MODULE LOOP_ITAB.
         LOOP AT ITAB INTO WA.
             IF SY-TABIX = <TABLE CONTROL>-CURRENT_LINE
    *--->It's the same record of LOOP of PAI (or PBO).
             ENDIF.
         ENLOOP.
      ENDMODULE.
    Max

  • Error code 82 occurs during installation...how to overcome?

    Error code 82 occurs during installation...how to overcome?

    Hi Sameer,
    You can follow the article: Error downloading, installing, or updating Creative Cloud applications which might help you to get your issue fixed.
    If you still face any issues I would recommend you to paste a screenshot of the error message you are getting.
    Thanks,
    Ratandeep Arora

  • How to overcome Block corruption using RMAN

    Hi All,
    How to overcome bolck corruption using RMAN. What is the procedure to do so.
    Thanks & Regards
    J.Venugopal

    Hi all,
    I´ve performed the following command on RMAN:
    RMAN> BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG ALL;After, I query the V$DATABASE_BLOCK_CORRUPTION table, and the below records
    was returned:
         FILE#     BLOCK#     BLOCKS CORRUPTION_CHANGE# CORRUPTIO
            67       4670          1         1202832866 LOGICAL
            68     154131        338         1175601952 LOGICAL
            68     155329         60         1174783128 LOGICAL
            68     155409         60         1174783132 LOGICAL
            68     155471         78         1174783135 LOGICAL
            68     155551         78         1174783139 LOGICAL
            68     155631         18         1174783143 LOGICAL
            68     155651         18         1174783144 LOGICAL
            68     155671         18         1174783145 LOGICAL
            68     155691         18         1174783146 LOGICAL
            68     155711         18         1174783147 LOGICAL
            68     155731         18         1174783148 LOGICAL
            68     155751         18         1174783149 LOGICAL
            68     155771         78         1174783150 LOGICAL
            68     155851         78         1174783154 LOGICAL
            68     155931         49         1174783158 LOGICAL
            73     165758          1         1180191676 LOGICALSo, when I try to recover these blocks by using blockrecover command, I got the error:
    RMAN> blockrecover corruption list;
    Starting blockrecover at 27-SEP-07
    using channel ORA_DISK_1
    using channel ORA_DISK_2
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of blockrecover command at 09/27/2007 10:22:10
    RMAN-06026: some targets not found - aborting restore
    RMAN-06023: no backup or copy of datafile 73 found to restore
    RMAN-06023: no backup or copy of datafile 68 found to restore
    RMAN-06023: no backup or copy of datafile 67 found to restoreWhat can I do in this case?
    Thank U very much!
    []´s

  • When I send open office documents to a PC user (even saved and sent in the word format), the document reaches with serious format changes and is rendered unusable to the PC user. How to overcome the problem??

    When I send open office documents to a PC user (even saved and sent in the word format), the document reaches with serious format changes and is rendered unusable to the PC user. How to overcome the problem??

    I don't use OpenOffice (I have it on my internal just to play around with, but seldom even open it). I do use MS Word and have few problems sharing files - it's usually a font issue so I tend to use MS fonts for documents that I know will need to be shared.
    Unless you need to make collaborative changed to the document, you could always save it as a pdf file. With Acrobat Pro you can even save a pdf file to a Word document with very little change in formatting.
    If I were you - and you have a need for .doc or .docx files to travel and play nicely - I'd just invest in MS Office. If you don't have to send a Word file, try pdf.
    Clinton

  • Error 1015. How to overcome?

    Error 1015. How to overcome?

    Type "1015" into the search bar at the top of this page by "Support" and follow the suggestions in the resulting articles.

Maybe you are looking for

  • IBooks removed "Category" from all PDF's.

    In iTunes, ePub books and PDF books were grouped into Categories. Any one Category had a mix of ePubs and PDF's.    iBook put all PDF's into "Uncategorized".  How do I restore Category to PDF"s so that ePubs and PDF's can be in the same category?  Th

  • Anyone know how to capture error messages?

    I'd like to capture the feedback I receive in the Output panel when testing something in the Flash IDE, and display it in a TextArea included in my movie when it is compiled and running in a live environment.  Is there any way I can make this happen?

  • Cannot compile C source code program

    This below is my source code. ===== main () printf(" Test"); ===== C compiler is Forte Develope 6 Update 2 . After I compile source by cc command . This below is output of C compling. #/opt/SUNWspro/bin/cc -o /tmp/main /tmp/main.c ld: fatal: library

  • My email is not working in lightroom. Need help setting that up.

    Need help setting up my email in lightroom. For some reason it's not connecting.

  • PS CS4 doesn't recognize my WIA supported printer on my network

    Hello I have PS CS4 installed on 2 W7Pro computers (1 license, one backup)  I have a Canon MP560 connected to my main computer and the printer is on my network and the backup computer uses this printer via wired LAN, network router etc..  I can print