File("") broken in 1.4.1_02 ?

hi,
running the code below for 1.4.1_02 gives this output
H:\java\misc\forums>java CurDir
H:\java\misc\forums exists? false
H:\java\misc\forums exists? true
H:\java\misc\forums>java -version
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
which I think works with earlier runtimes? is this a new bug!?
thanks,
asjf
import java.io.*;
public class CurDir
     public static void main(String [] arg) {
          File curdir = new File("");
          System.out.println(curdir.getAbsolutePath() + " exists? " + curdir.exists());
          curdir = new File(curdir.getAbsolutePath());
          System.out.println(curdir.getAbsolutePath() + " exists? " + curdir.exists());
}

H:\java\misc\forums>java CurDir
H:\java\misc\forums exists? false
H:\java\misc\forums exists? true
public class CurDir
     public static void main(String [] arg) {
          File curdir = new File("");
          curdir = new File(curdir.getAbsolutePath());
}I think what may be happening here is that, in the first case, you are selecting a file named "" in the current directory (not the directory itself). The absolute path name of this is then given as a string: "H:\java\misc\forums\" + "" (directory + file name). However, this string (when concatenated) represents a directory in the second case. That is, the second one is the current directory, while the first one is a file "" in the current directory ("" would not be a valid file). Internally, File contains a name sequence, representing the hierarchy of directory and file names. My guess is that in one case the hierarchy is {"H:", "java", "misc", "forums", ""} and the other {"H:", "java", "misc", "forums"}; see the difference?
You can test this out using File.getName() or File.getParent() to see if they represent different things:
File firstFile = new File("");
File secondFile = new File(firstFile.getAbsolutePath());
System.out.println("Name of first file:    " + firstFile.getName());
System.out.println("Name of second file:   " + secondFile.getName());
System.out.println("Parent of first file:  " + firstFile.getParent());
System.out.println("Parent of second file: " + firstFile.getParent());If you are looking to get the current directory, you may want to use "." instead of "". Alternatively, you can get the current working directory from the system properties.

