Source:
public List<Project> handle(final ResultSet rs) throws SQLException { if (!rs.next()) { return Collections.emptyList(); } final Map<Integer, Project> projects = new HashMap<>(); do { final int id = rs.getInt(1); if (!projects.containsKey(id)) { final String name = rs.getString(2); final boolean active = rs.getBoolean(3); final long modifiedTime = rs.getLong(4); final long createTime = rs.getLong(5); final int version = rs.getInt(6); final String lastModifiedBy = rs.getString(7); final String description = rs.getString(8); final int encodingType = rs.getInt(9); final byte[] data = rs.getBytes(10); final Project project; if (data != null) { final EncodingType encType = EncodingType.fromInteger(encodingType); final Object blobObj; try { if (encType == EncodingType.GZIP) { final String jsonString = GZIPUtils.unGzipString(data, "UTF-8"); blobObj = JSONUtils.parseJSONFromString(jsonString); } else { final String jsonString = new String(data, "UTF-8"); blobObj = JSONUtils.parseJSONFromString(jsonString); } project = Project.projectFromObject(blobObj); } catch (final IOException e) { throw new SQLException("Failed to get project.", e); } } else { project = new Project(id, name); } project.setActive(active); project.setLastModifiedTimestamp(modifiedTime); project.setCreateTimestamp(createTime); project.setVersion(version); project.setLastModifiedUser(lastModifiedBy); project.setDescription(description); projects.put(id, project); } final String username = rs.getString(11); final int permissionFlag = rs.getInt(12); final boolean isGroup = rs.getBoolean(13); if (username != null) { Permission perm = new Permission(permissionFlag); if (isGroup) { projects.get(id).setGroupPermission(username, perm); } else { projects.get(id).setUserPermission(username, perm); } } } while (rs.next()); return new ArrayList<>(projects.values()); }

Target:
public List<Project> handle(final ResultSet rs) throws SQLException { if (!rs.next()) { return Collections.emptyList(); } final Map<Integer, Project> projects = new HashMap<>(); do { final int id = rs.getInt(1); if (!projects.containsKey(id)) { final String name = rs.getString(2); final boolean active = rs.getBoolean(3); final long modifiedTime = rs.getLong(4); final long createTime = rs.getLong(5); final int version = rs.getInt(6); final String lastModifiedBy = rs.getString(7); final String description = rs.getString(8); final int encodingType = rs.getInt(9); final byte[] data = rs.getBytes(10); final Project project; if (data != null) { final EncodingType encType = EncodingType.fromInteger(encodingType); final Object blobObj; try { if (encType == EncodingType.GZIP) { final String jsonString = GZIPUtils.unGzipString(data, "UTF-8"); blobObj = JSONUtils.parseJSONFromString(jsonString); } else { final String jsonString = new String(data, "UTF-8"); blobObj = JSONUtils.parseJSONFromString(jsonString); } project = Project.projectFromObject(blobObj); } catch (final IOException e) { throw new SQLException(String.format("Failed to get project with id: %d", id), e); } } else { project = new Project(id, name); } project.setActive(active); project.setLastModifiedTimestamp(modifiedTime); project.setCreateTimestamp(createTime); project.setVersion(version); project.setLastModifiedUser(lastModifiedBy); project.setDescription(description); projects.put(id, project); } final String username = rs.getString(11); final int permissionFlag = rs.getInt(12); final boolean isGroup = rs.getBoolean(13); if (username != null) { Permission perm = new Permission(permissionFlag); if (isGroup) { projects.get(id).setGroupPermission(username, perm); } else { projects.get(id).setUserPermission(username, perm); } } } while (rs.next()); return new ArrayList<>(projects.values()); }