Files appended but not loaded

Hi
I have created a save function in my program to save new data and append it at the end of a single file. Here is the code.
private void SaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaveActionPerformed
       Vector<PointOnFret> vectorToSave = gPanel1.getFretPointsVector();
       String chordName = JOptionPane.showInputDialog("Enter chord name");
       Chord  chordToSave = new Chord();
       chordToSave.setName(chordName);
       chordToSave.setPositions(vectorToSave);
     try{
            FileOutputStream fis = new FileOutputStream(FILENAME,true);           
            ObjectOutputStream out = new ObjectOutputStream(fis);           
            out.writeObject(chordToSave);
            out.flush();
            out.close();
     catch(IOException ioException)
        JOptionPane.showMessageDialog(null, "Error opening File","Error",JOptionPane.ERROR_MESSAGE );
    }But I think the save works just fine...
Probably the problem is in the loading of the vector that contains those records in the file.
It loads the name of the first record of the file but does not open it...
private String [] loadChordsVector()
        try
            FileInputStream fis = new FileInputStream(FILENAME);
            ObjectInputStream ins = new ObjectInputStream(fis);
            int records  = 0;
            boolean read = true;
             Chord savedChord  = null;
            do
                 records++;
                 savedChord = (Chord)ins.readObject();
                 if(savedChord != null)
                     chords.add(savedChord);
            }while(savedChord == null);
            ins.close();
            System.out.println("Records "+ records);
            String [] chordNames = new String[chords.size()];
            for(int i = 0; i < chords.size(); i++)
                Chord chord = chords.get(i);
                chordNames[i] = chord.getName();
            return chordNames;
        catch (ClassNotFoundException ex) {
            Logger.getLogger(GFriendView.class.getName()).log(Level.SEVERE, null, ex);
            String[] dummy = {"Test"};
            return dummy;
        catch(IOException ioException)
            ioException.printStackTrace();
            JOptionPane.showMessageDialog(null, "Error opening File","Error",JOptionPane.ERROR_MESSAGE );
            String[] dummy = {"Test"};
            return dummy;
    }Can you pls tell me where do you see something wrong?
I'm a bit confused

I don't really understand your problem, but it seems to me your while condition is not logical.

