Skip to content

Commit

Permalink
fix: rolling back unintended changes to native serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Scoppio committed Dec 10, 2024
1 parent ee9e6ca commit 4336f1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
17 changes: 9 additions & 8 deletions megamek/mmconf/log4j2.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Configuration status="info">
<Properties>
<!-- <Property name="layout">%d{ABSOLUTE} %-5p [%logger{36}] {%t}%n%l - %m%n%ex%n</Property> -->
<Property name="layout">%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%F:%L) [%c{1.}] {%t} - %m%n%ex</Property>
<Property name="layout">%d{ABSOLUTE} %-5p [%logger{36}] {%t}%n%l - %m%n%ex%n</Property>
</Properties>

<Appenders>
<Console name="Console" target="SYSTEM_OUT" follow="true">
<Console name="dev">
<PatternLayout pattern="${layout}" />
</Console>
<File name="MegaMekLog" fileName="logs/megamek.log" append="false">
Expand All @@ -18,28 +17,30 @@
<File name="MekHQLog" fileName="logs/mekhq.log" append="false">
<PatternLayout pattern="${layout}" />
</File>
<Null name="null" />
</Appenders>

<Loggers>
<Logger name="megamek.client.bot" level="error" additivity="false">
<AppenderRef ref="MegaMekLog" />
<AppenderRef ref="Console" />
<AppenderRef ref="${env:mm.profile:-null}" />
</Logger>
<Logger name="megamek" level="info" additivity="false">
<AppenderRef ref="MegaMekLog" />
<AppenderRef ref="Console" />
<AppenderRef ref="${env:mm.profile:-null}" />
</Logger>
<Logger name="megameklab" level="info" additivity="false">
<AppenderRef ref="MegaMekLabLog" />
<AppenderRef ref="Console" />
<AppenderRef ref="${env:mm.profile:-null}" />
</Logger>
<Logger name="mekhq" level="info" additivity="false">
<AppenderRef ref="MekHQLog" />
<AppenderRef ref="Console" />
<AppenderRef ref="${env:mm.profile:-null}" />
</Logger>

<Root level="info">
<AppenderRef ref="Console" />
<AppenderRef ref="MegaMekLog" />
<AppenderRef ref="${env:mm.profile:-null}" />
</Root>
</Loggers>
</Configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.logging.Logger;

import megamek.common.net.enums.PacketCommand;
import megamek.common.net.packets.Packet;
Expand All @@ -40,12 +39,6 @@ public void marshall(final Packet packet, final OutputStream stream) throws Exce
@Override
public Packet unmarshall(final InputStream stream) throws Exception {
final ObjectInputStream in = new ObjectInputStream(stream);
var packed_command = PACKET_COMMANDS[in.readInt()];
try {
return new Packet(packed_command, (Object[]) in.readObject());
} catch (final Exception e) {
Logger.getLogger(getClass().getName()).warning("Failed to unmarshall packet: " + e.getMessage());
throw e;
}
return new Packet(PACKET_COMMANDS[in.readInt()], (Object[]) in.readObject());
}
}

0 comments on commit 4336f1b

Please sign in to comment.