This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 222968 - Problems with working with old files
Summary: Problems with working with old files
Status: RESOLVED DUPLICATE of bug 254567
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P4 normal (vote)
Assignee: Jaroslav Havlin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-29 11:12 UTC by rudyment
Modified: 2015-10-29 13:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot showing the descripted behavior (59.44 KB, image/png)
2012-11-29 11:16 UTC, rudyment
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rudyment 2012-11-29 11:12:42 UTC
Product Version = NetBeans IDE 7.2 (Build 201207171143)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_09
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.5-b02

I dowloaded a set of filed from the FTP server.
However the downloading program (WinSCP 5.1.1 build 2735) set to the all downloaded files the date/time 1970-01-01 - 01:00:00).
NetBeans don't want to show content of such files (see the attached screenshot).
After changing the file dates/times the editor started to work.
Comment 1 rudyment 2012-11-29 11:16:57 UTC
Created attachment 128571 [details]
Screenshot showing the descripted behavior
Comment 2 Tomas Mysik 2012-11-30 10:58:30 UTC
Nothing to do with PHP, reassigning... Thanks.
Comment 3 Tomas Mysik 2012-11-30 10:59:14 UTC
BTW I am not sure about the proper BZ component. Please evaluate, thanks.
Comment 4 Milutin Kristofic 2012-11-30 11:02:13 UTC
It looks the files are corrupted. Did you open files with other editors?
Comment 5 rudyment 2012-11-30 13:00:39 UTC
(In reply to comment #4)
> It looks the files are corrupted. Did you open files with other editors?

I was first wondered what happen and so 
I opened the file with another editor (PSPad).
When i discovered that it is readable, 
I opened the Total Commander and set the file date to today.
Then everything started to work.

So i tried to set to date of a file to 1.1.1970 01:00
in TotalCommander by hand
and problems with editihg this file in NB again appeared.

I am afraid that NB don't like, 
when the date/file field of file is set to zero.

JEdit opened the file without problems,
so it seems that it is not a Java problem.
Comment 6 Milutin Kristofic 2012-12-03 13:02:27 UTC
Reproducible

touch -d 'Jan 1 1970 1:00:00' JavaApplication1.java


I got same as it is in the screenshot above.

I can open file with Notepad.jar.



Product Version: NetBeans IDE Dev (Build 201211270002)
Updates: Updates available to version , NetBeans 7.3 Beta 2
Java: 1.7.0_09; Java HotSpot(TM) 64-Bit Server VM 23.5-b02
Runtime: Java(TM) SE Runtime Environment 1.7.0_09-b05
System: Linux version 3.0.0-28-generic running on amd64; UTF-8; en_US (nb)
Comment 7 Miloslav Metelka 2012-12-05 12:44:54 UTC
When CloneableEditorSupport.loadDocument() calls 

InputStream is = new BufferedInputStream(cesEnv().inputStream());

the MultiDataObject.getFile() returns a file that has file.isValid() == false.
This is likely due to impl of FileObj.isValid():


    @Override
    public boolean isValid() {
        //0 - because java.io.File.lastModififed returns 0 for not existing files        
        boolean retval = getLastModified() != 0;
        //assert checkCacheState(retval, getFileName().getFile());
        return retval && super.isValid();
    }

Reassigning to filesystems.
Comment 8 Jaroslav Tulach 2012-12-06 09:34:22 UTC
Sad result of using getLastModified() to check if the file exists or not. Anyway this is not the case to optimize for and the fix is easy. Making P4.
Comment 9 Jaroslav Havlin 2015-10-29 13:41:32 UTC

*** This bug has been marked as a duplicate of bug 254567 ***