[JBoss JIRA] (WFLY-6402) EJBs accessible too early (spec violation)
by RH Bugzilla Integration (JIRA)
[ https://issues.jboss.org/browse/WFLY-6402?page=com.atlassian.jira.plugin.... ]
RH Bugzilla Integration commented on WFLY-6402:
-----------------------------------------------
Fedor Gavrilov <fgavrilo(a)redhat.com> changed the Status of [bug 1310908|https://bugzilla.redhat.com/show_bug.cgi?id=1310908] from ON_QA to POST
> EJBs accessible too early (spec violation)
> ------------------------------------------
>
> Key: WFLY-6402
> URL: https://issues.jboss.org/browse/WFLY-6402
> Project: WildFly
> Issue Type: Bug
> Components: EJB
> Affects Versions: 10.0.0.Final
> Reporter: Brad Maxwell
> Assignee: Fedor Gavrilov
> Labels: downstream_dependency
> Attachments: auto-test-reproducer.zip
>
>
> {code}
> EJB 3.1 spec, section 4.8.1:
> "If the Startup annotation appears on the Singleton bean class or if the Singleton has been designated via the deployment descriptor as requiring eager initialization, the container must initialize the Singleton bean instance during the application startup sequence. The container must initialize all such startup-time Singletons before any external client requests (that is, client requests originating outside of the application) are delivered to any enterprise bean components in the application.
> {code}
> Wildlfy does not implement this correctly, and allows calls to other EJBs before a @Startup @Singleton finishes its @PostConstruct call.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
9 years, 4 months
[JBoss JIRA] (WFCORE-1619) Bad artifact resolution in wildfly-logging module
by Carlo de Wolf (JIRA)
[ https://issues.jboss.org/browse/WFCORE-1619?page=com.atlassian.jira.plugi... ]
Carlo de Wolf commented on WFCORE-1619:
---------------------------------------
As a work-around you can use: mvn install
But that pollutes your cache.
> Bad artifact resolution in wildfly-logging module
> -------------------------------------------------
>
> Key: WFCORE-1619
> URL: https://issues.jboss.org/browse/WFCORE-1619
> Project: WildFly Core
> Issue Type: Bug
> Components: Test Suite
> Reporter: Carlo de Wolf
> Assignee: Tomaz Cerar
>
> The test doesn't use project artifact resolution, but global artifact resolution. While the project hasn't been published yet.
> {noformat}
> Tests run: 14, Failures: 0, Errors: 6, Skipped: 3, Time elapsed: 21.024 sec <<< FAILURE! - in org.jboss.as.logging.LoggingSubsystemTestCase
> testTransformersEAP620(org.jboss.as.logging.LoggingSubsystemTestCase) Time elapsed: 8.508 sec <<< ERROR!
> java.lang.RuntimeException: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact org.wildfly.core:wildfly-subsystem-test-framework:jar:2.1.6.Final-redhat-SNAPSHOT in product-repository (https://maven.repository.redhat.com/nexus/content/groups/product-techprev...)
> at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:39)
> at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
> at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
> at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
> at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
> at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
> at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
> at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
> at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
> at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
> at org.jboss.as.model.test.MavenUtil.createMavenGavURL(MavenUtil.java:138)
> at org.jboss.as.model.test.ChildFirstClassLoaderBuilder.addMavenResourceURL(ChildFirstClassLoaderBuilder.java:197)
> at org.jboss.as.subsystem.test.SubsystemTestDelegate$LegacyKernelServiceInitializerImpl.install(SubsystemTestDelegate.java:839)
> at org.jboss.as.subsystem.test.SubsystemTestDelegate$LegacyKernelServiceInitializerImpl.access$700(SubsystemTestDelegate.java:724)
> at org.jboss.as.subsystem.test.SubsystemTestDelegate$KernelServicesBuilderImpl.build(SubsystemTestDelegate.java:691)
> at org.jboss.as.logging.LoggingSubsystemTestCase.testEapTransformer(LoggingSubsystemTestCase.java:281)
> at org.jboss.as.logging.LoggingSubsystemTestCase.testTransformersEAP620(LoggingSubsystemTestCase.java:130)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
9 years, 4 months
[JBoss JIRA] (WFCORE-1619) Bad artifact resolution in wildfly-logging module
by Carlo de Wolf (JIRA)
Carlo de Wolf created WFCORE-1619:
-------------------------------------
Summary: Bad artifact resolution in wildfly-logging module
Key: WFCORE-1619
URL: https://issues.jboss.org/browse/WFCORE-1619
Project: WildFly Core
Issue Type: Bug
Components: Test Suite
Reporter: Carlo de Wolf
Assignee: Tomaz Cerar
The test doesn't use project artifact resolution, but global artifact resolution. While the project hasn't been published yet.
{noformat}
Tests run: 14, Failures: 0, Errors: 6, Skipped: 3, Time elapsed: 21.024 sec <<< FAILURE! - in org.jboss.as.logging.LoggingSubsystemTestCase
testTransformersEAP620(org.jboss.as.logging.LoggingSubsystemTestCase) Time elapsed: 8.508 sec <<< ERROR!
java.lang.RuntimeException: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact org.wildfly.core:wildfly-subsystem-test-framework:jar:2.1.6.Final-redhat-SNAPSHOT in product-repository (https://maven.repository.redhat.com/nexus/content/groups/product-techprev...)
at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:39)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
at org.jboss.as.model.test.MavenUtil.createMavenGavURL(MavenUtil.java:138)
at org.jboss.as.model.test.ChildFirstClassLoaderBuilder.addMavenResourceURL(ChildFirstClassLoaderBuilder.java:197)
at org.jboss.as.subsystem.test.SubsystemTestDelegate$LegacyKernelServiceInitializerImpl.install(SubsystemTestDelegate.java:839)
at org.jboss.as.subsystem.test.SubsystemTestDelegate$LegacyKernelServiceInitializerImpl.access$700(SubsystemTestDelegate.java:724)
at org.jboss.as.subsystem.test.SubsystemTestDelegate$KernelServicesBuilderImpl.build(SubsystemTestDelegate.java:691)
at org.jboss.as.logging.LoggingSubsystemTestCase.testEapTransformer(LoggingSubsystemTestCase.java:281)
at org.jboss.as.logging.LoggingSubsystemTestCase.testTransformersEAP620(LoggingSubsystemTestCase.java:130)
{noformat}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
9 years, 4 months
[JBoss JIRA] (WFCORE-1499) logging custom-handler does not load module with slot
by RH Bugzilla Integration (JIRA)
[ https://issues.jboss.org/browse/WFCORE-1499?page=com.atlassian.jira.plugi... ]
RH Bugzilla Integration commented on WFCORE-1499:
-------------------------------------------------
Peter Palaga <ppalaga(a)redhat.com> changed the Status of [bug 1349223|https://bugzilla.redhat.com/show_bug.cgi?id=1349223] from NEW to ASSIGNED
> logging custom-handler does not load module with slot
> -----------------------------------------------------
>
> Key: WFCORE-1499
> URL: https://issues.jboss.org/browse/WFCORE-1499
> Project: WildFly Core
> Issue Type: Bug
> Components: Logging
> Reporter: Erwan Lacoste
> Assignee: James Perkins
> Fix For: 2.2.0.CR1, 3.0.0.Alpha1
>
>
> Tested on EAP 6.4
> when creating a module for a custom *loghandler*, everything works fine if the module is package in default main slot, e.g.
> my/loghandler/main
> - module.xml
> - my.jar
> {code:xml}
> <custom-handler name="4H" class="my.handler.Periodic4HFileHandler" module="my.loghandler">
> {code}
> Nevertheless I want to version the module, therefore package my module with a given slot:
> my/loghandler/1.0
> - module.xml
> - my.jar
> {code:xml}
> <custom-handler name="4H" class="my.handler.Periodic4HFileHandler" module="my.loghandler:1.0">
> {code}
> But this fails with following stacktrace:
> {code}
> 11:53:50,458 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014612: Operation ("add") failed - address: ([
> ("subsystem" => "logging"),
> ("custom-handler" => "4H")
> ]): java.lang.IllegalArgumentException: JBAS011532: Failed to load module 'my.loghandler:1.0' for handler '4H'
> at org.jboss.as.logging.HandlerOperations$HandlerAddOperationStepHandler.createHandlerConfiguration(HandlerOperations.java:320) [jboss-as-logging-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> at org.jboss.as.logging.HandlerOperations$HandlerAddOperationStepHandler.performRuntime(HandlerOperations.java:255) [jboss-as-logging-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> at org.jboss.as.logging.LoggingOperations$LoggingAddOperationStepHandler$1.execute(LoggingOperations.java:206) [jboss-as-logging-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:702) [jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:537) [jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:338) [jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:314) [jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1144) [jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> at org.jboss.as.controller.ModelControllerImpl.boot(ModelControllerImpl.java:416) [jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:301) [jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> at org.jboss.as.server.ServerService.boot(ServerService.java:355) [jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> at org.jboss.as.server.ServerService.boot(ServerService.java:330) [jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:263) [jboss-as-controller-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_65]
> Caused by: org.jboss.modules.ModuleNotFoundException: my.loghandler:1.0:main
> at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:240) [jboss-modules.jar:1.3.6.Final-redhat-1]
> at org.jboss.as.logging.HandlerOperations$HandlerAddOperationStepHandler.createHandlerConfiguration(HandlerOperations.java:295) [jboss-as-logging-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
> ... 13 more
> {code}
> why is the module not found being *my.loghandler:1.0:main* ?
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
9 years, 4 months
[JBoss JIRA] (WFLY-6655) When creating JMS bridge management API should pass bridge name to JMS broker
by Tom Ross (JIRA)
[ https://issues.jboss.org/browse/WFLY-6655?page=com.atlassian.jira.plugin.... ]
Tom Ross commented on WFLY-6655:
--------------------------------
Hi Chen,
No, this is not enough. There two places where changes are needed. One is Artemis code and the other is Wildly code.
This JIRA is for the wildly code change i.e. in JMSBridgeAdd class. Another is in artemis itself, but it's more extensie than just adding name to constructor. I'll submit PR today for all the changes.
> When creating JMS bridge management API should pass bridge name to JMS broker
> -----------------------------------------------------------------------------
>
> Key: WFLY-6655
> URL: https://issues.jboss.org/browse/WFLY-6655
> Project: WildFly
> Issue Type: Bug
> Components: JMS
> Environment: JBoss EAP 7.0
> Reporter: Tom Ross
> Assignee: Chen Maoqian
>
> In situations where there are multiple JMS bridges being created it woudl help if bridge name is logged in the server name. This helps with recognising which JMS bridge is having problems.
> For this to work the JBoss messaging API layer has to pass bridge name to the JMS broker.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
9 years, 4 months
[JBoss JIRA] (WFLY-6742) javax.servlet.http.Part.getSubmittedFileName() uses wrong encoding
by Maxim Wirt (JIRA)
[ https://issues.jboss.org/browse/WFLY-6742?page=com.atlassian.jira.plugin.... ]
Maxim Wirt edited comment on WFLY-6742 at 6/24/16 4:18 AM:
-----------------------------------------------------------
The charset is set by a Filter
@WebFilter("/*")
public class UtfFilter implements Filter {
private FilterConfig filterConfig = null;
public UtfFilter() {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if(request instanceof HttpServletRequest) {
HttpServletRequest htRequest = (HttpServletRequest)request;
try {
htRequest.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
throw new ServletException(e);
}
}
chain.doFilter(request, response);
}
public FilterConfig getFilterConfig() {
return filterConfig;
}
public void setFilterConfig(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
public void destroy() {
}
public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
}
the servlet is
@WebServlet("/file")
@MultipartConfig
public class FileServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println(request.getCharacterEncoding()); // returns "UTF-8"
for (Part part : request.getParts()) {
System.out.println("file=" + part.getSubmittedFileName()); //wrong name
System.out.println(new String(part.getSubmittedFileName().getBytes("ISO-8859-1"), "UTF-8")); // correct name
}
}
}
was (Author: maximwirt):
The charset is set by a Filter
@WebFilter("/*")
public class UtfFilter implements Filter {
private FilterConfig filterConfig = null;
public UtfFilter() {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if(request instanceof HttpServletRequest) {
HttpServletRequest htRequest = (HttpServletRequest)request;
try {
htRequest.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
throw new ServletException(e);
}
}
chain.doFilter(request, response);
}
public FilterConfig getFilterConfig() {
return filterConfig;
}
public void setFilterConfig(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
public void destroy() {
}
public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
}
the servlet is
@WebServlet("/file")
@MultipartConfig
public class FileServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println(request.getCharacterEncoding()); // returns "UTF-8"
for (Part part : request.getParts()) {
System.out.println("file=" + part.getSubmittedFileName()); //wrong name
System.out.println(new String(part.getSubmittedFileName().getBytes("ISO-8859-1"), "UTF-8")); // correct name
}
}
}
> javax.servlet.http.Part.getSubmittedFileName() uses wrong encoding
> ------------------------------------------------------------------
>
> Key: WFLY-6742
> URL: https://issues.jboss.org/browse/WFLY-6742
> Project: WildFly
> Issue Type: Bug
> Components: Web (Undertow)
> Affects Versions: 8.2.0.Final, 10.0.0.Final
> Environment: Ubuntu 16.04 LTS
> oracle java
> java version "1.8.0_91"
> Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
> Wildfly 8.2.0.Final
> Wildfly 10.0.0.Final
> Reporter: Maxim Wirt
> Assignee: Stuart Douglas
> Attachments: визитка.svg
>
>
> Servlet 3.1 file upload feature implementation uses incorrect character set for decoding file names
> request.getCharacterEncoding() returns "UTF-8",
> System property file.encoding is set to UTF-8, but
> javax.servlet.http.Part.getSubmittedFileName() returns file name encoded using Latin character set
> all non-latin symbols in name of the file become unreadably characters.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
9 years, 4 months
[JBoss JIRA] (WFLY-6742) javax.servlet.http.Part.getSubmittedFileName() uses wrong encoding
by Maxim Wirt (JIRA)
[ https://issues.jboss.org/browse/WFLY-6742?page=com.atlassian.jira.plugin.... ]
Maxim Wirt edited comment on WFLY-6742 at 6/24/16 4:17 AM:
-----------------------------------------------------------
The charset is set by a Filter
{{@WebFilter("/*")
public class UtfFilter implements Filter {
private FilterConfig filterConfig = null;
public UtfFilter() {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if(request instanceof HttpServletRequest) {
HttpServletRequest htRequest = (HttpServletRequest)request;
try {
htRequest.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
throw new ServletException(e);
}
}
chain.doFilter(request, response);
}
public FilterConfig getFilterConfig() {
return filterConfig;
}
public void setFilterConfig(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
public void destroy() {
}
public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
}
}}
the servlet is
{{@WebServlet("/file")
@MultipartConfig
public class FileServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println(request.getCharacterEncoding()); // returns "UTF-8"
for (Part part : request.getParts()) {
System.out.println("file=" + part.getSubmittedFileName()); //wrong name
System.out.println(new String(part.getSubmittedFileName().getBytes("ISO-8859-1"), "UTF-8")); // correct name
}
}
}}}
was (Author: maximwirt):
The charset is set by a Filter
@WebFilter("/*")
public class UtfFilter implements Filter {
private FilterConfig filterConfig = null;
public UtfFilter() {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if(request instanceof HttpServletRequest) {
HttpServletRequest htRequest = (HttpServletRequest)request;
try {
htRequest.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
throw new ServletException(e);
}
}
chain.doFilter(request, response);
}
public FilterConfig getFilterConfig() {
return filterConfig;
}
public void setFilterConfig(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
public void destroy() {
}
public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
}
the servlet is
@WebServlet("/file")
@MultipartConfig
public class FileServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println(request.getCharacterEncoding()); // returns "UTF-8"
for (Part part : request.getParts()) {
System.out.println("file=" + part.getSubmittedFileName()); //wrong name
System.out.println(new String(part.getSubmittedFileName().getBytes("ISO-8859-1"), "UTF-8")); // correct name
}
}
}
> javax.servlet.http.Part.getSubmittedFileName() uses wrong encoding
> ------------------------------------------------------------------
>
> Key: WFLY-6742
> URL: https://issues.jboss.org/browse/WFLY-6742
> Project: WildFly
> Issue Type: Bug
> Components: Web (Undertow)
> Affects Versions: 8.2.0.Final, 10.0.0.Final
> Environment: Ubuntu 16.04 LTS
> oracle java
> java version "1.8.0_91"
> Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
> Wildfly 8.2.0.Final
> Wildfly 10.0.0.Final
> Reporter: Maxim Wirt
> Assignee: Stuart Douglas
> Attachments: визитка.svg
>
>
> Servlet 3.1 file upload feature implementation uses incorrect character set for decoding file names
> request.getCharacterEncoding() returns "UTF-8",
> System property file.encoding is set to UTF-8, but
> javax.servlet.http.Part.getSubmittedFileName() returns file name encoded using Latin character set
> all non-latin symbols in name of the file become unreadably characters.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
9 years, 4 months
[JBoss JIRA] (WFLY-6742) javax.servlet.http.Part.getSubmittedFileName() uses wrong encoding
by Maxim Wirt (JIRA)
[ https://issues.jboss.org/browse/WFLY-6742?page=com.atlassian.jira.plugin.... ]
Maxim Wirt edited comment on WFLY-6742 at 6/24/16 4:17 AM:
-----------------------------------------------------------
The charset is set by a Filter
@WebFilter("/*")
public class UtfFilter implements Filter {
private FilterConfig filterConfig = null;
public UtfFilter() {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if(request instanceof HttpServletRequest) {
HttpServletRequest htRequest = (HttpServletRequest)request;
try {
htRequest.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
throw new ServletException(e);
}
}
chain.doFilter(request, response);
}
public FilterConfig getFilterConfig() {
return filterConfig;
}
public void setFilterConfig(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
public void destroy() {
}
public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
}
the servlet is
@WebServlet("/file")
@MultipartConfig
public class FileServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println(request.getCharacterEncoding()); // returns "UTF-8"
for (Part part : request.getParts()) {
System.out.println("file=" + part.getSubmittedFileName()); //wrong name
System.out.println(new String(part.getSubmittedFileName().getBytes("ISO-8859-1"), "UTF-8")); // correct name
}
}
}
was (Author: maximwirt):
The charset is set by a Filter
{{@WebFilter("/*")
public class UtfFilter implements Filter {
private FilterConfig filterConfig = null;
public UtfFilter() {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if(request instanceof HttpServletRequest) {
HttpServletRequest htRequest = (HttpServletRequest)request;
try {
htRequest.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
throw new ServletException(e);
}
}
chain.doFilter(request, response);
}
public FilterConfig getFilterConfig() {
return filterConfig;
}
public void setFilterConfig(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
public void destroy() {
}
public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
}
}
}}
the servlet is
{{@WebServlet("/file")
@MultipartConfig
public class FileServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println(request.getCharacterEncoding()); // returns "UTF-8"
for (Part part : request.getParts()) {
System.out.println("file=" + part.getSubmittedFileName()); //wrong name
System.out.println(new String(part.getSubmittedFileName().getBytes("ISO-8859-1"), "UTF-8")); // correct name
}
}
}}}
> javax.servlet.http.Part.getSubmittedFileName() uses wrong encoding
> ------------------------------------------------------------------
>
> Key: WFLY-6742
> URL: https://issues.jboss.org/browse/WFLY-6742
> Project: WildFly
> Issue Type: Bug
> Components: Web (Undertow)
> Affects Versions: 8.2.0.Final, 10.0.0.Final
> Environment: Ubuntu 16.04 LTS
> oracle java
> java version "1.8.0_91"
> Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
> Wildfly 8.2.0.Final
> Wildfly 10.0.0.Final
> Reporter: Maxim Wirt
> Assignee: Stuart Douglas
> Attachments: визитка.svg
>
>
> Servlet 3.1 file upload feature implementation uses incorrect character set for decoding file names
> request.getCharacterEncoding() returns "UTF-8",
> System property file.encoding is set to UTF-8, but
> javax.servlet.http.Part.getSubmittedFileName() returns file name encoded using Latin character set
> all non-latin symbols in name of the file become unreadably characters.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
9 years, 4 months
[JBoss JIRA] (WFLY-6742) javax.servlet.http.Part.getSubmittedFileName() uses wrong encoding
by Maxim Wirt (JIRA)
[ https://issues.jboss.org/browse/WFLY-6742?page=com.atlassian.jira.plugin.... ]
Maxim Wirt commented on WFLY-6742:
----------------------------------
<html><body><form action="/file" multiple="yes" enctype="multipart/form-data">
<input type="file" name="file"/>
<input type="submit" value=" OK "/>
</form></body></html>
> javax.servlet.http.Part.getSubmittedFileName() uses wrong encoding
> ------------------------------------------------------------------
>
> Key: WFLY-6742
> URL: https://issues.jboss.org/browse/WFLY-6742
> Project: WildFly
> Issue Type: Bug
> Components: Web (Undertow)
> Affects Versions: 8.2.0.Final, 10.0.0.Final
> Environment: Ubuntu 16.04 LTS
> oracle java
> java version "1.8.0_91"
> Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
> Wildfly 8.2.0.Final
> Wildfly 10.0.0.Final
> Reporter: Maxim Wirt
> Assignee: Stuart Douglas
> Attachments: визитка.svg
>
>
> Servlet 3.1 file upload feature implementation uses incorrect character set for decoding file names
> request.getCharacterEncoding() returns "UTF-8",
> System property file.encoding is set to UTF-8, but
> javax.servlet.http.Part.getSubmittedFileName() returns file name encoded using Latin character set
> all non-latin symbols in name of the file become unreadably characters.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
9 years, 4 months