Merge remote-tracking branch 'origin/pr/1464'

master
Andrew DeMaria 5 years ago
commit eafb128138
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 8
      airsonic-main/src/main/java/org/airsonic/player/dao/AbstractDao.java
  2. 2
      airsonic-main/src/main/java/org/airsonic/player/dao/AlbumDao.java
  3. 2
      airsonic-main/src/main/java/org/airsonic/player/dao/ArtistDao.java
  4. 4
      airsonic-main/src/main/java/org/airsonic/player/dao/MediaFileDao.java
  5. 2
      airsonic-main/src/main/java/org/airsonic/player/dao/PlayQueueDao.java
  6. 2
      airsonic-main/src/main/java/org/airsonic/player/dao/PlaylistDao.java
  7. 4
      airsonic-main/src/main/java/org/airsonic/player/dao/PodcastDao.java
  8. 17
      airsonic-main/src/main/java/org/airsonic/player/filter/ParameterDecodingFilter.java
  9. 4
      airsonic-main/src/main/java/org/airsonic/player/filter/ResponseHeaderFilter.java

@ -88,14 +88,14 @@ public class AbstractDao {
}
}
protected <T> List<T> query(String sql, RowMapper rowMapper, Object... args) {
protected <T> List<T> query(String sql, RowMapper<T> rowMapper, Object... args) {
long t = System.nanoTime();
List<T> result = getJdbcTemplate().query(sql, args, rowMapper);
log(sql, t);
return result;
}
protected <T> List<T> namedQuery(String sql, RowMapper rowMapper, Map<String, Object> args) {
protected <T> List<T> namedQuery(String sql, RowMapper<T> rowMapper, Map<String, Object> args) {
long t = System.nanoTime();
List<T> result = getNamedParameterJdbcTemplate().query(sql, args, rowMapper);
log(sql, t);
@ -165,12 +165,12 @@ public class AbstractDao {
return result;
}
protected <T> T queryOne(String sql, RowMapper rowMapper, Object... args) {
protected <T> T queryOne(String sql, RowMapper<T> rowMapper, Object... args) {
List<T> list = query(sql, rowMapper, args);
return list.isEmpty() ? null : list.get(0);
}
protected <T> T namedQueryOne(String sql, RowMapper rowMapper, Map<String, Object> args) {
protected <T> T namedQueryOne(String sql, RowMapper<T> rowMapper, Map<String, Object> args) {
List<T> list = namedQuery(sql, rowMapper, args);
return list.isEmpty() ? null : list.get(0);
}

@ -45,7 +45,7 @@ public class AlbumDao extends AbstractDao {
private static final String QUERY_COLUMNS = "id, " + INSERT_COLUMNS;
private final RowMapper rowMapper = new AlbumMapper();
private final RowMapper<Album> rowMapper = new AlbumMapper();
public Album getAlbum(int id) {
return queryOne("select " + QUERY_COLUMNS + " from album where id=?", rowMapper, id);

@ -39,7 +39,7 @@ public class ArtistDao extends AbstractDao {
private static final String INSERT_COLUMNS = "name, cover_art_path, album_count, last_scanned, present, folder_id";
private static final String QUERY_COLUMNS = "id, " + INSERT_COLUMNS;
private final RowMapper rowMapper = new ArtistMapper();
private final RowMapper<Artist> rowMapper = new ArtistMapper();
/**
* Returns the artist with the given name.

@ -54,8 +54,8 @@ public class MediaFileDao extends AbstractDao {
public static final int VERSION = 4;
private final RowMapper<MediaFile> rowMapper = new MediaFileMapper();
private final RowMapper musicFileInfoRowMapper = new MusicFileInfoMapper();
private final RowMapper genreRowMapper = new GenreMapper();
private final RowMapper<MediaFile> musicFileInfoRowMapper = new MusicFileInfoMapper();
private final RowMapper<Genre> genreRowMapper = new GenreMapper();
/**
* Returns the media file for the given path.

@ -37,7 +37,7 @@ public class PlayQueueDao extends AbstractDao {
private static final String INSERT_COLUMNS = "username, current, position_millis, changed, changed_by";
private static final String QUERY_COLUMNS = "id, " + INSERT_COLUMNS;
private final RowMapper rowMapper = new PlayQueueMapper();
private final RowMapper<SavedPlayQueue> rowMapper = new PlayQueueMapper();
@Transactional
public SavedPlayQueue getPlayQueue(String username) {

@ -39,7 +39,7 @@ public class PlaylistDao extends AbstractDao {
private static final String INSERT_COLUMNS = "username, is_public, name, comment, file_count, duration_seconds, " +
"created, changed, imported_from";
private static final String QUERY_COLUMNS = "id, " + INSERT_COLUMNS;
private final RowMapper rowMapper = new PlaylistMapper();
private final RowMapper<Playlist> rowMapper = new PlaylistMapper();
public List<Playlist> getReadablePlaylistsForUser(String username) {

@ -182,8 +182,8 @@ public class PodcastDao extends AbstractDao {
update(sql, id);
}
private static class PodcastChannelRowMapper implements RowMapper {
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
private static class PodcastChannelRowMapper implements RowMapper<PodcastChannel> {
public PodcastChannel mapRow(ResultSet rs, int rowNum) throws SQLException {
return new PodcastChannel(rs.getInt(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5),
PodcastStatus.valueOf(rs.getString(6)), rs.getString(7));
}

@ -79,14 +79,13 @@ public class ParameterDecodingFilter implements Filter {
}
@Override
public Map getParameterMap() {
Map map = super.getParameterMap();
public Map<String, String[]> getParameterMap() {
Map<String, String[]> map = super.getParameterMap();
Map<String, String[]> result = new HashMap<String, String[]>();
for (Object o : map.entrySet()) {
Map.Entry entry = (Map.Entry) o;
String name = (String) entry.getKey();
String[] values = (String[]) entry.getValue();
for (Map.Entry<String, String[]> entry : map.entrySet()) {
String name = entry.getKey();
String[] values = entry.getValue();
if (name.endsWith(PARAM_SUFFIX)) {
result.put(name.replace(PARAM_SUFFIX, ""), decode(values));
@ -98,11 +97,11 @@ public class ParameterDecodingFilter implements Filter {
}
@Override
public Enumeration getParameterNames() {
Enumeration e = super.getParameterNames();
public Enumeration<String> getParameterNames() {
Enumeration<String> e = super.getParameterNames();
Vector<String> v = new Vector<String>();
while (e.hasMoreElements()) {
String name = (String) e.nextElement();
String name = e.nextElement();
if (name.endsWith(PARAM_SUFFIX)) {
name = name.replace(PARAM_SUFFIX, "");
}

@ -40,8 +40,8 @@ public class ResponseHeaderFilter implements Filter {
HttpServletResponse response = (HttpServletResponse) res;
// Sets the provided HTTP response parameters
for (Enumeration e = filterConfig.getInitParameterNames(); e.hasMoreElements();) {
String headerName = (String) e.nextElement();
for (Enumeration<String> e = filterConfig.getInitParameterNames(); e.hasMoreElements();) {
String headerName = e.nextElement();
response.setHeader(headerName, filterConfig.getInitParameter(headerName));
}

Loading…
Cancel
Save