Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7914243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:03:05+00:00 2026-06-03T14:03:05+00:00

This code is from a library that I use and I decompiled because of

  • 0

This code is from a library that I use and I decompiled because of an error.

On Windows 32 it works correctly if the user that launches the program is an administrator of the machine, otherwise it crashes. On linux it crashes too.

/*      */   public static String cambiaEstensione(String nomeFile, String nuovaEstensione)
/*      */   {
/*  140 */     int p = nomeFile.lastIndexOf('.');
/*  141 */     if (p < 0) {
/*  142 */       return nomeFile + "." + nuovaEstensione;
/*      */     }
/*  144 */     return nomeFile.substring(0, p) + "." + nuovaEstensione;
/*      */   }

The caller of the function is this:

/* 182 */       if (this.fl_scrivi) {
/* 183 */         stato = "Apertura archivio dichiarazioni da inviare...";
/* 184 */         this.dcm = new Dcm();
/* 185 */         this.dcm.setNomeDcm(Util.cambiaEstensione(args[2], "dcm"));
/* 186 */         this.dcm.setFileDcm(new FileOutputStream(this.dcm.getNomeDcm()));
/*     */       }

The exception is:

java.io.FileNotFoundException: .dcm (Accesso negato)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at it.finanze.entrate.sco.main.M77S11.elaboraFile(M77S11.java:186)

Where “Accesso negato” means “Access Denied“.

Can you help me to understand the reason of the error?


UPDATE: The reason of the problem was that I was passing an empty string in args[2].

On Windows with administrator privileges it did not crash because it created the file C:\.dcm, not sure if I have to consider that a feature or a bug.

Thank you very much to everybody who answered.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:03:13+00:00Added an answer on June 3, 2026 at 2:03 pm

    It’s right there in the stack trace.

    java.io.FileNotFoundException: .dcm (Accesso negato)
    

    It can’t find a file named “.dcm” so it seems:

    Either the calling function passed an empty string for the filename, in other words args[2] returns an empty string at this line

    this.dcm.setNomeDcm(Util.cambiaEstensione(args[2], "dcm"));
    

    OR (since this occurs on Linux) args[2] contains a value like “.something” so this line

    int p = nomeFile.lastIndexOf('.');
    

    Returns zero and then this line

    return nomeFile.substring(0, p) + "." + nuovaEstensione;
    

    Returns just empty string + “.” + extension. (i.e. “.dcm”)

    Linux uses “.filename” to denote hidden files

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I copied this code from a book and tried to run that , basically
I got this code from someone and it works very well, I just want
We're migrating an application to use IIS7 integrated mode. In library code that is
I'm trying to compile the following simple DL library example code from Program-Library-HOWTO with
In this code (from the WCF REST starterkit - preview2): protected override SampleItem OnAddItem(SampleItem
I'm using this code from Microsoft to play audio notifications for my application. It's
I got this code from the wordpress <head profile=http://gmpg.org/xfn/11> What does this means? what
I copied this code from an example . I've read it 100 times. Array.prototype.map
I found this code from here: http://www.cssportal.com/form-elements/text-box.htm But the problem is you can still
I got this code from someone, it's almost perfect to create a dynamic breadcrumb,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.