Avatar billede fredand Forsker
17. juni 2022 - 13:55 Der er 6 kommentarer

How could this exception be in swedish?

Right now I am working on an issue in our production environment.
What I got is an error log message, see snippet below.

    at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: \\path\to\a\file (Filens storlek överskrider den tillåtna gränsen och filen kan därför inte sparas)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at com.a_swedish_company.util.UploadDelegate.uploadFileAsInputStream(UploadDelegate.java:219)
    ... 45 more

I have a real difficult to figure out how this could have happend.

I couple of thoughts:
1) The error message is in swedish, which is strange. In english it would say "The file size exceeds the allowable limit and the file can therefore not be saved".
2) The exception that is thrown is a FileNotFoundException, but according to the message the file is too big and must exist.
3) The exception seems to be thrown from some "Native Method", could that mean that it is araised from outside of the JVM, in some OS-code? (If the OS then is set to swedish, that could explain why the error message is in swedish)
4) Or is some localization executed in some how?
5) My first thoughts was to find some code at row 219 that catched some other exception and throw along a new FileNotFoundException with the swedish error message in our class com.a_swedish_company.util.UploadDelegate, but no. Given import com.healthmarketscience.rmiio.*, at row 219 we got this code:
            SerializableInputStream stream = new SerializableInputStream(new SimpleRemoteInputStream(new BufferedInputStream(new FileInputStream(file)), RemoteInputStreamServer.DUMMY_MONITOR, getChunkSizeRemoteStream()));
What are your thoughts about this exception? How could it be in swedish when we do not have it in our own code?

Any comments are most welcome!
Best regards
Avatar billede arne_v Ekspert
17. juni 2022 - 14:02 #1
My first thought is that  FileNotFoundException is correct and the text is wrong.

Reason: the code is trying to read - and the exception makes sense if it for some reason can't read the file. The text does not make sense as you are not trying to save a file.
Avatar billede arne_v Ekspert
17. juni 2022 - 14:05 #2
All Java IO goes like:

application Java code-->Java runtime Java code-->Java runtime C code-->C runtime-->OS

It is certainly possible that a call Java runtime C code-->C runtime returns an error code and that a call to strerror is done to produce an error text and that error text is passed on.

Possible != certain.
Avatar billede arne_v Ekspert
17. juni 2022 - 14:09 #3

indicate that you have a nodename in the file path.

And I am immediatetly thinking some access problem.

If you write a small 10 line Java program trying to read that file - can it?
Avatar billede fredand Forsker
17. juni 2022 - 14:35 #4
Yes you are right there is a node in the path
Btw I said production env, my bad, it is acctually in our test env.

That was a good idea to write a test to see if I could access it, unfortenately I could.

        File file = new File("\\\\path\\to\\a\\55 mb.pdf");
        FileInputStream fileInputStream = new FileInputStream(file);

        assertTrue( "Förväntat är att filen är större än 1024 byte", fileInputStream.available() > 1024);

You also spotted something I did not spot, it does a might do a read, not a save, which is strange.
Avatar billede arne_v Ekspert
17. juni 2022 - 16:27 #5
And the test program run under the same account as the code with the problem?

What if you open it the same way?
Avatar billede arne_v Ekspert
17. juni 2022 - 16:31 #6
And WTF is a SerializableInputStream?

Streams are usually not serializable.

Google finds:


"An input stream that can be sent over RMI. It uses an encrypted temp file to store the deserialized data."

That temp files sounds funky.

But probably not relevant as the stacktrace indicates that it is in FileINputStream the problem happens - way before that class gets into play.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview

Log ind eller opret profil


For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester

Stort CIO-interview: Lemvigh-Müllers milliard-omsætning er blevet digital