if (time == null) {
time = 0;
}
- Preconditions.checkArgument(time >= 0 && time <= MAX_RESTART_TIME, "Restart time is " + time);
+ Preconditions.checkArgument(time >= 0 && time <= MAX_RESTART_TIME, "Restart time is %s", time);
timeval = time;
final RestartFlags flags = grace.getRestartFlags();
if (flags != null && flags.isRestartState()) {
for (final Tables t : tables) {
final Class<? extends AddressFamily> afi = t.getAfi();
final Integer afival = this.afiReg.numberForClass(afi);
- Preconditions.checkArgument(afival != null, "Unhandled address family " + afi);
+ Preconditions.checkArgument(afival != null, "Unhandled address family %s", afi);
bytes.writeShort(afival);
final Class<? extends SubsequentAddressFamily> safi = t.getSafi();
final Integer safival = this.safiReg.numberForClass(safi);
- Preconditions.checkArgument(safival != null, "Unhandled subsequent address family " + safi);
+ Preconditions.checkArgument(safival != null, "Unhandled subsequent address family %s", safi);
bytes.writeByte(safival);
if (t.getAfiFlags() != null && t.getAfiFlags().isForwardingState()) {
final ByteBuf capBuffer = Unpooled.buffer();
final Class<? extends AddressFamily> afi = mp.getMultiprotocolCapability().getAfi();
final Integer afival = this.afiReg.numberForClass(afi);
- Preconditions.checkArgument(afival != null, "Unhandled address family " + afi);
+ Preconditions.checkArgument(afival != null, "Unhandled address family %s", afi);
capBuffer.writeShort(afival);
final Class<? extends SubsequentAddressFamily> safi = mp.getMultiprotocolCapability().getSafi();
final Integer safival = this.safiReg.numberForClass(safi);
- Preconditions.checkArgument(safival != null, "Unhandled subsequent address family " + safi);
+ Preconditions.checkArgument(safival != null, "Unhandled subsequent address family %s", safi);
capBuffer.writeZero(RESERVED);
capBuffer.writeByte(safival);
CapabilityUtil.formatCapability(CODE, capBuffer, byteAggregator);
}
-}
\ No newline at end of file
+}
Preconditions.checkNotNull(clazz);
final Class<?> c = numberToClass.get(number);
- Preconditions.checkState(c == null, "Number " + number + " already registered to " + c);
+ Preconditions.checkState(c == null, "Number %s already registered to %s", clazz, c);
final N n = classToNumber.get(clazz);
- Preconditions.checkState(n == null, "Class " + clazz + " already registered to " + n);
+ Preconditions.checkState(n == null, "Class %s already registered to %s", clazz, n);
numberToClass.put(number, clazz);
classToNumber.put(clazz, number);
synchronized AutoCloseable registerNlriSerializer(final Class<? extends DataObject> nlriClass, final NlriSerializer serializer){
final NlriSerializer prev = this.serializers.get(nlriClass);
- Preconditions.checkState(prev == null, "Serializer already bound to class " + prev);
+ Preconditions.checkState(prev == null, "Serializer already bound to class %s", prev);
this.serializers.put(nlriClass, serializer);
final Object lock = this;
final Class<? extends SubsequentAddressFamily> safi, final NlriParser parser) {
final BgpTableType key = createKey(afi, safi);
final NlriParser prev = this.handlers.get(key);
- Preconditions.checkState(prev == null, "AFI/SAFI is already bound to parser " + prev);
+ Preconditions.checkState(prev == null, "AFI/SAFI is already bound to parser %s", prev);
this.handlers.put(key, parser);
final Object lock = this;
// Parse length
final int length = ByteArray.bytesToInt(new byte[]{ byteArray[j], byteArray[j + 1] });
- Preconditions.checkArgument(length >= MINIMAL_LENGTH, "Invalid message at index " + start
- + ", length atribute is lower than " + MINIMAL_LENGTH);
+ Preconditions.checkArgument(length >= MINIMAL_LENGTH,
+ "Invalid message at index %s, length atribute is lower than %s", start, MINIMAL_LENGTH);
final byte[] message = Arrays.copyOfRange(byteArray, start, start + length);
messages.add(message);
// Assert that message is longer than minimum 19(header.length == 19)
// If length in BGP message would be 0, loop would never end
- Preconditions.checkArgument(length >= MINIMAL_LENGTH, "Invalid message at index " + idx + ", length atribute is lower than "
- + MINIMAL_LENGTH);
+ Preconditions.checkArgument(length >= MINIMAL_LENGTH, "Invalid message at index %s, length atribute is lower than %s",
+ idx, MINIMAL_LENGTH);
final String hexMessage = content.substring(idx, messageEndIdx);
byte[] message = null;
public static Ipv4Prefix prefixForByteBuf(final ByteBuf bytes) {
final int prefixLength = bytes.readByte();
final int size = prefixLength / Byte.SIZE + ((prefixLength % Byte.SIZE == 0) ? 0 : 1);
- Preconditions.checkArgument(size <= bytes.readableBytes(), "Illegal length of IP prefix: " + (bytes.readableBytes()));
+ Preconditions.checkArgument(size <= bytes.readableBytes(), "Illegal length of IP prefix: %s", bytes.readableBytes());
return Ipv4Util.prefixForBytes(ByteArray.readBytes(bytes, size), prefixLength);
}
public static Ipv6Prefix prefixForByteBuf(final ByteBuf bytes) {
final int prefixLength = bytes.readByte();
final int size = prefixLength / Byte.SIZE + ((prefixLength % Byte.SIZE == 0) ? 0 : 1);
- Preconditions.checkArgument(size <= bytes.readableBytes(), "Illegal length of IP prefix: " + (bytes.readableBytes()));
+ Preconditions.checkArgument(size <= bytes.readableBytes(), "Illegal length of IP prefix: %s", bytes.readableBytes());
return Ipv6Util.prefixForBytes(ByteArray.readBytes(bytes, size), prefixLength);
}
// Assert that message is longer than minimum 4(header.length == 4)
// If length in PCEP message would be 0, loop would never end
- Preconditions.checkArgument(length >= MINIMAL_LENGTH, "Invalid message at index " + idx + ", length atribute is lower than "
- + MINIMAL_LENGTH);
+ Preconditions.checkArgument(length >= MINIMAL_LENGTH, "Invalid message at index %s, length atribute is lower than %s",
+ idx, MINIMAL_LENGTH);
// dot
final String hexMessage = content.substring(messageIdx + 1, messageEndIdx);