@ -24,6 +24,7 @@ import org.airsonic.player.dao.ArtistDao;
import org.airsonic.player.domain.* ;
import org.airsonic.player.domain.* ;
import org.airsonic.player.service.* ;
import org.airsonic.player.service.* ;
import org.airsonic.player.service.metadata.JaudiotaggerParser ;
import org.airsonic.player.service.metadata.JaudiotaggerParser ;
import org.airsonic.player.util.FileUtil ;
import org.airsonic.player.util.StringUtil ;
import org.airsonic.player.util.StringUtil ;
import org.apache.commons.codec.digest.DigestUtils ;
import org.apache.commons.codec.digest.DigestUtils ;
import org.apache.commons.io.FilenameUtils ;
import org.apache.commons.io.FilenameUtils ;
@ -197,7 +198,7 @@ public class CoverArtController implements LastModified {
try {
try {
IOUtils . copy ( in , response . getOutputStream ( ) ) ;
IOUtils . copy ( in , response . getOutputStream ( ) ) ;
} finally {
} finally {
IOUtils . closeQuietly ( in ) ;
FileUtil . closeQuietly ( in ) ;
}
}
}
}
@ -214,7 +215,7 @@ public class CoverArtController implements LastModified {
}
}
ImageIO . write ( image , "jpeg" , response . getOutputStream ( ) ) ;
ImageIO . write ( image , "jpeg" , response . getOutputStream ( ) ) ;
} finally {
} finally {
IOUtils . closeQuietly ( in ) ;
FileUtil . closeQuietly ( in ) ;
}
}
}
}
@ -227,7 +228,7 @@ public class CoverArtController implements LastModified {
response . setContentType ( imageInputStreamWithType . getRight ( ) ) ;
response . setContentType ( imageInputStreamWithType . getRight ( ) ) ;
IOUtils . copy ( in , response . getOutputStream ( ) ) ;
IOUtils . copy ( in , response . getOutputStream ( ) ) ;
} finally {
} finally {
IOUtils . closeQuietly ( in ) ;
FileUtil . closeQuietly ( in ) ;
}
}
}
}
@ -255,13 +256,13 @@ public class CoverArtController implements LastModified {
} catch ( Throwable x ) {
} catch ( Throwable x ) {
// Delete corrupt (probably empty) thumbnail cache.
// Delete corrupt (probably empty) thumbnail cache.
LOG . warn ( "Failed to create thumbnail for " + request , x ) ;
LOG . warn ( "Failed to create thumbnail for " + request , x ) ;
IOUtils . closeQuietly ( out ) ;
FileUtil . closeQuietly ( out ) ;
cachedImage . delete ( ) ;
cachedImage . delete ( ) ;
throw new IOException ( "Failed to create thumbnail for " + request + ". " + x . getMessage ( ) ) ;
throw new IOException ( "Failed to create thumbnail for " + request + ". " + x . getMessage ( ) ) ;
} finally {
} finally {
semaphore . release ( ) ;
semaphore . release ( ) ;
IOUtils . closeQuietly ( out ) ;
FileUtil . closeQuietly ( out ) ;
}
}
} else {
} else {
// LOG.info("Cache HIT - " + request + " (" + size + ")");
// LOG.info("Cache HIT - " + request + " (" + size + ")");
@ -389,7 +390,7 @@ public class CoverArtController implements LastModified {
} catch ( Throwable x ) {
} catch ( Throwable x ) {
LOG . warn ( "Failed to process cover art " + coverArt + ": " + x , x ) ;
LOG . warn ( "Failed to process cover art " + coverArt + ": " + x , x ) ;
} finally {
} finally {
IOUtils . closeQuietly ( in ) ;
FileUtil . closeQuietly ( in ) ;
}
}
}
}
return createAutoCover ( size , size ) ;
return createAutoCover ( size , size ) ;
@ -639,7 +640,7 @@ public class CoverArtController implements LastModified {
} catch ( Throwable x ) {
} catch ( Throwable x ) {
LOG . warn ( "Failed to process cover art for " + mediaFile + ": " + x , x ) ;
LOG . warn ( "Failed to process cover art for " + mediaFile + ": " + x , x ) ;
} finally {
} finally {
IOUtils . closeQuietly ( in ) ;
FileUtil . closeQuietly ( in ) ;
}
}
return createAutoCover ( width , height ) ;
return createAutoCover ( width , height ) ;
}
}