Hashtable containsKey() problem when String key is read from a file - HELP

I'll try to be brief:
I open a .txt file of Unicode encoding (not ANSI) in order to fetch some info.
After I manipulate each line with splits etc I use a String as a key to a Hashtable.
The problem is that later inside my code, I try to check wether this key (and hence its corresponded value) exists and I get a false value from the containsKey() method.
and here's the code (I have embedded some comments //-type that address to this thread):
FileInputStream fis = new FileInputStream(initFilename);
InputStreamReader isr = new InputStreamReader(fis, "UTF-16");
BufferedReader br = new BufferedReader(isr);
lineText = loadSubiPhraseFilter(br);
//In the loadSubiPhraseFilter method
//parsing an input like this:
//δόξα τώ Θεώ,1:1,2:2
//Yeah, I know, its all greek to you ;)
//Thus we first split the line with ','
//we split the first token with ' ' and each one of the N words,
//serves as an index in a N-dimension hashtable
//This is achieved implicitly by adding another hashtable as a value to a String key etc...
//When all words are added, the hashtable which contains the last word is used
//to put another hashtable whose only key is the String "Index"
//which points to the rest of the data. The thing is, I never get that far...
//I dont get to even get a positive containsKey() when giving an inserted key at a later time
//here's the loading procedure
while((lineText = br.readLine()) != null && (lineText.charAt(0) != '#'))
     String [] info = lineText.split("[,]");
     /*Load subi indeces in a vector*/
     Integer [][] subiIndex = new Integer [info.length-1][2];// = new Vector<Integer>();
     for(int i = 1; i < info.length; i += 1)
          //load subiIndex here...
     /*Then fetch phrase to be modified and load its 'n' words in an n-dimesion hash which will utterly point to the subi indeces*/
     /*Starting from the last word, we  put the index vector*/
     String [] word = info[0].split("[ ']+");
     Hashtable<String, Object> nextWord = new Hashtable<String, Object>();
     nextWord.put("Index", subiIndex);
     /*Then we create a chain of hash dimensions corresponding to phrase words*/
     for(int i = word.length-1; i >= 0; i -=1)
          Hashtable<String, Object> prevWord = new Hashtable<String, Object>();
          //Yeah, I even tried the .trim() method...
          prevWord.put(word.trim(), nextWord);
          nextWord = prevWord;
          System.out.print(word[i] + "<-");
     /*We update the hash head and also add the first word with its first letter capitalized as key pointing to the same next key in hash dimension chain*/
     subiPhraseFilter = nextWord;
     subiPhraseFilter.put((capitalMap.get(word[0].charAt(0))+word[0].substring(1)).trim(), subiPhraseFilter.get(word[0]));
     //The following debbuging print outs work just fine. Its only just later when I cant get a containsKey()...
     System.out.println("|| "+subiPhraseFilter);
     System.out.println("subiPhraseFilter.containsKey("+word[0]+"): "+subiPhraseFilter.containsKey(word[0]));
//Then the following code is executed
Integer [][] subiPhraseIndeces(String word1, String word2, String word3)
     String [] tmp = {word1, word2, word3};
     Hashtable<String, Object> dimension = subiPhraseFilter;
     //The following debbuging print out does NOT return true
     //even when I explicitly give a String key which I know it is inserted
     System.out.println("subiPhraseFilter.containsKey(" + tmp[0] + "): " + subiPhraseFilter.containsKey("&#949;&#957;&#955;&#972;&#947;&#969;".trim()));
     for(int i = 0; (i < tmp.length) && (tmp[i] != null) && dimension.containsKey(tmp[i]); i += 1)
          //This is NEVER executed...
          System.out.println(i + ": dimension.containsKey(" + tmp[i].trim() + ")");
          dimension = (Hashtable<String, Object>)dimension.get(tmp[i].trim());
          return (Integer [][])dimension.get("Index");
