Problem writing to a file on a shared drive

I am having problems with my application not writing to a file on a shared drive. Actually it works perfect on one computer, but not on any other computer. Any ideas on why this would not work. Here is my code below, I think this may be an issue with permissions on the shared drive but have played with those until I am sick of it and nothing works. Any help on getting it to write to a file on a shared drive would be great.
report2 = new JButton("Provider Order Entry");
                    report2.addActionListener(new ActionListener() {
                         public void actionPerformed (ActionEvent e) {
                              if (e.getSource() == report2) {
                                   try {
                                        File file = new File("z:\\Provider Order Entry Reports\\ACCESSFILE.RMD");
                                        FileReader checkAccess = new FileReader(file);
                                        BufferedReader checkAccessBuff = new BufferedReader(checkAccess);
                                        boolean eof = false;
                                        while (!eof) {
                                             String line = checkAccessBuff.readLine();
                                             if (line != null) {
                                                  eof = true;
                                                  checkAccess.close();
                                                  checkAccessBuff.close();
                                                  if (!poeSelectionWindow.isShowing()) {
                                                       poeSelectionWindow.setSize(575, 200);
                                                       poeSelectionWindow.setBackground(blue);
                                                       JFrame.setDefaultLookAndFeelDecorated(false);
                                                       poeSelectionWindow.setVisible(true);
                                                  else if (poeSelectionWindow.isShowing()) {
                                                       poeSelectionWindow.setVisible(false);
                                   catch (IOException error) {
                                        Component controllingFrame = null;
                                        JOptionPane.showMessageDialog(controllingFrame,
                                                   "YOU DO NOT HAVE ACCESS TO THIS OPTION" + "\n" +
                                                   "PLEASE CONTACT IRM SUPPORT TO REQUEST ACCESS ",
                                                   "ACCESS DENIED",
                                                   JOptionPane.ERROR_MESSAGE);
                                        try {
                                             File errorFile = new File("Z:\\LOG\\LOGGER.log");
                                             String username = System.getProperty("user.name");
                                             InetAddress addr = InetAddress.getLocalHost();
                                             Date date = new Date();
                                             BufferedWriter bw = new BufferedWriter(new FileWriter(errorFile, true));
                                           bw.write("ACCESS ATTEMPTED ON: Provider Order Entry Report BY:" + username + " At Workstation/IP: "
                                                     + addr + " " + date);
                                           bw.newLine();
                                           bw.flush();
                                           bw.close();
                                        catch (IOException error1) {
                                             System.out.println("Error-- " + error1.toString());
                                        catch (NullPointerException NPE) {
                                             System.out.println("Error -- " + NPE.toString());                                                       
                                   catch (NullPointerException NPE) {
                                        System.out.println("Error -- " + NPE.toString());                                                       
                    });

So how do I stop the
NPE from occurring.By not dereferencing a null reference.
Thingamabob xyz = doSomethingWhichMightReturnNull();
if (xyz != null)
// go ahead and use xyz here
If you leave out the above "if" statement check, and just willy-nilly try to use xyz when it is null, you'll get the NPE.
It is occurring on the file
name. I have never been able to stop the file name
from throwing a NPE.I don't know how that translates to some lines of your code.

Similar Messages

  • Deleted Files , By Netwok Sharing Driver

    Hi! Everyone ,I use Windows server data center edition as a domain server ,i share a drive like ( D:\Share File ) for domain users , he work there and i permitted Delete and new create any file and folders( on the Shared Drive , But When he accidentally
    deleted any File on Domain Shared Drive its don't to move in the Domain Recycle Bin, its deleted permanently.If its move To Domain Recycle Bin no meter ,But i have trouble to solve it , If Have Anyone Solution Reply Me
    Thanx
    Khalil Ansari

    Hi,
    This is by design the Recycle Bin only stores files deleted from local drives, not from a network drives. The workaround is to move a folder in C:\users\<user name> to the network drive.
    For more detailed information, please refer to the thread below:
    Files deleting over the Network /share drive is not going to the recycle bin it permanently delete the file but deleting from local drive is normaly going to recycle Bin !
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/7119aafa-fe55-470c-ae20-568b80c5dcb4/files-deleting-over-the-network-share-drive-is-not-going-to-the-recycle-bin-it-permanently-delete?forum=winservergen
    Best Regards,
    Mandy
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How do I setup music files on a shared drive for access on my apple tv

    I am trying to set up music files on my shared wifi drive on my home network for accessability through the computer icon of my apple tv.....can someone tell me how to set up the files on the shared drive....right now, the apple tv will not recognize the music i have there to play it.

    Welcome to the Apple Community.
    You can put your music anywhere, but it must be part of an iTunes library and iTunes needs to be running for the Apple TV to play it.

  • Problem writing a segmented file to a a socket

    I have something like this:
    temp.out.writeObject("sot");
    temp.out.flush();
    temp.out.writeObject(fileName);
    temp.out.flush();
    for (int j=0;j<size;j=j+256){
                   byte[] temporary = new byte[256];
                   f.read(temporary,j,256);
                   System.out.println("J este " + j);
                   temp.out.writeObject(String.valueOf(j));
                   temp.out.flush();
                   temp.out.writeObject(temporary);
              temp.out.flush();
    temp.out.writeObject("-3");
         temp.out.flush();
    The problem is that it writes ok the "sot", it's writing ok the file name, and the first 256 bytes.
    After that the for stops at j=0. I don't get it ..

    sorry, I'm not really any good at reading other peoples code, but if it does what I think it does, here is how I do it
    int iHaveRead = 1;
              while(iHaveRead > 0){
              try {
    InBuffer = new byte[4096] ;
    iHaveRead = Sinput2.read(InBuffer, 0, 4096) ;
              } catch(IOException e) {
              System.out.println("Error on Input " + e) ;
              iHaveRead = -1 ;
              if(iHaveRead != -1){
              iToWrite = ProcData(iHaveRead) ;
              // write to Soutput
              try {
              Soutput.write(OutBuffer, 0, iToWrite) ;
    Soutput.flush() ;
    } catch(IOException e) {
              System.out.println("Error on Output " + e) ;
    iHaveRead = -1 ;
    where procData turns inbuffer to outbuffer and returns the size

  • Problem writing object to file

    Hi everyone,
    I am creating an index by processing text files. No of files are 15000 and index is a B+ Tree. when all files processed and i tried to write it to the file it gives me these errors.
    15000 files processed.
    writing to disk...
    Exception in thread "main" java.lang.StackOverflowError
            at sun.misc.SoftCache.processQueue(SoftCache.java:153)
            at sun.misc.SoftCache.get(SoftCache.java:269)
            at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:244)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1029)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:380)
            at java.util.Vector.writeObject(Vector.java:1018)
            at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1245)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1069)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:380)
            at java.util.Vector.writeObject(Vector.java:1018)
            at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
    ..........can anyone point out the mistake im doing?
    thanks

    the B+ Tree is balanced and is perfectly working without writing to the file. and i am using default writeObject() method of ObjectOutputStream.
      try {
                                FileOutputStream   f_out   = new   FileOutputStream ("tree.idx");
                                ObjectOutputStream obj_out = new   ObjectOutputStream (new BufferedOutputStream (f_out));   
         for (int x = 0, l = files.length; x < l; x++) {
              ProcessTree(files[x].toString());
                    System.out.println("Writing main index to the disk...");
                    obj_out.writeObject (tree); 
                    obj_out.flush();
                    obj_out.close();
                    } catch (Exception e)
          System.out.println (e.toString ());
          System.out.println("Error Writing to Disk!");
        }

  • How can I change the permissions in Mac OS X 10.10 to allow Illustrator to access the files on my shared drive?

    When trying to save out a file to the printer that runs my printers, I cannot access that drive when saving in Illustrator CC. It will actually show up the first time I save, then if I try to save out another file, the entire "shared" directory is gone. I can still access my shared drives through my finder window, but now Illustrator. Does anyone now how to fix that?

    I run a wide format printing company. I have my main computer that I design on, then a separate computer that runs my printers. So I do all of my layouts on my main design computer, then I save out a high res pdf to the printer computer. So all I am doing is saving a copy over to the program that runs my printers. I never had an issues until I updated to OSX 10.10 (Yosemite). What is weird is that they actually show up the first time I save a file out. Then when I go to save another file, they are gone. I have also noticed that in the top/middle of the "save" dialog box, there is a drop down menu of previous save locations and I can still access it from there, just not on the normal side menu.
    I called Adobe and they said it is an IT issue and that something is blocking Adobe from having access to the shared drives. I am not an IT person. so I have no idea how you modify that. When I try searching for answers, all I can come up with is how the modify file permissions, nothing on program permissions. This same thing happens to all of my Adobe programs.

  • Having trouble dragging/dropping files from my MacAir to a shared drive window, when I try to drag/drop gets bounced out. Can anyone help with advice on how to drag/drop or otherwise copy files to a shared drive? thanks in advance

    I am having trouble dragging/dropping or otherwise copying files from my MacAir to a window for a shared drive.
    When I try to drag/drop, files get bounced out.
    Anyone know how to drag/drop in such a case, or otherwise copy files from MacAir to a shared drive (which I do  not believe is on a Mac, not sure if that matters).
    Any help much appreciated, thanks in advance
    J.

    I am having trouble dragging/dropping or otherwise copying files from my MacAir to a window for a shared drive.
    When I try to drag/drop, files get bounced out.
    Anyone know how to drag/drop in such a case, or otherwise copy files from MacAir to a shared drive (which I do  not believe is on a Mac, not sure if that matters).
    Any help much appreciated, thanks in advance
    J.

  • Problem writing to excel file using report generation toolkit

    hello everyone, i have this report generation toolkit... and i want to output DAQmx Analog I/P data on to an excel sheet. the DAQmx is programmed to collect 
    data at 3samples/sec. however, when i see the excel file that Report Generation Toolkit generates, the time stamp is updated every second instead of every 0.33sec. 
    can anyone please help me?  i am using the MS Office Report Express VI. 
    Now on LabVIEW 10.0 on Win7

    @All, I got rid of the express VI, decided to work on the custom low level VIs instead. however, i have a new problem now... 
    I have a case statement wherein, the user selects if he wants to start generating a report. once the program enters tat loop, the program speed reduces! 
    can anyone please tell me why is it happening? i ahve attached the vi... also another question.. in this VI, i am capturing the unwanted data into the graph as I am indexin the graph input. how can i make a logic 
    that the graph captures the data only when I am switching the CREATE REPORT button (which is in the while loop). is there a way that I can append the data to the graph without creating a new graph every iteration? please let me know
    thanks
    Now on LabVIEW 10.0 on Win7
    Attachments:
    Untitled 7.vi ‏75 KB
    Untitled 7.JPG ‏99 KB

  • Problems loading a text-file from a shared NT network order

    Hi @ all,
    I try to upload a text file in MII that is destinated in a shared order in the NT file network.
    I used text_loader with URL FILE://SERVERNAME/SHARE/input.txt and I get the error message "connection refused" even if I use credentials with an authorised user.
    Do you have any idea why it does not work?
    Thanks in advance!
    Sebastian

    Hi,
    For this you need to use FTP Input Action. Put all the files(you want to upload to MII) are in shared network into your FTP server.
    Then use the FTP related actions in transaction. This is the best way.
    Also see the similar [Thread|Re: Saving a file to an external system from MII server] and [Help|http://help.sap.com/saphelp_mii121/helpdata/en/44/710ca09ea03abee10000000a155369/content.htm]
    Hope this helps you.
    -Suresh

  • Problem writing input to file

    This code compiles fine but my input values never write out to the flat file which is called datafile.txt, the datafile.txt gets created but file size shows zero, see code below..
    Thanks in advance
    import java.io.*;
    public class Write2File {
         public static void main (String[] args)
         try {
              OutputStream ostream;
              File outFile = new File("datafile.txt");     
              ostream = new FileOutputStream(outFile);
    char userInput;
              System.out.println("Enter Item Number and Quantity");
    userInput = (char)System.in.read();
    System.in.read();System.in.read();
    catch(IOException ex) {
    ex.printStackTrace();
    }

    It's because you're not writing to it. You're writing to System.out, but that is completely different, and it looks like you're not meaning for that to go to the file anyway.
    You probably want something more like:
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter Item Number and Quantity");
    String line = in.readLine();
    int space = line.indexOf(' ');
    int item = Integer.parseInt(line.substring(0, space);
    item quantity = Integer.parseInt(line.substring(space + 1));
    out = new PrintWriter(new FileWriter(outFile));
    out.println("Item Number: " + item + "; quantity: " + quantity);That's written from memory. Check the API to confirm it'll work.

  • Runtime.exec--problems writing to external file

    Hi. I went to http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html, and am still quite confused regarding the use of Runtime.exec, for my purposes. I want to decompile a CLASS file using javap, and then write that to a TXT file, for easier reading/input to JAVA. Now, I use the following code (a modification of what I got from http://www.mountainstorm.com/publications/javazine.html, as the "traps" article's sample code is WAY too confusing--they say the compiler had the output sent to text.txt, without even showing how in the source code they did that), but it hangs up. Modifications to the string array cause different results, such as showing the javap help menu, or saying that the class wasn't found, but I think the way I did the array here is right:
    import java.util.*;
    import java.io.*;
    public class Test {
            try {
             String ls_str;
                String[] cmd = {"C:\\j2sdk1.4.2_04\\bin\\javap", "-c", "-classpath", "H:\\Java\\metricTest", "metricTest > blah.txt", ""};
                Process ls_proc = Runtime.getRuntime().exec(cmd);
             // get its output (your input) stream
             DataInputStream ls_in = new DataInputStream(
                                              ls_proc.getInputStream());
             try {
              while ((ls_str = ls_in.readLine()) != null) {
                  System.out.println(ls_str);
             } catch (IOException e) {
              System.exit(0);
         } catch (IOException e1) {
             System.err.println(e1);
             System.exit(1);
         System.exit(0);
    }

    Also, jesie, I realize that's what I need...the only
    problem is, the name "test.txt" is nowhere to be found
    in the source code! lolLooks like I have to explain this, then.
    When you look at a Java program you'll notice that it always has a "main" method whose signature looks like this:public static void main(String[] args)When you execute that program from the command line, it takes whatever strings you put after the class name and passes them to the main program as that array of strings. For example if you run it likejava UselessProgram foo bar hippothen the "java" command takes the three strings "foo", "bar", and "hippo" and puts them into that args[] array before calling the "main" method.
    That means that inside the "main" method in this case, "args[0]" contains "foo", "args[1]" contains "bar", and "args[2]" contains "hippo".
    Now go back to the example and see how it lines up with that.

  • Problem writing a text file to user's hard drive

    I am trying to write a "GPX" file from an Oracle report to the user's hard drive on windows XP computers. To do this I want to write an ASCII file using the distribution method in the Oracle report. My URL to generate the report is as follows:
    http://serveraddress.dot.ca.gov:7779/reports/rwservlet?destype=cache&destype=file&desformat=ascii&DESNAME=d:\test_report.txt&mode=character&report=gpx&userid=userxx/pwxx@mydatabase
    When I run the report I get the following error: "REP-1804: Unable to open printer definition file 'ascii'"
    We are running Oracle Report 10G.
    Does anyone know what I am doing wrong or is there another method to write the ASCII file. If there is a method in Oracle forms, I could also do it in a form.
    Thanks for the help.

    desname=d:\test_report.txtThat is a file on d: drive on the server. You cannot directly write to the client PC.
    For valid values of desformat:
    http://download.oracle.com/docs/cd/E14571_01/bi.1111/b32121/pbr_cla005.htm#i636884
    Ascii is not a standard desformat. Try
    mode=character&desformat=dflt
    If there is a method in Oracle forms, I could also do it in a form.Yes, you can use client_text_io. Don't use that method for large files, though. Better to use text_io and copy the result from server to client:
    http://fdegrelle.over-blog.com/article-1810290.html
    Edited by: InoL on Apr 15, 2011 3:05 PM

  • CS4 InDesign Slow with files opened from shared drive

    We have an issue that I can't seem to figure out...
    I have six different people using Word files and InDesign files that are being opened from a server. When going from Word into InDesign (or vise verse) it takes a few seconds for the cursor to become active; however if the user is copying text from Word to any other Adobe product (Illustrator, Photoshop, Quark) no lag at all. They are also all getting a PDF creation failed when trying to save to the server (error is attatched).
    It's  not a specific file because all six people have the same issue, and  they're all working on separate projects.
    It's not machine specific since (again) all six Macs have the issue.
    Obviously it's an InDesign issue, but what, and why all of a sudden?
    Any  help would GREATLY be appreciated.

    My first guess would be that the client OS version could be apart of it - small changes to the SMB client in 10.6 could explain it. I'd also be interested in looking at the firewall issue. It may well be a combination of both.
    I think said earlier that working locally was not a problem, so you've already done the first logical test. Next, I'd think about trying the following, the order of which I'd base on their level of difficulty:
    Temporarily put one of the problematic client machines inside the firewall (or the server outside of it, though I assume that would be harder/impossible)
    Either upgrade one the of the problematic machines to 10.6.2, or create a Snow Leopard boot system with InDesign installed (on an external drive?) from which you can boot the machine
    I'm sure getting rid of the firewall is not a long term solution, but it would be good to know for future reference whether the firewall is involved. Would upgrading to Snow Leopard be in the cards if it does seem to fix it?

  • Unable to save Keynote file to Windows Shared Drive

    Have recently installed Mavericks 10.9, and Keynote Version 6.0.1.
    I am having difficulty saving any Keynote files to a Windows network Share. The network Share was added with domain credentials of the Windows Environment, so permissions are not the issue as far as the share is concerned.
    When attempting to save any file, existing or new to the network Share, Keynote advises that there are not sufficient permissions to be able to save to this folder. If I copy and paste the item into the folder, it works as normal.
    It looks to be an issue with Keynote saving with local Mac Credentials instead of Windows Credentials, however there are no issues saving other type of files to the network share, just Keynote.
    Any assistance would be greatly appreciated.

    This is a known issue, as you are doing the work around is to save to the Mac and then transfer to the the share folder. Hopefully this may be sorted when Apple completes the series of updates we are expecting.

  • Saving a .pdf file into the network shared drive from Outlook 2013

    Hello sirs,
    I have one client that having the file saving issue into the shared drive from outlook 2013.
    I have isolated the network portion and confirmed that there is nothing to do with the network. They have 1 host server which has 2 VMs inside (DC & FS). Whenever they want to save .pdf file into the shared drive, "Saving" message box popped up and showed for about 1 min to complete the file saving. I have tested with .xlsx & .dcsx but no error saving those files. only for this particular extension that facing this slowness problem. It has been on going for a month already and I couldn't figure it out what could be the issue.
    Please if anyone experienced this issue, I would really appreciate your suggestions & guidance.
    Thank you.
    This topic first appeared in the Spiceworks Community

    I have a script that I am trying to cobble together, but I am stuck at attempting to execute an SQL query against and ADO connection. My code is as follows:Powershell $FQDNUpper = $Computer.ToUpper() + ".domain.dn1.dn2" $FQDNLower = $Computer.ToLower() + ".domain.dn1.dn2" $shell = New-Object -ComObject "Wscript.Shell" # for use later in script $cnn = New-Object -ComObject "ADODB.Connection" $cnn.ConnectionString = "Connection_String" $cnn.Open() $queryUpper = "SELECT CAST(ID AS nvarchar(50)) ID FROM Machine WHERE Name=$FQDNUpper AND Role = 0" $rs = $cnn.Execute($queryUpper,' ',1) #If statement that will qualify if $FQDNUpper returned anything else try $FQDNLowerWhen executing the code I receive an error:
    PowershellArgument: '2' should be a System.Management.Automation.PSReference. Use [ref].At line:9 char:5+ $rs = $cnn.Execute(...

Maybe you are looking for