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 199200 - can't getInputStream() without connect()
Summary: can't getInputStream() without connect()
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Remote (show other bugs)
Version: 7.0
Hardware: Other Linux
: P2 normal (vote)
Assignee: Vladimir Kvashin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-06 15:03 UTC by Jaroslav Tulach
Modified: 2011-06-15 14:07 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2011-06-06 15:03:59 UTC
The URLs produced by remote filesystem (protocol 'rfs') are not behaving in a consistent way with regular URLs. One cannot call on their connection c.getInputStream() on them without previous call to c.connect().

Here would be the proposed fix (no test):

--- RemoteFileURLConnection.java (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -98,6 +98,9 @@
     @Override
     public InputStream getInputStream() throws IOException {
         if (fileObject == null) {
+            connect();
+        }
+        if (fileObject == null) {
             throw newFileNotFoundException();
         }
         if (iStream == null) {
Comment 1 Vladimir Kvashin 2011-06-10 16:29:16 UTC
If a remote machine is not connected, then the existing disk cache will be used. If there are no cache then
- empty input stream will be returned.
- a balloon that prompts for connection appears
- once connection is established, file change event should be fired for such a file

This allows working offline.

Making connect right here is not a good idea: as soon as there is no connection, user will be bored to death with this connection prompts.
Comment 2 Jaroslav Tulach 2011-06-12 19:21:27 UTC
I was connected still I could not obtain input stream for URL of clearly existing file.
Comment 3 Vladimir Kvashin 2011-06-14 10:19:58 UTC
Sorry, I just didn't get you right. Now I see.
Fixed
http://hg.netbeans.org/releases/rev/b7fd0bc4afa8
Comment 4 Jaroslav Tulach 2011-06-14 15:06:33 UTC
Thanks for fix and nice test.
Comment 5 Quality Engineering 2011-06-15 04:42:52 UTC
Integrated into 'releases'
Changeset: http://hg.netbeans.org/releases/rev/b7fd0bc4afa8
User: Vladimir Kvashin <vkvashin@netbeans.org>
Log: fix and test for #199200 - can't getInputStream() without connect()
Comment 6 Quality Engineering 2011-06-15 14:07:20 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/bb7fce8f6e05
User: Vladimir Kvashin <vkvashin@netbeans.org>
Log: fix and test for #199200 - can't getInputStream() without connect()
(transplanted from b7fd0bc4afa89b028cf44330a08ac0fecac2fc83)