Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-28791

Static code review sweep for 2.7

    Details

    • Type: Task
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7.2
    • Fix Version/s: 2.7.2
    • Component/s: Sitestats
    • Labels:
      None

      Description

      Alan did a quick look at sitestats for the 2.7 release and found two resource leaks under exceptional situations:

      [1] org.sakaiproject.sitestats.impl.ConvOldPrefsJobImpl
      If rs.close causes an SQLException then s.close not called [Line 209] Should place a try catch around close

      try

      { s = c.createStatement(); rs = s.executeQuery("select count(*) from SST_PREFS"); present = true; }

      catch(SQLException e)

      { LOG.error("Table SST_PREFS doesn't exist! Create it before running this conversion script.", e); present = false; }

      finally{
      if(rs != null)

      { rs.close(); }
      if(s != null){ s.close(); }
      }


      [2] Line 172
      Same bug pattern again
      try{
      s = c.createStatement();
      rs = s.executeQuery("select distinct SITE_ID from SST_PREFS");
      while(rs.next()) { siteIds.add(rs.getString(1)); }
      }catch(SQLException e){ LOG.error("Unable to get list of sites from SST_PREFS.", e); }finally{
      if(rs != null){ rs.close(); }

      if(s != null)

      { s.close(); }

      }
      }catch(SQLException e)

      { LOG.error("An SQL error occurred while getting list of sites from SST_PREFS.", e); }

      finally{
      if(c != null)

      { sqlService.returnConnection(c); }

      }

      return siteIds;
      }

      [3] StatsManagerImpl [line 1777]
      Not used
      final Map<Integer,Integer> columnMap = sqlBuilder.getHQLColumnMap();

        Gliffy Diagrams

          Zeplin

            Attachments

              Issue Links

                Activity

                  People

                  Assignee:
                  nfernandes Nuno Fernandes (Inactive)
                  Reporter:
                  nfernandes Nuno Fernandes (Inactive)
                  Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                    Dates

                    Created:
                    Updated:
                    Resolved:

                      Git Integration