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 194598 - RemoteDirectory.lastModified: Error parsing date string
Summary: RemoteDirectory.lastModified: Error parsing date string
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Remote (show other bugs)
Version: 7.0
Hardware: PC Windows XP
: P1 normal (vote)
Assignee: Vladimir Kvashin
URL:
Keywords:
Depends on:
Blocks: 194326
  Show dependency tree
 
Reported: 2011-01-21 18:38 UTC by Yulia Novozhilova
Modified: 2011-02-02 12:49 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
netbeans log (93.01 KB, text/x-log)
2011-01-21 18:38 UTC, Yulia Novozhilova
Details
messages.log (38.92 KB, text/x-log)
2011-01-31 13:25 UTC, Yulia Novozhilova
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yulia Novozhilova 2011-01-21 18:38:22 UTC
Created attachment 105253 [details]
netbeans log

Build: NetBeans IDE Dev 201101210001


java.lang.NullPointerException
	at org.openide.text.CloneableEditorSupport$Listener.run(CloneableEditorSupport.java:3000)
[catch] at org.openide.text.CloneableEditorSupport$3.doRun(CloneableEditorSupport.java:710)
	at org.openide.text.CloneableEditorSupport$3.run(CloneableEditorSupport.java:677)
	at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:314)
	at org.openide.text.NbDocument.runAtomic(NbDocument.java:422)
	at org.openide.text.CloneableEditorSupport$3.doRun(CloneableEditorSupport.java:687)
	at org.openide.text.CloneableEditorSupport$3.run(CloneableEditorSupport.java:677)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1424)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1968)


Steps to reproduce:
- activate C/C++ support,
- go to services pane > C/C++ development hosts, set up a host
- via context menu of the newly added host, add to Favorites some its directory
- try to open any file in this dir in Favorites.

Another issue #194326 was also introduced by adding "Add to favorites" functionality to C/C++ development hosts context menu.
Comment 1 David Strupl 2011-01-26 09:42:03 UTC
It seems the problem is related to usage of remote fs. The code that causes this is 

