Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad encoding in properties-files #834

Closed
gitblit opened this issue Aug 12, 2015 · 1 comment · Fixed by #1379
Closed

Bad encoding in properties-files #834

gitblit opened this issue Aug 12, 2015 · 1 comment · Fixed by #1379

Comments

@gitblit
Copy link
Collaborator

gitblit commented Aug 12, 2015

Originally reported on Google Code with ID 538

What steps will reproduce the problem?
1. Deploy gitblit on tomcat6 or 7 running on a platform supporting utf-8.
My example is dev.gitblit.com
2. Access the site with a browser specifying Norwegian as the Language

(or via curl:

$ curl -H"Accept-Language: no,nb-NO;q=0.8,nn-NO;q=0.5,en-US;q=0.3" https://dev.gitblit.com/
-I
HTTP/1.1 500 Server Error
Date: Tue, 25 Nov 2014 13:44:16 GMT
Content-Type: text/html; charset=UTF-8
Content-Language: no
Pragma: no-cache
Cache-Control: no-cache, max-age=0, must-revalidate
Content-Length: 1406
Server: Jetty(9.2.3.v20140905)

3. See the internal error

What is the expected output? What do you see instead?
I see the attached image - internal error. In the logs I'm spammed with this output:
2014-11-25 14:07:25 [INFO ] Loading properties files from jar:file:/data/prog/ap
ache-tomcat-7.0.29/webapps/gitblit/WEB-INF/lib/gitblit.jar!/com/gitblit/wicket/GitBlitWebApp_no.properties
2014-11-25 14:07:25 [ERROR] Can't instantiate page using constructor public com.
gitblit.wicket.pages.MyDashboardPage()
org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor
public com.gitblit.wicket.pages.MyDashboardPage()
        at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:212)
        at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:57)
        at org.apache.wicket.request.target.component.BookmarkablePageRequestTar
get.newPage(BookmarkablePageRequestTarget.java:298)
        at org.apache.wicket.request.target.component.BookmarkablePageRequestTar
get.getPage(BookmarkablePageRequestTarget.java:320)
        at org.apache.wicket.request.target.component.BookmarkablePageRequestTar
get.processEvents(BookmarkablePageRequestTarget.java:234)
        at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents
(AbstractRequestCycleProcessor.java:92)
        at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.j
ava:1279)
        at org.apache.wicket.RequestCycle.step(RequestCycle.java:1358)
        at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1465)
        at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
        at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:
486)
        at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.ja
va:319)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
        at com.gitblit.servlet.EnforceAuthenticationFilter.doFilter(EnforceAuthe
nticationFilter.java:87)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
        at com.gitblit.servlet.ProxyFilter$1.doFilter(ProxyFilter.java:74)
        at com.gitblit.servlet.ProxyFilter.doFilter(ProxyFilter.java:77)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:225)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:192)
        ... 34 more
Caused by: java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
        at java.util.Properties.loadConvert(Properties.java:568)
        at java.util.Properties.load0(Properties.java:391)
        at java.util.Properties.load(Properties.java:341)
        at org.apache.wicket.resource.PropertiesFactory$PropertiesFilePropertiesLoader.loadProperties(PropertiesFactory.java:343)
        at org.apache.wicket.resource.PropertiesFactory$AbstractPropertiesLoader.load(PropertiesFactory.java:274)
        at org.apache.wicket.resource.PropertiesFactory.load(PropertiesFactory.java:133)
        at org.apache.wicket.resource.loader.ComponentStringResourceLoader.loadStringResource(ComponentStringResourceLoader.java:141)
        at org.apache.wicket.resource.loader.ClassStringResourceLoader.loadStringResource(ClassStringResourceLoader.java:65)
        at org.apache.wicket.resource.loader.ComponentStringResourceLoader.loadStringResource(ComponentStringResourceLoader.java:261)
        at org.apache.wicket.resource.loader.ClassStringResourceLoader.loadStringResource(ClassStringResourceLoader.java:80)
        at org.apache.wicket.Localizer.getStringIgnoreSettings(Localizer.java:241)
        at org.apache.wicket.Localizer.getString(Localizer.java:313)
        at org.apache.wicket.Localizer.getString(Localizer.java:119)
        at org.apache.wicket.Component.getString(Component.java:1968)
        at org.apache.wicket.Component.getString(Component.java:1955)
        at com.gitblit.wicket.pages.RootPage$LoginForm.<init>(RootPage.java:581)
        at com.gitblit.wicket.pages.RootPage.setupPage(RootPage.java:176)
        at com.gitblit.wicket.pages.MyDashboardPage.setup(MyDashboardPage.java:71)
        at com.gitblit.wicket.pages.MyDashboardPage.<init>(MyDashboardPage.java:57)
        ... 39 more


What version of the product are you using? On what operating system?
1.6.2, running on 
server:/data/prog/apache-tomcat-7.0.29/logs> uname -a
Linux server 2.6.32-279.1.1.el6.x86_64 #1 SMP Wed Jun 20 11:41:22 EDT 2012 x86_64 x86_64
x86_64 GNU/Linux

Please provide any additional information below.
The file it's complaining about has alle Language-specific characters (æ,ø and å) encoded
as \u00xx, which corresponds to ISO-8859-1 encoding. The correct encoding is to use
Unicode.

Reported by thomas.arp on 2014-11-25 13:31:24


  • Attachment: gitblit_doesnt_work_with_norwegian_and_utf8.png
    gitblit_doesnt_work_with_norwegian_and_utf8.png

    Edit: Make image render
@darmbrust
Copy link

we are suddenly seeing a similar stack, but with a null pointer:

"2016-10-27 13:23:26 [ERROR] Can't instantiate page using constructor public com.gitblit.wicket.pages.MyDashboardPage()
org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor public com.gitblit.wicket.pages.MyDashboardPage()
at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:212)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:57)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1279)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1358)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1465)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:88)
at com.gitblit.servlet.EnforceAuthenticationFilter.doFilter(EnforceAuthenticationFilter.java:99)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:88)
at com.gitblit.servlet.ProxyFilter$1.doFilter(ProxyFilter.java:89)
at com.gitblit.servlet.ProxyFilter.doFilter(ProxyFilter.java:92)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:88)
at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120)
at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:133)
at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:130)
at com.google.inject.servlet.GuiceFilter$Context.call(GuiceFilter.java:203)
at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:130)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:192)
... 40 more
Caused by: java.lang.NullPointerException
at com.gitblit.utils.RefLogUtils.newUserModelFrom(RefLogUtils.java:159)
at com.gitblit.utils.RefLogUtils.getDailyLog(RefLogUtils.java:672)
at com.gitblit.utils.RefLogUtils.getDailyLogByRef(RefLogUtils.java:719)
at com.gitblit.wicket.pages.DashboardPage.addActivity(DashboardPage.java:86)
at com.gitblit.wicket.pages.MyDashboardPage.setup(MyDashboardPage.java:158)
at com.gitblit.wicket.pages.MyDashboardPage.(MyDashboardPage.java:57)
... 45 more"

@flaix flaix added Status-Verified A bug could be reproduced. and removed Status-New labels Oct 19, 2021
@flaix flaix closed this as completed in ab58795 Oct 21, 2021
@flaix flaix added Status-Fixed and removed Status-Verified A bug could be reproduced. labels Oct 21, 2021
@flaix flaix added this to the 1.9.2 milestone Oct 21, 2021
@flaix flaix linked a pull request Nov 25, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants