File constructor and TimerTask

Hello.
I have two questions.
One is I need to create a file with the name of an image.
For example I have an image in the path classes/Ventanas/router.png.
This path is created when the classes are compiled.
I did the same in other class with the path
ImageIcon icononodo = new ImageIcon(Ventanas.PantallaRedJGraph.class.getResource("router.png"))
But when I try to do it whit File it doesn�t work.
File f = new File(Ventanas.PantallaRedJGraph.class.getResource("router.png").getFile());
Does anybody know anything about it?
And the other question is I have a class that extends Timer.
Inside this class I have a TimerTask
public class Sondear extends Timer{
String ipasondear;
public ConectorInterfaz conector = ConectorInterfaz.getInstancia();
final Runnable sondeo = new Runnable(){
     public void run(){
     //The code     
     }//run
};//sondeo
TimerTask repetirsondeo = new TimerTask(){
     public void run(){
     EventQueue.invokeLater(sondeo);
     }//run
};//repetirsondeo
public void sondeando(String ip){
     this.ipasondear = ip;
this.schedule(repetirsondeo, 0, 45000);
}//sondeando
I call this class from another class with the instruction.
for( //all the IP adresses){
Sondear s = new Sondear();
s.sondeando(//The ip);
My question is how can I stop this TimerTask for a period of time and call another time this class to pass another IP adresses?
I will be very grateful if somebody helps me.
Thank you very much and sorry for my english.

paulcw wrote: > Probably the file doesn't exist, at least not in the way you think it does and/or with the name you get from URL.getFile().
Why are you doing it that way? Is the file a jar file? If so you should use getResourceAsStream (and no File objects at all).
Also you should provide more details. What do you mean "it doesn't work"? Do you get an exception? If so you should post it with your question.
>>
Perhaps I didn`t explain it well. SorryI don�t get an exception. The image in my application doesn�t appear.
At first I have all .java files in a directory called src. And I have another directory with all my images.
When I execute the application I send the .class files to a directory called classes and the images to a directory called Ventanas.
I don�t know exactly how it is used the instruction
new ImageIcon(Ventanas.PantallaRedJGraph.class.getResource("imagename"));But in a previous application it works, so the image appears in the application.
You told me that how I did it this way.
I don�t know a lot about programming, so if there is a better way to do this with a File I will be very grateful if you say it to me.
paulcw wrote: > That seems unnecessary. Just instantiate a Timer and use it.
Your code in general seems unnecessarily complicated.
I'd suggest canceling that task, and then scheduling a new one later if you need it to run again. If the task contains state that needs to be preserved across the times that it runs, then put that state in a different object and pass that object to multiple TimerTask wrappers.
>
I have an application that sends ping to another computers and routers to see if there are connected to the network.
When the user press a button to scan the network, the application begins to look for devices and when it draws the devices connected I need that it begins to sends the ping instructions.
When the Scan button is pressed I don�t know if it is the first time the user press it or not.
What I want is that when the application is scanning the network I need to stop the Timer and restart it when the network is scanned. I need to stop all the Timers I send for all the IP addresses.
I also think that my code is a bit complicated but I don�t know another way to do it.
How can I see if an instance of this class is created?
I have a trouble in my mind.
I hope this time my explanation has been easy to understand. My English is a bit poor .
Thank you, thank you very much.

Similar Messages

  • File constructor and unicode filename issue

    I have issues with unicode filename.
    I need to create a File object from unicode file name "Юга.mp3" in order to use it in the code.
    File in=new File("Юга.mp3")
    AudioFile f = AudioFileIO.read(in);
    Tag tag = f.getTag();
    Anybody knows how to deal with a file or directory that is named using Unicode characters?

    1) Have you tried just reading the file as a file using a FileInputStream?
    2) What operating system?
    3) What Java version?
    4) What are the \uxxxx values of some of the problem characters?
    Edit: I have just run        String filename =  System.getProperty("user.home") + "/\u1070\u1075\u1072.mp3";
           File file = new File(filename);
           OutputStream os = new FileOutputStream(file);
           os.write("Hello World".getBytes("utf-8"));
           os.close();
           DataInputStream dis = new DataInputStream(new FileInputStream(file));
           byte[] buffer = new byte[(int)file.length()];
           dis.readFully(buffer);
           dis.close();
           System.out.println(new String(buffer,"utf-8"));on Unbuntu 7.10 using JRE/JDK1.6.0_3
    without any problems other than not being able to see the \u1070\u1075\u1072 in my console because I don't have fonts installed for displaying them.
    Edited by: sabre150 on Dec 28, 2007 8:52 AM
    Further edit: It also runs on Windows XP using 1.6.0_03 .
    Edited by: sabre150 on Dec 28, 2007 9:00 AM
    I don't think the file is located where you think it is!
    Edited by: sabre150 on Dec 28, 2007 9:02 AM

  • File load and save errors???

    hi,i'am unable to get my file to oad and save in this class.i get 5 errors 1."Exception java.io.FileNotFoundEception must be caught or be declared in the throws clause" 2."Incompatible type for constructor.Cant convert java.io.FileInputStream to java.util.Properties" 3."Undefined variable: FileInputStream" 4."Variable 'p' is already defined in this method" 5. Incompatible type for constructor.cant covert java.io.FileInputStream to java.util.Properties.can someone please show me how to change this so it will compile and work?thanks
    import cs1.Keyboard;
    import publication;
    import java.util.*;
    import java.io.*;
    public class publicationmain
    public static void main(String args[])
    PublicationContainer pubdatabase = new PublicationContainer();
    int userchoice;
    boolean flag = false;
    while (flag == false)
    File file = new File("publicationsList.txt");
    //1st error on line below
    FileInputStream inputStream = new FileInputStream(file);
    //2nd error here
    Properties p = new Properties(inputStream);
    String myPublicationID = p.getProperty("PublicationID", defaultValue);
    System.out.println("------------------------------------Publications--------------------------------");
    System.out.println();
    System.out.println("please Make a Selection");
    System.out.println();
    System.out.println("1 to add publication");
    System.out.println("2 to delete publication");
    System.out.println("0 to quit");     
    System.out.println("3 to View all publications");
    System.out.println("4 to Edit a publication");
    System.out.println();
    userchoice = Keyboard.readInt();
    switch (userchoice)     
    case 1:
    String PubName;
    String PricePerIssue;
    String Publisher;
    String Pubstatus;
    String Pubtype;
    int PubID;
    System.out.println ("Enter Publication ID:");
    PubID = Keyboard.readInt();
    System.out.println("Enter Publication Name:");
    PubName = Keyboard.readString();
    System.out.println("Enter Publisher Name");
    Publisher = Keyboard.readString();
    System.out.println("Enter Price per Issue:");
    PricePerIssue = Keyboard.readString();
    System.out.println("Enter Publication status");
    Pubstatus = Keyboard.readString();
    System.out.println("Enter Publication type:");
    Pubtype = Keyboard.readString();
    pubdatabase.add (new publication(PubID, PubName, Publisher, PricePerIssue, Pubstatus, Pubtype));
    break;
    case 0:
    //3rd error here
    FileInputStream = new FileInputStream(file);
    //4th and 5th error here
    Properties p = new Properties(inputStream);
    p.put("PublicationID", PubID);
    p.put("PublicationName", PubName);
    p.put("PublisherName" , Publisher);
    p.put("PriceperIssue" , PricePerIssue);
    p.put("PublicationStatus" , Pubstatus);
    p.put("PublicationType" , Pubtype);
    p.store(outputStream, "My Header");
    flag = true;
    case 2:
    System.out.println ("Enter Publication ID:");
    PubID = Keyboard.readInt();
    pubdatabase.remove (PubID);
    System.out.println ("publication: "+(PubID)+" removed");
    System.out.println();
    break;
    case 3:
    System.out.println (pubdatabase);
    break;
    case 4:
    System.out.println ("Enter Publication to be edited by Publication ID: ");
    PubID = Keyboard.readInt();
    pubdatabase.remove (PubID);
    String PubName1;
    String PricePerIssue1;     
    String Publisher1;
    String Pubstatus1;
    String Pubtype1;
    int PubID1;
    System.out.println ("Enter Publication ID:");
    PubID1 = Keyboard.readInt();
    System.out.println("Enter Publication Name:");
    PubName1 = Keyboard.readString();
    System.out.println("Enter Publisher Name");
    Publisher1 = Keyboard.readString();
    System.out.println("Enter Price per Issue:");
    PricePerIssue1 = Keyboard.readString();
    System.out.println("Enter Publication status");
    Pubstatus1 = Keyboard.readString();
    System.out.println("Enter Publication type:");
    Pubtype1 = Keyboard.readString();
    pubdatabase.add (new publication(PubID1, PubName1, Publisher1, PricePerIssue1, Pubstatus1, Pubtype1));
    break;
    default:
    System.out.println("Incorrect Entry");
    }

    i'm sorry to ask this, but how long are you programming in java ? not so long, right ?
    maybe you should first learn how the syntax in java is. maybe you should take a look at the java tutorial.
    the errors you get are simple, so normally you should be able to solve these problems yourself.
    and, if you want to post another message with the same topic, please use the already existing (started by you) threads like
    http://forum.java.sun.com/thread.jsp?forum=31&thread=230202
    or
    http://forum.java.sun.com/thread.jsp?forum=31&thread=230185
    you can reply to your postings. you do not need to start a new thread.
    tobias

  • Moving constructors and assignment operators

    Do moving constructors and assignment operators have been implemented in the latest (july) beta or SolarisStudio 12.4?
    Thanks in advance.

    Please help because it's still not working for me:
    #include <cstdlib>
    using namespace std;
    class Thing {
    public:
        Thing();
        Thing(Thing&&);
    private:
        Thing(const Thing&);
    Thing f() {
        Thing t;
        return t; // OK: Thing(Thing&&) used (or elided) to return t
    int main(int argc, char** argv) {
        Thing t2 = f();
        return 0;
    Here's the build window output:
    dmake: defaulting to parallel mode.
    See the man page dmake(1) for more information on setting up the .dmakerc file.
    "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/bin/dmake" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
    "/opt/SolarisStudio12.4-beta_jul14-solaris-x86/bin/dmake"  -f nbproject/Makefile-Debug.mk dist/Debug/OracleSolarisStudio_12.4_Beta2-Solaris-x86/thing
    mkdir -p build/Debug/OracleSolarisStudio_12.4_Beta2-Solaris-x86
    CC    -c -g -std=c++11 -o build/Debug/OracleSolarisStudio_12.4_Beta2-Solaris-x86/main.o main.cpp
    mkdir -p build/Debug/OracleSolarisStudio_12.4_Beta2-Solaris-x86
    CC    -c -g -std=c++11 -o build/Debug/OracleSolarisStudio_12.4_Beta2-Solaris-x86/main.o main.cpp
    "main.cpp", line 30: Error: Thing::Thing(const Thing&) is not accessible from f().
    1 Error(s) detected.
    *** Error code 2
    dmake: Fatal error: Command failed for target `build/Debug/OracleSolarisStudio_12.4_Beta2-Solaris-x86/main.o'
    Current working directory /home/prime/NetBeansProjects/thing
    *** Error code 1
    dmake: Fatal error: Command failed for target `.build-conf'
    Current working directory /home/prime/NetBeansProjects/thing
    *** Error code 1
    dmake: Fatal error: Command failed for target `.build-impl'
    BUILD FAILED (exit value 1, total time: 4s)
    Thanks in advance.

  • How do I install Snow Leopard while keeping files, applications, and settings

    I need to update my system, I realized that I need Snow Leopard (quiet late) before Maverick. My question is, how can I install it keeping files and all the data. I found this on Internet, does it work?
    Install Snow Leopard while keeping files, applications, and settings
    If you follow these steps, the installer will replace your operating system if one is already present, but will preserve your account information and personal files.  You may have to reinstall some applications, however.
    Insert the install disc (or the first install disc if you have more than one) into your disc drive. Restart your computer while holding down the c key. This causes your computer to start up from the install disc rather than your hard drive. When you see the gray Apple insignia, release c . 
    The Mac OS X installer should open automatically. Follow the on-screen prompts to read and accept the license agreement and begin the installation. When prompted to choose a destination disk, select your preferred location and click Install. 
    When the Mac OS X installation finishes with the disc, restart your computer. After the installation completes, a configuration program may begin automatically if you are installing for the first time. You will need to supply basic setup information for your computer. 
    Update your system software to ensure that you have the most recent operating system components.  From the Apple menu, select Software Update... , and then follow the instructions on the screen. Often, you will have to restart your computer, and you may have to run Software Update multiple times before it can completely update your system.

    That's why you need to back it up. You won't need to restore the backup immediately afterwards unless something goes wrong during the upgrade, but you'll need it later; the drive will eventually fail.
    (105428)

  • Pdf portfolio source file name and date in file details

    Is it possible to import the source file name and extension as well as the source file created date in the portfolio file details?  Need to document source to portfolio in working with 3rd parties that will only have the original source.  Need to document what was converted into pdf as not all files in a directory will successfully convert to pdf.  Sometimes need to convert 100's of files.  Manual entry is inefficient.  the file names and modified dates are displayed on the Combine Files dialog.  is there a way to capture the detail on that page?

    I don't need the detail of when the pdf was added to the portfolio.  I
    need know which dwg or jpg or word file was converted and the original
    created date of that file for control of information.
    That is impossible; sorry. For some *very specific* types of conversion to PDF the pdfx:SourceModified XMP tag will be set to show the last-modification date of the source file (for example DOCX files converted using MS Word), but there will never be a human-readable record of the source filename or its creation date unless you have manually added them as document XMP properties after conversion (this is what the "Custom Properties" dialog is for). To embed source data automatically would raise no end of privacy and security problems for customers, who most certainly do NOT want their recipients seeing details of internal documents.
    Without writing a plugin there's no access to the internal workflow of the Combine Files dialog, so you cannot use a script to read the names and dates of the files *before* conversion and store them automatically in the new PDF Portfolio's Fields array.

  • Exporting catalog, making changes, then importing catalog does not update file movements and deletions

    I export part of my master catalog to a laptop.  I include the image files so I can edit the files at full res.  After managing and editing files I import the catalog back into the master catalog. When importing I check to replace metadata, develop settings and negative files. I have been running some tests to be sure all my work is being captured in the master catalog by this process.  I find that if I change develop settings or photo ratings this is detected when the file is imported and the data in the master catalog is updated properly.  The surprise is that if I delete files or move files among folders in the exported catalog these changes are not detected and these changes are not updated inthe master catalog.  It seems bizarre to me that such changes are not detected but I do not see how to get LR to recognize these changes and include them in the catalog update.  Without this capability I don't see how to use catalogs to move part of a catalog to another computer for edits and file management and then move back to the master catalog.

    There are various reasons why Lightroom works this way, but you'll need use pick flags to indicate photos to be deleted, and other metadata like colours or collections.

  • Download Helper, even with paid converter upgrade, gives "Invalid Capture File" errors and will not record audio, with "File Creation Error - Unable to rename/copy audio file" Error.

    Download Helper Screen Capture worked to capture video if the default "no audio" option is active. But, no audio. The "speakers" or "microphone" audio options are confusing....the audio to be captured is from the video, so what do you choose? With either "speakers" or "microphone" selected, the captured file has poor audio and no video. Re-capture efforts (speakers) get "Invalid capture file error" and "File Creation error- Unable to rename/copy audio file"
    The paid upgrade of "Converter" doesn't work.
    Instructive documentation - not very good.
    Suggestions - Need time delay between initiation of "Record" and starting the video to be recorded.
    Could use timer tracking of the record process.
    Are there operating system limitations? (Have Windows XP Pro)

    That is an issue for the developer of that Download Helper.

  • Adobe reader xi i am running 2 display screens and when i have a file open and go to print the print page opens on my second screen.  How can I get adobe reader to just display on one screen?

    adobe reader xi i am running 2 display screens and when i have a file open and go to print the print page opens on my second screen.  How can I get adobe reader to just display on one screen?
    I want the capability of adobe reader to just run on one screen.

    I had the same problem.
    Try this.
    https://igppwiki.ucsd.edu/groups/publichelpwiki/wiki/a1538/Howto_Disable_Acrobat _as_the_Safari_PDF_Viewer.html

  • I have recently updated my CC programs to the latest version and now all of my files wont open by default into their respective programs, only if I open the program and go to file open and open the file from there. How can I fix this?

    I have recently updated my CC programs to the latest version (CC2014) and now all of my files wont open by default into their respective programs, only if I open the program and go to file>open and open the file from there. How can I fix this?
    I have tried 'Open with' and the version of the program now installed on my computer isn't even suggested as an option and when I browse for it, the file wont open with it anyway

    On Windows (don't know about Mac), the latest version will always take over the file association, and become the default for indd files. It's impossible to change it.
    But there is a plugin for ID that makes this possible. Never tried it myself.
    https://www.rorohiko.com/wordpress/downloads/lightning-brain-soxy/

  • Using Timer and TimerTask classes in EJB's(J2EE)

    Does J2EE allow us to use Timer and TimerTask classes from java.util package in SessionBean EJB's ( Statless or Statefull )?.
    If J2EE does allow, I am not sure how things work in practical, Lets take simple example where a stateless SessionBean creates a Timer class
    and schedules a task to be executed after 5 hours and returns. Assuming
    GC kicks in many times in 5 hours, I wonder if the Timer object created by survives the GC run's so that it can execute the scheduled tasks.
    My gut feeling says that the Timer Object will not survive.. Just
    want to confirm that.
    I will be interested to know If there are any techiniques that can make
    the usage of Timer and TimeTask classes in EJB's possible as well as reliable with minmum impact on over all performance.

    Have a look at J2EE 1.4. I think they add a timer service for EJBs there...
    Kai

  • Best Practises for File Sharing and Print Server on Windows Server 2012

    Is it better to have File Sharing and Print Server installed on the same Windows 2012 Server ?
    Or, they should be installed on 2 different Windows Servers ?
    Hussien Sherief

    It will work just fine to combine them.
    But most people would recommend keeping functionality separate... if the budget allows.  That whole "single point of failure" concept.  If that server dies, you've lost both of those functions.

  • I'm having a huge issue with itunes locating my missing files..and it's too many for me to locate 1 by 1..It says I'm missing over 3,00 songs and They are all in my music folder..What can I do to fix this issue?

    I'm having a huge issue with itunes locating my missing files..and it's too many for me to locate 1 by 1..It says I'm missing over 3,000 songs and They are all in my music folder..What can I do to fix this issue? I've looked at all the tutorials on youtube and none of it works. I recently got a new computer and I Back-Up all my music and itunes playlist and I import it on my new computer with the new itunes and I go to play a few songs, it says I'm missing them I locate a few but it's still like 3,000 missing and again they are all on the computer and in one folder..Please Help !

    I did that and nothing changed half my songs still have examination marks beside them
    I also just tried dragging my folder of music int he playlist and it duplicated all of my songs? My playlist was at 5k now it's at 10k becuz of 3 duplicates of songs. Is there a way to delete multiple duplicate files?

  • I received a gift card and when I redeemed it an error message said that I had some itunes files missing and that I needed to reinstall itunes.  Will I still have all my credits when I download itunes?

    I received an online gift card for Father's Day.  When I tried to redeem the gift then I received a error message saying I had some itune files missing and I needed to reinstall/download itunes.  Will I still have my previous purchase credits after downloading and reistalling itunes? 

    You will, because the credited funds are on your iTunes account, not the application. When you reinstall iTunes just configure it with your old iTunes account and your credits will be there waiting for you.

  • File.delete() and File.deleteOnExit() doesn't work consistently..

    I am seeing some odd behavior with trying to delete files that were opened. Usually just doing new File("file.txt").delete() would work. However, in this case, I have created an input stream to the file, read it in, saved it to another location (copied it), and now I am trying to delete it.
    The odd thing is, in my simple application, the user can work with one file at a time, but I move "processed" files to a lower pane in a swing app. When they exit it, it then archives all the files in that lower pane. Usually every file but the last one opened deletes. However, I have seen odd behavior where by some files don't delete, sometimes all of them wont delete. I tried the deleteOnExit() call which to me should be done by the JVM after it has released all objects such that they don't matter and the JVM ignores any object refs and directly makes a call (through JNI perhaps) to the underlying OS to delete the file. This doesn't work either.
    I am at a loss as to why sometimes some files delete, and other times they don't. In my processing code, I always close the input stream and set its variable to null. So I am not sure how it is possible a reference could still be held to the object representing the file on disk.

    and then, in the other class
      public int cdplayerINIToMMCD(File aDatabase, String thePassword) throws IllegalArgumentException {
         /*---------DATA---------*/
         String dbLogin, dbPassword;
         JFileChooser fc;
         INIFileFilter ff;
         int dialogReturnVal;
         String nameChosen;
         File INIFile;
         ProgressMonitor progressMonitor;
         BufferedReader inFileStream;
         String oneLine;
         int totalLines = 0;
         int linesParsed = 0;
         boolean openDBResult;
         int hasPassword;
         if ((aDatabase == null) || (!aDatabase.exists()) ||
            (FileManagement.verifyMMCD(aDatabase) == FileManagement.VERIFY_FAILED)) {
            throw new IllegalArgumentException();       
         else { 
            currentDB = aDatabase;
            if(thePassword == null) {
              dbPassword = "";
            else { dbPassword = thePassword; }
            dbLogin = dbPassword; //For MSAccess dbLogin == dbPassword
         //Ask the user for the cdplayer.ini file.
         //Create a file chooser
         if (System.getProperty("os.name").indexOf("Windows") > -1) {
            fc = new JFileChooser("C:\\Windows");
         else {
            fc = new JFileChooser();     
         fc.setMultiSelectionEnabled(false);
         fc.setDragEnabled(false);
         //Create a new FileFilter
         ff = new INIFileFilter();
         //Add this filter to our File chooser.
         fc.addChoosableFileFilter(ff);
         fc.setFileFilter(ff);
         //Ask the user to locate it.
         do {
            dialogReturnVal = fc.showOpenDialog(mainFrame);
            if (dialogReturnVal == JFileChooser.APPROVE_OPTION) {
               nameChosen = fc.getSelectedFile().getAbsolutePath();
               if(nameChosen.toLowerCase().endsWith(INIFileFilter.FILE_TYPE)) { INIFile=new File(nameChosen); }
               else { INIFile = new File(nameChosen+INIFileFilter.FILE_TYPE); }
               if (!INIFile.exists()) {
                  continue; //If the name specified does not exist, ask again.
               else { break; }
            else { //User clicked cancel in the open dialog.
               //Ignore what we've done so far.
               return(IMPORT_ABORTED);
         } while(true); //Keep asking until cancelled or a valid file is specified.
         //Determine how many lines will be parsed.
         try {
           //Open the INI for counting
           inFileStream = new BufferedReader(new InputStreamReader(new FileInputStream(INIFile)));
           while ((inFileStream.readLine()) != null) {
               totalLines++;
           //Close the INI file.
           inFileStream.close();
         } catch (IOException ex) { return(IMPORT_FAILED); }
         //Make a progress monitor that will show progress while importing.
         progressMonitor = new ProgressMonitor(mainFrame, "Importing file","", 0, totalLines);
         progressMonitor.setProgress(0);
         progressMonitor.setMillisToPopup(100);
         progressMonitor.setMillisToDecideToPopup(1);
         //Make our DatabaseHandler to insert results to the database.
         dbh = new DatabaseHandler();
         //Open the database connection.
         do {
           try {
              openDBResult = dbh.openDBConnection(currentDB, dbLogin, dbPassword);
           } catch(JDBCException ex) { return(IMPORT_JDBC_ERROR); } //OUCH! can't write anything.
             catch(SQLException ex) {
                 openDBResult = DatabaseHandler.OPNCN_FAILED;
                 //Can not open the database. Is it password protected?
                 hasPassword = JOptionPane.showConfirmDialog(mainFrame, "Could not open the database. "+
                                                "The password is wrong or you have not specified it.\n"+
                           "Do you want to enter one now?", "New password?", JOptionPane.YES_NO_OPTION);
                if (hasPassword == MMCDCatalog.DLG_OPTN_YES) {
                   dbPassword = JOptionPane.showInputDialog(mainFrame, "Please enter your "+
                                                              "password for the DataBase:");
                    dbLogin = dbPassword; //For MSAccess, login == password                                                    
                //If the password wasn't the problem, then we can't help it.
                else { return(IMPORT_FAILED); }
         } while(openDBResult != DatabaseHandler.OPNCN_OK); //If it is OK, no exception thrown.
         //Import the ini file
         try {
            //Open the INI file for parsing.
            inFileStream = new BufferedReader(new InputStreamReader(new FileInputStream(INIFile)));
            //Read and parse the INI file. Save entries once parsed.
            while ((oneLine = inFileStream.readLine()) != null) {
               parseLine(oneLine);
               linesParsed++;
               progressMonitor.setNote("Entries imported so far: "+entriesImported);
               progressMonitor.setProgress(linesParsed);
               if ((progressMonitor.isCanceled()) || (linesParsed == progressMonitor.getMaximum())) {
                  progressMonitor.close();
                  break;
            //Close the INI file.
            inFileStream.close();
         } catch (IOException ex) {
              //Make absolutely sure the progressMonitor has disappeared
                progressMonitor.close();
                if (dbh.closeDBConnection() != DatabaseHandler.CLSCN_OK) {
                 JOptionPane.showMessageDialog(mainFrame, "Error while reading the INI file.\n"+
                    "Error while attempting to close the database", "Error", JOptionPane.INFORMATION_MESSAGE);
              else {
                 JOptionPane.showMessageDialog(mainFrame, "Error while reading the INI file.",
                                                    "Error", JOptionPane.INFORMATION_MESSAGE);     
                return(IMPORT_FAILED);
         //Make absolutely sure the progressMonitor has disappeared
         progressMonitor.close();
         //Close the database connection
         if (dbh.closeDBConnection() != DatabaseHandler.CLSCN_OK) {
            JOptionPane.showMessageDialog(mainFrame, "Error while closing the database after import.",
                                          "Error", JOptionPane.INFORMATION_MESSAGE);
         //Did the user cancel?
         if (totalLines != linesParsed) {
            return(IMPORT_ABORTED);     
         //Success!
         //Everything ok. Return the number of entries imported.
         return(entriesImported);
      }

Maybe you are looking for

  • SQL Server 2008 R2 - Adding Replication Components to an Existing Installation

    Hi All I have a SQL Server 2008 R2 instance that I need to install Replication components on.  I've been going through the appropriate wizard and selecting to upgrade an existing instance, the wizard recognizes the SQL Server that we have installed s

  • Raising exceptions in PL/SQL

    Hi Friends I have the following code: declare var1.... var2.... cursor c1 begin insert stmt; update stmt; update stmt; for r1 in c1 loop end loop; end; I will be having about 6-7 million rows every month to process. To raise exceptions, I am thinking

  • Problem in installing photoshop cs6 sample plugin

    HI!      i have compiled a sample plugin "OUTBOUND" from Photoshop CS6 sdk..it creates a file named outbound.8be i have copied that file to C:\Program Files (x86)\Adobe\Adobe Photoshop CS6\Plug-ins and also to C:\Program Files (x86)\Adobe\Adobe Photo

  • How to get ATTENDEE, ORGANIZER, Respond Status on a Appointment?

    Hi I am using the Calendar SDK to view the appointments. When I use fetchEventsByRange or fetchEventsByID method, I am getting only few parameters like DTSTAMP, CATEGORIES, CLASS, PRIORITY, STATUS, DESCRIPTION, LOCATION, DTEND, SUMMARY, DTSTART, UID.

  • SCCM 2012 R2 bitlocker reporting via "Computers running a specific service"

    I have searched the web for how to check how many clients have bitlocker enabled, via SCCM 2012 R2. All suggestions I find are SQL commands. I have not found anyone who suggest using the report Operating System -> Services - Computers running a speci