Why is there a error appearing in this??

I have written a program to search if the particular item is present in the file or not.. so why is there any error hope it is right!
BufferedReader check;
     try{
         check=new BufferedReader(new FileReader(FileName));
    }catch(FileNotFoundException ex){
        System.out.println("Sorry file not found");
        return; 
                            System.out.println("Enter the item to be found");
                            String input_item=in.readLine();
                            String item= input_item.toUpperCase();
                            System.out.println("Searching for "+item);
                            int messenger=0, x=0;
                             while(x<sType.length) {
                                sType[x]=check.readLine();
                                sNum[x]=Integer.parseInt(check.readLine());
                                sPrice[x]=Float.parseFloat(check.readLine());
                                if(item.equals(sType[x])) {
                                    System.out.println("Found "+sType[x]);
                                    System.out.println("-------------------------------------------------------");
                                    System.out.print("Stock Name :");
                                    System.out.println("\t"+sType[x]);
                                    System.out.print("Stock Level:");
                                    System.out.println("\t"+sNum[x]);
                                    System.out.print("Stock Price:");   
                                    System.out.println("\t$"+sPrice[x]);
                                    System.out.println("-------------------------------------------------------");
                                    messenger=1;
                                x++;
                            if(messenger==0) {
                                System.out.println("Sorry "+item+" not available");
  and the file contains the following in the particular format
LOGITECH CORDLESS DESKTOP LX300
200
50.2
MONITER
62
54.9
PANASONIC
54
32.3
MOUSE
95
21.4pl help why this error is appearing???
Exception in thread "main" java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:415)
at java.lang.Integer.parseInt(Integer.java:497)
at programname.<init>(NewMain.java:17)
??????????????????????????????????????????????????????

Please do not post the same question more than once!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
http://forum.java.sun.com/thread.jspa?messageID=9919410

Similar Messages

  • TS1368 Why is there an error appearing "cannot connect to iTunes store?" whenever i install apps? Please help, thanks!

    I'm having a hard time figuring this out. :(

    There might be an network problem if it is 3g if not u r wifi might be slow but u can slove the problem by rebooting u r ipad,iphone etc by perssing the lock button and the home button for 10sec and again switch on u r device this might solve u r problem

  • HT201210 why is there an error occurring when trying to do a software update ios6 on iphone 4s

    why is there an error occurring when trying to do a software update ios6 on iphone 4s??

    You might find this article helpful: http://support.apple.com/kb/TS3694
    It has the error range of 3000's which states
    Errors 3000-3999 (3002, 3004, 3013, 3014, 3018, 3164, 3194, and so on): Error codes in the 3000 range generally mean that iTunes cannot contact the gs.apple.com server on ports 80 or 443. This may be because out-of-date or incorrectly configured security or firewall software is interfering, an old version of iTunes is installed, an entry in your hosts file redirecting requests to gs.apple.com (see error 1004 above), or because of your Internet proxy settings. If you are using a proxy, try without using one or with a known-good network. If that does not resolve the issue, follow iTunes for Windows: Troubleshooting security software issues. Error 3014 may indicate that you need to free up more disk space on the computer before trying to restore again. Error 3194 most likely indicates you do not have the latest version of iTunes installed Update to the latest version of iTunes. 

  • Why is there no option to play this track next in the right click menu?

    Why is there no option to play this track next in the right click?

    It's not currently a feature, but you could try requesting it : http://www.apple.com/feedback/itunesapp.html

  • TS3694 why is there an error 9006 and how can i fix it?? please answer for ipad mini

    why is there an error 9006 and how can i fix it?? please answer and btw its an ipad mini

    if you are trying to download and install ios7, it is probably because of the enormous amount of traffic apple's download servers must be experiencing. things should return to normal before too long, just hang tight

  • I can't install itunes on my windows 8.. error appears says this : error microsoft. vc80.crt type="win32".version="8.0.50727.6195"

    Why I cant Install itunes in my windows 8? error appears and it says:
    error microsoft. vc80.crt type="win32".version="8.0.50727.6195"
    please healp me

    These ones are typically caused by underlying problems on the PC that also often cause Windows Updates to fail to install. If we can fix the Windows Update trouble, we can usually get the iTunes trouble cleaned up en passant.
    Go into your Windows update and try to check for new updates. If updates install, stock up on the ones you're behind on, restarting the PC if requested to do so. After the restart, try installing iTunes again. Does it go through this time for you?
    If windows updates fail to install, go into your Update History and doubleclick the failures. What alphanumeric codes appear for you? (For example, 8007000B.)

  • Why does Content Encoding Error appear always, even when home page is selected?

    The Question summarizes the problem that is prevelant in thousands of Firefox downloads as witnessed by the same thousands of people in your Question Forum. You must know what the heck is causing this and how to fix it. Version numbers are meaningless. This problem appeared last year and no cache clearing or cookie cutting or re-downloading or anything else will fix it. Why do you do nothing to solve this error?? I don't like IE8 but I have no choice, I need a working browser.

    I think I found something. When loading a web page it's looking for 128 bit (or something like that) encryption. An example that works every time: If I type java.com in the address bar I get that "Content Encoding Error" box.
    If I type http://www.java.com I get the same thing.
    If I type https://www.java.com It works
    The same thing happens with other sites. A few have http and still work. the ones that don't work but I change the address to start with https load properly. Ok maestro what gives? and how to make it work all the time?

  • HT201442 so why was there an error with me trying to restore my ipod i dont get it please someone explain?!

    So there was an error when i tried to restore my ipod i don't get it.. someone please help me!?

    If not this error:
    iOS: Restore error 3194 or 'This device isn't eligible for the requested build'
    What was the error?

  • Why is there an error with this GUI

    Hi again
    When i try to run the pump screen the little box which displays the numbers dont appear in the pump screen frame but instead in teh consoel screen
    frame.Which shouldnt happen but i cant find any reason why it is doing this or a way to stop it.Below is teh code for the pump screen and teh console screen.
    public void ConsoleScreen()
            makeFrame();
         * Create a 3x2 grid and place five components within it.action listener that is teh button knows ot run
         * teh method and that teh method that srunning
        private void makeFrame()
            frame = new JFrame("Console Screen");
            Container contentPane = frame.getContentPane();
            contentPane.setLayout(new FlowLayout());
             JButton NewDayReset = new JButton ("NewDayReset");
            contentPane.add(NewDayReset);
            NewDayReset.addActionListener(new ActionListener() {
                                   public void actionPerformed(ActionEvent e) { NewDayReset(); }
              JButton ViewTotalPetrolSold = new JButton ("ViewTotalPetrolSold");
            contentPane.add(ViewTotalPetrolSold);
             ViewTotalPetrolSold.addActionListener(new ActionListener() {
                                   public void actionPerformed(ActionEvent e) {ViewTotalPetrolSold(); }
        JButton ViewTotalTakings= new JButton ("ViewTotalTakings");
            contentPane.add(ViewTotalTakings);
             ViewTotalTakings.addActionListener(new ActionListener() {
                                   public void actionPerformed(ActionEvent e) {ViewTotalTakings(); }
           JButton AmmountToPayForTheTransaction= new JButton ("AmmountToPayForTheTransaction");
            contentPane.add(AmmountToPayForTheTransaction);
             AmmountToPayForTheTransaction.addActionListener(new ActionListener() {
                                   public void actionPerformed(ActionEvent e) { AmmountToPayForTheTransaction(); }
               JButton ResetPump= new JButton ("ResetPump");
            contentPane.add(ResetPump);
            ResetPump.addActionListener(new ActionListener() {
                                   public void actionPerformed(ActionEvent e) { ResetPump(); }
            SignIn = new JFrame("Peters Petrol Pump");
            Container contentPaneSignIn = SignIn.getContentPane();
            contentPaneSignIn.setLayout(new GridLayout(4,1));
            JLabel password = new JLabel(" Please Enter Password");
            contentPaneSignIn.add(password);
            passwordInput = new JPasswordField();
            contentPaneSignIn.add(passwordInput);
            passwordInput.addActionListener(new ActionListener() {
                                                public void actionPerformed(ActionEvent event) {
                                                    String passwordField = new String(passwordInput.getPassword());
                                                    if(passwordField.equals (Password)) {
                                                            ConsoleScreen();
                                                    else { String string = "Password is incorrect";
                                                        JOptionPane.showMessageDialog(null, string);}
            SignIn.pack();
            SignIn.setVisible(true);
              Font font = new Font("SansSerif", Font.BOLD, 10);           
        JLabel label;
        JLabel label2;
        JLabel label3;
        JLabel label4;
        JLabel label5;
        JFormattedTextField input;
        JFormattedTextField input2;
        JFormattedTextField input3;
        JFormattedTextField input4;
        JFormattedTextField input5;
        JPanel panel;
       Format currency = NumberFormat.getCurrencyInstance(Locale.UK);
        label = new JLabel("Amount To Pay");   
        label2 = new JLabel("Price Per Litre");
        label3 = new JLabel("Litres Dispensed");
        label4 = new JLabel("Total Money Taken  for that day");
        label5 = new JLabel("Total Petrol Sold  for that day");
        input = new JFormattedTextField(currency);
        input2 = new JFormattedTextField(currency);
        input3 = new JFormattedTextField();
        input4 = new JFormattedTextField(currency);
        input5 = new JFormattedTextField();
        input.setValue(AmmountToPay);
        input2.setValue(PencePerLitre);   
        input3.setValue(LitresDispensedPerTransaction);
        input4.setValue(TotalTakings);
        input5.setValue(TotalPetrolSold);
        input.setColumns(7);
        input2.setColumns(7);
        input3.setColumns(7);
        input4.setColumns(7);
        input5.setColumns(7);
        input.setFont(font);
        input2.setFont(font);
        input3.setFont(font);
        input4.setFont(font);
        input5.setFont(font);
        input.setEditable(false);
        input2.setEditable(true);
        input3.setEditable(false);
        input4.setEditable(false);
        input5.setEditable(false);
        panel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
        panel.add(label);
        panel.add(input);
        panel.add(label2);
        panel.add(input2);
        panel.add(label3);
        panel.add(input3);
        panel.add(label4);
        panel.add(input4);
        panel.add(label5);
        panel.add(input5);
        frame.add(panel);
        frame.pack();
        frame.setVisible(true);  
            frame.pack();
            frame.setVisible(true);
        public void PumpScreen()
            NewFrame();
        private void NewFrame ()
            newFrame = new JFrame("Pump Screen");
            Container contentPane = newFrame.getContentPane();
            contentPane.setLayout(new FlowLayout()) ; 
              JButton AmmountToPayForTheTransaction = new JButton ("AmmountToPayForTheTransaction");
            contentPane.add(AmmountToPayForTheTransaction);
             AmmountToPayForTheTransaction.addActionListener(new ActionListener() {
                                   public void actionPerformed(ActionEvent e) { AmmountToPayForTheTransaction(); }
                        JButton CostPerLitre = new JButton ("Cost Per Litre");
            contentPane.add(CostPerLitre);
      CostPerLitre.addActionListener(new ActionListener() {
                                   public void actionPerformed(ActionEvent e) {   CostPerLitre(); }
                 JButton StopSqueezing = new JButton ("Stop Squeezing");
            contentPane.add(StopSqueezing);
             StopSqueezing.addActionListener(new ActionListener() {
                                   public void actionPerformed(ActionEvent e) { StopSqueezing();
                                     keepRunning=false;}
                               JButton squeezeNozzle = new JButton ("Start Squeezing");
            contentPane.add(squeezeNozzle);
             squeezeNozzle.addActionListener(new ActionListener() {
                                   public void actionPerformed(ActionEvent e) { squeezeNozzle();
                                   JButton RemoveNozzle = new JButton ("Remove Nozzle");
            contentPane.add(RemoveNozzle);
             RemoveNozzle.addActionListener(new ActionListener() {
                                   public void actionPerformed(ActionEvent e) { RemoveNozzle();
                                    JButton ReplaceNozzle = new JButton ("Replace Nozzle");
            contentPane.add(ReplaceNozzle);
            ReplaceNozzle.addActionListener(new ActionListener() {
                                   public void actionPerformed(ActionEvent e) { ReplaceNozzle ();
            Font font = new Font("SansSerif", Font.BOLD, 10);           
        JLabel label;
        JLabel label2;
        JLabel label3;
        JLabel label4;
        JLabel label5;
        JLabel label6;
        JFormattedTextField input;
        JFormattedTextField input2;
        JFormattedTextField input3;
        JFormattedTextField input4;
        JFormattedTextField input5;
        JFormattedTextField input6;
        JPanel panel;
        Format currency = NumberFormat.getCurrencyInstance(Locale.UK);
        label = new JLabel("Amount To Pay");
        label2 = new JLabel("Price Per Litre");
        label3 = new JLabel("Litres");
        label4 = new JLabel("Nozzle in Use");
        label5 = new JLabel("Nozzle Out of Use");
        label6 = new JLabel("Nozzle Not in Use");
        input = new JFormattedTextField(currency);
        input2 = new JFormattedTextField(currency);
        input3 = new JFormattedTextField();
        input4 = new JFormattedTextField();
        input5 = new JFormattedTextField();
        input6 = new JFormattedTextField();
        input.setValue(AmmountToPay);
        input2.setValue(PencePerLitre);   
        input3.setValue(LitresDispensedPerTransaction);
        input4.setValue(NozzleInUse);   
        input5.setValue(NozzleOutOfOrder);   
        input6.setValue(NozzleReady);
        input.setColumns(7);
        input2.setColumns(7);
        input3.setColumns(7);
        input4.setColumns(7);
        input5.setColumns(7);
        input6.setColumns(7);
        input.setFont(font);
        input2.setFont(font);
        input3.setFont(font);
        input4.setFont(font);
        input5.setFont(font);
        input6.setFont(font);
        input.setEditable(false);
        input2.setEditable(false);
        input3.setEditable(false);
        input4.setEditable(false);
        input5.setEditable(false);
        input6.setEditable(false);
        panel = new JPanel(new FlowLayout());
        panel.add(label);   
        panel.add(input);
        panel.add(label2);
        panel.add(input2);
        panel.add(label3);
        panel.add(input3);
        panel.add(label4);
        panel.add(input4);
        panel.add(label5);
        panel.add(input5);
        panel.add(label6);
        panel.add(input6);
        frame.add(panel); 
        frame.pack();
        frame.setVisible(true);     
            newFrame.pack();
            newFrame.setVisible(true);
    }

    Without fishing through the world here:
            frame = new JFrame("Console Screen");
            Container contentPane = frame.getContentPane();
            contentPane.setLayout(new FlowLayout());Notice you set contentPane to the ContentPane of your "Console Screen" and then proceed to add everything to it.
    Other than that, I'd ask you: do you know how to work your debugger?

  • Why is there the error "The requested protocol does not exist comm:0" ?

    Hi all,
    I want to read data from a USB serial port of the mobile phone ( Alcatel OT-806D ). The cable connects the phone and the computer. The system running in the PC is Windows XP. I launch a java j2se program which writes a number to the usb serial port. And in my midlet I run a j2me which will read on the usb port. The problem is that the output displayed in the item on my midlet is "The requested protocol does not exist comm:0". So why there is this error , and how to correct it ?
    Thank you very much

    only protocol required to be suppoted by a j2me mobile device is http://: some vendors to implement more protcols like socket:// but this depends on the vendor...

  • Why is there no error ????

    Hi,
    This is from my sourcecode:
    public aj_List mergeSort (aj_List l){
         int m=l.size()/2;
         if(l.size()>2){
         aj_List l1=divide(l,0,m-1);
         aj_List l2=divide(l,m,l.size()-1);
         mergeSort(l1);
         mergeSort(l2);
         }else{ ...........................
    The function has the return type "aj_List", but I can call the funktion without doing this:
    a1,a2 are from type aj_List:
    a1 = mergeSort(l1);
    a2 = mergeSort(l2);
    this works too!
    Normally I get a error when trying to compile this. But there not. I do not why both implementations are allowed. Should be not, or ?

    Hard to understand the question but I think you want to know why both of the following are legal
    mergeSort(l1);
    a1 = mergeSort(l1);
    Basically because java allows the return value to be thrown away. It still exists for a short time, but you just don't use it.

  • Flash is complaining about XML? Im using AS3 why are there XML errors? Unknown syntax errors.

    Sorry to keep spamming these forums with my stupid errors, but I am trying really hard to learn Flash/AS3 and when I have got to grips with it, I will return the love.
    I am a flash rookie trying to make a simple calculation device and I am getting a whole world of errors I have never seen before.
    My Code (I apologise but it may be my bad syntax):
    import flash.ui.Mouse;
    var Hnum:String;
    var PCnum:String;
    var calc:Number = 25;
    var Total:Number;
    num1.restrict = "0-9";
    num2.restrict = "0-9";
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function PartCount(event:MouseEvent):void{
        PCnum = num2.text;
        if (PCnum > 0 && < 10){
            parseInt(PCnum) * 10;
        or if (PCnum > 11 && < 20){
            parseInt(PCnum) * 5;
        or if (PCnum > 21){
            parseInt(PCnum) * 1;
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function calculate(event:MouseEvent):void{
        Hnum = num1.text;
        PCnum = num2.text;
        Total = parseInt(Hnum) * calc + parseInt(PCnum);
        Total.toString();
        Total_txt.text = String(Total);
    I had everything working when I was only calculating Hnum by 25. But when I try to intergrate  the if or statement everything goes wrong and I get these 5 errors.
    Scene 1, Layer 'Actions', Frame 1, Line 15
    1104: invalid xml name
    Scene 1, Layer 'Actions', Frame 1
    1084: Syntax error: expecting xmltagendend before end of program.
    Scene 1, Layer 'Actions', Frame 1
    1084: Syntax error: expecting rightparen before end of program.
    Scene 1, Layer 'Actions', Frame 1
    1084: Syntax error: expecting identifier before end of program.
    Scene 1, Layer 'Actions', Frame 1
    1084: Syntax error: expecting rightbrace before end of program.
    I dont understand what these errors are pointing out? Why XML? is it my variable names?
    Here is the code I had before the second function that worked fine:
    var Hnum:String;
    var PCnum:String;
    var calc:Number = 25;
    var Total:Number;
    num1.restrict = "0-9";
    num2.restrict = "0-9";
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function calculate(event:MouseEvent):void{
         Hnum = num1.text;
         PCnum = num2.text;
         Total = parseInt(Hnum) * calc;
         Total.toString();
         Total_txt.text = String(Total);
    Any help would be greatly appreciated! I will get the hang of this!
    MrB

    Thanks guys you were right it was parse problem with the var type.
    I have changed the code adding parseInt where necessary.
    I have also added the other functions. But now after it was working fine with just the one function it is doing the strangest thing.
    There are no errors, it is running fine but it is outputting the letter "a" instead of any numbers? Is this something to do with the strings? It is most odd.
    Any help would be greatly appreciated.
    Here is the new code:
    import flash.ui.Mouse;
    var Hnum:String;
    var PCnum:String;
    var PCcalc:Number;
    var Pmath:Number;
    var calc:Number = 25;
    var Total:Number;
    num1.restrict = "0-9";
    num2.restrict = "0-9";
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function PartCount(event:MouseEvent):void{
        if (parseInt(PCnum) > 0 && parseInt(PCnum)< 10){
            PCcalc == 1;
        if (parseInt(PCnum) > 11 && parseInt(PCnum)< 20){
            PCcalc == 2;
        if (parseInt(PCnum) > 21 && parseInt(PCnum)<200){
            PCcalc == 3;
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function PartCalc(event:MouseEvent):void{
        if (PCcalc == 1){
            Pmath * 10;
        if (PCcalc == 2){
            Pmath * 5;
        if (PCcalc == 3){
            Pmath * 1;
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function calculate(event:MouseEvent):void{
        Hnum = num1.text;
        PCnum = num2.text;
        Total = parseInt(Hnum) * calc + Pmath;
        Total.toString();
        Total_txt.text = String(Total);
    Thanks
    MrB

  • Why is there an 'Error: No Data' sign when importing in Log and Transfer?

    Hello,
    I am trying to import clips from my Panasonic HDC-SD100 camcorder into Final Cut Express 4. I am using the Log and Transfer window and am able to import most of my clips. However, every time I import there are a handful of clips that are left idle and an 'Error: No Data' sign appears next to them. They have not been imported to the Scratch Disk, and yet there doesn't seem to be anything wrong with them because they playback on the viewing screen in the Log and Transfer window. Can anyone help me to determine what is wrong?
    Many thanks.

    Some of the descriptions you are using are kind of confusing.
    "first 2 controls of each DO line(s)"
    "button 1 of DO lines 1 and DO lines 2"
    "control 2 of DO lines 1 and DO lines 2"
    What is the difference between "button 1" and "control 2".  I am going to assume you mean the same thing when you say "button" vs. "control" but just decided to change terminology in mid-sentence
    You need to write out a Truth table to describe what you need done.  The way you have the description written, you are already using the word "OR" to describe the different situations.  That is going to be a key part of your program.
    This shows:
    (DOlines button1 AND button2)  OR
    (DOlines2 button1  AND button2) OR
    (DOlines button1 AND DO lines2 button1)  OR
    (DOlines button2 AND DO lines2 button2)
    Attachments:
    002[1]_BD.png ‏11 KB

  • Why is there an error when activating custom wsp's (timer job) via SharePointUI?

    We have created a Timer Job Project.
    Before packaging wsp and deploying via PowerShell:- 
    1. If I set scope to Web and go to site features then I hit on Activate it gives error
    (sayin to enable debug for error msg in web.config).
    2. Similarly, if I set scope to Site, then if I go into site collection features and activate,
    it give same error.
    3. If scope is set to Web Application then the feature is activated by default (under
    web app features), but cannot see the job under job definitions.
    4. If scope is set to farm, then (under farm features) similar to above point no. 3
    There is also error when deactivating features which are already activated when a package
    is deployed. for example: web applicaiton feature. 
    Further, I cannot see the timer job under job defn unless it is scoped to SITE..
    Why is this?
    I donot get the issues when activating the features via PowerShell. Why is this?

    Hi Nachiket Kamat,
    When you are using web scoped or site scoped features to install the timer jobs, the account that does the scheduling must have write permissions to the configuration database of the server farm, usually, the identity of the application pool that is hosting
    the SharePoint site does not have permissions on the configuration database, this is the account that is used when you activate the feature through the browser interface, this may cause the feature activated failed.
    Another scenario that you met when you change the feature scope to web application, job definition cannot be seen, this may be caused by the feature receiver code, like if scope to web application, then get the web application from properties.Feature.Parent
    as SPWebApplication, if you change the feature scope, then this also need to change to get the proper object.
    Thanks,
    Qiao Wei
    TechNet Community Support

  • Why is there an error message when I try to update to ios 5.1 on my iPod touch?

    When I click "Install Now" it says "Verifying" then an error message pops up saying that there was an error updating and it dosent give me much more information.

    This indicates an issue with the network.
    Power cycle the ATV, router, and computer.

Maybe you are looking for