Showing 7,775 of 7,775 total issues

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

    private static boolean doSort(Listbox listbox) {
        Listhead hds = listbox.getListhead();
        if (!listbox.isAutosort() || hds == null)
            return false;
        for (Iterator<Component> it = hds.getChildren().iterator(); it.hasNext();) {
Severity: Major
Found in zul/src/main/java/org/zkoss/zul/Listbox.java and 1 other location - About 1 hr to fix
zul/src/main/java/org/zkoss/zul/Grid.java on lines 918..930

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

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

        private void checkAdd(Item newVal, Item other, boolean replace) {
            //allowed type?
            if (!(newVal instanceof Element) && !(newVal instanceof Text)
            && !(newVal instanceof CData) && !(newVal instanceof Comment)
            && !(newVal instanceof EntityReference) && !(newVal instanceof Binary)
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/idom/impl/AbstractGroup.java - About 1 hr to fix

    Method doGet has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected void doGet(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            Servlets.getBrowser(request); //update request info
    
            final String path = Https.getThisServletPath(request);

      Method toString has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static final String toString(Object o) {
              if (o == null) return null;
              if (o instanceof Date) return DateFormats.format((Date)o, false);
              if (o instanceof Class) {
                  final Class cls = (Class)o;
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/lang/Objects.java - About 1 hr to fix

        Method initialise has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private static String initialise(Token currentToken,
                                   int[][] expectedTokenSequences,
                                   String[] tokenImage) {
            String eol = System.getProperty("line.separator", "\n");
            StringBuffer expected = new StringBuffer();
        Severity: Minor
        Found in zel/src/main/java/org/zkoss/zel/impl/parser/ParseException.java - About 1 hr to fix

          Method coerceToCollection has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @SuppressWarnings({ "rawtypes", "unchecked" })
              private static Object coerceToCollection(Object obj, Class<?> type) {
                  if(obj==null) return null;
                  // since 8.0.0 support proxy form binding
                  if (ProxyFactory.isProxyClass(type)) {
          Severity: Minor
          Found in zel/src/main/java/org/zkoss/zel/impl/lang/ELSupport.java - About 1 hr to fix

            Method render has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public void render(final Treeitem treeItem, B70_ZK_2460_ContactTreeNode treeNode, int index) throws Exception {
                        B70_ZK_2460_ContactTreeNode ctn = treeNode;
                        B70_ZK_2460_Contact B70_ZK_2460_Contact = (B70_ZK_2460_Contact) ctn.getData();
                        final Treerow dataRow = new Treerow();
                        dataRow.setParent(treeItem);

              Method isAnnotation has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static boolean isAnnotation(String val) {
                      int len = val.length();
                      if (len >= 4) {
                          len = (val = val.trim()).length();
                          if (len >= 4 && val.charAt(0) == '@') {

                Method destroy has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public void destroy() {
                        final ExecutionMonitor execmon = _wapp != null //just in case
                                ? _wapp.getConfiguration().getExecutionMonitor() : null;
                
                        _rque = null; //denote it is destroyed
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/impl/DesktopImpl.java - About 1 hr to fix

                  Method execNonComponent has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static final void execNonComponent(CreateInfo ci, Component comp, Object meta) {
                          final Page page = ci.page;
                          if (meta instanceof AttributesInfo) {
                              final AttributesInfo attrs = (AttributesInfo) meta;
                              if (comp != null)
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiEngineImpl.java - About 1 hr to fix

                    Method create has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            public Component[] create(Component parent, Component insertBefore, VariableResolver resolver,
                                    Composer composer) {
                                final Execution exec = Executions.getCurrent();
                                final ExecutionCtrl execCtrl = (ExecutionCtrl) exec;
                                final Component[] cs;
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiEngineImpl.java - About 1 hr to fix

                      Method doBeforeComposeChildren has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public void doBeforeComposeChildren(final Component comp) throws Exception {
                              //ZK-3831
                              if (comp.getPage() == null) {
                                  final Map<?, ?> currentArg = Executions.getCurrent().getArg();
                                  ((ComponentCtrl) comp).addCallback(ComponentCtrl.AFTER_PAGE_ATTACHED, new Callback() {
                      Severity: Minor
                      Found in zkbind/src/main/java/org/zkoss/bind/BindComposer.java - About 1 hr to fix

                        Method initRendererIfAny has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private void initRendererIfAny(Component comp, String attr) {
                                final Object installed = comp.getAttribute(BinderCtrl.RENDERER_INSTALLED);
                                if (installed != null) { //renderer was set already init
                                    return;
                                }
                        Severity: Minor
                        Found in zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java - About 1 hr to fix

                          Method getConverter has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public Converter getConverter(String name) {
                                  checkInit();
                                  Converter converter = null;
                                  if (_hasGetConverterMethod) {
                                      Object vm = getViewModel();
                          Severity: Minor
                          Found in zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java - About 1 hr to fix

                            Method getValidator has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public Validator getValidator(String name) {
                                    checkInit();
                                    Validator validator = null;
                                    if (_hasGetValidatorMethod) {
                                        Object vm = getViewModel();
                            Severity: Minor
                            Found in zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java - About 1 hr to fix

                              Method addFormAssociatedSaveBinding has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public void addFormAssociatedSaveBinding(Component associatedComp, String formId, SaveBinding saveBinding,
                                          String fieldName) {
                                      checkInit();
                                      //find the form component by form id and a associated/nested component
                                      Component formComp = lookupAssociatedFormComponent(formId, associatedComp);
                              Severity: Minor
                              Found in zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java - About 1 hr to fix

                                Method getLoadBindingsPerProperty has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private void getLoadBindingsPerProperty(Collection<TrackerNode> nodes, String prop,
                                            LinkedHashSet<LoadBinding> bindings, LinkedHashSet<Object> kidbases, Set<TrackerNode> visited) {
                                        if (".".equals(prop)) { //all base object
                                            for (TrackerNode node : nodes) {
                                                getLoadBindings0(node, bindings, kidbases, visited);
                                Severity: Minor
                                Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java - About 1 hr to fix

                                  Method show has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public static Button show(String message, String title, Button[] buttons, String[] btnLabels, String icon,
                                              Button focus, EventListener<ClickEvent> listener, Map<String, String> params) {
                                          final Map<String, Object> arg = new HashMap<String, Object>();
                                          final Desktop desktop = Executions.getCurrent().getDesktop();
                                          arg.put("message", message);
                                  Severity: Minor
                                  Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 1 hr to fix

                                    Method getAvailableAtClient has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        protected Set<? extends Component> getAvailableAtClient(int offset, int limit, boolean itemOnly) {
                                            final Set<Component> avail = new LinkedHashSet<Component>(32);
                                            if (!itemOnly) {
                                                avail.addAll(_listbox.getHeads());
                                                final Listfoot listfoot = _listbox.getListfoot();
                                    Severity: Minor
                                    Found in zul/src/main/java/org/zkoss/zul/impl/ListboxDataLoader.java - About 1 hr to fix

                                      Method include has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public void include(RenderRequest request, RenderResponse response) throws PortletException, java.io.IOException {
                                              try {
                                                  // B60-ZK-1337: issues with RenderHttpServletRequest/RenderHttpServletResponse Wrapper
                                                  //   will cause ServletException: Original SevletRequest or wrapped original ServletRequest
                                                  //       not passed to RequestDispatcher in violation of SRV.8.2 and SRV.14.2.5.1
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language