Hi Luca,
Thanks, I folded in a modified version of your fix and added tests
that replicate the bug.

FilePortParameter did not have any unit tests, so I added
FilePortParameter.tcl which calls the asFile() method.

_Christopher

--------

    
    Dear Ptolemy-hackers,
    I am trying to use the FilePortParameter and I had some problem, 
    When I call a asFile() 
    http://chess.eecs.berkeley.edu/ptexternal/src/ptII/doc/codeDoc/ptolemy/acto
   r/parameters/FilePortParameter.html#asFile()
    on an FilePortParameter which has not been used by the user I get 
    a nullPointerException, while in the doc it says that it should 
    return null.
    My guess is that there is a bug in the FilePortParameter.java and 
    the following patch fixes my problem. 
    
    
    [EMAIL PROTECTED]:~/projects/opal/kepler/ptII$ svn diff 
ptolemy/actor/parameters/Fil
   ePortParameter.java 
    Index: ptolemy/actor/parameters/FilePortParameter.java
    ===================================================================
    --- ptolemy/actor/parameters/FilePortParameter.java (revision 49987)
    +++ ptolemy/actor/parameters/FilePortParameter.java (working copy)
    @@ -277,6 +277,7 @@
     
             try {
                 File file = FileUtilities.nameToFile(name, getBaseDirectory())
   ;
    +            if ( file == null ) return null;
     
                 if ((file.toString().indexOf("!/") != -1)
                         || (file.toString().indexOf("!\\") != -1)) {
    
    
    
    
    Please let me know if I am wrong or I am missing something,
    Luca
    
    ---------------------------------------------------------------------------
   -
    Posted to the ptolemy-hackers mailing list.  Please send administrative
    mail for this list to: [EMAIL PROTECTED]
--------

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to