Returns the type of file problem of method

I have a method that looks like this:


Public folder OpenFile()
{
final JFileChooser CF = new JFileChooser();
int iReturnVal = fc.showOpenDialog (this);

File = null;

If (iReturnVal is CF. APPROVE_OPTION)
{
file = fc.getSelectedFile ();

return the file;
}

return the file;
}


As you can see, this method allows the user to open a file picker and select a file to open, the file variable is returned. It works fine when a user selects a file, but when the user presses Cancel, which means that the value of the file will be "null". The following error is returned:


Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
to the teleprompter. Hand$ 1.actionPerformed (hand. Java:99)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
in javax.swing.AbstractButton$ Handler.actionPerformed (AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
in javax.swing.plaf.basic.BasicMenuItemUI$ Handler.mouseReleased (BasicMenuItemUI.java:877)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6504)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6269)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4860)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4686)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2713)
at java.awt.Component.dispatchEvent(Component.java:4686)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
to java.awt.EventQueue.access$ 000 (EventQueue.java:101)
in java.awt.EventQueue$ 3.run(EventQueue.java:666)
in java.awt.EventQueue$ 3.run(EventQueue.java:664)
at java.security.AccessController.doPrivileged (Native Method)
in java.security.ProtectionDomain$ 1.doIntersectionPrivilege(ProtectionDomain.java:76)
in java.security.ProtectionDomain$ 1.doIntersectionPrivilege(ProtectionDomain.java:87)
in java.awt.EventQueue$ 4.run(EventQueue.java:680)
in java.awt.EventQueue$ 4.run(EventQueue.java:678)
at java.security.AccessController.doPrivileged (Native Method)
in java.security.ProtectionDomain$ 1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Should I be 'file' as something else than null initialization to avoid this error? How can I fix? I can post the source for the entire program if you want, let me know.
if (file != null)

Tags: Java