Similar Messages

  • HT1661 My mid-2009 MacBook Pro has just died via a painful (for me) hard drive failure. I backed up a good percentage of files recently but not enough to keep me happy.  I need to access the dead drive on the MBP via a 2008 iMac. Best options?

    My mid-2009 MacBook Pro has just died via a painful (for me) hard drive failure. I backed up a good percentage of files recently but not enough to keep me happy.  I need to access the dead drive on the MBP via a 2008 iMac. Best options?
    I have ordered a 800 firewire to 800 firewire cable and am hoping to use the target mode option to copy files from the MBP.
    Is this possible?
    Hope so!
    Any advice and or help would be greatly appreciated.
    Many thanks,
    Neil

    Thanks Ogelthorpe.
    Just bought an enclosure to try that also.
    Hoping the MBP isn't really dead but just feigning death
    Fingers crossed.

  • I received a replacement iPad. On my original iPad I had dozens of books and PDF's. I completely backed up my original iPad. The categories of my iBook files transferred but NOT the actual PDF and Books. Please help.

    I received a replacement iPad. On my original iPad I had dozens of books and PDF's. I completely backed up my original iPad. The categories of my iBook files transferred but NOT the actual PDF and Books. Please help.

    Are the PDFs and ibooks on your computer's iTunes ? If so then you should be able to re-sync them, if not then you can re-download ibooks for free as long as they are still available in the store and you use the same iTunes account as you originally used to buy them : http://support.apple.com/kb/HT2519 . The backup doesn't contain the contents of the ibooks app, so for them to be restored to the device they needed to be in your iTunes library.

  • Certain songs will sync but not load?

    Certain songs in my recently added will sync to my iPhone but not load (i.e. titles are in gray, will not play when I click on them). How can I fix this? All of the songs are checked, I have tried with my iCloud on and off and it won't work either way.

    Have you tried restoring your iPod? For details on how to do that, see this article:
    Restoring iPod shuffle to factory settings
    If you are having problems with restoring the iPod, then you can try downloading the iPod Reset Utility 1.0, and basically restoring your iPod through there.
    To download it, go here:
    iPod Reset Utility for Windows - 1.0</font color</a>
    -Kylene

  • Extra jar fetched but not loaded ?

    Hi there !
    I have a very strange issue. I have planned to use JNLP to "deploy" a Java application via HTTP, but I ran into some issues I was able to reproduce even using very simple projects (e.g. a Blank desktop app).
    The problem I have is that even though the JNLP file and all the resources are fetched correctly via HTTP (see Apache logs extracts below), the Java Console tells me it couldn't load a class although the jar file containing it is loaded correctly.
    Here is the JNLP file (even with such a basic JNLP it fails) :
    <jnlp codebase="http://lt087/dev/TestValidation/" href="launch.jnlp" spec="1.0+">
    <information>
    <title>ValidationApp for example purposes</title>
    </information>
    <update check="background"/>
    <resources>
    <j2se version="1.5+"/>
    <jar href="TestValidation.jar" main="true"/>
    <jar href="lib/appframework-1.0.3.jar"/>
    <jar href="lib/swing-worker-1.1.jar"/>
    </resources>
    <application-desc main-class="validationapp.TestValidationMainApp" />
    <security>
    <all-permissions/>
    </security>
    </jnlp>
    Here are the apache logs to confirm the files are fetched correctly :
    172.29.55.147 - - [23/Nov/2010:09:55:25 +0100] "GET /dev/TestValidation/launch.jnlp HTTP/1.1" 200 677 "-" "JNLP/6.0 javaws/1.6.0_22 (b04) Java/1.6.0_22"
    172.29.55.147 - - [23/Nov/2010:09:55:25 +0100] "GET /dev/TestValidation/TestValidation.jar HTTP/1.1" 200 119374 "-" "JNLP/6.0 javaws/1.6.0_22 (b04) Java/1.6.0_22"
    172.29.55.147 - - [23/Nov/2010:09:55:25 +0100] "GET /dev/TestValidation/lib/swing-worker-1.1.jar HTTP/1.1" 200 13258 "-" "JNLP/6.0 javaws/1.6.0_22 (b04) Java/1.6.0_22"
    172.29.55.147 - - [23/Nov/2010:09:55:25 +0100] "GET /dev/TestValidation/lib/appframework-1.0.3.jar HTTP/1.1" 200 272709 "-" "JNLP/6.0 javaws/1.6.0_22 (b04) Java/1.6.0_22"
    And here is the exception I'm getting (after the dialog asking me to trust the editor) :
    java.lang.NoClassDefFoundError: org/jdesktop/application/SingleFrameApplication
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClassCond(Unknown Source)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.access$000(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
         at com.sun.javaws.Launcher.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: org.jdesktop.application.SingleFrameApplication
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         ... 16 more
    I have tried running it from a stock VM running a standard 1.6.22 JRE but I had the same issue, does anyone have an idea why it fails ?

    So you are saying that JaNeLA showed no red errors at the end of the changes?
    As an aside, please use the code tags for code, XML/HTML or input/output. How to do it is described on the sticky post at the top of the forum listing. Here is how the code tags make XML appear..
    <!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN" "http://java.sun.com/dtd/JNLP-6.0.dtd">
    <jnlp spec="6.0+" codebase="http://lt087/dev/TestValidation/" href="launch.jnlp">
    <information>
    <title>ValidationApp</title>
    <vendor>Example Inc</vendor>
    <homepage href="http://www.example.com"/>
    <description>Application de test pour validation</description>
    <description kind="short">Validation App for example purposes</description>
    <offline-allowed/>
    </information>
    <security>
    <all-permissions/>
    </security>
    <update check="always" policy="always" />
    <resources>
    <java version="1.6+" href="http://java.sun.com/products/autodl/j2se" />
    <jar href="TestValidation.jar" main="true"/>
    <jar href="lib/appframework-1.0.3.jar"/>
    <jar href="lib/swing-worker-1.1.jar"/>
    <jar href="lib/sqljdbc4.jar"/>
    </resources>
    <application-desc main-class="validationApp.TestValidationApp" />
    </jnlp>Ahh.. and now I see it formatted, I note you have raised the minimum Java to 1.6, yet still include the swing-worker-1.1.jar. It would seem unnecessary.
    What is the output of ?..
    prompt> jar -tf appframework-1.0.3.jar

  • ODI - IKM SQL to File Append - Header not Generated

    I'm using ODI IKM SQL to File Append to create a text file, but the header is not being generated. And the GENERATE_HEADER is set to Yes. The file is Tab delimited and the Heading (number of lines) is set to 1.
    Seems to only be an issue with HFM files coming from the Unix server.
    Any suggestions?
    Thanks, Mike

    Ok, getting the following error in step 6 - Integration - HFM_EA_Translate - Insert Column Headers
    java.lang.NumberFormatException
         at java.math.BigDecimal.<init>(BigDecimal.java:459)
         at java.math.BigDecimal.<init>(BigDecimal.java:728)
         at com.sunopsis.sql.SnpsQuery.updateExecStatement(SnpsQuery.java)
         at com.sunopsis.sql.SnpsQuery.addBatch(SnpsQuery.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.h.y(h.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Thread.java:662)
    The last two columns in the file are numeric which seems to be causing the issue. Will change formatting for the two columns (String, Numeric, etc.) to see if I can resolve the header issue.
    Thanks,
    Mike

  • Some files in HTMLResources not loading in single edition developer app

    Good day again.
    I have created a single edition app and it works perfectly when tested in Content Viewer. The moment I install the Developer .ipa  the PDF files I loaded in the HTMLResources.zip folder does not load.
    Any ideas what I did wrong?
    Thanks

    Anyone? I installed  DPS v32.1 hoping that will solve the problem but still no joy.
    The Single Edition app I build works fine on both iOS7 and 8 when viewed in the Content Viewer, but as soon as I download the Developer App the PDF files I embedded in the HTMLResources.zip file does not load?
    Please, any help out there?
    Stefan

  • Muvo Slim download mp3 files only but not playing!

    i just bought this Muvo Slim with 256MB memory.. if i plugged it on my computer it can be opened and still can download files.. but once you remove it from the computer, it wont open.. even the opening logo nor the the blue backlight won't open!, it started acting this way right after i plugged it on my friends mp3 (not creative) player.. it has a USB output connector, and 5volts output which is the voltage as a regular USB provides!.. can this still be fixed?.. cause i did tried loading the uograded firmware, and it did recognize the player, but when disconnected to the computer it just went blank!.. need help here! thanks!

    On Linux you need proper GStreamer support to play mp3 files with the HTML5 media player.
    *media.gstreamer.enabled = true
    *Bug 794282 - Enable GStreamer in official builds

  • Swf file works but not html when preview and publish

    hi,
    i made a simple nav bar with a dropdown menu it works fine in flash mode and preview but when i try to embed into html it only show the nav bar but not the dropdown menu. please advice.
    thanks in advance!

    http://lunarvision.zxq.net/banner_flash_test.swf // the swf file
    http://lunarvision.zxq.net // when it on the website.
    thanks!

  • Can connect to airport but not load internet page

    I can connect my PS3 and window based laptop to my airport network, as both show successful connection, but I can not load internet page on either the PS3 or the laptop. My airport network is not protected. My airport base station is about 7 years old.

    Well the symptoms now point to a number of issues that need to be eliminated and they are you need to check that you are logged onto the ISP. For always ON systems this is usually a function of the Router in which case you need to log onto the Router and check the appropriate settings for this function also release the lease on the IP address and reboot the Router. The other issue is that the Router may not have access to the ISP which may cabling problem [disconnected or accidently damaged cable] within your environment of a service problem within the ISP domain. Check with a neighbour who is subscribed to the same Exchange as you are to see if they have problems otherwise call your Service Provider they may have to perform a reset on their end of your connectivity. Good luck
    Message was edited by: adnixon

  • I've set the download settings to always ask where to save a file, and it will do that for some file extensions, but not for others. How can I fix this?

    I've noticed it especially with .pdf files, which always end up on my desktop, even after I double check the download settings under Preferences and then restart Firefox, just in case. Also, when I download .pdf files they will automatically open, but when I download .doc files they do not. I would rather not have downloaded files automatically open, but I can't find how to change that setting either.

    You can check for problems with preferences.
    Rename or delete the prefs.js file and possible numbered prefs-##.js and user.js files to reset all prefs to the default value.
    *http://kb.mozillazine.org/Preferences_not_saved
    *http://kb.mozillazine.org/Resetting_preferences

  • Problem with .sitx files (Safari but not Firefox???)

    Hi All,
    I have a website online (with help from iWeb and BBEdit) but am having a problem I cant figure out (this IS my first website!)
    I am hoping that someone much more knowledgeable than me can help me with it.
    I basically have a download section. Icons and desktops.
    Now, when I (or anyone else) tries to download- everything seems to be fine in FireFox (even IE!) but not in Safari.
    My desktops are compressed as .zip files. No problems there, everyone can download and open (including Safari users!)
    My icons are compressed as .sitx files. This is where the problems come in. Firefox and IE download them no problem ('save to disk?' etc) However when one attempts to download the icons (.sitx files) with Safari it simply displays pages of gibberish (starting with the word 'Stuffit') which I am presuming is Safari trying to 'display' the contents of the actual stuffit file.
    Why is this? Why wont safari simply download the .sitx files as it does .zip files?
    Does Safari have some sort of inherent problem with .sitx files? Is it some sort of configuration within Safari preferences? or (and probably most likely!) is it something I have done wrong?
    Oh, my website (page in question!) can be found here:
    http://aoimedia.co.uk/news/news.html
    Thanks in advance for all your valuable help
    Kind regards
    John
    12 G4 Powerbook/Superdrive. (she's named Skates!) Mac OS X (10.4.4)

    Hi,
    It sounds like the server the website/file is hosted on is not identifying the type correctly. As you've seen, different browsers will handle this situation differently.
    Have a read of this article:
    http://www.macosxhints.com/article.php?story=20040211102018600
    Hope that helps.

  • HP 4500 printing file name but not the context

    I have an hp 4500 connected to my router via an rj45 and have a laptop connected via wireless to my router. When I print a document from word it prints the file name and not the context.
    I have also tried to print an image but the same happen the file name got printed.  
    can any one help how i print the context on the file and not the name?
    is it due to my BT router?

    BT routers don't play well with HP printers, sorry.
    However, before we blame the BT, re-install the HP software from the "Support & Drivers" link at the top of this page.
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • Deploy WAR file - Servlets are not loaded

    Hi,
    I deploy a WAR file through a Application server console. The Deployement was successful. I restart the oc4j and http servers. After that i check the status, The servlets are NOT LOADED. Pls anybody provide a solutions.
    Thanks!

    Did you ever call them? Only then they're loaded - assuming you are looking at the status, using OEM

  • I can send vars to php but not load

    My AS2 script:
    var sen = new LoadVars();
    sen.nam = "mycont";
    sen.wor = "test";
    myvar = sen.wor;
    And I got a button with the script:
    on (release){
    _root.sen.sendAndLoad("this.php", _root.sen, "POST");
    And a textbox with the var "myvar".
    My PHP content is:
    <?php
    $myf = "that.html";
    $cont = $_POST['nam'];
    $write = fopen($myf,"w+");
    $wor = fread($write, filesize($myf));
    $vars = "wor=" . $wor ;
    echo $vars;
    fwrite($write, $cont);
    fclose($write);
    ?>
    When running it the send is succesfull because I can see that
    it edits my file.
    But nothing is get into my textbox.
    Whan is the problem? I try to fix it two hours already.
    Thank yo for your help...

    well, first myvar is going to have a value of "test", but
    that doesn't mean anything's been received from your php file
    because you're assigned rec to have a property of wor that has a
    value of "test".
    if you're not seeing that, you have a problem that has
    nothing to do with your php file: you don't have a visible
    textfield that has variable myvar.
    second, you don't want to assign any properties to rec. you
    want those properties to be assigned by your php file so you can
    retrieve feedback from your script, including assurance that it
    executed properly.
    further, you don't want to use the code i showed. i
    mistakenly thought you wanted to send wor and its value to your php
    script but there's no reason for that. so remove that
    sen.wor="test" line of code.
    finally, you probably don't have a way to check the trace()
    functions output so you can't see if everything is working. instead
    of using trace(src), use myvar=src and make sure myvar is an
    existing visiable textfield variable. (or, even better, use a
    textfield instance name and assign its text property.)

Maybe you are looking for

  • How to Create a batch file to display and count specific words in log file

    Hi All, I have requirement Program to be written that will go through a log file and look for following key words. Unexpected Essbase error And also it will count the # of times the word error appear in a log file. You may use batch file or Perl scri

  • Why does Google Search not work with FF14.0.1?

    <blockquote>Locking duplicate thread.<br> Please continue here: [[/questions/934886]]</blockquote> When I use Google Search, no matter what I type in, this is all that shows up: http://i20.photobucket.com/albums/b232/emerald_typhoon/Example1.jpg If I

  • Help with Keywording a group of Images

    I need help applying keywords to a group of selected images. For some reason I can't get this to work. I've done it before and now it won't work. Here is what I'm doing. I've selected a group of images in a project by using shift and clicking the fir

  • N70 Won't Boot Up

    Hi, I was in the middle of sending a text message earlier when my N70 froze. None of the keys would work and it would not turn off. I had to take out the battery. The phone won't boot up now though. It keeps hanging on the Nokia Welcome Message. I tr

  • Extend-TCP client not failing over to another proxy after machine failure

    I have a configuration of three hosts. on A is the client, on B & C are a proxy and a cache instance. I've defined an AddressProvider that returns the address of B and then C. The client just repeatedly calls the cache (read-only). The client configu