Skip to content

Commit

Permalink
Remove logs from ICE4J config implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
rtm516 committed Aug 22, 2024
1 parent 59fa2a1 commit 7084564
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ public class CustomIceConfigSource implements ConfigSource {
put("ice4j.harvest.mapping.static-mappings", "");
}};

@NotNull
@Override
public String getName() {
return "";
}

@NotNull
@Override
public String getDescription() {
Expand All @@ -87,8 +93,6 @@ public String getDescription() {
@Override
public Function1<String, Object> getterFor(@NotNull KType kType) {
return s -> {
System.out.println("getterFor: " + s + " " + kType);

String value = config.get(s);
if (value != null) {
String typeName = kType.getClassifier().toString();
Expand All @@ -99,41 +103,24 @@ public Function1<String, Object> getterFor(@NotNull KType kType) {
if (value.isEmpty()) {
return new ArrayList<>();
} else {
System.out.println("List not empty: " + s + " " + value + " " + kType);
return null;
}
}

Object out = switch (typeName) {
return switch (typeName) {
case "kotlin.Boolean" -> Boolean.parseBoolean(value);
case "kotlin.Int" -> Integer.parseInt(value);
case "kotlin.Long" -> Long.parseLong(value);
case "kotlin.Double" -> Double.parseDouble(value);
case "java.time.Duration" -> Duration.ofMillis(Long.parseLong(value));
default -> {
System.out.println("Unknown type: " + typeName);
yield null;
}
default -> null;
};

if (out == null) {
System.out.println("Failed to parse: " + s + " " + value + " " + kType);
}

return out;
}

System.out.println("Unknown key: " + s + " " + kType);
return null;
};
}

@NotNull
@Override
public String getName() {
return "";
}

public static void install() {
JitsiConfig.Companion.useDebugNewConfig(new CustomIceConfigSource());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static Promise<BedrockPong> ping(InetSocketAddress server, long timeout,
.group(workerEventLoopGroup)
.option(RakChannelOption.RAK_GUID, ThreadLocalRandom.current().nextLong())
.handler(new ClientPingHandler(promise, timeout, timeUnit))
.bind(ThreadLocalRandom.current().nextInt(10000, 15000))
.bind(0)
.addListener((ChannelFuture future) -> {
if (future.cause() != null) {
promise.tryFailure(future.cause());
Expand Down

0 comments on commit 7084564

Please sign in to comment.