title: Try with resource class variable gets null
body: <pre><code>        protected void saveData() {
          Map&lt;String, String&gt; allStationsParams = new HashMap&lt;&gt;();
          List&lt;String&gt; stations = getAllStations();
          stmt = Database.getUpdateableStatement();
          today = (SysTime.currentTimeMillis() / DasStamp.TICKS_PER_DAY) * 
          DasStamp.TICKS_PER_DAY;
          String changeTimestamp = DasStamp.asCompactString(today);
          String keyName = "COM.MAPPINGTOOLTIP." + attributeValue;
          for (int row = 0; row &lt; this.getTableModel().getRowCount(); row++) {
              String station = (String)this.getTableModel().getValueAt(row, 0);
              putInStationParams(this, station, allStationsParams, row);
          }
          for (String station : stations) {
              boolean sendToDB = false;
              try (ResultSet rs = this.rsParameters) {
                  rs.beforeFirst();
                  while (rs.next()) {
                      if (rs.getString("station").equals(station)) {
                          sendToDB = true;
                          break;
                      }
                  }
                  if (sendToDB) {
                      if (!rs.getString("value_text").equals(allStationsParams.get(station)) || !allStationsParams.containsKey(station)) {
                          sendToDB = true;
                      } else {
                          sendToDB = false;
                      }
                  } else if (allStationsParams.containsKey(station)) {
                      sendToDB = true;
                  }
  
                  if (sendToDB) {
                      String  sql = "REPLACE INTO dss_parameter (key_name, station, valid_from, value_text"
                              + ", change_timestamp) VALUES ('"
                              + keyName + "','" + station + "','" + DasStamp.asDateOnlyString(today) + "','"
                              + Helper.nz(allStationsParams.get(station)) + "','"
                              + changeTimestamp + "') ;";
                      if (null != stmt) {
                          stmt.execute(sql);
                          if (!isResultSetEmpty(rs) &amp;&amp; !rs.isAfterLast()) {
                              AdminLogger.log("dss_parameter", Action.UPDATE,
                                      "key_name='" + keyName + "' and station='" + station + "' and valid_from='" + DasStamp.asDateOnlyString(today) + "'",
                                      "value_text='" + rs.getString("value_text") + "'",
                                      "value_text='" + Helper.nz(allStationsParams.get(station)) + "', change_timestamp='" + changeTimestamp + "'");
                          } else {
                              AdminLogger.log("dss_parameter", Action.INSERT,
                                      "key_name='" + keyName + "' and station='" + station + "' and valid_from='" + DasStamp.asDateOnlyString(today) + "'",
                                      "", "value_text='" + Helper.nz(allStationsParams.get(station)) + "', change_timestamp='" + changeTimestamp + "'");
                          }
                      }
                  }
              } catch (SQLException e) {
                  AppFrame.msgBox("Error on insert: " + e.getMessage());
                  Helper.printMessage(true, false, "Parameter save failed!!", e);
              }
          }
      }
  </code></pre>
  
  <p>where rsParameters is class level and is fetched before. After first 
     iteration, rsParameters values is getting null.Is this a problem with try 
     with resource block?    Please help   </p>
  
  <p>where rsParameters is class level and is fetched before. After first 
     iteration, rsParameters values is getting null.Is this a problem with try 
     with resource block?    Please help                                                                     </p>