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.
Summary: | FileObject.toURI | ||
---|---|---|---|
Product: | platform | Reporter: | Jesse Glick <jglick> |
Component: | Filesystems | Assignee: | Jesse Glick <jglick> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | apireviews |
Priority: | P3 | Keywords: | API |
Version: | 7.1 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Bug Depends on: | 207648, 207690 | ||
Bug Blocks: | 207060 | ||
Attachments: |
Patch in progress
Updated patch |
Description
Jesse Glick
2012-01-13 18:21:58 UTC
Created attachment 114895 [details]
Patch in progress
Fixed some sources which were catching FileStateInvalidException and no longer need to; would fix the rest (at least in cluster.config=stableuc) before commit.
Please review. If reviewers are uncomfortable removing the throws clause from getURL(), which is binary compatible but not source compatible, an alternate approach would be: /** @deprecated use {@link #toURL} */ public final URL getURL() throws FileStateInvalidException { return toURL(); } /** @since 7.57 */ public final URL toURL() { return URLMapper.findURL(this, URLMapper.INTERNAL); } which also better matches the naming idiom established in java.io.File. (A URL is not so much a property of a FileObject as it is an alternative representation.) By the way FileObject.getFileSystem() is documented to throw FileStateInvalidException yet this only actually happens after deserialization, i.e. essentially never. This could perhaps be fixed in a separate API review, which would save a lot more silly catch clauses. (There are a few other miscellaneous uses of FSIE in methods declared to throw IOE.) Created attachment 115094 [details]
Updated patch
Similar but leaves getURL signature unchanged and introduces toURL as a replacement, for source-level compatibility and naming consistency.
Also updates some more modules to use the new idioms. Inspect & Refactor is great here; still need to manually correct compilation errors caused by code no longer throwing FSIE, but only after applying refactoring, so can be done at any time.
Will commit tomorrow unless there are objections.
core-main #4acf9d4318d6 Integrated into 'main-golden', will be available in build *201201250600* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/4acf9d4318d6 User: Jesse Glick <jglick@netbeans.org> Log: #207294: FileObject.toURI/toURL. |