Whats most irritating is that this also happens arbitrarily in another place of my code where I load again info by using each line as a key to another Hashtable and, the containsKey() method returns true to all but one (!) line-words, even if I change its position in the file. I won't put the latter code here because its just very simple. (in case I wasnt clear I read a section of a file that looks like
wordA
wordB
wordC
wordN
each wordX is put as a key to a Boolean value and yet, containsKey(wordA) returns false even if i change the input file to
wordB
wordA
wordC
wordN
isn't that just peculiar?
A significant note in this problem is that I do not read english characters, rather than greek (hence the unicode filetype) which I put as keys to the hashtable; later I try to get corresponded values by fetching text (which I also manipulate) from a JTextfield, as key, and I'm afraid that maybe something is happening there.
However the code sample I added above didnt work even when I added an english word in the file and explicitly asked wether it is contained as a key...
Maybe I am doing something I really can't see right now...
Help would be appreciated                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

BalusC: "I would also not be surprised if that file is after all actually just UTF-8"
No, it's not cause I explictly saved the .txt file as Unicode in wordpad and NOT as UTF-8. By the way notepad has ANSI as its default save-type.
However I converted my input files to UTF-8 and read them using the "UTF-8" String flag in the constructor of the reader I was using. All the same.
EDIT: Not to metion, the UTF-8 file needed an empty line at the beggining or my parsing would skip the first line, messing everything up!
Just for the sake of it I will show the output of my program (redirected to a file cause cmd.exe does not support greek letters, or I didnt find a way to make it so):
(This is the output when I load from the UTF-8 file the word "&#949;&#957;&#955;&#972;&#947;&#969;" in my has as a key (pointing to a Boolean i think - it doesnt really matter). What I print is the key of each dimension of the hash -here there's only one dimension- and then I print the hash reference, i.e like a toString() representation. The result shows that the Hashtable contains at key "&#949;&#957;&#955;&#972;&#947;&#969;" a value which is another Hashtable which contains the key "Index" pointing to something you shouldnt care. The hash head also contains the key "&#917;&#957;&#955;&#972;&#947;&#969;", which is actually the same as before only to have its first letter capitalized, which in turn points to a hash with one key etc...)
&#949;&#957;&#955;&#972;&#947;&#969;<-|| {&#949;&#957;&#955;&#972;&#947;&#969;={Index=[[Ljava.lang.Integer;@360be0}, &#917;&#957;&#955;&#972;&#947;&#969;={Index=[[Ljava.lang.Integer;@360be0}}
subiPhraseFilter.containsKey(&#949;&#957;&#955;&#972;&#947;&#969;): true
(And later on I get a string from a JTextField I tokenize it and here's what I get when I reach the same word:)
(Don't mind "Checking: ..." its 'cause I check a window of three words in order to reach up to a 3-dimension hash key. Yet I dont even get the first key!)
Current token: '&#949;&#957;&#955;&#972;&#947;&#969;'
Checking: &#949;&#957;&#955;&#972;&#947;&#969;, null, null
subiPhraseFilter.containsKey(&#949;&#957;&#955;&#972;&#947;&#969;): false
Now isn't that making one crazy?
Any other ideas?
Thnak you in advance!
P.S. In case that I haven't done something really stupid which is ommitted here and yet can't be tracked, I think the problem must be somewhere between the encoding of JTextField and the encoding I read...
P.S.2 Excuse me for saying hash instead of Hashtable sometimes in the above text
Edited by: M.M. on Sep 2, 2009 3:22 AM
Edited by: M.M. on Sep 2, 2009 3:23 AM

Similar Messages

  • Data reading and writing problem? how to set " Read from Measurment File express.vi​" 's readout datasize?

    Dear all,
    I want to use Labview to process a data.
    Now I have a array in a text file.
    this array is very very big. which is at least row*col = 6 * 100000;
    the column size always 6,
    but the row size is ramdom, some times is very big, like bigger than 65535,
    when I use "read from measurement file express.vi" to read this file, the array I could get always 6*5339, I don't know why. the column size is always 5339.
    and then I delete the 1st row of the array and then write into a txt file via "write measurement file express. vi", it takes a very long time. almost computer has no response. after a while, no file was creat to record the data.
    is there an efficient way to process such big data file and store the processed file into a new file
    thank you very much
    Jack
    Message Edited by weichengatech on 03-09-2006 12:00 AM

    Hello,
    There’s no real efficient way to read the file if you don’t
    know exactly how many rows of data you have. 
    Your going to just have to read a row at a time and add the results to
    the end of an array (granted for the clever programmers there are some more
    efficient ways to do this than just with ‘build array’).  I would start by asking you how much
    information you know about the file and what the exact structure of it is (i.e.
    is it a binary file, a tab delimited file, or a LVM file)?  Could you provide a screenshot of the code
    you are running? If you provide a little more information on the file structure
    we might be able to contribute some additional information.
    Look forward to hearing back from you-
    Travis M
    LabVIEW R&D
    National Instruments

  • Read from Text File - Help Bug?

    Hi - I am currently working on LV8 and I think that there is some misunderstanding potential in the help file. To be more exact in the help to the "Read From Text File" VI.
    The description for "count":
    " ... If count is <0, the function reads the entire file. The
    default is –1, which indicates to read a single line if you placed a checkmark
    next to the Read Lines shortcut menu item and to read the
    entire file if you removed the checkmark next to the item. "
    If count is lower than zero, the function reads the entire file. That sounds clear to me.
    The default is -1, which indicates to read a single line if you placed a checkmark next to the "Read Lines" shortcut menu item. Now what? Does it read a single line or the whole file?
    .. and to read the entire file if you removed the checkmark next to the item. I thought it reads the whole file if I use -1 ?
    the VI itself behaves as I'd expect it to:
    * If I place a checkmark next to Read Lines and put -1, I get an array containing the lines
    * If I remove the checkmark, I get only a single string item.
    Now where is the error? Is the VI not working properly or only the description a little bit ... strange ?

    ?hein??
    ?what?
    Both you guys lost me..
    And I drink coffee without sugar (being sweet enough, already) 
    Here is what I get from Context Help on the Read From Text File:
    Read from Text File
    Reads a specified number of characters or lines from a byte stream file. By default, this function reads all characters from the text file. Wire an integer value to count to specify how many individual characters you want to read starting with the first character. Right-click the function and place a checkmark next to the Read Lines option in the shortcut menu to read individual lines from the text file. When you select the Read Lines option in the shortcut menu, wire an integer value to the count input to specify how many individual lines you want to read from the file starting with the first line. Enter a value of -1 in count to read all characters and lines from the text file.
    Humm.
    New feature (again)..  If you select checkmark the Read Lines option, it will not send the text to a sting indicator, as shown in the attached image.  If selected, then it's expecting to write lines to an array of strings...  WHY???  I don't know..  I'll ask..
    Strange...  LV8 is full of mysteries... 
    RayR
    Attachments:
    bad write file.JPG ‏33 KB
    more bad write file.JPG ‏12 KB

  • Read From Spreadsheet File help

    I am saving all my data to a text file (See attached file). The problem is that when I try and use the Read From Spreadsheet File.vi I am unclear on how to make it show all my data.
    Does anyone know a away for me to read the whole file and display it all at once reather than line by line?
    Solved!
    Go to Solution.
    Attachments:
    test data 1.txt ‏6 KB

     The read from spread sheet Vi has two data outputs : the top right retrieves the whole file as a 2D array, if you leave the "number of rows" input on the left unwired.
    Message Edité par chilly charly le 01-07-2009 11:22 AM
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • ALV GRID Problem when delete key is pressed from keyboard

    I have created a ALV Grid using cl_gui_alv_grid class
    I this I made one field editable based on some conditions
    and used SEL_MODE as 'A' ( i tried 'D' too) in the LAYOUT Settings
    When I select the records and press the DELETE key from keyboard
    the records are getting deleted, and i am not able to catch this action
    in the debug mode
    (FYI: I have written my own set of code for delete row in the USER COMMAND EVENT which is not getting triggered in this case )
    Can any body help me with this

    have you used this to trigger the event
    SET HANDLER W_EVENT_RECEIVER->HANDLE_USER_COMMAND FOR W_GRID

  • Read from measurement file (wrong values)

    I have a VI where I save data using the ''Write To Measurement File utility''. When I open the .lvm file in the note pad I can see all the data correctly, but when I use the "Read From Measurement File" tool and try tho make a graph the data shown is not correct. Attached the .lvm file and one image of the chart that labview made using the "Read From Measurement File". If you open the lvm in the notepad you can see that the time column goes up to  22 sec. In the chart the time axis goes only up to 7,5 sec. What is going wrong??? Thanks
    Ps: I changed the file .lvm to .txt to attach
    Solved!
    Go to Solution.
    Attachments:
    Chart.jpg ‏688 KB
    teste.txt ‏156 KB

    vitor22 wrote:
    I tryed.
    And how did it turn out?  Saying I tried and not saying how it didn't work doesn't help me help you.
    I was able to do it.  But the X data wasn't correct.  That is because your timestamps aren't regular spaced.  So you can't use a waveform graph.
    You need to use an XY graph.  See the attached code for how to convert the two channels of data (time, your values) into a datatype to feed to the XY graph.
    Attachments:
    Example_VI_BD.png ‏49 KB

  • I am getting "a network error occurred while attempting to read from the file c:\windows\installer\itunes.msi" when I attempt to download itunes, can someone help me with this?

    I am getting "a network error occurred while attempting to read from the file c:\windows\installer\itunes.msi" when I attempt to install itunes.  Can anybody help me to resolve this issue?

    You can try disabling the computer's antivirus and firewall during the download the iTunes installation
    Also try posting in the iTunes forum since it is not an iPod touch problem.

  • Problems reading from a file

    Hey,
    I have this file that I need to read so i can handle the contents. It was created in MSDOS and as I have very little experience in that topic, I wondered if anyone can point me in the right direction. I tried reading it as a ascii and binary file but neither work, I'm really just guessing though.
    The file has no extension. Hence I can't upload it to the forum. Its made up of mostly meaningless strings of characters.
    Any help is appreciated,
    Regards,
    Rkll

    Rkll wrote:
    Ya you're exactly right, its parsing the data that is the problem. I have done what you said and attached it as a .txt file. My inital thought was that it was a collection of binary digits but I was unable to read them with the built in Labview read binary file VI. Although maybe I had a setting wrong or something.
    This has nothing to do with the Read From Binary File VI, or any setting. That functions does not magically know the format of a file, just like any binary file read for any other programming language. Thus, you have to tell it how to interpret the data. You can tell it to read the file as a series of bytes, and it will dutifully return to you an array of U8 integers. Or, you tell it to read it as a series of 16-bit integers and it will dutifully return to you an array of I16. It will give you what you tell it to give you. 
    Looking at the file I can see some header information, though it's not clear what all the spaces are being used for. I can't tell whether they're padding for a section, or what. As I noted, do you have any idea as to the format of the file?  You said you're updating an old computer system. Any documentation?

  • Read from measurement file problem

    Hi all,
    I am using the "Read from Measurement File" VI that is built into LV8. I am reading in a .lvm file consisting of 2 columns. I cannot seem to figure out how to index each column. When tested using a a single column data file, I am able to use the index array vi to  access the data successfully. The problem occurs when I have 2 columns. To get around this problem I split my initial data file into 2 single column data file, but I would prefer not having to do this. Is there anyway to avoid this?
    When I read the 2D file into an array I can only index the data located in the 1st row 1st col and the data in the last row 2nd col.
    The array size function results in the value "2" yet each column has 201 entries.

    Attachments:
    Write to LVM.vi ‏128 KB
    To read LVM.vi ‏70 KB

  • How to best format input read from a file to a string

    I am trying to set up a class to convert input read from an xml-file to a java-string, which I can pass on to a web service.
    My attempt is probably not the smartest, but what I did was to set up a for-loop, which iterates through each line in the xml, appending "\n" to the end of each line, before storing them in a variable, which is loaded into an arraylist. When there are no more lines to read in the xml-file, the for-loop should terminate and the contents of the ArrayList should be written to a string, which is then returned.
    Below is my attempt to implement this - thanks in advance!
    import java.io.*;
    import java.util.*;
    public class RequestBuilder {
         private String _filename, output;
         //Constructor method
         RequestBuilder(String filename){
              String line;
              _filename = filename;
              //Sets up a array to store each line of XML read from a file
              ArrayList<String> lineList;
         lineList = new ArrayList<String>();
              try {
                   //Sets up a filereader and a buffer
                   FileReader fr = new FileReader(_filename);
                   BufferedReader br = new BufferedReader(fr);
                   //Iterates through each element of the arraylist until empty
                   for (String o : lineList){
                   //Stores a single linein a variable and appends a line-break
                   line = br.readLine() + "\n";
                   //Addseach line to the arraylist
                   lineList.add(line);
                   //Closes the filereader
                   fr.close();
                   //Writes the arraylist to a string
                   output = lineList.toString();
              } catch (FileNotFoundException e) {
                   e.printStackTrace();
              } catch (IOException e) {
                   e.printStackTrace();
         public String getRequest(){
              return output;
    }

    799992 wrote:
    Well, the reason for doing an ArrayList was that I had to process each line with line breaks and escape characters, but I know realize that I can do the same thing by summing the lines for each iteration directly intro a string like below - it works :-)
    Apparently the filereader takes care of double-quotes as I don't see any difference in the output when I disable the logic I made, which substitutes " with \", can anyone confirm this?
    The code I ended up using:
         //Sets up a filereader and a buffer
                   FileReader fr = new FileReader(_filename);
                   BufferedReader br = new BufferedReader(fr); 
                   //initializes the output variable with the first line from the file
                   output = br.readLine() + "\n";
                   while (br.ready() == true) {
                        //reads each line, saves it in a variable and appends line breaks
                        line = br.readLine() + "\n";
                        //Replaces adds escape character to any double-quotes (apparently not neccessary?)
                        tmpLine = line.replaceAll("\"", "\\\"");
                        line = tmpLine;
                        //sums each line in the current string
                        output = output + line;
    As EJP said you can directly write to the webservice. If you want to check for yourself what the result looks like just read the file without adding anything.
    public String readFile(){
         String xmlString = "";
              try{
                   String line = null;
                   xmlFile = new File(//file);
                   reader = new BufferedReader(new FileReader(xmlFile));
                        while((line = reader.readLine()) != null){
                             xmlString += line;
              catch(FileNotFoundException e){
                        e.printStackTrace();
              catch(IOException e){
                        e.printStackTrace();
         return xmlString.replaceAll("\\s+"," ").trim();//remove spaces
    }

  • Format precision apparently ignored when using read from spreadsheet file

    I hope there is ridiculously simple solution to this problem but so far I can't find it. Using the Read from Spreadsheet File function in LabVIEW7.1, I can't get the floating point format (%f) to work; the decimal (%d) seems to work fine. For example, the first value in the attached file is 399.5853. When I read it in using %.2f format I would think I should get 399.58 but instead I get 399.58529663... Oddly if I use %d as the format, I get an as expected value of 399. Can anyone see what I am missing?
    Attachments:
    ReadFileTEST.vi ‏23 KB
    test.txt ‏1 KB

    The solution to the problem is the internal representation of floating point numbers: with a limited number of bytes only a limited number of the (infinitely many) real numbers can be represented. The nearest representable number to 399.5853 is 399.58529663 if the so-called single precision representation (abbr. SGL in Labview) is used.
    It seems that (ridiculously!) NI has chosen to use SGL as the data format in the Read from Spreadsheet VI which causes the unexpected behaviour you observed.
    You can change the representation from SGL (which uses 4 bytes) to DBL (double precision, using 8 bytes) in the Read from Spreadsheet VI and you will observe a better approximation then, but still not 'exact' since the number now reads 399.585300000000018. (With t
    he EXT representation, 10 bytes, you could go to even higher precision)
    I hope someone from NI reads this and they fix the unnecessary limitation of the precision in the Read from Spreadsheet VI.

  • Problem with reading from bin file into Vector

    What am I doing wrong? It works fine to write the vector to the bin file and then read from it. But if I try just to read from the file it wont work.
    Does anybody has any good advice to give when it comes to reading data form a bin file??
    import javax.swing.*;
    import java.util.*;
    import java.io.*;
    class Binaerfil
         public static void main (String [] args) throws IOException, ClassNotFoundException{
              ObjectOutputStream utFil = new ObjectOutputStream (new FileOutputStream("HighScoreLista.bin"));
              int po = 50;
              Spelare s;
              Spelare s1, s2, s3, s4, s5,s6,s7,s8,s9,s10;
              String f�rNamn;
              Vector v = new Vector();
              s1 = new Spelare("Mario", 100);
              s2 = new Spelare("Tobias",90 );
              s3 = new Spelare("Sanja", 80 );
              s4 = new Spelare("Marko", 70 );
              s5 = new Spelare("Sofia", 60 );
              s6 = new Spelare("Kalle", 50 );
              s7 = new Spelare("Lisa", 40 );
              s8 = new Spelare("Pelle", 30 );
              s9 = new Spelare("Olle", 20 );
              s10 = new Spelare("Maria",10 );
              v.add(s1);
              v.add(s2);
              v.add(s3);
              v.add(s4);
              v.add(s5);
              v.add(s6);
              v.add(s7);
              v.add(s8);
              v.add(s9);
              v.add(s10);
              System.out.println ("Before writing to file");
              System.out.println(v);
              //Write to file
              utFil.writeObject (v);
              utFil.close();
         ObjectInputStream inFil = new ObjectInputStream (new FileInputStream("HighScoreLista.bin"));     
              v =(Vector) inFil.readObject();
         System.out.println (v);
              inFil.close();
    }

    Because what you are writing to the file is a vector, that is all you can get out. You are actually reading a single Object from the file which you can cast to a Vector, from which you can access the data stored inside. If you want to read the Spelare instances from the file, you will have to save them individually to the file. You will have to implement Serializable and look up the API to do that.

  • Problem with reading from DAT file. FileNotFound exception

    Can't seem to find the issue here. Two files, one (listOfHockeyPlayers) reads from a DAT file a list of players. The other (HockeyPlayer) has just the constructor to make a new hockey player from the read data.
    import javax.swing.*;
    import javax.swing.event.*;
    import java.util.*;
    import java.awt.*;
    import java.io.*;
    public class ImportHockeyPlayers
    private ArrayList<HockeyPlayer> listOfHockeyPlayers = new ArrayList<HockeyPlayer>();
    public ImportHockeyPlayers(String fileName)
      throws FileNotFoundException
      try
       Scanner scan = new Scanner(new File(fileName));
       while (scan.hasNext())
        //Uses all the parameters from the HockeyPlayer constructor
        String firstName = scan.next();
        String lastName = scan.next();
        int num = scan.nextInt();
        String country = scan.next();
        int dob = scan.nextInt();
        String hand = scan.next();
        int playerGoals = scan.nextInt();
        int playerAssists = scan.nextInt();
        int playerPoints = playerGoals + playerAssists;
        //listOfHockeyPlayers.add(new HockeyPlayer(scan.next(),scan.next(),scan.nextInt(),scan.next(),scan.nextInt(),scan.next(),
         //scan.nextInt(),scan.nextInt(),scan.nextInt()));
      catch(FileNotFoundException e)
       throw new FileNotFoundException("File Not Found!");
    public String toString()
      String s = "";
      for(int i = 0; i < listOfHockeyPlayers.size(); i++)
       s += listOfHockeyPlayers.get(i);
      return s;
    public class HockeyPlayer
    private String playerFirstName;
    private String playerLastName;
    private int playerNum;
    private String playerCountry;
    private int playerDOB;
    private String playerHanded;
    private int playerGoals;
    private int playerAssists;
    private int playerPoints;
    public HockeyPlayer(String firstName, String lastName, int num, String country, int DOB,
      String hand, int goals, int assists, int points)
      this.playerFirstName = firstName;
      this.playerLastName = lastName;
      this.playerNum = num;
      this.playerCountry = country;
      this.playerDOB = DOB;
      this.playerHanded = hand;
      this.playerGoals = goals;
      this.playerAssists = assists;
      this.playerPoints = goals + assists;
    DAT File
    Wayne Gretzky 99 CAN 8/13/87 R 120 222
    Joe Sakic 19 CAN 9/30/77 L 123 210These are all in early development, we seem to have the idea down but keep getting the odd FileNotFound exception when making an object of the ImportHockeyPlayers class with the parameter of the DAT file.
    We might even be on the wrong track with an easier way to do this. To give you an idea of what we want to do...read from the file and be able to pretty much plug in al lthe players into a GUI with a list of the all the players.
    Thanks for your time.

    Thanks for the tip on the date format...good to
    know.
    public static void main(String[] args)
    GUI gui = new GUI();
    ImportHockeyPlayers ihp = new
    ImportHockeyPlayers("HockeyPlayers.dat");
    }It's just being called in the main.
    Throws this error:
    GUI.java:39: unreported exception
    java.io.FileNotFoundException; must be caught or
    declared to be thrown
    ImportHockeyPlayers ihp = new
    ImportHockeyPlayers("HockeyPlayers.dat");
    ^This error is simply telling you that an exception may occur so you must enclose it in a try catch block or change the main method to throw the exception as follows
    public static void main(String[] args) throws  
                          java.io.FileNotFoundException {
         GUI gui = new GUI();
         ImportHockeyPlayers ihp = new
         ImportHockeyPlayers("HockeyPlayers.dat");
    }or
    public static void main(String[] args) {
         GUI gui = new GUI();
         try {
              ImportHockeyPlayers ihp = new
              ImportHockeyPlayers("HockeyPlayers.dat");
         catch (FileNotFoundException e) {
              System.out.println("error, file not found");
    }I would reccomend the second approch, it will be more helpful in debugging, also make sure that the capitalization of "HockeyPlayers.dat" is correct
    hope that helps

  • I face problem when I try to buy gold ,can you help me please?

    I face problem when I try to buy gold ,can you help me please?

    Nobody here can help you with a purchase problem.  You need to call Apple directly at the number on the contact page - http://www.apple.com/contact/
    We here are just fellow Apple product users, not Apple employees.

  • I have problem when transferring book (PDF/Epub) from Computer to iPad with the new iTune? Please Help....

    I have problem when transferring book (PDF/Epub) from Computer to iPad with the new iTune? Please Help....

    With iTunes 11 you can enable the left-hand sidebar via control-S on a PC, option-command-S on a Mac. If you are trying to get it to the iBooks app then with the sidebar enabled the process should be similar to how it was on previous versions of iTunes e.g. add it to your iTunes library via File > Add To Library, connect the iPad and select it on the left-hand sidebar, and then use the Books tab on the right-hand side to select and sync it to the iBooks app.

Maybe you are looking for

  • On click of a link the LOV should always show the first value.

    Hi ADF Experts, Jdev Version 11.1.1.7.0 I have a table with one of the column as hyperlink. On click of the hyperlink a LOV comes inside a popup. And the LOV shows a value as "Day" by default. After that I select "Week" from LOV. and click search and

  • How to check whether calendar is being used in any of the sap application

    Hello All, We are having few factory calendars. However some of the calendar having valid to year 2010. Can you please let me know how to check whether these calendar is being used in any of the sap application/module kindly reply as early as possibl

  • Can I perform masking & layers for HDR image in Aperture 2 _RAW images

    Hello I own Aperture 2. Can I do post processing such as masking & layers like one do to to create HDR image. If so... I generally take in RAW format. In Photoshop or Photomatix the HDR post processing is done in JPG. [I do not own Photoshop or Photo

  • Disk space-simple question

    This is a simple question, I think: I have an external drive (250GB) and have my iPhoto and iTune libraries over there. If I delete about half of my photos from the main library (on the desktop, G4, running 10.4.10) to free up some space, will I stil

  • Job Work - Party's inspection report

    Dear All, We are into process industry We are receiving material with Party's Quality Inspection report for Job Work. We are also doing quality inspection in our lab. Results are recording using QA32. Now our requirement is : 1. We also want to inser