Bug 41266 - API Review of nbinst URL protocol.
API Review of nbinst URL protocol.
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: -- Other --
4.x
All All
: P1 (vote)
: 4.x
Assigned To: Tomas Zezula
issues@platform
: API_REVIEW_FAST
Depends on: 41436
Blocks:
  Show dependency treegraph
 
Reported: 2004-03-24 14:00 UTC by Tomas Zezula
Modified: 2008-12-22 15:52 UTC (History)
2 users (show)

See Also:
Issue Type: TASK
:


Attachments
Diff File (16.29 KB, patch)
2004-03-24 14:01 UTC, Tomas Zezula
Details | Diff
Diff File (15.89 KB, patch)
2004-03-25 12:49 UTC, Tomas Zezula
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Zezula 2004-03-24 14:00:09 UTC
The nbinst URL provides URL which resolves to the
files under the netbeans installation folders.
This URL is required by the libraries API to allow
modules to define libraries independently on the
netbeans installation. For example the URL:
nbinst://modules/ext/junit.jar is resolved into
file /opt/NetBeans/modules/ext/junit.jar if the
NetBeans is installed in the /opt/NetBeans folder.

The addition of this URL protocol does not affect
any existing APIs.
The code does not expose any APIs, but it defines
a new URL protocol.
The code is covered by unit test.
Comment 1 Tomas Zezula 2004-03-24 14:01:14 UTC
Created attachment 14123 [details]
Diff File
Comment 2 Jesse Glick 2004-03-24 15:25:48 UTC
Rather than using URLDecoder you may wish to convert to a URI and use
its getPath method which decodes automatically. I'm not sure.

Checking for fo.isFolder() should be done in connect().

getOutputStream() is probably unnecessary - no one should be writing
to an IDE installation file.

The test should be added to the stable (code) config in
core/test/cfg-unit.xml, not dev.

I'm not sure I understand how the test registers its
TestInstalledFileLocator. Probably it needs to set the default lookup,
using the system property. Also setUp should confirm that there is a
TestInstalledFileLocator using an assertion, not just continue quietly
if it was not registered.

Before calling getWorkDir() you should call cleanWorkDir(). This
should be done in setUp, not tearDown - if the test fails you probably
want to see what files it was working on at the time.

Don't use assertTrue(x == y); use assertEquals(x, y) (in the proper
order). Also always give a message to JUnit assertions.

Should be a test to check that the host field is used correctly.
Comment 3 Tomas Zezula 2004-03-24 17:06:56 UTC
OK, I've changed 
URLDecoder.decode () into URI.
Moved isFolder test into connect
and removed the getOutputStream() method.
I have also changed the FileUtil.fromFile () in the decodeURL to
URLMapper.findFileObjects(). This solves the absence of the MasterFS
during the start up.

The test registers InstalledFileLocater in its META-INF/services/.
I will add the test testing the host part of the URL.
Comment 4 Tomas Zezula 2004-03-25 12:49:45 UTC
Created attachment 14146 [details]
Diff File
Comment 5 Jesse Glick 2004-03-25 14:27:59 UTC
Javadoc comments:

"The host part is optional, if presents it specifies the name of the
supplying module." - specifically, code name base.

"relative path from the ${netbeans.home}, ${netbeans.user} or
${netbeans.dirs}" - or whatever InstalledFileLocator decides.

BTW also need apichanges.xml patch etc. for the commit, though this is
not needed for the review.

testFindFileObject is confusing. (1) Use assertEquals and assertNull
and assertNotNull where appropriate. (2) Not necessary to check that
URLMapper static methods do not return null - that is for
URLMapperTest. (3) If fos.length == 1 you should also check that
fos[0] is in fact correct.

Typo in "testURLConenction".

cleanUp method is useless - just use clearWorkDir().

Otherwise looks fine to me.
Comment 6 Jesse Glick 2004-04-02 21:38:49 UTC
I guess it's been reviewed as much as it's going to be. Can be
implemented.
Comment 7 Tomas Zezula 2004-04-27 09:00:53 UTC
Done.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo