<tfoot id='faZFq'></tfoot>

  • <legend id='faZFq'><style id='faZFq'><dir id='faZFq'><q id='faZFq'></q></dir></style></legend>

      <i id='faZFq'><tr id='faZFq'><dt id='faZFq'><q id='faZFq'><span id='faZFq'><b id='faZFq'><form id='faZFq'><ins id='faZFq'></ins><ul id='faZFq'></ul><sub id='faZFq'></sub></form><legend id='faZFq'></legend><bdo id='faZFq'><pre id='faZFq'><center id='faZFq'></center></pre></bdo></b><th id='faZFq'></th></span></q></dt></tr></i><div id='faZFq'><tfoot id='faZFq'></tfoot><dl id='faZFq'><fieldset id='faZFq'></fieldset></dl></div>
        <bdo id='faZFq'></bdo><ul id='faZFq'></ul>

        <small id='faZFq'></small><noframes id='faZFq'>

      1. 安全性 - 数组直接存储

        Security - Array is stored directly(安全性 - 数组直接存储)
      2. <legend id='2CWy0'><style id='2CWy0'><dir id='2CWy0'><q id='2CWy0'></q></dir></style></legend>
          <bdo id='2CWy0'></bdo><ul id='2CWy0'></ul>

            <tfoot id='2CWy0'></tfoot>

            <small id='2CWy0'></small><noframes id='2CWy0'>

                <i id='2CWy0'><tr id='2CWy0'><dt id='2CWy0'><q id='2CWy0'><span id='2CWy0'><b id='2CWy0'><form id='2CWy0'><ins id='2CWy0'></ins><ul id='2CWy0'></ul><sub id='2CWy0'></sub></form><legend id='2CWy0'></legend><bdo id='2CWy0'><pre id='2CWy0'><center id='2CWy0'></center></pre></bdo></b><th id='2CWy0'></th></span></q></dt></tr></i><div id='2CWy0'><tfoot id='2CWy0'></tfoot><dl id='2CWy0'><fieldset id='2CWy0'></fieldset></dl></div>
                  <tbody id='2CWy0'></tbody>
                • 本文介绍了安全性 - 数组直接存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我什至提到:声纳违规:安全 - 阵列直接存储

                  我的代码是--->

                      public final void setSelectedObjectsList(final ScheduleDTO[] selectedObjectsList) 
                                 //      Security - Array is stored directly    
                                 //The user-supplied array 'selectedObjectsList' is stored directly.      
                  {
                              if (selectedObjectsList != null) {
                                  this.selectedObjectsList = selectedObjectsList.clone();
                              } else {
                                  this.selectedObjectsList = null;
                              }
                          }
                  

                  这已经在处理防御副本了,不知道为什么声纳就在函数参数处对我大喊大叫.

                  This is already taking care of defensive copy wonder why sonar is yelling at me right at function parameter.

                  这不是重复的声纳违规:安全 - 数组直接存储

                  再次感谢您的帮助和时间.

                  Again, Thank-you for your hyelp and time.

                  推荐答案

                  不确定 Sonar 的想法,但使用 clone() 进行防御性浅拷贝应该适用于数组,就像 Arrays.copyOfSystem.arrayCopy().

                  Not sure what Sonar is thinking but defensive shallow copying with clone() should work fine for arrays, as would Arrays.copyOf and System.arrayCopy().

                  另一方面,由于您已经将数组称为列表:selectedObjectsList,您也可以将其设为实际列表并进行一些重构:

                  On the other hand, since you are already calling the array a list: selectedObjectsList, you could also make it an actual list and refactor a bit:

                  public final void setSelectedSchedules(List<ScheduleDTO> selectedSchedules) {
                      this.selectedSchedules = selectedSchedules != null ? new ArrayList<ScheduleDTO>(selectedSchedules) : null;
                  }
                  

                  这篇关于安全性 - 数组直接存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Slf4j LoggerFactory.getLogger and sonarqube(Slf4j LoggerFactory.getLogger 和 sonarqube)
                  SonarQube quot;Class Not Foundquot; during Main AST Scan(SonarQube“找不到类在主 AST 扫描期间)
                  Integrate Spock#39;s test with Sonar(将 Spock 的测试与声纳集成)
                  How do I make Hudson/Jenkins fail if Sonar thresholds are breached?(如果违反声纳阈值,我如何让 Hudson/Jenkins 失败?)
                  automatically add curly brackets to all if/else/for/while etc. in a java code-base(自动将大括号添加到 java 代码库中的所有 if/else/for/while 等)
                  How do I ignore duplicated code report in Sonar?(如何忽略 Sonar 中的重复代码报告?)

                    <tfoot id='JIFwr'></tfoot>
                    <legend id='JIFwr'><style id='JIFwr'><dir id='JIFwr'><q id='JIFwr'></q></dir></style></legend>
                    <i id='JIFwr'><tr id='JIFwr'><dt id='JIFwr'><q id='JIFwr'><span id='JIFwr'><b id='JIFwr'><form id='JIFwr'><ins id='JIFwr'></ins><ul id='JIFwr'></ul><sub id='JIFwr'></sub></form><legend id='JIFwr'></legend><bdo id='JIFwr'><pre id='JIFwr'><center id='JIFwr'></center></pre></bdo></b><th id='JIFwr'></th></span></q></dt></tr></i><div id='JIFwr'><tfoot id='JIFwr'></tfoot><dl id='JIFwr'><fieldset id='JIFwr'></fieldset></dl></div>
                      <tbody id='JIFwr'></tbody>
                      <bdo id='JIFwr'></bdo><ul id='JIFwr'></ul>

                      • <small id='JIFwr'></small><noframes id='JIFwr'>