Similar Messages

  • Pdf-file broken

    Want to send pdf-file to fax server. Receipt denied, errror-message:  pdf-file broken.
    Pdf-file was dreated with Acrobat X Pro. Same error message after complete new installation of X Pro.
    When pdf-file ist created by Epson scanner, fax server accepts file.
    But if i link 3 Epson-scanner-pdf-files with Acrobat to 1 X Pro-file, fax server says again: pdf file broken.

    Ian,
    is the client on SP1? IIRC this was fixed in SP1.
    Uwe
    Novell Knowledge Associate
    Please don't send me support related e-mail unless I ask you to do so.

  • Photo files broken

    Photo files broken while reading photo files in QNAP TS-469 Pro NAS with Lightrom CC 5.6 ver. The QNAP NAS using SMB & AFP. what's wrong?

    Photo files broken while reading photo files in QNAP TS-469 Pro NAS with Lightrom CC 5.6 ver. The QNAP NAS using SMB & AFP. what's wrong?

  • Orphaned files - broken links - URGENT

    Hi everyone
    I am currently going through and deleting 675 orphaned files
    and files that are old although if they create a broken link after
    deletion this will not show when I re run the link checker even
    though I know they are. Does anyone know why this is? I can't keep
    deleting things if it is going to create a broken link within the
    site. Also, is there any way of finding out where an individual
    document is located on the site if at all?
    Second issue is that orphaned files that I have deleted in
    both the local site and remote site are still coming up when I do
    the link check. Why is this so and how can I get them removed from
    the orphaned files list?
    Please help
    Merry

    many of the people offering answers use the NNTP newsgroup
    reader version.
    the webforum has been flaky lately i think.
    Here's my reply from a while ago-
    after deleting files- recreate the site cache.
    It's under the site menu on older versions, under
    site-->advanced on newer.
    dw's link checker checks html links, and links in "behaviors"
    that it
    understands.
    it will not check links in most javascript.
    What's an example of a broken link that dw didn't warn of
    when deleting the
    reported orphan? �url address to the page??
    and here are links to a google archive of the newsgroup.
    http://groups.google.com/group/macromedia.dreamweaver/search?group=macromedi
    a.dreamweaver&q=Orphaned+files+-+broken+links+-+URGENT&qt_g=1&searchnow=Sear
    ch+this+group
    http://groups.google.com/group/macromedia.dreamweaver/browse_frm/thread/3b1c
    2e1950cbb577/9ed3b0a716f876c5?lnk=gst&q=Orphaned+files+-+broken+links+-+URGE
    NT&rnum=1#9ed3b0a716f876c5
    > Hi Murray
    >
    > It's just that it says there are 9 posts regarding my
    original question
    > although when I open it up they don't show.
    >
    > Merry :)

  • Server admin tool's help file broken ?

    Hi,
    SL Server 10.6.4
    I'm trying to open the help file of the server admin tool but it seems to be broken : 100% CPU, beachball. The same occurs with the file included in the standalone bundle (see http://support.apple.com/downloads/ServerAdmin_Tools_106) installed on a SL 10.6.4 client.
    Anybody having the problem too ? Any idea ?
    Thanks

    Hi,
    SL Server 10.6.4
    I'm trying to open the help file of the server admin tool but it seems to be broken : 100% CPU, beachball. The same occurs with the file included in the standalone bundle (see http://support.apple.com/downloads/ServerAdmin_Tools_106) installed on a SL 10.6.4 client.
    Anybody having the problem too ? Any idea ?
    Thanks

  • Zip files broken - Can't open, getting error

    I am no longer able to unzip my zip files.  It was working one day and broken the next.  The zip file icons no longer have a zipper, they simply show as a blank sheet.  When I double click to open/extract, I receive this message:
    The document “mydocument.zip” could not be opened. The file isn’t in the correct format.  The document “AmazonS3HowToFull.zip” could not be opened. The file isn’t in the correct format.
    This is happening with all my zip files.  New and old.  I have tried reinstalling UnRarX with no luck.
    It would seem that zip files are no longer associated with the appropriate app.  I don't know if there was a default unzip app on the Macbook.
    There is nothing I can put my finger on that I have done recently or differently that would have caused this change.
    I'm running OSx Lion 10.7.4.
    Thanks for any help you can give!
    Doug

    Thank you for trying to help. But I have tried to download the Program MPEG Streamclip as you said but unfortunately it need Quicktime too, the Readme said that there were another program I could use too called Quicktime Alternative. So I tried to uninstall the real Quicktime and install the alternative instead. But either the program MPEG Streamclip can't see that I have removed Quicktime or that I have removed the old one.
    Every time I put an .avi file into the program it can only convert about 1:30min of the movie and that is only with the sound no movie, and if I put one of the .MPG (that Itunes can't convert) in an error box pops up and says:
    *The Apple QuickTime 6 MPEG-2 Playback Component is not installed...*
    Please uninstall QuickTime completely. Then install QuickTime Alternative (1.61 or later), making sure the "Extra QuickTime plugins checkbox is enable.
    Alternatively, if you have Apple QuicktTime and you don't want to uninstall it, you can buy MPEG-2 Playback Component from Apple Computer.
    I think this is a bit sad cause I just bought the new Ipod Touch and I can't put the movies I like the most.
    Hope someone can help me...
    But thanks for the time you used to try to help me QuickTimeKirk

  • File broken Handheld Software section, please fix it

    Hello, I’m trying to download the file:
    Software Download for Cable & Wireless Panama
    Downloading BlackBerry Handheld Software v4.6.1.411 (Multilanguage)
    Download Details
    Software Name:               BlackBerry Handheld Software v4.6.1.411 (Multilanguage)
    File Name:          8520wifiM_PBr4.6.1_rel411_PL4.2.0.118_A4.6.1.274_Cable__amp__Wireless_Panama.exe
    Download Size: 116.413 MB
    Language:           Spanish
    Published Date:                08/11/2009
    But when the download starts the file changes sizes to 17.3 MB
    So I’m guess is a broken file on the this link, can you please fix it as soon as possible, I really need to fix my Blackberry.
    Thanks in advance.

    Well its just an idea, because you guys can download it all right and I keep getting 17.3 MB.
    Please can you send it to me, I have a web designer guy at office that can give set up an FTP account for this purpose.
    I just had the most difficult week, since i dont have backup of my contacts and stuff, ask a lot of numbers that i had there, please guys send me this file, I send a mail to:
    [email protected]
    reporting this stuff, and they answer me this:
    Thank you for contacting BlackBerryTechnical Support. The email you submitted has not been delivered. Please find many alternative support options below.
    Are you a BlackBerry Partner or Carrier?
    If you are a BlackBerry Partner or Carrier and have a carrier code please contact your partner Support Account Manager as you incorrectly received this message.
    Self-Help Options:
    BlackBerryTechnical Solution Center. All BlackBerry smartphone users have free access to the BlackBerry Technical Solution Center a repository of support information and documentation, with enhanced search capabilities. Easily search for and find the BlackBerry support information you need.
    (http://www.blackberry.com/btsc/)
    BlackBerry Answers.The mobile web site that like having your own technical support team at your fingertips. Accessible right from your BlackBerry smartphone at mobile.blackberry.com, just type in a question to get step-by-step instructions that should solve the problem.(Note: BlackBerry Answers is compatible with all BlackBerry smartphones carrying a series number of 8000 and higher).
    BlackBerry Support Community Forums.Get your questions answered, and participate in discussions on BlackBerry products and services. Visit the BlackBerry Community Support Forum to get started
    Flickr Picasa Facebook and Instant Messaging Applications. If you require assistance with one of our free social networking applications, please feel free to use our online web form to submit technical issues directly to BlackBerryTechnical Support at your convenience.
    (http://supportforums.blackberry.com/rim/)
     Are you already a BlackBerry Technical Support Services subscriber? 
    If you have a technical support services subscription, you may contact us through our online web form (https://www.blackberry.com/besc/dashboard). If your BlackBerry smartphone has been provided to you by your company, please contact your IT help desk for assistance.
     All other BlackBerry smartphone users are encouraged to use one of the following options:
    Contact your Wireless Service Provider. Your service provider fields general questions and provides technical support for BlackBerry related issues and can act as your first point of contact.
     Subscribe to an annual based BlackBerry technical support program. BlackBerryTechnical Support Services offers 24x7 technical support and BlackBerryEnterprise Server software upgrades. If your technical support subscription has expired, or you would like to learn more about this option, copy and paste the following URL into your address bar: (http://na.blackberry.com/eng/support/programs/technical.jsp#tab_tab_annual.)
     Obtain Pay-Per Incident Support from Research In Motion (RIM). Receive fee-based support directly from RIM, the manufacturer and wireless experts for the BlackBerry solution. If you would like to learn more about this option, please copy and paste the following URL into your address bar:
    (http://na.blackberry.com/eng/support/programs/technical.jsp#tab_ddetail_subtab_incident)
    Its a weird issue I know, but I need help
    Edwin

  • Lighttpd rc.d file broken

    If I try to run /etc/rc.d/lighttpd start I always get
    :: Checking configuration                                                [DONE]
    :: Starting lighttpd                                                     [FAIL]
    However I looked in the lighttpd file for what it was running and ran the command:
    nohup /usr/sbin/lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf
    and the web server works just fine, it seems that the rc.d file is broken somehow but I have no idea how. Is there any way for me to get more information about why it isn't working to help fix it?

    As a note for the possibility that my lighttpd.conf is broken I copied the lighttpd.conf.pacnew to lighttpd.conf and the rc.d still failed.

  • FIle path between iTunes and music files broken

    Somehow I've managed to lose the file path connecting my songs on an external hard drive with iTunes. I've checked the advanced aoptions to make sure that iTunes is pointing to F: (instead of C:) but no dice.
    Obviously I can go through and reconnect them all individually but for 16,000 songs that's not an option. I also don't want to reload the song files (by opening them directly from the drive) and lose all my play count information.
    I've had this happen before when upgrading PCs or when the EHD was renamed and been able to fix it but this time nothing seems to work.

    Yes it has. I recently changed from laptop to PC and managed to load iTunes on PC, copy across playcount and album artwork information and have the EHD connected and showing the correct pathways. Everything was working fine for about 3 days. When launching iTunes a couple of days ago, it asked me to go through the setup screens again (which I did) and since then the file paths have been missing. I've been into the xml file of the iTunes library and it shows everything pointing to the default c: drive location. This may be because I read that consolidating the library (under the advanced tab) would help but it didn't.

  • Linked files broken in Photoshop CC 2014 when working in the cloud across multiple computers (PC and Mac)

    I'm using the new linked file option in Photoshop CC 2014, which is great. I'm working with my files in the cloud, however because I'm working on both a PC and Mac it breaks them links every time I save the file. Is there a way around this?

    Hi, yes I'm having the same issue. The problem is that Adobe is not correctly connecting the linked files. They are using absolute paths  user/folder/folder this is just crazy and I hope they fix this.
    Changing this will fix our issue.
    I'm a professional web designer and I find the use of linked items really good. My workflow consists of creating a UI folder with different elements linked into photoshop documents saved in another folder.
    UI - elements
    Front page folder
    Second page folder
    etc.
    Moving these folders is impossible. Making my life really hard.
    Moving them to a network drive doesn't seem an option when you need to link all the files again, for each doc.
    Adobe kudos on the idea now fix the paths so this is usable across computers.
    Best
    Raven

  • Link between slides & sound files broken

    Following an inadvertant folder move the slides in a slideshow are not now linked to the corresponding narrative sound files. Can the link be re-eastablished and if so how?
    Peter Goldsworthy

    if, for example, A is a class name, you should use "A" and then use getDefinitionByName() to retrieve the class reference from the string.
    private var  lettersL1:Array = new Array['A','F','G','H','I','N','O','S','T'];
    for(var i:int=0;i<lettersL1.length;i++){
    var C:Class=Class(getDefinitionByName(lettersL1[i]));  // import flash.utils.getDefinitionByName
    var c:*=new C(); // create instances from the classes in lettersL1
    // do whatever with c
    or, move those instanciation statements into your LetterArray constructor or somewhere beyond like:
    package
        import flash.display.*;
        import flash.events.*;
        import flash.text.*;
        import flash.utils.Timer;
        import flash.media.Sound;
        import flash.media.SoundChannel;
        import flash.net.URLRequest;
        public class LetterArray extends MovieClip
            private var _stage:Stage; //this reference works well to the main file. Should I somehow link it to the errorous code below?
            private var letterArray:Array;
            private var  lettersL1:Array; //this is the line that causes the error. I am sure it is because I need to add something to the main class.
            public function LetterArray(ss:Stage):void{
                var a:A = new A();
                var f:F = new F();
                 etc
                lettersL1 = [a,f,...]
                _stage = ss;

  • All referenced files broken....

    Hey,
    i recently did a clean install of snow leopard and used timemachine to restore all my files however i have been working with a referenced file management structure in aperture 3 and although all the files are in the correct path and the hardrive name has not changed etc, aperture wont recognise my library files is there any way of forcing it to recognise them, or building a new managed library without losing all the versions of my files?
    Thanks
    Anthony

    I have a referenced file library. I started having this problem after I installed the 3.1 update in October - I did NOT have this problem prior to that installation.
    After the 3.1 update, when I unsuccessfully tried to export a version, I found that many - indeed most of my files have the 'red-line' badge, indicating that the referenced file cannot be found.
    I do the File / Locate Referenced Files thing, reconnect my photo, and sometimes (yes, sometimes!) the red slash goes away. I've tried to determine why is seems to be hit-or-miss, but I've been unable to identify why they connect and usually not. I test by trying to export a version.
    So then, after checking the support boards and this forum, I tried rebuilding my library. (And yes, before I did the rebuild, I ran the 'Repair Permissions ' and 'Repair Database' fixes also. Multiple times.)
    Here's a real whacky part of this problem: Sometime when I attempt to reconnect my referenced files, the red-slash badge remains, but I'm able to export a version. And just as intermittently, again after attempting to reconnect referenced files, the badge will go away, and I'll think I have success, but the histograms reads "Image offline." (And it is - I cannot export and my reconnection has failed.)
    Today I took my external HD with my to the Apple Store for a 1"1. They initially removed the plist, which didn't change anything. My store has a pretty knowledgeable crew, but this one stumped them too. I showed them what I did, they did the same thing, with the results I described above. They told me to AppZap and re-install A3 and A3 updates - which I've done. My problem persists. They thought that if a clean install didn't work, that maybe I might have a 'corrupt library' - which sounds serious - and I'm not sure I understand HOW that would've happen.
    I sure could use some help on this one - when A3 works, I love it! But I've had major headaches after the last two updates, and I'm just exasperated. (Oh yes - I'm stressin' too since my wife is asking me about the photo cards and gifts we were planning on giving for Christmas. Since I can't export, I'm kinda stuck. I haven't tried reprocessing my images in CS5 just because I thought I could fix this...)
    Many thanks ~
    Greg
    (tzargregory)

  • 10.7.3 and 9.1.6 exporting all tracks as audio files broken?

    Hi all,
    Is anyone else experiencing the loss of function with export all tracks as audio files in logic 9.1.6 on 10.7.3?
    When I select the function, nothing happens, as in im waiting for a prompt screen to appear but nothing, no beachball, no beeps or error messages.
    I should note I am using folders, and even when they are resized to start at 1 it still does not work, I have tried different songs and re-installed logic.
    any info on this would be appreciated.
    Thanks
    tommy

    In addition to the flex algorithms being disappointingly substandard in overall tc quality, flex tracks glitch constantly--especially if there are tempo changes or crossfades. You may be able to freeze them first and then export. AlternAtively, you could try tmelocking them and then using an alternate tempo map with a single tempo, then switching back after you flex tracks are bounced.

  • Photoshop (PSD) file broken out of nothing

    He folks,
    Today I was working on a .psd file.
    A few hours later (now) I'm trying to open the file getting the following error: "Could not complete your request because it is not a valid Photoshop document."
    I'm using Photoshop CS6 and a Mac. When I preview the file (pressing space in finder) it shows correctly.
    How could this happen and what can I do about it?
    When I copy it an change the extension to .tiff or .jpg it opens, but without all my layers etc.
    I read something about open it in a hex edtior search for this and this. I did but I didn't helped me out..
    I'll hope someone in here can help me ..
    Thanks for the effort!

    If you open the image as a tiff an save that what is the filesize and what is the psd’s filesize?
    Salvaging the damaged file may not be possible, how it was damaged is another issue.
    http://forums.adobe.com/message/4145463#4145463

  • Auto-proxy via file broken? Fix for crashing Tweetie and iTunes

    After upgrading to 10.6, Tweetie and iTunes would crash on launch.
    I was using a proxy.pac file to automatically set up a proxy when I'm at home (I've got Squid running on my file server). Disabling this (System Preferences > Network > Advanced > Proxies > Automatic Proxy Configuration) made them work again.
    I noticed slowdowns with Firefox and Thunderbird as well, hopefully disabling the proxy will fix that issue as well.
    Here's my proxy.pac file:
    function FindProxyForURL( url, host ) {
    if( shExpMatch( host, "*.local" ) ) {
    return "DIRECT";
    } else if( url.substring( 0, 6 ) == "https:" ) {
    return "DIRECT";
    } else if( isInNet( myIpAddress(), "10.0.0.0", "255.255.255.0" ) ) {
    return "PROXY10.0.0.12:3128";
    } else if( isInNet( myIpAddress(), "192.168.0.0", "255.255.0.0" ) ) {
    // It's there somewhere..."
    return "DIRECT";
    return "DIRECT";
    }

    grags wrote:
    Thanks for the thoughts.
    I'll look through both your suggestions.  It's not really what I'd call a split library, as the /media/music/... folder structure contains both the music files themselves and the iTunes Library folder.
    If the folder with the library files (normally iTunes) contains the designated media folder (normally iTunes Media) which in turn contains all media, including any iOS apps and clickwheel games, in any structure you like, then the library is portable. If it doesn't meet the criteria then it is split. Portability comes from the relative relationship between library location and media folder location. iTunes will adjust for a similar change in the root path to both that happens simultaneously, but otherwise expects media to remain on exactly the same path each time it runs.
    In context it would seem as if /media is your current media folder in which case moving the library files (see the tip) up to the root of the drive would make the library portable, if not consistent with the common names for the folders. Having accessed the library database at /iTunes Library.itl you should find that you can now close iTunes, change /media to /iTunes Media and reopen without breaking the library. You should then be able to close iTunes, create a new empty folder /iTunes, move the library files and media folder inside /iTunes and access the library at /iTunes/iTunes Library.itl. This would now be a completely portable library with standard names for the principal folders.
    iTunes for Windows doesn't provide access to the last known path of missing files so it isn't possible to use a simple string replacement technique to fix things up. If you were to use my script you'd probably need to run it against the media folders; Artists, Pop, Rock, etc. in turn, looking for the content located within each.
    tt2

Maybe you are looking for