Showing 7,775 of 7,775 total issues

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

    public PrintWriter getWriter() throws IOException {
        if (_sos != null)
            throw new IllegalStateException("getOutputStream was called");

        if (_pwt == null) {
zweb/src/main/java/org/zkoss/web/servlet/BufferedResponse.java on lines 96..112

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

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 8 locations. Consider refactoring.
Open

private int jjMoveStringLiteralDfa5_1(long old0, long active0)
{
   if (((active0 &= old0)) == 0L)
      return jjStartNfa_1(3, old0);
   try { curChar = input_stream.readChar(); }
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 598..615
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 616..633
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 634..651
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 652..669
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 1409..1426
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 1427..1444
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 1445..1462

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

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 8 locations. Consider refactoring.
Open

private int jjMoveStringLiteralDfa7_1(long old0, long active0)
{
   if (((active0 &= old0)) == 0L)
      return jjStartNfa_1(5, old0);
   try { curChar = input_stream.readChar(); }
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 598..615
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 616..633
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 634..651
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 652..669
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 1391..1408
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 1409..1426
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 1445..1462

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

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

Method afterRenderHtml has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static void afterRenderHtml(Execution exec, Page page, Writer out, Object param)
            throws IOException {
        if (param == null)
            return; // nothing to do

Severity: Minor
Found in zhtml/src/main/java/org/zkoss/zhtml/impl/PageRenderer.java - About 1 hr to fix

    Method set has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @SuppressWarnings({ "unchecked", "rawtypes" })
        public static final void set(Object obj, String name, Object val,
        boolean autoCoerce) throws NoSuchMethodException {
            try {
                AccessibleObject acs;
    Severity: Minor
    Found in zcommon/src/main/java/org/zkoss/lang/reflect/Fields.java - About 1 hr to fix

      Method formatStackTrace has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static final StringBuffer
          formatStackTrace(StringBuffer sb, Throwable t, String prefix, int maxcnt) {
              final StringWriter sw = new StringWriter();
              t.printStackTrace(new PrintWriter(sw));
              final StringBuffer trace = sw.getBuffer();
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/lang/Exceptions.java - About 1 hr to fix

        Method toInternalForm has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static final String toInternalForm(String clsName) {
                final int k = clsName.indexOf('[');
                if (k <= 0) { //not an array, or already in internal form
                    return clsName;    //just return
                }
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

          Method invoke has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public Object invoke(EvaluationContext ctx,
                      @SuppressWarnings("rawtypes") Class[] paramTypes,
                      Object[] paramValues) throws ELException {
          
                  Target t = getTarget(ctx);
          Severity: Minor
          Found in zel/src/main/java/org/zkoss/zel/impl/parser/AstValue.java - About 1 hr to fix

            Method equals has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static final boolean equals(final Object obj0, final Object obj1)
                        throws ELException {
                    if (obj0 == obj1) {
                        return true;
                    } else if (obj0 == null || obj1 == null) {
            Severity: Minor
            Found in zel/src/main/java/org/zkoss/zel/impl/lang/ELSupport.java - About 1 hr to fix

              Method checkVersion has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static boolean checkVersion(URL url, Document doc, boolean zk5required) throws Exception {
                      final Element el = doc.getRootElement().getElement("version");
                      if (el == null)
                          return true; //version is optional (3.0.5)
              
              
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 1 hr to fix

                Method removeListener has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public void removeListener(final Class<?> klass) {
                        if (_monitor != null && _monitor.getClass().equals(klass))
                            _monitor = null;
                        if (_pfmeter != null && _pfmeter.getClass().equals(klass))
                            _pfmeter = null;
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/util/Configuration.java - About 1 hr to fix

                  Method addPrologChild has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public void addPrologChild(NodeInfo child) {
                          if (_prokids == null)
                              _prokids = new LinkedList<NodeInfo>();
                  
                          // fix ZK-2622
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/NativeInfo.java - About 1 hr to fix

                    Method parseCustomAttributes has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static void parseCustomAttributes(LanguageDefinition langdef, NodeInfo parent, Element el,
                                AnnotationHelper annHelper) throws Exception {
                            //if (!el.getElements().isEmpty())
                            //    throw new UiException(message("Child elements are not allowed for <custom-attributes>", el));
                    
                    
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 hr to fix

                      Method addForward0 has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private boolean addForward0(String orgEvent, Object target, String targetEvent, Object eventData) {
                              if (orgEvent == null)
                                  orgEvent = "onClick";
                              else if (!Events.isValid(orgEvent))
                                  throw new IllegalArgumentException("Illegal event name: " + orgEvent);
                      Severity: Minor
                      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 hr to fix

                        Method write has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            /*package*/ static final void write(java.io.ObjectOutputStream s, AbstractComponent comp,
                                    Map<String, List<EventListenerInfo>> listeners) throws IOException {
                                if (listeners != null) {
                                    final Logger logio = Serializables.logio;
                                    final boolean debug = logio.isDebugEnabled();
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/EventListenerInfo.java - About 1 hr to fix

                          Method loadBuild has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static synchronized String loadBuild() {
                                  if (_build == null) {
                                      final String FILE = "/metainfo/zk/build";
                                      ClassLoader cl = Thread.currentThread().getContextClassLoader();
                                      InputStream is = null;
                          Severity: Minor
                          Found in zk/src/main/java/org/zkoss/zk/ui/impl/AbstractWebApp.java - About 1 hr to fix

                            Method desktopDestroyed0 has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private void desktopDestroyed0(Desktop desktop) {
                                    final Configuration config = _wapp.getConfiguration();
                                    if (!_suspended.isEmpty()) { //no need to sync (better performance)
                                        final Map<Object, List<EventProcessingThreadImpl>> map;
                                        synchronized (_suspended) {
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiEngineImpl.java - About 1 hr to fix

                              Method getValidates has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public Set<Property> getValidates(BindContext ctx) {
                                      final Set<Property> properties = new HashSet<Property>(2);
                                      //we should not check this binding need to validate or not here,
                                      //since other validator may want to know the value of porperty of this binding, so just provide it
                                      final Binder binder = getBinder();
                              Severity: Minor
                              Found in zkbind/src/main/java/org/zkoss/bind/impl/SaveFormBindingImpl.java - About 1 hr to fix

                                Method postPhase has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public void postPhase(Phase phase, BindContext ctx) {
                                        switch (phase) {
                                        case COMMAND:
                                            final String commandName = ctx.getCommandName();
                                            final Binder binder = ctx.getBinder();

                                  Method readUTF has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          private String readUTF(int index, final int utfLen, final char[] buf) {
                                              int endIndex = index + utfLen;
                                              byte[] b = this.b;
                                              int strLen = 0;
                                              int c;
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language