Changeset 755


Ignore:
Timestamp:
Sep 4, 2008, 11:38:46 AM (13 years ago)
Author:
Martin Svensson
Message:

Fixed weaknesses discovered with FindBugs?-eclipse plug-in

Location:
plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/plugins
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/plugins/AverageNormalization.java

    r753 r755  
    471471          sum = sum + d.getNormalizableData();
    472472        }
    473         float assayAverage = new Float(sum/dataSize);
     473        float assayAverage = (float)(sum/dataSize);
    474474        scaleFactor = refValue / assayAverage;
    475475       
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/plugins/RankInvariantNormalization.java

    r754 r755  
    328328     
    329329      // Write spot data to file and calculate row summaries
    330       if (rowSummaries == null) rowSummaries = new double[data.size()];     
     330      if (rowSummaries == null) rowSummaries = new double[data.size()];
     331      FileWriter fw = null;
    331332      try
    332333      {
    333334        // Create temp-file to store the spot's original values and position.
    334335        File tempFile = File.createTempFile("Rank", null);
    335         FileWriter fw = new FileWriter(tempFile);
     336        fw = new FileWriter(tempFile);
    336337        for (int i=0; i<data.size(); i++)
    337338        {
     
    343344        }
    344345        fw.flush();
    345         fw.close();
    346346
    347347        // Map the file with the assay's data cube column no.
     
    351351      {
    352352        throw new BaseException(e);
     353      }
     354      finally
     355      {
     356        if (fw != null)
     357        {
     358          try
     359          {
     360            fw.close();
     361          }
     362          catch (IOException e){}
     363        }
    353364      }
    354365    }
     
    358369    for (int i=0; i<rowSummaries.length; i++)
    359370    {
    360       rowAverages[i] = new Float(rowSummaries[i]/assays.size());
     371      rowAverages[i] = (float)(rowSummaries[i]/assays.size());
    361372    }
    362373   
     
    400411        // Clean up
    401412        input.close();
    402         assayFile.delete();
     413        if (!assayFile.delete()) throw new BaseException("Temporary file  " + assayFile.getAbsolutePath() + " could not be deleted");
    403414       
    404415        // Update progress
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/plugins/SpotData1Ch.java

    r753 r755  
    2828
    2929/**
    30   This class holds spot data information for a spot on a 1-channel array
     30  This class holds spot data information for a spot on a 1-channel array.
     31  Note: this class has a natural ordering that is inconsistent with equals.
    3132    @author Martin
    3233    @version 1.0
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/plugins/SpotData2Ch.java

    r753 r755  
    2828
    2929/**
    30   This class holds spot data information for a spot on a 2-channel array
     30  This class holds spot data information for a spot on a 2-channel array.
     31  Note: this class has a natural ordering that is inconsistent with equals.
    3132    @author Martin
    3233    @version 1.0
     
    8788  {
    8889    ratio = data;
    89     ch2 = new Float(Math.sqrt(Math.pow(10d, (2d*A))/ratio));
     90    ch2 = (float)Math.sqrt(Math.pow(10d, (2d*A))/ratio);
    9091    ch1 = ratio * ch2;
    9192  }
Note: See TracChangeset for help on using the changeset viewer.