File DHtmlUpdateServlet.java
has 489 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* DHtmlUpdateServlet.java
Purpose:
Description:
Method sessionTimeout
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
private void sessionTimeout(HttpServletRequest request, HttpServletResponse response, WebApp wapp, String dtid,
boolean compress) throws ServletException, IOException {
final String sid = request.getHeader("ZK-SID");
if (sid != null) {
//B65-ZK-2464 : Possible XSS Vulnerability in HTTP Header
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method process
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public void process(Session sess, HttpServletRequest request, HttpServletResponse response, boolean compress)
throws ServletException, IOException {
final String errClient = request.getHeader("ZK-Error-Report");
if (errClient != null)
if (log.isDebugEnabled())
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method process
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void process(Session sess, HttpServletRequest request, HttpServletResponse response, boolean compress)
throws ServletException, IOException {
final String errClient = request.getHeader("ZK-Error-Report");
if (errClient != null)
if (log.isDebugEnabled())
DHtmlUpdateServlet
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
public class DHtmlUpdateServlet extends HttpServlet {
private static final Logger log = LoggerFactory.getLogger(DHtmlUpdateServlet.class);
private static final String ATTR_UPDATE_SERVLET = "org.zkoss.zk.au.http.updateServlet";
private static final String ATTR_AU_PROCESSORS = "org.zkoss.zk.au.http.auProcessors";
Method init
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public void init() throws ServletException {
final ServletConfig config = getServletConfig();
final ServletContext ctx = getServletContext();
ctx.setAttribute(ATTR_UPDATE_SERVLET, this);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method doGet
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
final String pi = Https.getThisPathInfo(request);
final ServletContext ctx = getServletContext();
if (DHtmlResourceServlet.doGet0(request, response, ctx, getClassWebResource()))
Method doGet
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
final String pi = Https.getThisPathInfo(request);
final ServletContext ctx = getServletContext();
if (DHtmlResourceServlet.doGet0(request, response, ctx, getClassWebResource()))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method init
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void init() throws ServletException {
final ServletConfig config = getServletConfig();
final ServletContext ctx = getServletContext();
ctx.setAttribute(ATTR_UPDATE_SERVLET, this);
Method sessionTimeout
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void sessionTimeout(HttpServletRequest request, HttpServletResponse response, WebApp wapp, String dtid,
boolean compress) throws ServletException, IOException {
final String sid = request.getHeader("ZK-SID");
if (sid != null) {
//B65-ZK-2464 : Possible XSS Vulnerability in HTTP Header
Method recoverDesktop
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected Desktop recoverDesktop(Session sess, HttpServletRequest request, HttpServletResponse response,
WebAppCtrl wappc, String dtid) {
final FailoverManager failover = wappc.getFailoverManager();
if (failover != null) {
Desktop desktop = null;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getLastModified
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected long getLastModified(HttpServletRequest request) {
final String pi = Https.getThisPathInfo(request);
if (pi != null && pi.startsWith(ClassWebResource.PATH_PREFIX) && pi.indexOf('*') < 0 //language independent
&& !Servlets.isIncluded(request)) {
//If a resource extension is registered for the extension,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method sessionTimeout
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private void sessionTimeout(HttpServletRequest request, HttpServletResponse response, WebApp wapp, String dtid,
boolean compress) throws ServletException, IOException {
Method recoverDesktop
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected Desktop recoverDesktop(Session sess, HttpServletRequest request, HttpServletResponse response,
WebAppCtrl wappc, String dtid) {
Method getAuExtension
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static final AuExtension getAuExtension(WebApp wapp, String prefix) {
DHtmlUpdateServlet upsv = DHtmlUpdateServlet.getUpdateServlet(wapp);
if (upsv == null) {
synchronized (DHtmlUpdateServlet.class) {
upsv = DHtmlUpdateServlet.getUpdateServlet(wapp);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method addAuExtension
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static final AuExtension addAuExtension(WebApp wapp, String prefix, AuExtension extension)
throws ServletException {
DHtmlUpdateServlet upsv = DHtmlUpdateServlet.getUpdateServlet(wapp);
if (upsv == null) {
synchronized (DHtmlUpdateServlet.class) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Method isIgnorable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public boolean isIgnorable(Object request, WebApp wapp) {
final HttpServletRequest hreq = (HttpServletRequest) request;
for (int j = 0;; ++j) {
if (hreq.getParameter("cmd_" + j) == null)
break;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Identical blocks of code found in 2 locations. Consider refactoring. Open
protected long getLastModified(HttpServletRequest request) {
final String pi = Https.getThisPathInfo(request);
if (pi != null && pi.startsWith(ClassWebResource.PATH_PREFIX) && pi.indexOf('*') < 0 //language independent
&& !Servlets.isIncluded(request)) {
//If a resource extension is registered for the extension,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 126.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (sid != null) {
//B65-ZK-2464 : Possible XSS Vulnerability in HTTP Header
try {
Integer.parseInt(sid);
} catch (NumberFormatException e) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 58.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (sid != null) { //Some client might not have ZK-SID
//B65-ZK-2464 : Possible XSS Vulnerability in HTTP Header
try {
Integer.parseInt(sid);
} catch (NumberFormatException e) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 58.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
} finally {
if (sess != null)
I18Ns.cleanup(request, old);
else {
Charsets.cleanup(request, old);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 40.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76