Getting error for the Array : help

Hi i have written following code and getting this error
String srcdir = new String("C:\\projects\\xml\\rwjf-org\\closedgrants\\finalxml\\grr\\");
File fileDir = new File(srcdir);
String[] fileList = new String[100];
fileList = fileDir.list();
for(int i=0; fileList.length>0; i++){
String currFile = srcdir + fileList;
//String fname = new String(fileList[i]);
System.out.print("String file name is " + currFile);
//System.out.print("file name is " + fileList[i]);
ERROR : java.lang.ArrayIndexOutOfBoundsException
I'm new to java.
Please tell me where i'm going wrong.
any help would be great.
Pooja

Hi i have written following code and getting this
error
String srcdir = new
w
String("C:\\projects\\xml\\rwjf-org\\closedgrants\\fina
xml\\grr\\");
File fileDir = new File(srcdir);
String[] fileList = new String[100];
fileList = fileDir.list();If you are not after limiting the number of files returned, change the previous two lines to this one line (then, you will get all files/subdirs contained within the srcdir):
String[] fileList = fileDir.list();
for(int i=0; fileList.length>0; i++){And, as another poster mentioned, change your first line of the for loop to this:
for (int i = 0; i < fileList.length; i++)
HTH,
Mike Kares
String currFile = srcdir + fileList;
//String fname = new String(fileList[i]);
System.out.print("String file name is " +
is " + currFile);
//System.out.print("file name is " +
is " + fileList[i]);
ERROR : java.lang.ArrayIndexOutOfBoundsException
I'm new to java.
Please tell me where i'm going wrong.
any help would be great.
Pooja

Similar Messages

  • Getting error in the array : help

    Hi i have written following code and getting this error
    String srcdir = new String("C:\\projects\\xml\\rwjf-org\\closedgrants\\finalxml\\grr\\");
    File fileDir = new File(srcdir);
    String[] fileList = new String[100];
    fileList = fileDir.list();
    for(int i=0; fileList.length>0; i++){
    String currFile = srcdir + fileList;
    //String fname = new String(fileList[i]);
    System.out.print("String file name is " + currFile);
    //System.out.print("file name is " + fileList[i]);
    ERROR : java.lang.ArrayIndexOutOfBoundsException
    I'm new to java.
    Please tell me where i'm going wrong.
    any help would be great.
    Pooja

    There are several errors in your code:
    String[] fileList = new String[100];
    fileList = fileDir.list();
    Here you point the fileList reference to a String[] object, and then immediately point the reference to another object. This is a useless creation of an object... the #1 cause of slow Java code.
    Write just this instead:
    String[] fileList = fileDir.list();
    for(int i=0; fileList.length>0; i++){
    The condition fileList.length > 0 will forever be true or false. the condition should be i < fileList.length.
    I think those suggestions should get you started...

  • I tunes 11 will not let me sync my I pod nano... keep getting error meessage:  the software required for this I pod was not installed correctly... I have tried to reinstall 6 times Dumped everything i tunes related no luck help!

    I recently updated to Itunes 11 and now no sync... get error message: The software required for this I pod was not installed correctly. Please reinstall Itunes to install the required software.  I backed up all music and deleted all related itunes items and still get this error after 6 attempts to reload itunes... i give up please help

    I recently updated to Itunes 11 and now no sync... get error message: The software required for this I pod was not installed correctly. Please reinstall Itunes to install the required software.  I backed up all music and deleted all related itunes items and still get this error after 6 attempts to reload itunes... i give up please help

  • HT201210 I have an old i phone 3G and do not know the password for it. trying to restore it from itunes but keep getting error code 1015, any help on how to get passed this please?

    I have an old i phone 3G and do not know the password for it. trying to restore it from itunes so my daughter can use it as an ipod but keep getting error code 1015, any help on how to get passed this please?

    Hi ratcat14!
    I have an article that can help you troubleshoot this issue:
    Resolve specific iTunes update and restore errors
    http://support.apple.com/kb/ts3694
    Check for hardware issues
    Try to restore your iOS device two more times while connected with a cable, computer, and network you know are good. Also, confirm your security software and settings are allowing communication between your device and update servers. If you still see the alert when you update or restore, contact Apple support.
    Common errors: 1, 10-47, 1002, 1011, 1012, 1014, 1000-1020.
    Thanks for being a part of the Apple Support Communities!
    Cheers,
    Braden

  • Keep getting error message "The registry settings used by the iTunes drivers for importing and burning CDs ....please reinstall iTunes." I have done this several times but it doesn't help.

    Keep getting error message "The registry settings used by the iTunes drivers for importing and burning CDs ....please reinstall iTunes." I have done this several times but it doesn't help.

    Refer to this article:
    iTunes for Windows: "Registry settings" warning when opening iTunes
    http://support.apple.com/kb/TS3299

  • In iWeb I created a hyperlink to a file on my computer. When I publish I get a 404 error for the link.  Can anyone help?

    In iWeb I created a hyperlink to a file on my computer. When I publish I get a 404 error for the link.  Can anyone help?

    How would I check to see if the like works when I enable via the inspector pane
    If you enable hyperlinks when you click on the link link to the pdf file it will open a browser window and display the pdf file.
    I upload the pdf files to the server and link to them as if they were an external web page:
    That's been more reliable for me than linking to the file as Link To: A file and have iWeb upload the pdf file to the serve.

  • TS3297 itunes 10.6.1 now asking for 3 security questions. After input I get "error in the itunes store -1202". I cannot purchase from the store.

    Running Vista Ultimate. Itunes 10.6.1 is now asking to answer 3 security questions before accessing the store. After entry I get "error in the itunes store -1202" I cannot purchase music at this point. Any help is appreciated.

    This problem is resolved. I deleted the old iTunes (with write permissions turned on for my account) and reinstalled successfully. Removing the deleted iTunes from Trash was troublesome even with root but after playing around with permissions and flags, I was able to remove it.

  • Getting Error In the Routine - While writing Code for the Cross Reference.

    Hi,
    Getting Error In the Start Routine - While writing Code for the Cross Reference from the Text table ( /BIC/TZMDES with Fields /BIC/ZMDES(Key),TXTSH ) Getting Error as [ E:Field "ZMDES" unknown ].
    Transformation : IOBJ ZPRJ3(Source) -> IOBJ ZPRJC ( Target ).
    The Source  Fields are: 0logsys(Key),zprj3(Key),ZDOM3.
    The Target Fields are : 0logsys(Key),zprjc(Key),ZDOM3, UID.
    Here i am trying to Update the target Field UID by Comparing the Source Field [ zprj3(Key)] with the Text table ( /BIC/TZMDES ) and update the UID.
    The Code is as below:
    Global Declarations in the Start Routine:
    Types: begin of itabtype,
            ZMDES type /BIC/TZMDES-/BIC/ZMDES,
            TXT type /BIC/TZMDES-TXTSH,
             end of itabtype.
    data : itab type standard table of itabtype
    with key ZMDES,
    wa_itab like line of itab.
    Routine Code :
    select * from /BIC/TZMDES into corresponding fields of table itab for
    all entries in SOURCE_PACKAGE
    where ZMDES = SOURCE_PACKAGE-/BIC/ZPRJ3.
    READ TABLE itab INTO wa_itab
    WITH KEY ZMDES = SOURCE_PACKAGE-/BIC/ZPRJ3
    BINARY SEARCH.
    IF SY-SUBRC = 0.
    RESULT = wa_itab.
    CLEAR wa_itab.
    The tys_SC_1 structure is :
    BEGIN OF tys_SC_1,
         InfoObject: 0LOGSYS.
            LOGSYS           TYPE RSDLOGSYS,
         InfoObject: ZPRJ3.
            /BIC/ZPRJ3           TYPE /BIC/OIZPRJ3,
         InfoObject: ZDOM3.
            /BIC/ZDOM3           TYPE /BIC/OIZDOM3,
         Field: RECORD.
            RECORD           TYPE RSARECORD,
          END   OF tys_SC_1.
        TYPES:
          tyt_SC_1        TYPE STANDARD TABLE OF tys_SC_1
                            WITH NON-UNIQUE DEFAULT KEY.
    Please suggest with your valuable inputs.
    Thanks in Advance

    I have split the code in two.. one for start routine.. other for field routine.. hope this helps
    Types: begin of itabtype,
    ZMDES type /BIC/TZMDES-/BIC/ZMDES,
    TXT type /BIC/TZMDES-TXTSH,
    end of itabtype.
    data : itab type standard table of itabtype
    with key ZMDES,
    wa_itab like line of itab.
    Start routine
    select * from /BIC/TZMDES into corresponding fields of table itab for
    all entries in SOURCE_PACKAGE
    where ZMDES = SOURCE_PACKAGE-/BIC/ZPRJ3.
    Sort itab.
    field routine
    CLEAR wa_itab.
    READ TABLE itab INTO wa_itab
    WITH KEY ZMDES = SOURCE_FIELD-/BIC/ZPRJ3
    BINARY SEARCH.
    IF SY-SUBRC = 0.
    RESULT = wa_itab-<field name>

  • I backed up my movies and rebuild my computer, and after making sure i'm using the latest version of itunes and quicktime and and making sure i still had spare computer authorizations, i still get error 23132.  Please help.

    I backed up my movies and rebuild my computer, and after making sure i'm using the latest version of itunes and quicktime and and making sure i still had spare computer authorizations, i still get error 23132.  Please help.

    I had this exact issue.  Spent over an hour on the phone with apple support, they couldn't resolve.  Here is what I ended up doing, that worked.
    1.  Turned iTunes match off on all my iOS devices
    2.  Deleted the offending playlists from the iOS device they originated on
    3.  Started iTunes, let it run (literally) for an hour before it became responsive.  First thing I did, before clicking anywere else was disable iTunes match.  If I clicked anywhere, it would clock for another hour.
    4.  Let iTunes run overnight, by morning it had cleaned out the repeating play lists.  This got my Mac/iTunes back to an operable state.
    5.  Restore iPhones from backup in iTunes.
    What was causing my issue was a single playlist that was created on an iPhone, then suddenly showed up with several thousand duplicates on my other iPhone.  The culprit playlist did not, for some reason, duplicate itself on my two iPads.  Apple support seemed to think it was because the problem iPhone tried to sync the playlist to iCloud over and over again unsuccessfully, then it finally went through and populated the thousands of blank/failed playlists which then tried to propigate to iTunes and my other iOS devices.  Seems like a reasonable theory.
    I have not yet re-enabled iTunes match.  So, no idea what will happen if I decide to go back down that rabbit hole.

  • I have several episodes of a TV show that say "download error, tap to retry" and when I do it just repeats that error message.  Can I get it to work? If not can I get reimbursed for the episodes I'm missing?  I'm using an iPad one which has worked fine B4

    I have several episodes of a TV show where it says download error, tap to retry and when I do it repeats the error message.  Can I get it to work or get reimbursed for the ones I'm missing?  I'm using an iPad 1 which has worked fine for all the others.

    Hi AlpineJean,
    I'm sorry to hear you are having issues downloading some episodes to your iPad.
    I would first suggest you sign out of your iTunes account on your iPad, restart the device and sign back in.
    Settings > iTunes & App Stores > Tap on your Apple ID account > Tap Sign Out
    Click on the link below for additional troubleshooting steps with more details and screenshots.
    I've quoted some helpful highlights for you:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    To view or download previously purchased:
    TV Shows on iOS
    Open the iTunes Store on your device.
    Make sure you are signed in with the same Apple ID you used for the original purchase.
    Tap More from the bottom navigation bar.
    Tap TV Shows.
    Locate the TV show episode or series you would like to download.
    Once you've located the TV shows you are looking for, tap the download button.
    The TV show will begin downloading.
    Previous purchases may be unavailable if they have been refunded or are no longer on the iTunes Store. Downloading previously purchased movies and TV shows requires iTunes 10.6 or later.
    If this does not resolve your issue, please follow these instructions for support from the iTunes Store:
    How to report an issue with your iTunes Store, App Store, Mac App Store, or iBookstore purchase
    Find the email receipt for your purchase.
    Click Report a Problem under the app that is having the issue.
    When prompted, enter the Apple ID and password you used to purchase the item, then click Report a Problem.
    Click Report a Problem next to the item you are having an issue with.
    From the Choose Problem dropdown menu, choose the appropriate issue.
    Follow the onscreen instructions and—if prompted—type a description of the problem into the text field.
    Click Submit to have your issue reviewed.
    Have a great day!
    - Judy

  • I am getting this for the first time when i sync .iphone 3gs error message itunes could not sync calendars to the iphone because the sync server failed to sync iphone

    i am getting this for the first time when i sync .iphone 3gs error message itunes could not sync calendars to the iphone because the sync server failed to sync iphone

    I have tried the suggestion to reset the sync log to no avail. Anyone have another idea? This just started after I downloaded 4.3.5.

  • My ipad mini 2 is not turning on. I tried to reset with the power/home buttons but it didnt work. I tried to restore it in DFU mode but it didnt work, i get error 4004. Please help me!

    My ipad mini 2 is not turning on. I tried to reset with the power/home buttons but it didnt work. I tried to restore it in DFU mode but it didnt work, i get error 4004. Please help me!

    I also tried the ol' whacking 3 times trick...Didn't work to my surprise

  • HT1338 My kid down loaded mackeeper and now I can not get rid of it.  I have tried all techniques suggesting on several sites and still can not empty the trash can.  keep getting error code -8003.  Help.

    My kid down loaded mackeeper and now I can not get rid of it.  I have tried all techniques suggesting on several sites and still can not empty the trash can.  keep getting error code -8003.  Help.

    http://reviews.cnet.com/8301-13727_7-20020873-263.html
    This should help you empty what's currently in the trash, but is no guarantee you got everything related to MacKiller off the drive. See Ogelthorpe's link.

  • Trying to restore/update 3rd gen ipod touch - keep getting error message - THe ipod touch could not be restored. An unknow error occurred (-1). Please help.

    Please Help..
    Trying to restore / update ipod 3rd generation - keep getting error message - The ipod touch could not be restores. An unknown error occurred (-1).

    Error 1 or -1
    This may indicate a hardware issue with your device. Follow Troubleshooting security software issues, and restore your device on a different known-good computer. If the errors persist on another computer, the device may need service.
    The "device may need service" means a hardware problem. in that case make an appointment at the Genius Bar of an Apple store.
    Apple Retail Store - Genius Bar

  • TS1718 I tried to update, did not work, unintstalled did not work.  Now when I try to install i get error message "The feature you are trying to use is on a network resource tha is unabailable.  Looking for itunes64.msi path.

    I tried to update, did not work, unintstalled did not work.  Now when I try to install i get error message "The feature you are trying to use is on a network resource tha is unabailable.  Looking for itunes64.msi path.

    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

Maybe you are looking for

  • Can't open Adobe Reader XI! May not have appropriate permissions?? Need help!

    Here's the deal. I noticed I wasn't able to open up my PDF files like I used to (it would suddenly pop up a window asking if I wanted to open the file using another program on my computer or the web) so I figured that the latest update might've done

  • How to restore 5.1.1 back up for my 4.1 3GS phone?

    Hi, My 3GS phone had 5.1.1 iOS & got locked while updating. Now I have got it unlocked, but have 4.1 iOS right now & it gets locked if i try to update the iphone version since this is required to load my back up file. Now, I need my back up very much

  • Unable to connect using connect string in linus using sys user in Linux

    Hi, I am facing problem in using connect string while connecting as sys user in Linux OS For example: When I am connecting as sys/sysoracle as sysdba its getting connected. But when I am providing the connect string such as sys/sysoracle@TEST as sysd

  • Variable for start page number?

    I have a collection of indesign documents collated in a book. I want to implement a footer that looks like: "Start Page - Last Page" "750 - 763" where Start Page is begining of the beging of the constituent indesign document and last page is the end

  • Recovery of Factory Default Software

    I'm trying to re-format my Satellite A100 Model: PSAAKL-00E002 OS: Windows Vista. Upon starting, there is "BOOTMNGR is missing". I restarted then boot to CD/DVD where the DVD RECOVERY DISK is located. I choose: Step1. TOSHIBA RECOVERY WIZARD Step2. R