Source:
private void checkIpSecConfig(IpSecConfig config) { if (config.getLocalAddress() == null) { throw new IllegalArgumentException("Invalid null Local InetAddress"); } if (config.getRemoteAddress() == null) { throw new IllegalArgumentException("Invalid null Remote InetAddress"); } switch (config.getMode()) { case IpSecTransform.MODE_TRANSPORT: if (!config.getLocalAddress().isEmpty()) { throw new IllegalArgumentException("Non-empty Local Address"); } checkInetAddress(config.getRemoteAddress()); break; case IpSecTransform.MODE_TUNNEL: break; default: throw new IllegalArgumentException( "Invalid IpSecTransform.mode: " + config.getMode()); } switch (config.getEncapType()) { case IpSecTransform.ENCAP_NONE: break; case IpSecTransform.ENCAP_ESPINUDP: case IpSecTransform.ENCAP_ESPINUDP_NON_IKE: if (mUdpSocketRecords.getAndCheckOwner( config.getEncapSocketResourceId()) == null) { throw new IllegalStateException( "No Encapsulation socket for Resource Id: " + config.getEncapSocketResourceId()); } int port = config.getEncapRemotePort(); if (port <= 0 || port > 0xFFFF) { throw new IllegalArgumentException("Invalid remote UDP port: " + port); } break; default: throw new IllegalArgumentException("Invalid Encap Type: " + config.getEncapType()); } for (int direction : DIRECTIONS) { IpSecAlgorithm crypt = config.getEncryption(direction); IpSecAlgorithm auth = config.getAuthentication(direction); IpSecAlgorithm authenticatedEncryption = config.getAuthenticatedEncryption(direction); if (authenticatedEncryption == null && crypt == null && auth == null) { throw new IllegalArgumentException( "Authenticated Encryption, Encryption and " + "Authentication are all null"); } else if (authenticatedEncryption != null && (auth != null || crypt != null)) { throw new IllegalArgumentException( "Authenticated Encryption is mutually" + " exclusive with other Authentication or Encryption algorithms"); } if (mSpiRecords.getAndCheckOwner(config.getSpiResourceId(direction)) == null) { throw new IllegalStateException("No SPI for specified Resource Id"); } } }

Target:
private void checkIpSecConfig(IpSecConfig config) { if (config.getLocalAddress() == null) { throw new IllegalArgumentException("Invalid null Local InetAddress"); } if (config.getRemoteAddress() == null) { throw new IllegalArgumentException("Invalid null Remote InetAddress"); } switch (config.getMode()) { case IpSecTransform.MODE_TRANSPORT: if (!config.getLocalAddress().isEmpty()) { throw new IllegalArgumentException("Non-empty Local Address"); } checkInetAddress(config.getRemoteAddress()); break; case IpSecTransform.MODE_TUNNEL: break; default: throw new IllegalArgumentException( "Invalid IpSecTransform.mode: " + config.getMode()); } switch (config.getEncapType()) { case IpSecTransform.ENCAP_NONE: break; case IpSecTransform.ENCAP_ESPINUDP: case IpSecTransform.ENCAP_ESPINUDP_NON_IKE: if (mUdpSocketRecords.getAndCheckOwner( config.getEncapSocketResourceId()) == null) { throw new IllegalStateException( "No Encapsulation socket for Resource Id: " + config.getEncapSocketResourceId()); } int port = config.getEncapRemotePort(); if (port <= 0 || port > 0xFFFF) { throw new IllegalArgumentException("Invalid remote UDP port: " + port); } break; default: throw new IllegalArgumentException("Invalid Encap Type: " + config.getEncapType()); } for (int direction : DIRECTIONS) { IpSecAlgorithm crypt = config.getEncryption(direction); IpSecAlgorithm auth = config.getAuthentication(direction); IpSecAlgorithm authenticatedEncryption = config.getAuthenticatedEncryption(direction); if (authenticatedEncryption == null && crypt == null && auth == null) { throw new IllegalArgumentException( "No Encryption, Authentication or Authenticated Encryption algorithms specified"); } else if (authenticatedEncryption != null && (auth != null || crypt != null)) { throw new IllegalArgumentException( "Authenticated Encryption is mutually" + " exclusive with other Authentication or Encryption algorithms"); } if (mSpiRecords.getAndCheckOwner(config.getSpiResourceId(direction)) == null) { throw new IllegalStateException("No SPI for specified Resource Id"); } } }