From 237f28014ab9d27d2cdfe3fdc4a5b0a0680f8e95 Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Fri, 13 May 2022 14:40:22 +0000 Subject: [PATCH] 8286393: Address possibly lossy conversions in java.rmi 8286388: Address possibly lossy conversions in java.smartcardio Reviewed-by: lancea, dfuchs, smarks --- .../share/classes/sun/rmi/log/LogInputStream.java | 2 +- .../classes/sun/security/smartcardio/ChannelImpl.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java b/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java index 1dbdd3064bc..d4176b63305 100644 --- a/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java +++ b/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java @@ -103,7 +103,7 @@ class LogInputStream extends InputStream { return 0; n = (length < n) ? length : n; n = in.skip(n); - length -= n; + length -= (int) n; return n; } diff --git a/src/java.smartcardio/share/classes/sun/security/smartcardio/ChannelImpl.java b/src/java.smartcardio/share/classes/sun/security/smartcardio/ChannelImpl.java index b329a140479..4d89c57e48c 100644 --- a/src/java.smartcardio/share/classes/sun/security/smartcardio/ChannelImpl.java +++ b/src/java.smartcardio/share/classes/sun/security/smartcardio/ChannelImpl.java @@ -255,14 +255,14 @@ final class ChannelImpl extends CardChannel { if (channel <= 3) { // mask of bits 7, 1, 0 (channel number) // 0xbc == 1011 1100 - com[0] &= 0xbc; - com[0] |= channel; + com[0] &= (byte) 0xbc; + com[0] |= (byte) channel; } else if (channel <= 19) { // mask of bits 7, 3, 2, 1, 0 (channel number) // 0xbc == 1011 0000 - com[0] &= 0xb0; - com[0] |= 0x40; - com[0] |= (channel - 4); + com[0] &= (byte) 0xb0; + com[0] |= (byte) 0x40; + com[0] |= (byte) (channel - 4); } else { throw new RuntimeException("Unsupported channel number: " + channel); }