-1

I have a Java project I was working on in NetBeans when suddenly my PC shutdown. When I open it again file I was working on at the shut down moment is now blank. Even though Local History was active it doesn't show it. It is still 4kb size and when you press Ctrl+A - select all, it selects 3 lines. But those are empty lines.

http://prntscr.com/q5b8lf

Does anyone know what can it be?

halfer
  • 19,824
  • 17
  • 99
  • 186
MightyMike
  • 34
  • 5

1 Answers1

1

Using a java program, I concluded that all these characters are spaces except for 1 newline character.

Code:

public class Table {

    public static void main (String[] args){
        String S = "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ";
        System.out.println(S);
        System.out.println((int) S.charAt(0)); // First character
        for(int i=0; i<S.length(); i++){
            if(S.charAt(i) != 32) System.out.println(i + (int) S.charAt(i)); 
                // If any character is ever != a space
        }
        System.out.println(32); // Space ASCII code
    }
}
Input: None

Output: (lots of spaces in the first line) 

32 // First character
32 // Space ASCII code
FailingCoder
  • 757
  • 1
  • 8
  • 20
  • Note: I had to remove the newline character to avoid causing an error. (String literal is not properly closed by a double-quote) where S is defined. – FailingCoder Dec 03 '19 at 02:06
  • Is there any known methods to restore files like this and get the code ? I cannot image why netbeans replace all characters with spaces... – MightyMike Dec 03 '19 at 02:29
  • @MightyMike I don't know. I believe I have answered your question though. Can you mark it as the correct answer, or tell me that I did not solve the question? Additionally, https://stackoverflow.com/questions/14108475/recover-lost-java-source-code-due-to-previous-abnormal-exit-of-eclipse might be useful for you. [**Retrieve/Recover lost netbeans project**](https://stackoverflow.com/questions/900992/retrieve-recover-deleted-netbeans-project) – FailingCoder Dec 03 '19 at 02:59