import org.netbeans.modules.remote.spi.FileSystemProvider;
...
 FileSystem fs = FileSystemProvider.getFileSystem(env);
 FileObject fo = fs.getRoot();
  if (!Favorites.getDefault().isInFavorites(fo)) {
   try {
   Favorites.getDefault().add(fo);
...
and trying to open a file on the remote fs in the editor causes this exception.

I am trying to find out who owns the remote fs ...
Comment 2 Yulia Novozhilova 2011-01-26 13:01:30 UTC
I suppose Vladimir Kvashin(CC-ing) can help since hi is one of the authors and I believe the owner.
Comment 3 David Strupl 2011-01-27 10:32:47 UTC
The problem is in org.netbeans.modules.remote.impl.fs.RemoteDirectory

in method:


    Date lastModified(RemoteFileObjectBase child) {
        Entry childEntry = getChildEntry(child);
        if (childEntry != null) {
            String timestamp = childEntry.getTimestamp();
            try {
                if (timestamp != null) {
                    int dot = timestamp.indexOf('.'); // NOI18N
                    if (dot > 0) {
                        int space = timestamp.indexOf(' ', dot); // NOI18N
                        if (space > 0) {
                            timestamp = timestamp.substring(0,dot)+timestamp.substring(space);
                        }
                    }
                    return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(timestamp); // NOI18N
                }
            } catch (ParseException ex) {
            }
        }
>>>>>        return null;
    }


Just put a break point where I put the >>>>> and debug why your ignored ParseException happened.
Comment 5 Quality Engineering 2011-01-28 06:04:39 UTC
Integrated into 'main-golden', will be available in build *201101280000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/a97151ccf30c
User: Vladimir Kvashin <vkvashin@netbeans.org>
Log: fix for #194598 -  RemoteDirectory.lastModified returns null
Comment 6 Yulia Novozhilova 2011-01-31 13:23:52 UTC
INFO [remote.support.logger]: Error parsing date string for /Users/juli/Downloads/messages-1.log.1: Jan 18 06:42:39 2011
java.text.ParseException: Unparseable date: "Jan 18 06:42:39 2011"
	at java.text.DateFormat.parse(DateFormat.java:337)
[catch] at org.netbeans.modules.remote.impl.fs.RemoteDirectory.lastModified(RemoteDirectory.java:796)

Steps to reproduce:
- activate C/C++ support,
- go to services pane > C/C++ development hosts, set up a host
- via context menu of the newly added host, add to Favorites some its directory
- try to open any file in this dir in Favorites.

P1 since prevents from fixing P1 issue #194326.

Another strange thing is:
WARNING [org.openide.util.io.NbObjectOutputStream]: Serializable class org.netbeans.modules.remote.impl.fs.RemoteFileObjectBase does not declare serialVersionUID field. Encountered while storing: [org.openide.windows.TopComponent$Replacer, java.lang.Short, java.lang.Number, org.openide.windows.CloneableOpenSupport$Listener, org.openide.windows.CloneableTopComponent$Ref, org.openide.loaders.DefaultES$Environment, org.openide.text.DataEditorSupport$Env, org.openide.loaders.OpenSupport$Env, org.openide.loaders.DataObject$Replace, org.netbeans.modules.remote.impl.fs.RemotePlainFile] See also http://www.netbeans.org/issues/show_bug.cgi?id=19915 [may have been writing Windows2Local/Components/tmp1.settings]
INFO [org.netbeans.core.windows.persistence]: TopComponent tmp1 is not serializable.
java.io.NotSerializableException: org.netbeans.modules.nativeexecution.ExecutionEnvironmentImpl
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)

Please, take a look at it as well.
Comment 7 Yulia Novozhilova 2011-01-31 13:25:02 UTC
Created attachment 105518 [details]
messages.log
Comment 8 Vladimir Kvashin 2011-01-31 14:45:26 UTC
As I see, your remote system is Mac, right?
Mac isn't supported as a remote platform.

However, this exception should sure be fixed.
Comment 9 Vladimir Kvashin 2011-01-31 16:39:59 UTC
fixed in cnd-main
http://hg.netbeans.org/cnd-main/rev/fa6ad5dba794
Comment 10 Leonid Lenyashin 2011-01-31 19:19:02 UTC
(In reply to comment #8)
> As I see, your remote system is Mac, right?
> Mac isn't supported as a remote platform.
> 
> However, this exception should sure be fixed.

If Mac is not supported as remote system (I assume with "smart copy"), then user must be at least warned or at most prohibited of doing wrong things.
Comment 11 Vladimir Kvashin 2011-01-31 20:01:26 UTC
Just FYI, serialization related warnings fixed as well:
http://hg.netbeans.org/cnd-main/rev/b0b3c271e0ba
Comment 12 Quality Engineering 2011-02-01 05:59:16 UTC
Integrated into 'main-golden', will be available in build *201102010000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/fa6ad5dba794
User: Vladimir Kvashin <vkvashin@netbeans.org>
Log: fixed #194598 -  RemoteDirectory.lastModified: Error parsing date string
Comment 13 Yulia Novozhilova 2011-02-02 10:03:19 UTC
Thanks! There is no exception anymore, but something is still wrong since all the files from my Mac machine have modification time Thu Jan 01 03:00:00 MSK 1970.
Comment 14 Vladimir Kvashin 2011-02-02 11:38:42 UTC
Yulia, are you going to reopen one and the same P1 issue in the case of ANY problem is remote file system?

I'd also like to note that Mac isn't a supported remote platform.

I just filed a separate issue 194983 for this.
Comment 15 Vladimir Kvashin 2011-02-02 11:46:21 UTC
If the newly filed issue 194983 is a stopper for fixing issue 194326 (which is unlikely so), please let me know, so I'll fix it ASAP.
Comment 16 Yulia Novozhilova 2011-02-02 12:06:28 UTC
Vladimir, I'm trying to fix 194326 and test the fix using Mac as the remote system. Could you please point me at the place where it is written that Mac is not supported remote platform. 
I reopened this issue since the current behavior seems to be a result of your fix for this bug so I supposed fix wasn't clean enough. Possibly P1 is too high for this issue, I should downgraded it. But the priority is still high since files are invalid for search with such a date so it will lead to another P1 for search soon.
Comment 17 Vladimir Kvashin 2011-02-02 12:49:02 UTC
As to supported platforms, here is a user document that states 
it is Solaris and Linux
http://netbeans.org/kb/docs/cnd/remotedev-tutorial.html#intro
I can refer to QA, bit I don't remember NB internal docs about that.

And I'm going to fix issue 194326 in any case, the question is in priority.