Commit 9ccb934f authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Avoid invoking overridable methods from constructors.

Fixes #33205.
parent 6408bd9a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
# Changes in version 2.1?.? - 2020-0?-??

 * Minor changes
   - Avoid invoking overridable methods from constructors.


# Changes in version 2.10.0 - 2020-01-15

+2 −2
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@ public class BridgeNetworkStatusImpl extends NetworkStatusImpl
  protected BridgeNetworkStatusImpl(byte[] rawDescriptorBytes,
      int[] offsetAndLength, File descriptorFile, String fileName)
      throws DescriptorParseException {
    super(rawDescriptorBytes, offsetAndLength, descriptorFile,
        false, false);
    super(rawDescriptorBytes, offsetAndLength, descriptorFile, false);
    this.splitAndParseParts(false);
    this.setPublishedMillisFromFileName(fileName);
  }

+3 −4
Original line number Diff line number Diff line
@@ -26,14 +26,13 @@ public abstract class NetworkStatusImpl extends DescriptorImpl {
  protected Map<Integer, String> flagStrings = new HashMap<>();

  protected NetworkStatusImpl(byte[] rawDescriptorBytes, int[] offsetAndLength,
      File descriptorFile, boolean containsDirSourceEntries,
      boolean blankLinesAllowed) throws DescriptorParseException {
      File descriptorFile, boolean blankLinesAllowed)
      throws DescriptorParseException {
    super(rawDescriptorBytes, offsetAndLength, descriptorFile,
        blankLinesAllowed);
    this.splitAndParseParts(containsDirSourceEntries);
  }

  private void splitAndParseParts(boolean containsDirSourceEntries)
  protected final void splitAndParseParts(boolean containsDirSourceEntries)
      throws DescriptorParseException {
    int firstRIndex = this.findFirstIndexOfKey(Key.R);
    int firstDirectorySignatureIndex = this.findFirstIndexOfKey(
+2 −1
Original line number Diff line number Diff line
@@ -25,7 +25,8 @@ public class RelayNetworkStatusConsensusImpl extends NetworkStatusImpl
  protected RelayNetworkStatusConsensusImpl(byte[] consensusBytes,
      int[] offsetAndLimit, File descriptorFile)
      throws DescriptorParseException {
    super(consensusBytes, offsetAndLimit, descriptorFile, true, false);
    super(consensusBytes, offsetAndLimit, descriptorFile, false);
    this.splitAndParseParts(true);
    Set<Key> exactlyOnceKeys = EnumSet.of(
        Key.VOTE_STATUS, Key.CONSENSUS_METHOD, Key.VALID_AFTER, Key.FRESH_UNTIL,
        Key.VALID_UNTIL, Key.VOTING_DELAY, Key.KNOWN_FLAGS);
+2 −1
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@ public class RelayNetworkStatusImpl extends NetworkStatusImpl

  protected RelayNetworkStatusImpl(byte[] statusBytes, int[] offsetAndLength,
      File descriptorFile) throws DescriptorParseException {
    super(statusBytes, offsetAndLength, descriptorFile, false, true);
    super(statusBytes, offsetAndLength, descriptorFile, true);
    this.splitAndParseParts(false);
    Set<Key> exactlyOnceKeys = EnumSet.of(
        Key.NETWORK_STATUS_VERSION, Key.DIR_SOURCE, Key.FINGERPRINT,
        Key.CONTACT, Key.DIR_SIGNING_KEY, Key.PUBLISHED);
Loading