Skip to content

Commit

Permalink
Change to switch perm space name by JRE version
Browse files Browse the repository at this point in the history
  • Loading branch information
k-tamura committed Aug 22, 2017
1 parent 6bc925a commit 47a6fbf
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
package org.t246osslab.easybuggy4sb.controller;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class IndexController {

@RequestMapping(value = "/")
public ModelAndView init(HttpSession ses, ModelAndView mav) {
ses.removeAttribute("dlpinit");
mav.setViewName("index");
mav.addObject("title", "EasyBuggy");
return mav;
}
package org.t246osslab.easybuggy4sb.controller;

import java.util.Locale;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class IndexController {

@Autowired
MessageSource msg;

@RequestMapping(value = "/")
public ModelAndView init(HttpSession ses, ModelAndView mav, Locale locale) {
ses.removeAttribute("dlpinit");
mav.setViewName("index");
mav.addObject("title", "EasyBuggy");
String permName = null;
String lblPerm = null;
if (System.getProperty("java.version").startsWith("1.7")) {
permName = "PermGen space";
lblPerm = msg.getMessage("label.permgen.space", null, locale);
} else {
permName = "Metaspace";
lblPerm = msg.getMessage("label.metaspace", null, locale);
}
mav.addObject("permname", permName);
mav.addObject("memoryleak2func", msg.getMessage("function.name.memory.leak2", new Object[] { lblPerm }, locale));
mav.addObject("memoryleak2desc", msg.getMessage("function.description.memory.leak2", new Object[] { lblPerm }, locale));
return mav;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public class MemoryLeakController2 {
public ModelAndView process(ModelAndView mav, Locale locale) {
mav.setViewName("memoryleak");
mav.addObject("title", msg.getMessage("title.nonheap.memory.usage", null, locale));
mav.addObject("note", msg.getMessage("msg.permgen.space.leak.occur", null, locale));
String permName = System.getProperty("java.version").startsWith("1.7")
? msg.getMessage("label.permgen.space", null, locale) : msg.getMessage("label.metaspace", null, locale);
mav.addObject("note", msg.getMessage("msg.permgen.space.leak.occur", new Object[] { permName }, locale));
try {
toDoRemove();

Expand Down
8 changes: 5 additions & 3 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ description.troubles=Memory leak, infinite loop, deadlock, and so on:

function.name.memory.leak=Memory Leak (Java heap space)
function.description.memory.leak=Memory leak occurs in Java heap space every time you load this page.
function.name.memory.leak2=Memory Leak (Metaspace)
function.description.memory.leak2=Memory leak occurs in Metaspace every time you load this page.
function.name.memory.leak2=Memory Leak ({0})
function.description.memory.leak2=Memory leak occurs in {0} every time you load this page.
function.name.memory.leak3=Memory Leak (C heap space)
function.description.memory.leak3=Memory leak occurs in C heap space every time you load this page.
function.name.infinite.loop=Infinite Loop
Expand Down Expand Up @@ -158,6 +158,8 @@ label.memory.max=Max Init Value
label.memory.usage=Memory Usage
label.memory.peak.usage=Peak Memory Usage
label.memory.collection.usage=Collection Usage
label.metaspace=Metaspace
label.permgen.space=PermGen space
label.name=Name
label.numbers=Numbers
label.obelus=/
Expand Down Expand Up @@ -288,7 +290,7 @@ msg.passwd.changed=Your password is successfully changed.
msg.passwd.change.failed=Password change failed.
msg.passwd.is.too.short=The password must be at least 8 characters.
msg.password.not.match=The password does not match.
msg.permgen.space.leak.occur=Memory leak occurs in Metaspace every time you load this page. \
msg.permgen.space.leak.occur=Memory leak occurs in {0} every time you load this page. \
If keeping on loading this page, OutOfMemoryError is finally thrown.
msg.question.reach.the.moon=How many times would you have to fold a piece of paper (thickness 0.1mm) for it to be thick enough to reach the moon (384,400 km)?
msg.reverse.color=You can reverse the color of an image file.
Expand Down
8 changes: 5 additions & 3 deletions src/main/resources/messages_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ description.troubles=\u30E1\u30E2\u30EA\u30EA\u30FC\u30AF\u3001\u7121\u9650\u30E

function.name.memory.leak=\u30E1\u30E2\u30EA\u30EA\u30FC\u30AF (Java\u30D2\u30FC\u30D7\u9818\u57DF)
function.description.memory.leak=\u3053\u306E\u30DA\u30FC\u30B8\u3092\u30ED\u30FC\u30C9\u3059\u308B\u305F\u3073\u306B\u3001Java\u30D2\u30FC\u30D7\u9818\u57DF\u306E\u30E1\u30E2\u30EA\u30EA\u30FC\u30AF\u304C\u767A\u751F\u3057\u307E\u3059\u3002
function.name.memory.leak2=\u30E1\u30E2\u30EA\u30EA\u30FC\u30AF (Metaspace)
function.description.memory.leak2=\u3053\u306E\u30DA\u30FC\u30B8\u3092\u30ED\u30FC\u30C9\u3059\u308B\u305F\u3073\u306B\u3001Metaspace\u306E\u30E1\u30E2\u30EA\u30EA\u30FC\u30AF\u304C\u767A\u751F\u3057\u307E\u3059\u3002
function.name.memory.leak2=\u30E1\u30E2\u30EA\u30EA\u30FC\u30AF ({0})
function.description.memory.leak2=\u3053\u306E\u30DA\u30FC\u30B8\u3092\u30ED\u30FC\u30C9\u3059\u308B\u305F\u3073\u306B\u3001{0}\u306E\u30E1\u30E2\u30EA\u30EA\u30FC\u30AF\u304C\u767A\u751F\u3057\u307E\u3059\u3002
function.name.memory.leak3=\u30E1\u30E2\u30EA\u30EA\u30FC\u30AF (C\u30D2\u30FC\u30D7\u9818\u57DF)
function.description.memory.leak3=\u3053\u306E\u30DA\u30FC\u30B8\u3092\u30ED\u30FC\u30C9\u3059\u308B\u305F\u3073\u306B\u3001C\u30D2\u30FC\u30D7\u9818\u57DF\u306E\u30E1\u30E2\u30EA\u30EA\u30FC\u30AF\u304C\u767A\u751F\u3057\u307E\u3059\u3002
function.name.infinite.loop=\u7121\u9650\u30EB\u30FC\u30D7
Expand Down Expand Up @@ -158,6 +158,8 @@ label.memory.max=\u6700\u5927\u5024
label.memory.usage=\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u91CF
label.memory.peak.usage=\u30D4\u30FC\u30AF\u30E1\u30E2\u30EA\u30FC\u4F7F\u7528\u91CF
label.memory.collection.usage=\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4F7F\u7528\u91CF
label.metaspace=Metaspace
label.permgen.space=PermGen\u9818\u57DF
label.name=\u540D\u524D
label.numbers=\u6570\u5B57
label.obelus=\u00F7
Expand Down Expand Up @@ -288,7 +290,7 @@ msg.passwd.changed=\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u6B63\u5E38\u306B\u5909\
msg.passwd.change.failed=\u30D1\u30B9\u30EF\u30FC\u30C9\u306E\u5909\u66F4\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
msg.passwd.is.too.short=\u30D1\u30B9\u30EF\u30FC\u30C9\u306F8\u6841\u4EE5\u4E0A\u306B\u3057\u3066\u4E0B\u3055\u3044\u3002
msg.password.not.match=\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002
msg.permgen.space.leak.occur=\u3053\u306E\u30DA\u30FC\u30B8\u3092\u8AAD\u307F\u8FBC\u3080\u305F\u3073\u306B\u3001Metaspace\u306E\u30E1\u30E2\u30EA\u30EA\u30FC\u30AF\u304C\u767A\u751F\u3057\u307E\u3059\u3002\
msg.permgen.space.leak.occur=\u3053\u306E\u30DA\u30FC\u30B8\u3092\u8AAD\u307F\u8FBC\u3080\u305F\u3073\u306B\u3001{0}\u306E\u30E1\u30E2\u30EA\u30EA\u30FC\u30AF\u304C\u767A\u751F\u3057\u307E\u3059\u3002\
\u753B\u9762\u3092\u30ED\u30FC\u30C9\u3057\u7D9A\u3051\u308B\u3068\u3001\u6700\u7D42\u7684\u306BOutOfMemoryError\u304C\u30B9\u30ED\u30FC\u3055\u308C\u307E\u3059\u3002
msg.question.reach.the.moon=0.1mm\u306E\u539A\u3055\u306E\u7D19\u3092\u4F55\u56DE\u6298\u308A\u305F\u305F\u3080\u3068\u3001\u5730\u7403\u304B\u3089\u6708\u306E\u8DDD\u96E2(384,400 km)\u306B\u5230\u9054\u3059\u308B\u3067\u3057\u3087\u3046\u304B\uFF1F
msg.reverse.color=\u753B\u50CF\u30D5\u30A1\u30A4\u30EB\u306E\u8272\u53CD\u8EE2\u3092\u884C\u3046\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h2>
<li><p><a href="forwardloop" target="_blank" th:text="#{function.name.forward.loop}"></a>: <span th:text="#{function.description.forward.loop}"></span></p></li>
<li><p><a href="jvmcrasheav" target="_blank" th:text="#{function.name.jvm.crash.eav}"></a>: <span th:text="#{function.description.jvm.crash.eav}"></span></p></li>
<li><p><a href="memoryleak" th:text="#{function.name.memory.leak}"></a>: <span th:text="#{function.description.memory.leak}"></span></p></li>
<li><p><a href="memoryleak2" th:text="#{function.name.memory.leak2}"></a>: <span th:text="#{function.description.memory.leak2}"></span></p></li>
<li><p><a href="memoryleak2" th:text="${memoryleak2func}"></a>: <span th:text="${memoryleak2desc}"></span></p></li>
<li><p><a href="memoryleak3" th:text="#{function.name.memory.leak3}"></a>: <span th:text="#{function.description.memory.leak3}"></span></p></li>
<li><p><a href="netsocketleak" th:text="#{function.name.network.socket.leak}"></a>: <span th:text="#{function.description.network.socket.leak}"></span></p></li>
<li><p><a href="dbconnectionleak " th:text="#{function.name.database.connection.leak}"></a> :<span th:text="#{function.description.database.connection.leak}"></span></p></li>
Expand Down Expand Up @@ -91,7 +91,7 @@ <h2>
<li><p><a href="oome2" target="_blank">OutOfMemoryError (Requested array size exceeds VM limit)</a>: <span th:text="#{function.description.throwable(${'OutOfMemoryError'})}"></span></p></li>
<li><p><a href="oome3" target="_blank">OutOfMemoryError (unable to create new native thread)</a>: <span th:text="#{function.description.throwable(${'OutOfMemoryError'})}"></span></p></li>
<li><p><a href="oome4" target="_blank">OutOfMemoryError (GC overhead limit exceeded)</a>: <span th:text="#{function.description.throwable(${'OutOfMemoryError'})}"></span></p></li>
<li><p><a href="oome5" target="_blank">OutOfMemoryError (Metaspace)</a>: <span th:text="#{function.description.throwable(${'OutOfMemoryError'})}"></span></p></li>
<li><p><a href="oome5" target="_blank">OutOfMemoryError (<span th:text="${permname}"></span>)</a>: <span th:text="#{function.description.throwable(${'OutOfMemoryError'})}"></span></p></li>
<li><p><a href="oome6" target="_blank">OutOfMemoryError (Direct buffer memory)</a>: <span th:text="#{function.description.throwable(${'OutOfMemoryError'})}"></span></p></li>
<li><p><a href="sofe" target="_blank">StackOverflowError</a>: <span th:text="#{function.description.throwable(${'StackOverflowError'})}"></span></p></li>
<li><p><a href="tfce" target="_blank">TransformerFactoryConfigurationError</a>: <span th:text="#{function.description.throwable(${'TransformerFactoryConfigurationError'})}"></span></p></li>
Expand Down

0 comments on commit 47a6fbf

Please sign in to comment.