Remove superfluous casts

master
jvoisin 5 years ago
parent 3202a1086d
commit 643be3930f
  1. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/AvatarUploadController.java
  2. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/StatusChartController.java
  3. 2
      airsonic-main/src/main/java/org/airsonic/player/service/jukebox/PlayerTest.java
  4. 8
      airsonic-main/src/main/java/org/airsonic/player/util/StringUtil.java
  5. 2
      airsonic-main/src/test/java/org/airsonic/player/io/RangeOutputStreamTestCase.java

@ -118,7 +118,7 @@ public class AvatarUploadController {
// Scale down image if necessary.
if (width > MAX_AVATAR_SIZE || height > MAX_AVATAR_SIZE) {
double scaleFactor = (double) MAX_AVATAR_SIZE / (double) Math.max(width, height);
double scaleFactor = MAX_AVATAR_SIZE / (double) Math.max(width, height);
height = (int) (height * scaleFactor);
width = (int) (width * scaleFactor);
image = CoverArtController.scale(image, width, height);

@ -134,7 +134,7 @@ public class StatusChartController extends AbstractChartController {
XYItemRenderer renderer = plot.getRendererForDataset(dataset);
renderer.setSeriesPaint(0, Color.blue.darker());
renderer.setSeriesStroke(0, new BasicStroke(2f));
renderer.setSeriesStroke(0, new BasicStroke(2.0f));
// Set theme-specific colors.
Color bgColor = getBackground(request);

@ -48,7 +48,7 @@ public class PlayerTest implements AudioPlayer.Listener {
});
gainSlider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
float gain = (float) gainSlider.getValue() / 1000.0F;
float gain = gainSlider.getValue() / 1000.0F;
player.setGain(gain);
}
});

@ -200,25 +200,25 @@ public final class StringUtil {
// More than 1 TB?
if (byteCount >= 1024L * 1024 * 1024 * 1024) {
NumberFormat teraByteFormat = new DecimalFormat("0.00 TB", new DecimalFormatSymbols(locale));
return teraByteFormat.format( ((double) byteCount ) / ((double) 1024 * 1024 * 1024 * 1024));
return teraByteFormat.format( byteCount / ((double) 1024 * 1024 * 1024 * 1024));
}
// More than 1 GB?
if (byteCount >= 1024L * 1024 * 1024) {
NumberFormat gigaByteFormat = new DecimalFormat("0.00 GB", new DecimalFormatSymbols(locale));
return gigaByteFormat.format((double) byteCount / ((double) 1024 * 1024 * 1024));
return gigaByteFormat.format(byteCount / ((double) 1024 * 1024 * 1024));
}
// More than 1 MB?
if (byteCount >= 1024L * 1024) {
NumberFormat megaByteFormat = new DecimalFormat("0.0 MB", new DecimalFormatSymbols(locale));
return megaByteFormat.format((double) byteCount / ((double) 1024 * 1024));
return megaByteFormat.format(byteCount / ((double) 1024 * 1024));
}
// More than 1 KB?
if (byteCount >= 1024L) {
NumberFormat kiloByteFormat = new DecimalFormat("0 KB", new DecimalFormatSymbols(locale));
return kiloByteFormat.format((double) byteCount / ((double) 1024));
return kiloByteFormat.format((double) byteCount / 1024);
}
return byteCount + " B";

@ -65,7 +65,7 @@ public class RangeOutputStreamTestCase extends TestCase {
private void doTestWrap(int first, Integer last, int sourceSize, int bufferSize) throws Exception {
byte[] source = createSource(sourceSize);
ByteArrayOutputStream out = new ByteArrayOutputStream();
OutputStream rangeOut = RangeOutputStream.wrap(out, new HttpRange((long) first, last == null ? null : last.longValue()));
OutputStream rangeOut = RangeOutputStream.wrap(out, new HttpRange(first, last == null ? null : last.longValue()));
copy(source, rangeOut, bufferSize);
verify(out.toByteArray(), first, last, sourceSize);
}

Loading…
Cancel
Save