Retrieving a file

Hi!
I would like to find a file (doc.xml) in my architecture, at the second level bottom.
For this, I use the following code:
import java.io.*;
import java.util.*;
public class recherche extends Object {
public static void main (String args[]) throws Exception
/*org.apache.xalan.xslt.Process.main(new String[] {"-IN", "C:/WINDOWS/Bureau/DGA/AIS/cyril/DERA/HP/61DG019H0035/doc.xml",
"-XSL", "C:/WINDOWS/Bureau/DGA/AIS/cyril/DERA/HP/61DG019H0035/doc.xsl"});*/
File f = new File("C:/WINDOWS/Bureau/DGA/AIS/cyril/DERA");
File [] files = f.listFiles();
for (int i=0; i<files.length; i++)
System.out.println(files.getName());
File [] sfiles = files[i].listFiles();
for (int j=0; j<sfiles.length; j++)
System.out.println(sfiles[j].getName());
File [] ssfiles = sfiles[j].listFiles();
for (int k=0; k<ssfiles.length; k++)
System.out.println(ssfiles[k].getName());
/*if (ssfiles[k].getName() == "doc.xml")
System.out.println(ssfiles[k].getName());
For the levels i and j, the program runs well, but not for the third level k.
I have the following error message:
Exception in thread "main" java.lang.NullPointerException at recherche.main (recherche.java:21).
Some of you know how to fix this,
REgards,
Steev

Copying your code into an editor, line 21 (where the exception is thrown) is the final loop. In this case it looks like you are calling File[].length on a null array, which will of course throw a null pointer exception. The array is null because only a directory has sub-files.
You list the files of each file in the file system. You should be only listing the files of directories.
example:
File f=new File("C:\\"); //just an example base-file
if (f.isDirectory()) {
  File[] files=f.listFiles();
  for (int i=0; i<files.length; i++) {
    //etc
}Alternatively, you can check for null:
File f=new File("C:\\");
File[] files=f.listFiles();
if (files != null) {
  for (int i=0; i<files.length; i++) {
    //etc
}Hope this helps.

Similar Messages

  • Retrieve text file from ftp server every 15 mins

    Hi guys,
    We are able to connect to an FTP server with 5 text files. Every 15 minutes, we need to retrieve each of the 5 files. Please assist me with the coding logic to retrieve the file into the SAP Directory. Any suggestions would be greatly appreciated.
    Regards,
    Sid

    Sid
    Try searching on SCN, there are plenty of materials you can find without even asking a question in the forum.
    How to use SCN search
    For example, if you search with keywords "FTP ABAP", immediately the first two Wiki entries would give you the details you are looking for.
    Rgds
    Eng Swee

  • How do I retrieve a file from Trash using Time Machine in Mavericks?

    Is it even possible to retrieve a file from Trash from a Time Machine backup? Does Time Machine even back up the Trash? I've been told a total restore from a Time Machine backup will put the past Trash back on the Mac, but what if I just want to restore an individual file?
    Shortly after emptying my Trash on my Mac (10.9.4) for the first time in weeks, I realized I needed one of the files I'd just erased. Trying to retrieve with Time Machine was not fruitful, however, because I couldn't find the file on any of the past backups using the normal Enter Time Machine interface. However, I know it would have been in the Trash during all of the most recent backups.
    So I researched how to find the backups of Trash with Time Machine, but I think all of the solutions I found on various online forums were pre-Mavericks and do not seem to work now. I've basically tried 2 things:
    Show Trash in Finder using the Terminal command: open ~/.Trash
    It shows the hidden Trash folder in Finder, located in Macintosh HD/Users/User. For easy access, I added the .Trash folder to the Finder Sidebar. But I can't get to it in the backups. The Trash shortcut in the Finder Sidebar is always grayed out in the old backups using the Time Machine app. And it does not show up in ~ when looking through the backups.backupdb folder on my external HD.
    I also tried the Terminal command to show all hidden files in Finder: defaults write com.apple.finder AppleShowAllFiles YES
    But while many hidden files do suddenly appear in Finder, curiously, the User's .Trash folder is not one. This is true for the Finder of the Mac, the backups.backupdb folder on the External HD, and Time Machine app.
    Thanks.

    How do I retrieve a file from my backup in Time Capsule?
    It depends on the type of file that you are trying to retreive.
    In general.....
    Open Time Machine by clicking on the clock icon on the dock
    Wait a few minutes for Time Machine to fully load
    Use the timeline at the far right of the window to go back in time to a date when the file was still on your Mac
    Click that date
    Navigate using the Finder interface to locate the file that you want
    Click on the file to highlight it
    Click Restore at the lower right of the window to be brought back to the present
    You have to retrieve other types of files differently. For details, see:
    http://pondini.org/TM/28.html

  • Please help me, I mistakenly deleted a file.  How can I retrieve my file?

    PLease help me retrieve my file.  I was rearranging some docs into sub-files and mistakenly deleted the main file, thinking the sub-files would still be there and they are all gone.  Lots and lots of docs.  PLEASE HELP ME,!!!  The File name was "Cardis, Jackets, Ponchos& Tops Patterns.  I was using the new Adobe Acrobat Reader.

    I don't believe you can if the only copy is on your iPad.
    You must make backups of files which you have on your mobile devices. Then restore from the backup. Backups could easily made by uploading them to Document Cloud, or backing up to another device.

  • FTP and Internet Explorer lets me retrieve all files in a folder with one click, how to in Firefox?

    I want to use FTP to copy multiple files from a remote machine so I can burn a backup here. I cannot find any syntax in Firefox yet in Internet Explorer 8 I can get a Windows-like display of all remote directories then use Windows commands to 'select all' and/or 'copy to folder' which does the bulk transfer with no further commands. The initial WinXP response to the FTP command is like Firefox in that I have to retrieve each file with a separate command.

    hello, firefox has just a simple viewing capability for files on a ftp server. for more advanced functions please use an extension like fireftp: https://addons.mozilla.org/firefox/addon/fireftp/

  • "Error retrieving xml file from database"

    Hello All,
    I have installed and configured planning with Shared services. While I try to create an instance in Configuration Utility by entering the Instance Name, Host Name, Port (8300) and Click "Next", I get this error -
    *"System failure:Error retrieving xml file from database".*
    My RDBMS is - SQL Server 2005
    OS - Windows 2003 Server
    I am unable to work on planning for few months due to this error.. I would sincerely appreciate if someone can provide me a solution for this..
    Thanks much,
    Varma.

    Hi,
    Ive seen this before.
    If this is a new environment could you create a blank database and configure it as your System database? Then try again and you should be fine.
    I think you may have some invalid entries in your sys database.
    Seb
    www.taysols.com.au

  • Product Instance Registration Error Message: "System Failure: Error while retrieving xml file from database"

    Hi Planning installation Gurus,
    Did u get any luck to resolve this problem as i am also facing same problem "Error creating instance" during install of Planning 9.3.1. i tried 30-50 times reconfiguration every time same problem..
    OS: Vista Premium
    SQL Server 2005
    Essbase:9.3.1
    Error Message: "System Failure: Error while retrieving xml file from database"
    Details of error:::::::::::::::::::::::::
    at com.hyperion.planning.event.HspSysExtChangeHandler.run(Unknown Source
    Can not get JDBC connection for SYS external changed actions.
    Can not get JDBC connection.
    java.lang.NullPointerException
    at com.hyperion.planning.sql.HspSQLImpl.getConnection(Unknown Source)
    at com.hyperion.planning.event.HspSysExtChangeHandler.actionPoller(Unkno
    wn Source)
    at com.hyperion.planning.event.HspSysExtChangeHandler.run(Unknown Source
    Can not get JDBC connection for SYS external changed actions.
    Can not get JDBC connection.
    java.lang.NullPointerException
    at com.hyperion.planning.sql.HspSQLImpl.getConnection(Unknown Source)
    at com.hyperion.planning.event.HspSysExtChangeHandler.actionPoller(Unkno
    wn Source)
    at com.hyperion.planning.event.HspSysExtChangeHandler.run(Unknown Source
    Can not get JDBC connection for SYS external changed actions.
    Can not get JDBC connection.
    Pls provide Solution

    Hi John,
    though i am trying with SQl server authentication with different user but still status is same of planningSystemDB.properties
    SYSTEM_DB_DRIVER=hyperion.jdbc.sqlserver.SQLServerDriver
    SYSTEM_DB_URL=jdbc:hyperion:sqlserver://neeraj-PC:1433
    SYSTEM_DB_USER=windowsAuthentication
    SYSTEM_DB_PASSWORD=CAFBAEFNBGEAABHEDOADFKADACBGBIFHBLCDFBAFFH
    SYSTEM_DB_CATALOG=plandb
    SYSTEM_DB_TYPE=SQL
    INSTANCE=
    my steps:
    Using SQL Server Management Studio
    Changed Widows authentication to SQL server authentication mode
    In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
    On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
    In the SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server.
    In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
    On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
    In the SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server.
    To restart SQL Server from SQL Server Management Studio
    To enable the sa login by using Management Studio
    In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties.
    On the General page, you might have to create and confirm a password for the sa login.
    On the Status page, in the Login section, click Enabled, and then click OK.
    In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties.
    On the General page, you might have to create and confirm a password for the sa login.
    On the Status page, in the Login section, click Enabled, and then click OK.}}}
    anything else should i change.................

  • Product Instance Registration Error: "System Failure: Error while retrieving xml file from database"

    Hi S9 installation Gurus,
    Please try to resolve this long awaited issue with Planning installation as this is purely configuration related issue.
    Detail of Problem:-
    After Susessful configuration of
    1) Foundation Services (Hyperion Shared Services)
    2) Essbase administration services
    3) Essbase Server
    4) Hyperion reporting and analysis
    5) Planning -----> Product options, Register with shared services, configure database, deploy to application server (Appache)
    Error Point: when i tick ckeck box in front of Product instance registration
    click next
    create instance
    click next
    instance name-Plan1
    Web tier host name: my machine name (neeraj-pc, as i installed locally all component of hyperion)
    server port: 8300 (system suggesting)
    tick on active instance
    click next
    Error Pop Up "System Failure: Error while retrieving xml file from database"
    Details of PlanningSystemDB (file :- \Hyperion\common\config\PlanningSystemDB.properties)
    SYSTEM_DB_DRIVER=hyperion.jdbc.sqlserver.SQLServerDriver
    SYSTEM_DB_URL=jdbc:hyperion:sqlserver://neeraj-PC:1433
    SYSTEM_DB_USER=puser
    SYSTEM_DB_PASSWORD=GGAKFJ
    SYSTEM_DB_CATALOG=p1db
    SYSTEM_DB_TYPE=SQL
    INSTANCE=
    Note: puser (SQL Authenticated user)
    Thanks
    Kumar
    Edited by: user10385300 on Dec 4, 2008 5:44 AM

    This has been resolved at :- Product Instance Registration Error Message: "System Failure: Error while retrieving xml file from database"
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Kernel panic/invalid node structure; please help retrieving my files!!

    Hi everyone, thank you for your time in advance... if anyone has ideas about how to solve it, I appreciate this very much!
    OK, here is how it began: while I was working on the airplane using PowerPoint, the gray spinning wheel appeared after which PowerPoint stopped working. I pressed the power button to exit (all applications froze). (So much for trying to get more work done...)
    Next, I powered up the computer but it would not boot up, with only gray spinning wheel showing.
    Next, tried to boot up while pressing power button and holding shift key. After some time (10 minutes), an error message appears. Researching it on discussion forums, I found that it is called “kernel panic”. Here is beginning of the message:
    panic(cpu 1 caller 0x47f5ad): "Process 1 exec of /sbin/launchd failed, errno 8\n"@SourceCache/xnu/xnu-1504.15.3/bsd/kern/kern_exec.c:3145
    Debugger called: <panic>
    [additional information here]
    Also, message “You need to restart your computer. Hold down the Power button until it turns off, then press the Power button again” is shown transparently in the middle of the screen over the “panic” message output.
    I turned on and off the Power button many times, but I get the same error message.
    I also tried Apple Hardware Test but it did not work (it did not generate any messages).
    Next, I tried to use the Disk Utility using the Installation Disk that came with the computer. After I clicked “Disk Repair”, here is the log:
    Verify and Repair volume “Macintosh HD”
    Checking Journaled HFS Plus volume.
    Checking extents overflow file.
    Checking catalog file.
    Invalid node structure
    Rebuilding catalog B-tree.
    Invalid node structure
    [many repeats of “Invalid node structure”  ~ about 400 repeats]
    Rechecking volume.
    Checking Journaled JFS Plus volume.
    Checking extents overflow file.
    Checking catalog file.
    Missing thread record (id=18)
    Missing thread record (id=110)
    [many instances of “Missing thread record” ~about 200 repeats]
    Checking multi-linked files.
    Checking catalog hierarchy.
    Checking extended attributes file.
    The volume Macintosh HD could not be verified completely.
    Error: Disk Utility can’t repair this disk…disk, and restore your back-up files.
    At the end, a window presented over the error log stated :
    “Disk Utility stopped repairing “Macintosh HD”
    Disk Utility can’t repair this disk. Back up as many of your files as possible, reformat the disk, and restore your back-up files.
    I need to retrieve my recent files!! Please Help!! Argh!! I promise that I will promptly back up my files now! I did not use Time Machine, and only some of my files are backed up.
    From what I read on the discussion forum, I will probably need to erase the disk and then do a fresh installation, but could someone please guide me with regard to how to back up the data / retrieve the files? I may have access to another mac so I’m thinking that the FireWire Target Disk Mode may work. I also have spare external harddrive (formatted for mac) (not partitioned). Also, how do I retrieve the files from the other computer if the FireWire transfer works?
    Also, the second step is to do a new installation, but is there any reason why “Archive and Install” using Disk Utility won’t help? I have some additional programs installed (Illustrator, Photoshop) so this means if I do a new installation, I will need to re-install those as well?
    I did some investigation, and it looks like this problem is similar to this:
    https://discussions.apple.com/message/18098343#18098343
    But my main issue now is to retrieve the files!
    Also, how do I investigate whether this problem is due to a failing hard drive or a natural file system corruption ? (so should I get a new harddrive or do a new install).
    http://forums.macnn.com/t/459376/heart-attack-invalid-node-structure
    I don’t know what is the OS version;  it is Snow Leopard OS X ……. I bought it in September 2009.
    I appreciate any help, thank you so much for your time…

    Create a data recovery/undelete external boot drive
    Step by Step to fix your Mac
    Most commonly used backup methods

  • HT1386 The laptop I originally synch'd my iphone 4s with is broken and cannot retrieve any files. How can I sync the phone with a new laptop without losing all my downloaded music and apps already installed on my iphone?

    The laptop I originally synch'd my iphone 4s with is broken and cannot retrieve any files. How can I sync the phone with a new laptop without losing all my downloaded music and apps already installed on my iphone?

    If the answer to the above question is "yes", FIRST, set up a backup of your new computer before you do anything else so the next time your computer breaks you will not be in the same situation. Backup solutions are numerous and inexpensive, and there is absolutely no excuse in the Third Millennium not to have one.
    Then see this tip: https://discussions.apple.com/docs/DOC-3141

  • I backed up files onto an external hard rive form my old PC. Now I want to retrieve the files to put on my mac but it is telling me to format it to Mac. How can I do this without erasing all of the data on my hard drive?

    I backed up files onto an external hard rive form my old PC. Now I want to retrieve the files to put on my mac but it is telling me to format it to Mac. How can I do this without erasing all of the data on my hard drive?

    Your drive was used with a PC and formatted NTFS which is proprietary Microsoft format.
    You need to install a third party program that will read the NTFS format.
    There is various software from PARAGON, Tuxera and NTFS-3G
    When you get the data off and have verified it to be good, reformat the drive either HFS+ for Mac use only, or for Mac and PC use then MSDOS (FAT32) for under 4GB files (best) or exFAT (for larger than 4GB files) is proprietary and Microsoft is appling for a patent, which would likely mean OS X won't be allowed to read it anymore without a licensing fee and you'l have to pay another third party software company to read the format, just like NTFS is.
    The less you have to rely upon third party sources to read your drives the better, this way if you have a issue and need to read the drive on another machine you don't need the software, and a internet connection and a credit card and...and...and...

  • Mac Book Pro 13" LPTP-Photo Booth Recorded Video File won't find my video/movie that I recently recorded from Sun 9-1-13. Is there a way I can retrieve the files under the Time Machine or will I need to download something for iPhoto Booth?

    I have been having the most difficult times with the use of iPhoto Booth for recording movie files of church services. It seems if I make a rename on the files, for some odd reason, I cannot find it in any of my Files Folders in Finder. I need to know is there a more simple way to retrieve movie files thru iPhoto Booth or is there something I may can download to fix this issue? Also, is there a way the videos can be flipped around to not a mirror image, but to a reverse camera? Please anyone who recognizes this problem, contact me ASAP. Thank you for your support!

    You used the data.  Verizon can not see what it was sued for.  However your phone can see whats apps used the data.  go to settings-data usage- there will be a place that says data usage cycle.  line the dates up with your cycle.  then there will be a bar graph below that   extend bother white bars one all the way to the left and one all the way to the right.  after those are extended below that will be a list of apps,  there should be one that used over 2 gb and that will show you what app used that data in her purse

  • My music files etc were all located on my old laptop which was stolen. I have just plugged my iphone in to my new computer and it has deleted all my files. Has anybody got any ideas on how to retrieve the files?

    My music files etc were all located on my old laptop which was stolen. I have just plugged my iphone in to my new computer and it has deleted all my files. Has anybody got any ideas on how to retrieve the files?

    WINDOWS?
    Connect the iPod to your PC. If iTunes starts syncing (ie erasing) your music automatically, hit the X in the upper right hand corner of iTunes display, to the left of the search box, to stop it.
    In Control Panel, Portable Media Devices, double-click your iPod.
    In the Tools menu -> Options, in the View Tab, check "Show hidden files and folders."
    Navigate to the Music folder. On my 'pod, the full path is
    Portable Media Devices\NAME of IPOD (F:)\iPod_Control\Music
    Select all the music folders, and drag and drop them into a folder on your hard drive, or directly into iTunes.
    And you're done! The iPod music folder structure is strange and inexplicable, but once you move your files into iTunes you can set it to automatically organize your folder by artist and album to clean that up. (To do this, in iTunes Edit menu, choose Preferences and in the Advanced tab, check "Keep iTunes Music Folder organized."
    might be out of date worth a try

  • How to restore/retrieve my files from external HD backed up by Time Machine

    I'm recently a victim of car theft and my MacBook Pro, iPad 2 and external hard drive was stolen from the car. A friend of mine is lending me his MacBook Air to temporary use until I get a new MBP. I use Time Machine and Time Capsule to do frequent back up of all my files. I am attempting to restore my files on this MacBook Air, but I need assistance in trying to retrieve files/information from the external hard drive that I have attached to my MacBook Pro. My previous research on Time Machine/Time Capsule is that it will also back up external hard drive as long as they are attached/mounted to my MacBook Pro during back-ups.
    How do I restore/retrieve the files or folders from my external hard drive using Migration Assistant. Do I need to get another external hard drive? Should I get the same exact brand and type of external hard drive?
    I hope that someone can help me with this? Like most of us, my entire life's work in on my computer and hard drive. I need to be able to retrieve this valuable information.
    Thank you everyone for taking the time to help m

    Sorry you had such an experience.. not the first I have heard..
    Having your entire life on the laptop is a concern!!
    The pondini knowledgebase will give you an excellent starting point. as recovery is not necessarily simple in this scenario.. as the external drive might or might not have been backed up depending on the settings..
    http://pondini.org/TM/FAQ.html
    Look at Q14-20
    Particularly 16 to restore to alternative location.
    You will probably need another disk, just because the disk in the air is small. It does not have to be the same size or model.. just get one big enough to restore everything.

  • Retrieving the file name in the adapter module in the sender file adapter

    hi,
    i need to retrieve the file name, in the adapter module. This module is placed in the sender file channel.
    After the file adapter has picked up the file from the file directory, the file is placed in the archived directory.Custom adapter mofule is place in the file shanel. i need to retrieve the file name of the file in the adapter module. Is it possible to retrieve the file name?
    Also is it possible to retrieve the archive directory path in module?
    Regards,
    Meenkashi

    Hi Meenakshi,
    I guess you are looking for this
    /people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
    Regards
    Suraj

  • Is it possible to retrieve deleted files from the cloud i.e. contact list?

    Is it possible to retrieve deleted files from the cloud i.e. contacts?

    If you have an iCloud backup of an iOS device that was made while the contacts were still on it, you may be able to restore them from the backup by following this user tip from Winston Churchill: https://discussions.apple.com/docs/DOC-4841.

Maybe you are looking for