You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Dan Du (JIRA)" <ji...@apache.org> on 2011/01/26 08:15:43 UTC
[jira] Created: (WW-3564) Unable to find a result type for
extension
Unable to find a result type for extension
------------------------------------------
Key: WW-3564
URL: https://issues.apache.org/jira/browse/WW-3564
Project: Struts 2
Issue Type: Bug
Components: Plugin - Convention
Affects Versions: 2.2.1
Environment: windows xp, spring 2.5, tomcat 5.0.28, struts2-convention-plugin-2.2.1.jar
Reporter: Dan Du
Priority: Blocker
I set a convention constant like this below:
==========================================================================================
<constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
==========================================================================================
After I deployed my project to tomcat server, I backup a file "search.jsp" and named the backup file with "search.jsp.bak", There is a class named with "SearchAction"。The action's search method is annotated by @Action, like this:
==========================================================================================
@Action(value = "search", results = { @Result(name = "search", location = "/WEB-INF/jsp/search.jsp") })
==========================================================================================
When I startup tomcat server, I recieved some message:
==========================================================================================
Unable to find a result type for extension [bak] in location attribute [/WEB-INF/jsp/search.jsp.bak]. - [unknown location]
==========================================================================================
Then I checked org.apache.struts2.convention.DefaultResultMapBuilder.java, I found this exception throwing at line 527。
I debug that snippet, At line 269, I found some problems,ServletContext.getResourcePaths() method will scan a directory and its sub-directory and return all files in these directories, If a file's extension is not jsp, jspx,vm,ftl,html or htm。 I would get the error。
So I think this code need to be change to fix this problem。
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] [Commented] (WW-3564) Unable to find a result type for
extension
Posted by "Johannes Geppert (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028713#comment-13028713 ]
Johannes Geppert commented on WW-3564:
--------------------------------------
1.) Why is this Issue a Blocker?
2.) I was abble to fix this with changeing following code in method createFromResources from
if (StringUtils.isBlank(fileName) || StringUtils.startsWith(fileName, ".")) {
if (LOG.isTraceEnabled())
LOG.trace("Ignoring file without name [#0]", path);
continue;
}
to
if (StringUtils.isBlank(fileName) || StringUtils.startsWith(fileName, ".")) {
if (LOG.isTraceEnabled())
LOG.trace("Ignoring file without name [#0]", path);
continue;
}
else if(fileName.lastIndexOf(".") > 0){
String suffix = fileName.substring(fileName.lastIndexOf(".")+1);
if(conventionsService.getResultTypesByExtension(packageConfig).get(suffix) == null) {
if (LOG.isDebugEnabled())
LOG.debug("No result type defined for file suffix : [#0]. Ignoring file #1", suffix, fileName);
continue;
}
}
Now only Files where a Result Type is defined are processed.
Is this the right way?
> Unable to find a result type for extension
> ------------------------------------------
>
> Key: WW-3564
> URL: https://issues.apache.org/jira/browse/WW-3564
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Convention
> Affects Versions: 2.2.1
> Environment: windows xp, spring 2.5, tomcat 5.0.28, struts2-convention-plugin-2.2.1.jar
> Reporter: Dan Du
> Assignee: Maurizio Cucchiara
> Priority: Blocker
> Attachments: 1.jpg, 11.jpg, 2.jpg, DefaultResultMapBuilder.java
>
>
> I set a convention constant like this below:
> ==========================================================================================
> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
> ==========================================================================================
> After I deployed my project to tomcat server, I backup a file "search.jsp" and named the backup file with "search.jsp.bak", There is a class named with "SearchAction"。The action's search method is annotated by @Action, like this:
> ==========================================================================================
> @Action(value = "search", results = { @Result(name = "search", location = "/WEB-INF/jsp/search.jsp") })
> ==========================================================================================
> When I startup tomcat server, I recieved some message:
> ==========================================================================================
> Unable to find a result type for extension [bak] in location attribute [/WEB-INF/jsp/search.jsp.bak]. - [unknown location]
> ==========================================================================================
> Then I checked org.apache.struts2.convention.DefaultResultMapBuilder.java, I found this exception throwing at line 527。
> I debug that snippet, At line 269, I found some problems,ServletContext.getResourcePaths() method will scan a directory and its sub-directory and return all files in these directories, If a file's extension is not jsp, jspx,vm,ftl,html or htm。 I would get the error。
> So I think this code need to be change to fix this problem。
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WW-3564) Unable to find a result type for
extension
Posted by "Dan Du (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13029106#comment-13029106 ]
Dan Du commented on WW-3564:
----------------------------
tks
> Unable to find a result type for extension
> ------------------------------------------
>
> Key: WW-3564
> URL: https://issues.apache.org/jira/browse/WW-3564
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Convention
> Affects Versions: 2.2.1
> Environment: windows xp, spring 2.5, tomcat 5.0.28, struts2-convention-plugin-2.2.1.jar
> Reporter: Dan Du
> Assignee: Maurizio Cucchiara
> Priority: Minor
> Attachments: 1.jpg, 11.jpg, 2.jpg, DefaultResultMapBuilder.java
>
>
> I set a convention constant like this below:
> ==========================================================================================
> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
> ==========================================================================================
> After I deployed my project to tomcat server, I backup a file "search.jsp" and named the backup file with "search.jsp.bak", There is a class named with "SearchAction"。The action's search method is annotated by @Action, like this:
> ==========================================================================================
> @Action(value = "search", results = { @Result(name = "search", location = "/WEB-INF/jsp/search.jsp") })
> ==========================================================================================
> When I startup tomcat server, I recieved some message:
> ==========================================================================================
> Unable to find a result type for extension [bak] in location attribute [/WEB-INF/jsp/search.jsp.bak]. - [unknown location]
> ==========================================================================================
> Then I checked org.apache.struts2.convention.DefaultResultMapBuilder.java, I found this exception throwing at line 527。
> I debug that snippet, At line 269, I found some problems,ServletContext.getResourcePaths() method will scan a directory and its sub-directory and return all files in these directories, If a file's extension is not jsp, jspx,vm,ftl,html or htm。 I would get the error。
> So I think this code need to be change to fix this problem。
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (WW-3564) Unable to find a result type for
extension
Posted by "Dan Du (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Du updated WW-3564:
-----------------------
Attachment: DefaultResultMapBuilder.java
It's my updated file.
> Unable to find a result type for extension
> ------------------------------------------
>
> Key: WW-3564
> URL: https://issues.apache.org/jira/browse/WW-3564
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Convention
> Affects Versions: 2.2.1
> Environment: windows xp, spring 2.5, tomcat 5.0.28, struts2-convention-plugin-2.2.1.jar
> Reporter: Dan Du
> Assignee: Maurizio Cucchiara
> Priority: Blocker
> Attachments: 1.jpg, 11.jpg, 2.jpg, DefaultResultMapBuilder.java
>
>
> I set a convention constant like this below:
> ==========================================================================================
> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
> ==========================================================================================
> After I deployed my project to tomcat server, I backup a file "search.jsp" and named the backup file with "search.jsp.bak", There is a class named with "SearchAction"。The action's search method is annotated by @Action, like this:
> ==========================================================================================
> @Action(value = "search", results = { @Result(name = "search", location = "/WEB-INF/jsp/search.jsp") })
> ==========================================================================================
> When I startup tomcat server, I recieved some message:
> ==========================================================================================
> Unable to find a result type for extension [bak] in location attribute [/WEB-INF/jsp/search.jsp.bak]. - [unknown location]
> ==========================================================================================
> Then I checked org.apache.struts2.convention.DefaultResultMapBuilder.java, I found this exception throwing at line 527。
> I debug that snippet, At line 269, I found some problems,ServletContext.getResourcePaths() method will scan a directory and its sub-directory and return all files in these directories, If a file's extension is not jsp, jspx,vm,ftl,html or htm。 I would get the error。
> So I think this code need to be change to fix this problem。
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] [Updated] (WW-3564) Unable to find a result type for
extension
Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dave Newton updated WW-3564:
----------------------------
Priority: Minor (was: Blocker)
> Unable to find a result type for extension
> ------------------------------------------
>
> Key: WW-3564
> URL: https://issues.apache.org/jira/browse/WW-3564
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Convention
> Affects Versions: 2.2.1
> Environment: windows xp, spring 2.5, tomcat 5.0.28, struts2-convention-plugin-2.2.1.jar
> Reporter: Dan Du
> Assignee: Maurizio Cucchiara
> Priority: Minor
> Attachments: 1.jpg, 11.jpg, 2.jpg, DefaultResultMapBuilder.java
>
>
> I set a convention constant like this below:
> ==========================================================================================
> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
> ==========================================================================================
> After I deployed my project to tomcat server, I backup a file "search.jsp" and named the backup file with "search.jsp.bak", There is a class named with "SearchAction"。The action's search method is annotated by @Action, like this:
> ==========================================================================================
> @Action(value = "search", results = { @Result(name = "search", location = "/WEB-INF/jsp/search.jsp") })
> ==========================================================================================
> When I startup tomcat server, I recieved some message:
> ==========================================================================================
> Unable to find a result type for extension [bak] in location attribute [/WEB-INF/jsp/search.jsp.bak]. - [unknown location]
> ==========================================================================================
> Then I checked org.apache.struts2.convention.DefaultResultMapBuilder.java, I found this exception throwing at line 527。
> I debug that snippet, At line 269, I found some problems,ServletContext.getResourcePaths() method will scan a directory and its sub-directory and return all files in these directories, If a file's extension is not jsp, jspx,vm,ftl,html or htm。 I would get the error。
> So I think this code need to be change to fix this problem。
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Assigned: (WW-3564) Unable to find a result type for
extension
Posted by "Maurizio Cucchiara (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Maurizio Cucchiara reassigned WW-3564:
--------------------------------------
Assignee: Maurizio Cucchiara
> Unable to find a result type for extension
> ------------------------------------------
>
> Key: WW-3564
> URL: https://issues.apache.org/jira/browse/WW-3564
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Convention
> Affects Versions: 2.2.1
> Environment: windows xp, spring 2.5, tomcat 5.0.28, struts2-convention-plugin-2.2.1.jar
> Reporter: Dan Du
> Assignee: Maurizio Cucchiara
> Priority: Blocker
> Attachments: 1.jpg, 11.jpg, 2.jpg
>
>
> I set a convention constant like this below:
> ==========================================================================================
> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
> ==========================================================================================
> After I deployed my project to tomcat server, I backup a file "search.jsp" and named the backup file with "search.jsp.bak", There is a class named with "SearchAction"。The action's search method is annotated by @Action, like this:
> ==========================================================================================
> @Action(value = "search", results = { @Result(name = "search", location = "/WEB-INF/jsp/search.jsp") })
> ==========================================================================================
> When I startup tomcat server, I recieved some message:
> ==========================================================================================
> Unable to find a result type for extension [bak] in location attribute [/WEB-INF/jsp/search.jsp.bak]. - [unknown location]
> ==========================================================================================
> Then I checked org.apache.struts2.convention.DefaultResultMapBuilder.java, I found this exception throwing at line 527。
> I debug that snippet, At line 269, I found some problems,ServletContext.getResourcePaths() method will scan a directory and its sub-directory and return all files in these directories, If a file's extension is not jsp, jspx,vm,ftl,html or htm。 I would get the error。
> So I think this code need to be change to fix this problem。
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WW-3564) Unable to find a result type for
extension
Posted by "Dan Du (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Du updated WW-3564:
-----------------------
Attachment: 2.jpg
1.jpg
11.jpg
Pay attention to this below:
protected void makeResults(Class<?> actionClass, String path, String resultPrefix,
Map<String, ResultConfig> results, PackageConfig packageConfig,
Map<String, ResultTypeConfig> resultsByExtension) {
if (path.startsWith(resultPrefix)) {
"if (path.startsWith(resultPrefix)) {", it is important.
Not all backup files ended with "bak" will cause this error.it must satisfied the condition:
====================================================
path.startsWith(resultPrefix)
====================================================
> Unable to find a result type for extension
> ------------------------------------------
>
> Key: WW-3564
> URL: https://issues.apache.org/jira/browse/WW-3564
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Convention
> Affects Versions: 2.2.1
> Environment: windows xp, spring 2.5, tomcat 5.0.28, struts2-convention-plugin-2.2.1.jar
> Reporter: Dan Du
> Priority: Blocker
> Attachments: 1.jpg, 11.jpg, 2.jpg
>
>
> I set a convention constant like this below:
> ==========================================================================================
> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
> ==========================================================================================
> After I deployed my project to tomcat server, I backup a file "search.jsp" and named the backup file with "search.jsp.bak", There is a class named with "SearchAction"。The action's search method is annotated by @Action, like this:
> ==========================================================================================
> @Action(value = "search", results = { @Result(name = "search", location = "/WEB-INF/jsp/search.jsp") })
> ==========================================================================================
> When I startup tomcat server, I recieved some message:
> ==========================================================================================
> Unable to find a result type for extension [bak] in location attribute [/WEB-INF/jsp/search.jsp.bak]. - [unknown location]
> ==========================================================================================
> Then I checked org.apache.struts2.convention.DefaultResultMapBuilder.java, I found this exception throwing at line 527。
> I debug that snippet, At line 269, I found some problems,ServletContext.getResourcePaths() method will scan a directory and its sub-directory and return all files in these directories, If a file's extension is not jsp, jspx,vm,ftl,html or htm。 I would get the error。
> So I think this code need to be change to fix this problem。
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] [Commented] (WW-3564) Unable to find a result type for
extension
Posted by "Dan Du (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13029100#comment-13029100 ]
Dan Du commented on WW-3564:
----------------------------
To Johannes Geppert:
1.) Why is this Issue a Blocker?
Not all backup files ended with "bak" will cause a blocker.
Only path start with the same prefix:
====================================================
path.startsWith(resultPrefix)
====================================================
for example,if a directory contains two jsp files:
/WEB-INF/jsp/search.jsp
/WEB-INF/jsp/search.jsp.bak
An exception will be thrown,it's a blocker.Below is stack message:
"Unable to find a result type for extension"
2.) Yes, you are right.
> Unable to find a result type for extension
> ------------------------------------------
>
> Key: WW-3564
> URL: https://issues.apache.org/jira/browse/WW-3564
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Convention
> Affects Versions: 2.2.1
> Environment: windows xp, spring 2.5, tomcat 5.0.28, struts2-convention-plugin-2.2.1.jar
> Reporter: Dan Du
> Assignee: Maurizio Cucchiara
> Priority: Minor
> Attachments: 1.jpg, 11.jpg, 2.jpg, DefaultResultMapBuilder.java
>
>
> I set a convention constant like this below:
> ==========================================================================================
> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
> ==========================================================================================
> After I deployed my project to tomcat server, I backup a file "search.jsp" and named the backup file with "search.jsp.bak", There is a class named with "SearchAction"。The action's search method is annotated by @Action, like this:
> ==========================================================================================
> @Action(value = "search", results = { @Result(name = "search", location = "/WEB-INF/jsp/search.jsp") })
> ==========================================================================================
> When I startup tomcat server, I recieved some message:
> ==========================================================================================
> Unable to find a result type for extension [bak] in location attribute [/WEB-INF/jsp/search.jsp.bak]. - [unknown location]
> ==========================================================================================
> Then I checked org.apache.struts2.convention.DefaultResultMapBuilder.java, I found this exception throwing at line 527。
> I debug that snippet, At line 269, I found some problems,ServletContext.getResourcePaths() method will scan a directory and its sub-directory and return all files in these directories, If a file's extension is not jsp, jspx,vm,ftl,html or htm。 I would get the error。
> So I think this code need to be change to fix this problem。
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (WW-3564) Unable to find a result type for
extension
Posted by "Johannes Geppert (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Johannes Geppert resolved WW-3564.
----------------------------------
Resolution: Fixed
Fix Version/s: 2.3
Assignee: Johannes Geppert (was: Maurizio Cucchiara)
> Unable to find a result type for extension
> ------------------------------------------
>
> Key: WW-3564
> URL: https://issues.apache.org/jira/browse/WW-3564
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Convention
> Affects Versions: 2.2.1
> Environment: windows xp, spring 2.5, tomcat 5.0.28, struts2-convention-plugin-2.2.1.jar
> Reporter: Dan Du
> Assignee: Johannes Geppert
> Priority: Minor
> Fix For: 2.3
>
> Attachments: 1.jpg, 11.jpg, 2.jpg, DefaultResultMapBuilder.java
>
>
> I set a convention constant like this below:
> ==========================================================================================
> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
> ==========================================================================================
> After I deployed my project to tomcat server, I backup a file "search.jsp" and named the backup file with "search.jsp.bak", There is a class named with "SearchAction"。The action's search method is annotated by @Action, like this:
> ==========================================================================================
> @Action(value = "search", results = { @Result(name = "search", location = "/WEB-INF/jsp/search.jsp") })
> ==========================================================================================
> When I startup tomcat server, I recieved some message:
> ==========================================================================================
> Unable to find a result type for extension [bak] in location attribute [/WEB-INF/jsp/search.jsp.bak]. - [unknown location]
> ==========================================================================================
> Then I checked org.apache.struts2.convention.DefaultResultMapBuilder.java, I found this exception throwing at line 527。
> I debug that snippet, At line 269, I found some problems,ServletContext.getResourcePaths() method will scan a directory and its sub-directory and return all files in these directories, If a file's extension is not jsp, jspx,vm,ftl,html or htm。 I would get the error。
> So I think this code need to be change to fix this problem。
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WW-3564) Unable to find a result type for
extension
Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13029103#comment-13029103 ]
Dave Newton commented on WW-3564:
---------------------------------
Hmm, I'm half-and-half on "blocker".
I'd say we'll fix it, though :) I'm just not sure anything with a trivial, common workaround should be a blocker.
(I also don't see any reason to keep .bak files in the same directory; that's what tags/etc. are for--if they're that important you need a backup, take the time to do it in your SCCS, I say.)
> Unable to find a result type for extension
> ------------------------------------------
>
> Key: WW-3564
> URL: https://issues.apache.org/jira/browse/WW-3564
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Convention
> Affects Versions: 2.2.1
> Environment: windows xp, spring 2.5, tomcat 5.0.28, struts2-convention-plugin-2.2.1.jar
> Reporter: Dan Du
> Assignee: Maurizio Cucchiara
> Priority: Minor
> Attachments: 1.jpg, 11.jpg, 2.jpg, DefaultResultMapBuilder.java
>
>
> I set a convention constant like this below:
> ==========================================================================================
> <constant name="struts.convention.result.path" value="/WEB-INF/jsp" />
> ==========================================================================================
> After I deployed my project to tomcat server, I backup a file "search.jsp" and named the backup file with "search.jsp.bak", There is a class named with "SearchAction"。The action's search method is annotated by @Action, like this:
> ==========================================================================================
> @Action(value = "search", results = { @Result(name = "search", location = "/WEB-INF/jsp/search.jsp") })
> ==========================================================================================
> When I startup tomcat server, I recieved some message:
> ==========================================================================================
> Unable to find a result type for extension [bak] in location attribute [/WEB-INF/jsp/search.jsp.bak]. - [unknown location]
> ==========================================================================================
> Then I checked org.apache.struts2.convention.DefaultResultMapBuilder.java, I found this exception throwing at line 527。
> I debug that snippet, At line 269, I found some problems,ServletContext.getResourcePaths() method will scan a directory and its sub-directory and return all files in these directories, If a file's extension is not jsp, jspx,vm,ftl,html or htm。 I would get the error。
> So I think this code need to be change to fix this problem。
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira