OutOfMemoryError while using File.list()

I'm facing OutOfMemoryError while using file.list(). Below is the description of the requirement
We have a directory structure of the following format -
**sourcedir\<date folders>\No Retry\<reason folders>\..\..\....\<*.ini files>**
sourcedir will be passed as argument to the program. The directories present in between "<>" can be in multiples of 10. The *.ini files can be in multiple of lacs in each directory.
The program is required to browse through the directory structure and look for *.ini files. The *.ini files are parsed for some data which needs to be stored in data base. We are using "File.list()" to load the name of files and FileFilter to find *.ini" files. As the number of files are huge the program is throwing OutOfMemoryError. We have increased heap space, it solved the problem. But we are looking for a solution which will not throw this error in future as the number of files may increase.
Can you please suggest us a technique to solve this permanently as we are beginners to java.

I suggest you try using a memory profiler to see where your memory is being used.
The problem you suggest shouldn't consume so much memory.

Similar Messages

  • How to return only filename without extention using File.list() ?

    I want to return every filename into an array using File.list() However I want my return String array to be filtered out file extention. That means only return file name without extention. How? Please advice! Thanks.

    Use the following method for every file in the list (it's from the top of my head so maybe there are a few typos):
    private String getNameWithoutExtension(File f) {
        String s = f.getName();
        String name = s;
        int i = s.lastIndexOf('.');
        if (i > 0 &&  i < s.length() - 1) {
            name = s.substring(1, i);
        return name;
    }

  • Most Recent Used File List

    Hi,
    Does anyone know how to create List of most recent used files and display it in the main menu?
    Has anyone done that?
    Currently, I am opening one file at the time and I have the last
    path of opened file.
    thanx !

    You could recurse over the file system, creating a bunch of File objects, which you'd stick into a List. Then create a comparator that sorts the objects by File.lastModified() value, descending.
    Then you'd have a sorted list, from which you could easily take the N most recent files.
    Of course, the recursing would take a while. You may want to put creation and/or updating of this list, into a low priority thread.

  • Using File.list()

    Hi,
    Im using FMS 3 on the server side when onConnect occures i
    need an array of all file that is the directory root/streams/myApp
    how do use the File.list() ? do i need to create a new file
    just for getting the list of files of the directory? and how do i
    get to do that on the directory i want ? is it like this:
    File.list(function(name){ return
    name.indexOf("streams/myApp/")!=-1);
    i so the example in the doc files :
    var a = x.currentDir.list(function(name){return
    name.length==3;});
    does x is a File object? and where the currentDir came from
    its not a File property?
    Please help ...

    In SSAS, File objects represent both files and directories.
    The "x" in the examples just means "arbitrary thing that has
    a member of whatever type we're talking about." In this case, "x"
    is something that has a member called "currentDir" that's a File
    object (presumably representing the current directory).
    I'm pretty sure you can create an equivalent like this:
    currentDir = File(".");
    Also, your search isn't going to work the way you expected.
    The find function doesn't search all subfolders recursively, and
    the name parameter only gets the filename (the last component of
    the path), not the entire pathname. You're going to want to open
    streams/myApp as a File, then just list everything in it.

  • Most Recent Used File List in Menus

    Hi,
    Does anyone know how to create List of most recent used files and display it in the main menu?
    Has anyone done that?
    Currently, I am opening one file at the time and I have the last
    path of opened file.
    thanx !

    Offhand, you'll have to do it the hard way. I don't think Swing or Awt provide a default JMenuItem(), MenuItem() that does the file list. Now that you mention it, it does seem like an interesting project to do.
    You essentially need an array of the files, and for each file, create the associated menu entry, as in:
    String entryName = files[ i ];
    if ( entryName.length > 10 ) {
       entryName = entryName.subString( 0, 10 );
    JMenuItem entry = new JMenuItem( i + ". " + entryName );
    ...and define the event listeners however appropriate for your application.

  • ERR: EXCEPTION_DURING_EXECUTE while using FILE CONTENT CONVERSION

    Hi,
    I'm trying a file to file scenario with File Content Conversion for Sender communication channel. But am getting the following error in SXMB_MONI
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area=<b>"MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code> </b>
      <SAP:P1>com/sap/xi/tf/_MM_ContentBased_</SAP:P1>
      <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException</SAP:P2>
      <SAP:P3>RuntimeException in Message-Mapping transformatio~</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>During the application mapping com/sap/xi/tf/_MM_ContentBased_ a com.sap.aii.utilxi.misc.api.BaseRuntimeException was thrown: RuntimeException in Message-Mapping transformatio~</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    I tried the same message mapping for normal file to file scenario without using File Content Conversion. It went through fine.
    <b>Our file structure follows</b>
        <Header>
          <Sysnum>01</Sysnum>
       </Header>
       <Body>
          <Name>ABCDE</Name>
          <Age>25</Age>
          <Stream>XYZ</Stream>
       </Body>
      <b>The Sender Communication Channel Parameters follows:
    </b>
      Recordset Str:  Header,1,Body,1
      Header.fieldFixedLengths : 2
      Header.fieldNames : Sysnum
      Body.fieldFixedLengths : 5,2,3
      Body.fieldNames : Name,Age,Stream
      ignoreRecordsetName : true
      Looking for a solution
    Thanks,
    Ajay.

    Hi Ajay,
    your message mapping failed.
    Copy the XML message from monitoring and exectute the mapping in Integration Builder with maximal trace to get the reason.
    Regards,
    Udo

  • Remove Line feed at the end of the file while using file adapter

    Hi All,
    I have a requirement. We are sending a file from SAP to FTP using file adapter. we are successful in sending the file to FTP but at the end of the file a extra blank line is created .
    Can anyone please suggest how to remove the extra line feed at the end of the file.
    Thanks and Regards,
    LRK.

    check this:
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/frameset.htm
    To define an additional string as a separator after the last column in a row, specify it here. The system skips this string when it processes the last column (otherwise the system would treat it as part of the last column).
    Also there are solved threads which deal with same problem....you can even check them out...
    regards,
    Abhishek.

  • How to download subtotals into xl sheet while using alv list display

    hi all,
    i have a reqiurement i.e.
    iam displaying the data by using alv list display. i have one option called Download in my PF-STATUS.when i click this button it downloads the data .now my requirement is when i cllick on subtotals list displays asubtotals according to the sales order no.now i click doenload button then it has download the data into xlsheet with subtotals and grandtotals.
    anybody can send me the sample code plz.
    thanks,
    maheedhar.t

    Hello Maheedhar
    Using ALV lists you do not need a special function for downloading. Simply calculate the totals and subtotals on your ALV list and then press the (toolbar or menu bar) button <b>"Print Preview...".</b>
    The print preview display a "flat" list including the subtotals that can be downloaded to Excel.
    Regards
      Uwe

  • IMP:ClassCastException while using File upload UI in Webdynpro for java

    Hi All,
    I have used a FileUpload UI element in my screen , which is working fine for only the first time we upload a file. If we try to upload any file with out refreshing the application , a ClassCastException is being thrown. Please help me in resolving the issue.
    Thanks in advance.
    Srikanth

    Thank you!!
    1. But when i use the File Upload UI and try to use the 'data' property to retrieve the bytes i am getting a null pointer exception meaning the data is not being picked up by the UI even though browsed file has data.
    2. How I am I supposed to set the 'Resource' property while downloading a PDF which has UTF-16 text and picture??
    Note: I have done the same scenario using WD04 java without any trouble.
    reg
    vln

  • Error while using File Upload through Frontend

    Hi,
    I need to upload an EXcel file , read the content and save the data to a db table. I used the
    <htmlb:fileUpload id = "FileUpload"
                                onUpload    = "HandleUpload"
                                upload_text = "Upload"
                         size        = "40"  />
    But while calling the function for clipboard
    CALL FUNCTION 'CLPB_IMPORT'
        TABLES
          data_tab   = excel_tab
        EXCEPTIONS
          clpb_error = 1
          OTHERS     = 2.
      IF sy-subrc <> 0.
        MESSAGE a037(alsmex).
      ENDIF.
    It is throwing the 'message a alsmex 037 cannot be processed in plugin mode https'. Can you pleas guide me how to rectify this problem. Is there a note for this?
    Regards,
    Shiny

    Hi Shiny,
    Did you ever come across a solution to this problem? I'm having the same issue myself.
    I have a function module that transfers the data from an excel file into database tables and when I try to call the FM from a BSP page I get the same error
    Message A ALSMEX 037 cannot be processed in plugin mode HTTP
    Just wondering if you ever solved this or found another way of uploading excel using BSP?
    Thanks,
    Darren

  • "Root element is missing." - While using Sharepoint List Source in SSIS.

    Hi Team,
    We are trying to import data from sharepoint list using sharepointlist source in SSIS. But the following error pops-up.
    [SP_SRC_SharePointList [67]] Error: System.Xml.XmlException: Root element is missing.
       at System.Xml.XmlTextReaderImpl.Throw(Exception e)
       at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
       at System.Xml.XmlTextReaderImpl.Read()
       at System.Xml.XmlReader.MoveToContent()
       at System.Xml.Linq.XElement.Load(XmlReader reader, LoadOptions options)
       at System.Xml.Linq.XElement.Parse(String text, LoadOptions options)
       at System.Xml.Linq.XElement.Parse(String text)
       at Microsoft.Samples.SqlServer.SSIS.SharePointListAdapters.SharePointListSource.PrimeOutput(Int32 outputs, Int32[] outputIDs, PipelineBuffer[] buffers)
       at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPrimeOutput(IDTSManagedComponentWrapper100 wrapper, Int32 outputs, Int32[] outputIDs, IDTSBuffer100[] buffers, IntPtr ppBufferWirePacket)
    We are unable to debug / move any further. Request your help.
    Thank you.
    Best Regards,
    Gayathri

    It appears that the XML you trying to load does indeed not have the root element.
    E.g.
    <?xml version="1.0" encoding="UTF-8"?>
    <iii>
    <kkk>test</kkk>
    <ppp>000</ppp>
    </iii>
    <iii>
    <kkk>test</kkk>
    <ppp>000</ppp>
    </iii>
    <iii>
    <kkk>test</kkk>
    <ppp>000</ppp>
    </iii>has nonemust be<?xml version="1.0" encoding="UTF-8"?>
    <Root><iii>
    <kkk>test</kkk>
    <ppp>000</ppp>
    </iii>
    <iii>
    <kkk>test</kkk>
    <ppp>000</ppp>
    </iii>
    <iii>
    <kkk>test</kkk>
    <ppp>000</ppp>
    </iii></Root>
    Arthur My Blog

  • How do I edit the Screen Sharing 'Most Recently Used' files list ?

    I have recently added a mac mini to the network at home, and will be using this as a headless device. I am connecting remotely (using screen sharing) which works well. I have set the Sceeen Sharing icon to remain permanently visible on the dock, ad by right clicking, I get a list of the most recently used shares.
    The trouble is, that some of theses shares no longer exist, and tghere is also some duplication.
    I would like to edit this list, but cannot find out how to do it.
    Can anyone help please ?
    Thanks
    Geoff
    PS - The same principle applies to a number of other programs that retaim n MRU lst on their dock icon - how can these be edited.

    This doesn't apply to me anymore.

  • Getting error in while using  File Events Notification....

    Hi all,
    I want to monitor a folder using C++, i tried with the sample code given in http://blogs.sun.com/praks/entry/file_events_notification
    I'm getting the following error...
    "find.c", line 40: incomplete struct/union/enum file_obj: fobj
    "find.c", line 49: undefined symbol: FILE_ACCESS
    "find.c", line 52: undefined symbol: FILE_MODIFIED
    "find.c", line 55: undefined symbol: FILE_ATTRIB
    "find.c", line 58: undefined symbol: FILE_DELETE
    "find.c", line 61: undefined symbol: FILE_RENAME_TO
    "find.c", line 64: undefined symbol: FILE_RENAME_FROM
    "find.c", line 67: undefined symbol: UNMOUNTED
    "find.c", line 70: undefined symbol: MOUNTEDOVER
    "find.c", line 88: undefined symbol: FILE_EXCEPTION
    "find.c", line 89: undefined struct/union member: fo_name
    "find.c", line 89: warning: improper pointer/integer combination: arg #1
    "find.c", line 91: improper member use: fo_name
    "find.c", line 91: undefined symbol: errno
    "find.c", line 92: improper member use: fo_name
    "find.c", line 92: warning: improper pointer/integer combination: arg #1
    "find.c", line 102: undefined struct/union member: fo_name
    "find.c", line 102: warning: improper pointer/integer combination: arg #2
    "find.c", line 106: undefined symbol: FILE_EXCEPTION
    "find.c", line 107: improper member use: fo_name
    "find.c", line 107: warning: improper pointer/integer combination: arg #1
    "find.c", line 115: undefined struct/union member: fo_atime
    "find.c", line 115: assignment type mismatch:
    int "=" struct timespec {long tv_sec, long tv_nsec}
    "find.c", line 116: undefined struct/union member: fo_mtime
    "find.c", line 116: assignment type mismatch:
    int "=" struct timespec {long tv_sec, long tv_nsec}
    "find.c", line 117: undefined struct/union member: fo_ctime
    "find.c", line 117: assignment type mismatch:
    int "=" struct timespec {long tv_sec, long tv_nsec}
    "find.c", line 118: warning: implicit function declaration: port_associate
    "find.c", line 118: undefined symbol: PORT_SOURCE_FILE
    "find.c", line 125: undefined struct/union member: fo_name
    "find.c", line 125: undefined symbol: errno
    "find.c", line 126: improper member use: fo_name
    "find.c", line 126: warning: improper pointer/integer combination: arg #1
    "find.c", line 140: warning: implicit function declaration: port_get
    "find.c", line 146: undefined symbol: PORT_SOURCE_FILE
    "find.c", line 146: non-constant case expression
    "find.c", line 170: warning: implicit function declaration: port_create
    "find.c", line 196: undefined struct/union member: fo_name
    "find.c", line 196: warning: improper pointer/integer combination: op "="
    "find.c", line 205: undefined symbol: FILE_ACCESS
    "find.c", line 205: undefined symbol: FILE_MODIFIED
    "find.c", line 205: undefined symbol: FILE_ATTRIB
    "find.c", line 217: warning: implicit function declaration: close
    "find.c", line 222: warning: implicit function declaration: thr_join
    can anyone help me in this..
    The following the version that i'm using in my Solaris
    Machine hardware: sun4u
    OS version: 5.10
    Processor type: sparc
    Hardware: SUNW,SPARC-Enterprise
    Please help me in this....

    rectified

  • Last used files of an appilcation in start screen

    Hello,
    I don't know if someone from Microsoft is reading this (I hope so) but I really would like to see a feature that shows the recent used files of an application in the start screen.
    I don't have that much problems with that start screen in general. But this is one of the features I miss when using the new start screen introduced with Windows 8. Just to be clear.
    I am asking for a feature which shows the last opened files of an application listed in the start screen. You can see this feature at the start menu in Windows 7 - this tiny black arrow right of an application. For example an arrow right of Microsoft Office
    Word which shows the last opened documents of Office Word.
    It could be implemented as a context menu sub-menu. But I guess you have got the better designers for fitting this feature somewhere (?).
    This feature is very important for me. This is the only reason I don't like the new start screen that much because I like the recent used file list of one specific application.

    On Tue, 25 Nov 2014 00:15:31 +0000, Markus Schuhmacher wrote:
    I don't know if someone from Microsoft is reading this (I hope so) but I really would like to see a feature that shows the recent used files of an application in the start screen.
    If you really want someone from Microsoft to see this suggestion then you
    need to file it using the feedback app.
    Paul Adare - FIM CM MVP
    We're standing there pounding a dead parrot on the counter, and the mgt.
    response is to frantically swap in new counters to see if that fixes the
    problem. -- Peter Gutmann

  • Removing Recent File List in Staroffice 7?

    I have been asked by a user to remove the Recently used file list in Staroffice 7. I cannot seem to find where this information is stored or a built in option to Clear the List
    Any Deas?
    Thanks

    Spot on Phil. I was looking for the wrong extension.
    I have now Created a Batch file to be run as and when to remove the file and my user seems happy with that.
    Thanks
    Michael
    Batch File Command used
    c:
    cd\
    cd C:\Program Files\StarOffice7\user\registry\
    del data\org\openoffice\Office\common.xcu /s

Maybe you are looking for

  • Oracle Upgrade to 9i for BO 5i

    I'm preparing for an Oracle upgrade from 8.1.6 to 9.2 and a unix server migration via Oracle Export / Import. Potentially going on to 10g at a later point. Will importing the BO user and re-pointing users to the new database be sufficient to upgrade

  • Matrix report in condensed mode in dot matrix printer

    How can we print a 10g matrix report in condensed mode in dot matrix printer? The dot matrix printer is a Epson LQ 1070+ printer. I am tried using a printer definition file and given printer codes in the report. The printing is not taking place in co

  • Display freezing on call

    I have a HTC Thunderbolt.  It has happened to me about 4 times so far, where I will be on a call and my phone display will freeze.  Or I will be on a call and the mute button will accidentally be hit and then freeze.  I would like to know how to fix

  • I can open all email attachments except .pdf.

    Until yesterday I could open all attachments. Now I can't open .pdfs.

  • What if my itunes won't let me open it

    Hello my itunes app won't allow me to open it how do I fix it?