Skip to content

ServletContextResourceLoader performance problem: creates a lot of MalformedURLExceptions ("no protocol") in normal operation [SPR-8283] #12931

@spring-projects-issues

Description

@spring-projects-issues

Lari Hotari opened SPR-8283 and commented

The performance of ServletContextResourceLoader.getResource is very bad because it creates a MalformedURLException in normal operation.
I've noticed this problem in Grails webapplications.

Creating exceptions are costly because filling the stack trace of the exception takes relatively a lot of cpu.

There should be a better way to check url validity (without exceptions). In commons-validator there is org.apache.commons.validator.routines.UrlValidator , but I guess a simple check in ServletContextResourceLoader.getResource should be ok. (if path starts with '/' , prefer getResourceByPath)


Affects: 3.0.5

Referenced from: commits f388408

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions