zweb/src/main/java/org/zkoss/web/servlet/http/Https.java

Summary

Maintainability
F
1 wk
Test Coverage

Method write has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
Open

    public static void write(HttpServletRequest request, HttpServletResponse response, Media media, boolean download,
            boolean repeatable) throws IOException {
        //2012/03/09 TonyQ: ZK-885 Iframe with PDF stop works in IE 8 when we have Accept-Ranges = bytes.

        if (!Servlets.isBrowser(request, "ie")) {
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 2 days to fix

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

File Https.java has 491 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* Https.java

    Purpose: 
    Description: 
    History:
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 7 hrs to fix

    Method parseRange has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

        private static int[] parseRange(String range) {
            range = range.toLowerCase(java.util.Locale.ENGLISH);
            for (int j = 0, k, len = range.length(); (k = range.indexOf("bytes", j)) >= 0;) {
                for (k += 5; k < len;) {
                    char cc = range.charAt(k++);
    Severity: Minor
    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 6 hrs to fix

    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 write has 148 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static void write(HttpServletRequest request, HttpServletResponse response, Media media, boolean download,
                boolean repeatable) throws IOException {
            //2012/03/09 TonyQ: ZK-885 Iframe with PDF stop works in IE 8 when we have Accept-Ranges = bytes.
    
            if (!Servlets.isBrowser(request, "ie")) {
    Severity: Major
    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 5 hrs to fix

      Https has 30 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class Https extends Servlets {
          private static final Logger log = LoggerFactory.getLogger(Https.class);
      
          /** Compresses the content into an byte array, or null
           * if the browser doesn't support the compression (accept-encoding).
      Severity: Minor
      Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 3 hrs to fix

        Method encodeRedirectURL has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            public static final String encodeRedirectURL(ServletContext ctx, HttpServletRequest request,
                    HttpServletResponse response, String uri, Map params, int mode) {
                if (uri == null) {
                    uri = request.getContextPath() + getOriginFullServlet(request);
                } else {
        Severity: Minor
        Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 3 hrs to fix

        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 normalizePath has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public static String normalizePath(String path) {
                if (path == null) {
                    return null;
                }
                if ("/".equals(path)) {
        Severity: Minor
        Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 1 hr to fix

        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 parseRange has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static int[] parseRange(String range) {
                range = range.toLowerCase(java.util.Locale.ENGLISH);
                for (int j = 0, k, len = range.length(); (k = range.indexOf("bytes", j)) >= 0;) {
                    for (k += 5; k < len;) {
                        char cc = range.charAt(k++);
        Severity: Minor
        Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 1 hr to fix

          Method gzip has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public static final byte[] gzip(HttpServletRequest request, HttpServletResponse response, InputStream content1,
                      byte[] content2) throws IOException {
                  //We check Content-Encoding first to avoid compressing twice
                  String ae = request.getHeader("accept-encoding");
                  if (ae != null && !response.containsHeader("Content-Encoding")) {
          Severity: Minor
          Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 1 hr to fix

          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 normalizePath has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static String normalizePath(String path) {
                  if (path == null) {
                      return null;
                  }
                  if ("/".equals(path)) {
          Severity: Minor
          Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 1 hr to fix

            Method sendRedirect has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static final void sendRedirect(ServletContext ctx, HttpServletRequest request, HttpServletResponse response,
                        String uri, Map params, int mode) throws IOException, ServletException {
            Severity: Minor
            Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 45 mins to fix

              Method encodeRedirectURL has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static final String encodeRedirectURL(ServletContext ctx, HttpServletRequest request,
                          HttpServletResponse response, String uri, Map params, int mode) {
              Severity: Minor
              Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            if (j >= 0) {
                                                String s = range.substring(j + 1).trim();
                                                if (s.length() > 0) {
                                                    int to = Integer.parseInt(s);
                                                    if (to >= from)
                Severity: Major
                Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 45 mins to fix

                  Method write has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public static void write(HttpServletRequest request, HttpServletResponse response, Media media, boolean download,
                              boolean repeatable) throws IOException {
                  Severity: Minor
                  Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 35 mins to fix

                    Method toDate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static final Date toDate(String sdate) throws ParseException {
                            ParseException ex = null;
                            for (String df : _dfs) {
                                try {
                                    return new SimpleDateFormat(df, Locale.US).parse(sdate);
                    Severity: Minor
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 25 mins to fix

                    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 getCharset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static String getCharset(String contentType) {
                            if (contentType != null) {
                                int j = contentType.indexOf("charset=");
                                if (j >= 0) {
                                    String cs = contentType.substring(j + 8).trim();
                    Severity: Minor
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 25 mins to fix

                    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 getCookieValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static final String getCookieValue(HttpServletRequest request, String name) {
                            final Cookie[] cookies = request.getCookies();
                            if (cookies != null) {
                                for (int j = cookies.length; --j >= 0;) {
                                    if (cookies[j].getName().equals(name))
                    Severity: Minor
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 25 mins to fix

                    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 getOriginQueryString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static final String getOriginQueryString(ServletRequest request) {
                            String path = (String) request.getAttribute(Attributes.FORWARD_QUERY_STRING);
                            return path != null ? path : isForwarded(request) ? null
                                    : //null is valid even included
                                    request instanceof HttpServletRequest ? ((HttpServletRequest) request).getQueryString() : null;
                    Severity: Minor
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 25 mins to fix

                    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 getOriginPathInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static final String getOriginPathInfo(ServletRequest request) {
                            String path = (String) request.getAttribute(Attributes.FORWARD_PATH_INFO);
                            return path != null ? path : isForwarded(request) ? null
                                    : //null is valid even included
                                    request instanceof HttpServletRequest ? ((HttpServletRequest) request).getPathInfo() : null;
                    Severity: Minor
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 25 mins to fix

                    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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                                        } catch (IOException ex) {
                                            //browser might close the connection
                                            //and reread (test case: B30-1896797.zul)
                                            //so, read it completely, since 2nd read counts on it
                                            if (in instanceof org.zkoss.io.Repeatable) {
                    Severity: Minor
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java and 1 other location - About 1 hr to fix
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 644..658

                    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 68.

                    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

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                                        } catch (IOException ex) {
                                            //browser might close the connection and reread
                                            //so, read it completely, since 2nd read counts on it
                                            if (in instanceof org.zkoss.io.Repeatable) {
                                                try {
                    Severity: Minor
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java and 1 other location - About 1 hr to fix
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 600..615

                    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 68.

                    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

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public static final String getOriginQueryString(ServletRequest request) {
                            String path = (String) request.getAttribute(Attributes.FORWARD_QUERY_STRING);
                            return path != null ? path : isForwarded(request) ? null
                                    : //null is valid even included
                                    request instanceof HttpServletRequest ? ((HttpServletRequest) request).getQueryString() : null;
                    Severity: Minor
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java and 1 other location - About 45 mins to fix
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 254..259

                    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 56.

                    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

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public static final String getThisQueryString(ServletRequest request) {
                            String path = (String) request.getAttribute(Attributes.INCLUDE_QUERY_STRING);
                            return path != null || isIncluded(request) || !(request instanceof HttpServletRequest) ? path
                                    : //null is valid even included
                                    ((HttpServletRequest) request).getQueryString();
                    Severity: Minor
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java and 1 other location - About 45 mins to fix
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 212..217

                    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 56.

                    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

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public static final String getOriginPathInfo(ServletRequest request) {
                            String path = (String) request.getAttribute(Attributes.FORWARD_PATH_INFO);
                            return path != null ? path : isForwarded(request) ? null
                                    : //null is valid even included
                                    request instanceof HttpServletRequest ? ((HttpServletRequest) request).getPathInfo() : null;
                    Severity: Minor
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java and 1 other location - About 45 mins to fix
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 265..270

                    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 56.

                    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

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public static final String getThisPathInfo(ServletRequest request) {
                            String path = (String) request.getAttribute(Attributes.INCLUDE_PATH_INFO);
                            return path != null || isIncluded(request) || !(request instanceof HttpServletRequest) ? path
                                    : //null is valid even included
                                    ((HttpServletRequest) request).getPathInfo();
                    Severity: Minor
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java and 1 other location - About 45 mins to fix
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 199..204

                    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 56.

                    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

                    Further Reading

                    Similar blocks of code found in 5 locations. Consider refactoring.
                    Open

                        public static final String getThisServletPath(ServletRequest request) {
                            String path = (String) request.getAttribute(Attributes.INCLUDE_SERVLET_PATH);
                            return path != null ? path
                                    : request instanceof HttpServletRequest ? ((HttpServletRequest) request).getServletPath() : "/";
                        }
                    Severity: Major
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java and 4 other locations - About 40 mins to fix
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 187..191
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 223..227
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 233..237
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 244..248

                    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 48.

                    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

                    Further Reading

                    Similar blocks of code found in 5 locations. Consider refactoring.
                    Open

                        public static final String getOriginServletPath(ServletRequest request) {
                            String path = (String) request.getAttribute(Attributes.FORWARD_SERVLET_PATH);
                            return path != null ? path
                                    : request instanceof HttpServletRequest ? ((HttpServletRequest) request).getServletPath() : "/";
                        }
                    Severity: Major
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java and 4 other locations - About 40 mins to fix
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 175..179
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 187..191
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 223..227
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 244..248

                    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 48.

                    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

                    Further Reading

                    Similar blocks of code found in 5 locations. Consider refactoring.
                    Open

                        public static final String getThisRequestURI(ServletRequest request) {
                            String path = (String) request.getAttribute(Attributes.INCLUDE_REQUEST_URI);
                            return path != null ? path
                                    : request instanceof HttpServletRequest ? ((HttpServletRequest) request).getRequestURI() : "/";
                        }
                    Severity: Major
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java and 4 other locations - About 40 mins to fix
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 175..179
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 223..227
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 233..237
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 244..248

                    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 48.

                    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

                    Further Reading

                    Similar blocks of code found in 5 locations. Consider refactoring.
                    Open

                        public static final String getOriginContextPath(ServletRequest request) {
                            String path = (String) request.getAttribute(Attributes.FORWARD_CONTEXT_PATH);
                            return path != null ? path
                                    : request instanceof HttpServletRequest ? ((HttpServletRequest) request).getContextPath() : "";
                        }
                    Severity: Major
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java and 4 other locations - About 40 mins to fix
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 175..179
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 187..191
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 233..237
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 244..248

                    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 48.

                    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

                    Further Reading

                    Similar blocks of code found in 5 locations. Consider refactoring.
                    Open

                        public static final String getOriginRequestURI(ServletRequest request) {
                            String path = (String) request.getAttribute(Attributes.FORWARD_REQUEST_URI);
                            return path != null ? path
                                    : request instanceof HttpServletRequest ? ((HttpServletRequest) request).getRequestURI() : "/";
                        }
                    Severity: Major
                    Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java and 4 other locations - About 40 mins to fix
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 175..179
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 187..191
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 223..227
                    zweb/src/main/java/org/zkoss/web/servlet/http/Https.java on lines 233..237

                    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 48.

                    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

                    Further Reading

                    There are no issues that match your filters.

                    Category
                    Status