You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey Varlamov (JIRA)" <ji...@apache.org> on 2007/03/15 14:00:18 UTC
[jira] Assigned: (HARMONY-3368) [drlvm][kernel] Unnecessary NPE
creation and catching in ClassLoader.getResourceAsStream(String)
[ https://issues.apache.org/jira/browse/HARMONY-3368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexey Varlamov reassigned HARMONY-3368:
----------------------------------------
Assignee: Alexey Varlamov
> [drlvm][kernel] Unnecessary NPE creation and catching in ClassLoader.getResourceAsStream(String)
> ------------------------------------------------------------------------------------------------
>
> Key: HARMONY-3368
> URL: https://issues.apache.org/jira/browse/HARMONY-3368
> Project: Harmony
> Issue Type: Improvement
> Components: DRLVM
> Reporter: Sergey Dmitriev
> Assigned To: Alexey Varlamov
>
> As per 516732 revision VM class ClassLoader's method getResourceAsStream(String) creates and catches NullPointerException in case of needed resource absence.
> -- ClassLoader.java --
> 221 /**
> 222 * @com.intel.drl.spec_ref
> 223 */
> 224 public InputStream getResourceAsStream(String name) {
> 225 URL foundResource = getResource(name);
> 226 try {
> 227 return foundResource.openStream();
> 228 } catch (IOException e) {
> 229 } catch (NullPointerException e) {
> 230 }
> 231 return null;
> 232 }
> It is worthy to replace "catch NullPointerException" with "if (foundResource == null)" -- thus we can avoind useless creation of NPE's objects.
> I didn't make deep analysis here, but - for example - starting up Eclipse with simple HelloWorld project auto-open shows about a hundled of such NPE creations in ClassLoader.getResourceAsStream(String). Just for your information.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.