Similar Questions

  • Y a you it the restriction when the type of file stored on the cloud?

    Hello
    Having problems paying UTI cloud of my space on the, I wonder if there are restrictions when the type of file format
    organization unit to the size of files that can be stored on the cloud?

    Some will upload and go! Can you inform me if the system is not at the point or if it's just me
    who have this kind of problems?

    Thanks and regards.

    There are intermittent problems with the download of large files. We aware and are working on fixing it.

    -Dave

  • Can limit us the type of file as an attachment?

    Hello

    Is it possible to limit the types of files that attachment of the OAF can download?
    Thank you!

    Published by: maeve on April 17, 2011 19:09

    Hi Maeve

    You can make use of the code below in the pfr to control method

    if(pageContext.getParameter("FileUpload") != null)
    {
    DataObject fileUploadData = (DataObject)pageContext.getNamedDataObject("Bean id of OAFileUploadBean ");
    String contentType = fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
    
    //Write logic here to limit the file type
    }
    

    For more details read JavaDoc as well as see below thread

    Upload of a file

    I hope that helps!

    Thank you
    AJ

  • Send list library subdirectory of files to a spreadsheet regardless of the type of file or printer

    Earlier versions of XP allowed me to BACK to print a list of items in file located in any subdirectory of the printer, regardless of the type of file or extension, just a list of files.  How to do this on XP or if available in System 7, I shall take it that buy?  Thank you.

    The game, October 7, 2010 03:20:09 + 0000, FrJim wrote:

    Earlier versions of XP allowed me to BACK to print a list of items in file located in any subdirectory of the printer, regardless of the type of file or extension, just a list of files.  How to do this on XP or if available in System 7, I shall take it that buy?  Thank you.

    Here are four ways:

    1. go to a command prompt and run the command

    dir [drive: folder] > c:\tempfilename (you can use any name and put
    in any folder of your choice)

    Then open Notepad, open tempfilename and print from there.

    2. write (for example, in Notepad), a text line 1:
    / DIR %1 > LPT1:

    Save it as 'printdir.bat' in the folder ' send to '.

    Then, to print the list of files in any folder, right click on this folder
    and select send to | Printdir.bat

    To include subfolders, set up the command DIR %1/O/S > LPT1:

    3. go in
    http://support.microsoft.com/default.aspx?scid=kb; EN-US; Q321379 and
    Follow the instructions.

    4. download and use all the several freeware/shareware utilities
    who can do this, as the popular
    http://www.KarenWare.com/PowerTools/ptdirprn.asp

    Ken Blake (MS-MVP)

  • How to get the Types of files - not associated with the applications Adobe CC

    How can I prevent Adobe creative cloud files of type to come in my research.

    I don't know how to use I or PS I accidentally a license and an image that cannot be opened with the help of HAVE or EPS (which makes all this shit even average?)

    I just want some png or JPEG files or any files can be used without having to use adobe software.

    So now I'm forced by Adobe to pay $22.99 per month for access to their software, just so that I can open a picture - what the mini-bars

    I'm not a designer, I can't use these programs, I want just the images that I can use on my site - is it so difficult?

    It is very easy in fact. Just deselect "Vectors" in your search. Which will remove all the .ai files. The rest you can use without any Adobe applications at all.

    And to be sure, every detail of the image indicates the type of file. If she says .ai/.eps you probably don't want to.

  • restrict the types of files that can be downloaded

    I refer to the Configuration Guide for Oracle E-Business Suite Release 12. I have a question on the recommendation * restrict the types of files that can be downloaded *. I'm not really a functional E-Business Suite user, more looking at it from a perspective of risk analysis.

    A few questions if you will allow me:

    May I ask if anyone of you in your E-Business Suite facilities restrict the types of files that can be downloaded? If yes which?
    What is the risk by limiting only not the files that can be downloaded? What can happen? What's the risk major?
    And also, specific to the financial modules of EBS, what types of files "load" users? Can you give us some examples?
    Can do you more harm than good by limiting certain types of files allowed for download?
    And also where exactly can you check what restrictions in terms of file type and size are currently defined? And how to navigate EBS to see what's next?

    Published by: user599292 on March 20, 2013 02:54

    Please see these documents.

    Mechanism of Security Configuration in the function of attachments in Oracle E-Business Suite [ID 1357849.1]
    Configuration Guide for Oracle E-Business Suite Release 12 [403537.1 ID]
    Error: This file Type is not allowed. Please choose another file. [1428248.1 ID]
    New Configuration of the security translates into "this file Type is not allowed" error downloading jar CX [1432305.1 ID]

    Thank you
    Hussein

  • How display you the type of file in PS Elements 10?

    How display you the type of file in PS 10 items in the organizer for each photo?

    I know that you can right click and watch meta data.

    In PSE 7 it was displayed under each photo.

    Two things:

    1. set the display option to display file names:

    2. make sure your tiles are large enough to display the data:

    Ken

  • How to return the Type of function

    I defined a type and a function in the specification. But package body returns error pls-00330 (invalid use of the name of type or subtype). What I am doing wrong? My intention is to write a function that returns a folder that contains two values. For now, I put "null;" as a placeholder.

    -Specifications
    CREATE or REPLACE PACKAGE res.year_qtr AS
    Yq_type RECORD TYPE IS
    (year varchar2 (2),)
    QTR varchar2 (1));
    FUNCTION yq_fun (date_in date)
    RETURN yq_type;
    END year_qtr;

    -body
    CREATE or REPLACE PACKAGE BODY res.year_qtr AS
    FUNCTION yq_fun (date_in date)
    IS BACK yq_type
    BEGIN
    null;
    RETURN year_qtr.yq_type; -get error on this line!
    END;
    END year_qtr;

    Published by: user516543 on March 23, 2009 12:17

    You must declare a variable of this type and the return variable.
    You can not simply to return the type because it is not really a statement of this type.

    --specification
    CREATE OR REPLACE PACKAGE res.year_qtr AS
      TYPE yq_type IS RECORD
        (yr varchar2(2),
         qtr varchar2(1));
      FUNCTION yq_fun (date_in date)
        RETURN yq_type;
    END year_qtr;
    
    --body
    CREATE OR REPLACE PACKAGE BODY res.year_qtr AS
      FUNCTION yq_fun (date_in date) RETURN yq_type IS
        v_ret year_qtr.yq_type;
      BEGIN
        null;
        RETURN v_ret;
      END;
    END year_qtr;
    
  • a function that returns the type with a table joint!

    Good day to all,
    I have a function that returns a type.

    so I select it as:
    Select * from table (function (param1, param2))

    now I want to combine this with a table so that the settings for the service we get from the join table. Is this possible? And how?
    I tried different options without success.

    something like:
    Select *.
    table table (function (b.column1, b.columnb) x), tablea b
    where x.a = b.col

    Is this possible?

    Thanks in advance?

    user564819 wrote:

    something like:
    Select *.
    table table (function (b.column1, b.columnb) x), tablea b
    where x.a = b.col

    Is this possible?

    Somehow...

    SQL> create or replace type TIntegers is table of integer;
      2  /
    
    Type created.
    
    SQL>
    SQL> --// our sample pipeline simply spews 2 numbers for eevry number input - simple
    SQL> --// to use for the testcase below
    SQL> create or replace function FooPipe( n number ) return TIntegers pipelined is
      2  begin
      3          pipe row( trunc(n) );
      4          pipe row( trunc(n)*-1 );
      5          return;
      6  end;
      7  /
    
    Function created.
    
    SQL>
    SQL> with dataset( n ) as(
      2          --// ignore this part as it only builts a base table
      3          --// for us to use to select values for input to
      4          --// to the pipeline - in "real world" use this table
      5          --// will already exist
      6          select
      7                  level
      8          from    dual
      9          connect by level <= 10
     10  ),
     11  pipe_line( n, array ) as(
     12          --// we run the pipeline as a nested table column
     13          --// in the SQL projection - the CAST is important
     14          --// in order to establish the nested table type
     15          select
     16                  d.n,
     17                  cast(
     18                          FooPipe(d.n) as TIntegers
     19                  )
     20          from    dataset d
     21  )
     22  --// we now use a standard query to unnest the nested table column
     23  select
     24          p.n,
     25          pipe_val.*
     26  from       pipe_line p, TABLE(p.array)  pipe_val
     27  /
    
             N COLUMN_VALUE
    ---------- ------------
             1            1
             1           -1
             2            2
             2           -2
             3            3
             3           -3
             4            4
             4           -4
             5            5
             5           -5
             6            6
             6           -6
             7            7
             7           -7
             8            8
             8           -8
             9            9
             9           -9
            10           10
            10          -10
    
    20 rows selected.
    
    SQL>
    

    Not sure I like it. What is the real problem that this method (driving a pipeline with input of a base table rows) is supposed to address? There may be a simpler and more elegant approach...

  • Colour varies with the type of file

    I have an Office Jet Pro 8600, which is about 1.5 years old.  It allows to print PDF files perfectly but JPGs, MS Publisher are distorted in this red appears yellow to orange.  I haven't checked the other types of files.

    I cleaned the print head, and finally the diagnosis told to replace the print head.  However, it prints the PDF (and maybe others) just drop off.  Black works very well too.

    Do I need a new printer or?

    David

    My bad.  It wasn't printing the files OK.   The test file, I chose didn't need any magenta ink and so I see no problem.  HP sent me a necessary printing head and fortunately my printer is still under warranty, so everything should be OK within 5-7 business days when the new leader arrives.  My apologies and please ignore all this.  David

    My bad.  It was NOT OK for pdf printing.  I got to choose one with no red (magenta), which was what was screwed up in the print head.  With HP cat and they went through it with me.  Need print head is on it way for me.

    Sorry for the inconvenience.

    David

  • Checking file system on C: the Type of file is NTFS. The Volume is dirty. -What this means and how do I clean the Volume, please? My computer is Dell XPS

    Recently, when I turn on my computer is starts, guests of the computer and starts check my system files as follows: "checking file system on C: the Type of the file is NTFS. The Volume is dirty. "That is what this means and how can I clean and maintain the clean Volume, please? My computer is Dell XPS

    The computer system continues and invite "CHKDSK checks the files (step 1 of 3)... .

    The system deletes some files and at the end of shows, complete audit files and then show

    CHLDSK is verifying indexes (stage 2 of 3)...

    Once again, it shows the following:

    Deleting Index Entry _64280 ~ 1. jpg in index file 4632 $130

    Deleting Index Entry _64280552_little-mix_211112_get [1] .jpg in index file 4632 $130

    Deleting Index Entry 69gw [1] .jpg in index file 6722 $130

    Remove entries of Index 69 GW_1 ~ 1. jpg in index file 6722 $130

    Deleting Index Entry _64274754_messi_211112_elvis [1] .jpg in index file 6722 $130

    Deleting entry Index _64274 ~ 1. jpg in index file 6722 $130

    Finished the index checking

    CHKDSK is checking security descriptors (stage 3 of 3)...

    100%

    CHKDSK checks usn Journal...

    Windows control disc is finished.

    After all checks, Windows proceed to start as usual.

    I would like to know if I need the dirty Volume, and if so, how can I carry out the cleaning operation.

    Sometimes, at the early stage of the CHKDSK, the computer makes a pe. .. PE... noise and cut.  Then I turn the computer off via the key of the insulation. When I restart the computer, it then runs the check again until the end.

    Please advice me on the following points:

    1 is this normal as he started only happening in recent weeks?

    2. How can clean the Volume in order to show "Volume is clean instead of sale"

    I look forward to hear from you.

    Thank you

    Hi, Dr.,

    Volumes that contain file system errors are known as Sales. To indicate that a file system problem has occurred and that the volume is dirty, Windows XP Professional displays a message similar to the following when you try to open, delete, or rename a file or folder by using Microsoft Windows Explorer or the command prompt:

    Autochk runs if the volume is marked as modified.

    If the file system has marked the volume as dirty, Autochk runs the Startup Repair process. Volumes are marked as dirty, when the file system detects an error on the volume. If Autochk detects a dirty volume, it provides a delay of 10 seconds, and then starts the repair process. If you cancel Autochk when a volume is dirty, Autochk tries to run again after a 10 second delay every time the computer is restarted.

    See Chkdsk for all the necessary explanations:

    http://TechNet.Microsoft.com/en-us/library/bb457122.aspx

    Run the Dell Diagnostics to check the drive failure.  If the disc is a failure, it must be replaced.

  • ORA-1403 when change the type of file to APEX_APPLICATION_TEMP_FILES browser storage

    Hi all

    I'm new to APEX.  I use APEX 5.0 and try in site APEX Oracle using load data wizard to download the csv file.

    I managed to download data when the browser file storage type is obsolete WWV_FLOW_FILES.

    However, when I change the type of storage of Table APEX_APPLICATION_TEMP_FILES, system will prompt ORA-1403 when I click 'Next' to the Source of data loading page.

    Exception logging: Sqlerrm: ORA-01403: no Backtrace data: ORA-06512: at the "APEX_050000.WWV_FLOW_DATA_UPLOAD", line 564 ORA-06512: to the "APEX_050000.WWV_FLOW_PROCESS_NATIVE", line 975 ORA-06512: at the "APEX_050000.WWV_FLOW_PROCESS_NATIVE", line 1172 ORA-06512: to the 'APEX_050000.WWV_FLOW_PLUGIN', line 2017 ORA-06512: at the "APEX_050000.WWV_FLOW_PROCESS", line 188

    Someone able to guide how to diagnose this problem?

    Thank you, Dorothy

    DorothySG wrote:

    I'm new to APEX.  I use APEX 5.0 and try in site APEX Oracle using load data wizard to download the csv file.

    I managed to download data when the browser file storage type is obsolete WWV_FLOW_FILES.

    However, when I change the type of storage of Table APEX_APPLICATION_TEMP_FILES, system will prompt ORA-1403 when I click 'Next' to the Source of data loading page.

    Exception logging: Sqlerrm: ORA-01403: no Backtrace data: ORA-06512: at the "APEX_050000.WWV_FLOW_DATA_UPLOAD", line 564 ORA-06512: to the "APEX_050000.WWV_FLOW_PROCESS_NATIVE", line 975 ORA-06512: at the "APEX_050000.WWV_FLOW_PROCESS_NATIVE", line 1172 ORA-06512: to the 'APEX_050000.WWV_FLOW_PLUGIN', line 2017 ORA-06512: at the "APEX_050000.WWV_FLOW_PROCESS", line 188

    Someone able to guide how to diagnose this problem?

    It's bug #21478903: error when changing from APEX_APPLICATION_TEMP_FILES to download files

    Use the deprecated option for now.

  • How to add commands to the context menu for the types of files (add associations)?

    I would like to download anime and re - encode standard dvd (mpeg2) format before you burn it to a DVD for better quality.  I have a program suite that supports the grunt work, but to do a contextual menu command that calls the original batch file that the user must manually add it to the menu of context by file association.  I found that I can access the menus of file associations, but the option to add a new association with an existing file type does not seem to exist.  Is there a registry entry, I need to change or add to allow me to customize my context menus in Windows 7?

    Create a text file (make sure you have the framework where you DO NOT hide known file extensions unmarked)

    Change the new text file... Copy the following: [quote]

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\WMP11. AssocFile.AVI\shell\Queue for encoding]
    @= "& Queue for encoding.

    [HKEY_CLASSES_ROOT\WMP11. AssocFile.AVI\shell\Queue for Encoding\command]
    "@="c:\\dvdstudio\\scripts\\Queue.bat \"%1\"

    [HKEY_CLASSES_ROOT\WMP11. AssocFile.MP4\shell\Queue for encoding]
    @= "& Queue for encoding.

    [HKEY_CLASSES_ROOT\WMP11. AssocFile.MP4\shell\Queue for Encoding\command]
    "@="c:\\dvdstudio\\scripts\\Queue.bat \"%1\"

    [HKEY_CLASSES_ROOT\CCCP. WMP. AssocFile.MKV.1\shell\Queue for encoding]
    @= "& Queue for encoding.

    [HKEY_CLASSES_ROOT\CCCP. WMP. AssocFile.MKV.1\shell\Queue for Encoding\command]
    "@="c:\\dvdstudio\\scripts\\Queue.bat \"%1\"

    [/ quote]

    Save the text file..., rename the text file with the .reg extension

    Double-click the new registry file to add the context menu commands to your registry... everything is done! :)

    And thank you very much, BluePlateSpecial!

  • Adding keywords to a subject causes the search return the names of file instead of topic titles

    When I search for a term in my WebHelp Pro project, matching topics are displayed by filename if the subject has anything in its properties > General > keywords field, and are presented by topic title if there is no defined keywords for the subject.

    I confirmed this behavior by adding and deleting keywords from subjects and looking alternately to be shown in the search by file name or title of the topic.

    Obviously, I want stories to be displayed by topic titles in search results no matter whether they have keywords assigned or not.

    Any idea of what this could be the cause? Is this a known bug?

    Here is some additional information. This problem occurs, these four conditions must be met:

    1. The subject must have manually added keywords in properties > general > keywords field.
    2. The title of the topic and the name of the file must be different.
    3. We have to search among keywords added in step 1.
    4. Occurs in WebHelp Pro when published to a remote server.

    Interviews with Adobe today are not conclusive, but it seems that it was an unknown bug. Maybe I'll get a free t-shirt or something.

    Hi Rocky,

    Journal on Robohelp Configuration Manager.

    Uncheck the option "re-indexing of documents to the server.

    Republish and check. If the problem exists, try to restart the Apache/Tomcat server.

    This should work for you.

    Kind regards

    Robbie

  • How can we change the types of files in Vista?

    I'm changing a. WAV (file audio .wav) in one. JPG (JPEG image file)
    I remember you can easily do in XP, but Vista gives me some problems
    Thanks in advance for your time

    I wish you had said this in the first place. It would have saved me time going haring Google trying to find something that would work. No wonder I couldn't understand how you were converting an audio file to an image file. Next time be more come on your final goals.

    Vista can display the file extension like any other Windows operating system. Go to control panel > Classic view > Folder Options > tab display uncheck the checkbox "Hide extensions of known file types". Apply/OK outside. MS - MVP - Elephant Boy computers - don't panic!

Maybe you are looking for