auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected ZkClient(IZkConnection zkConnection, int connectionTimeout, long operationRetryTimeout, PathBasedZkSerializer zkSerializer, String monitorType, String monitorKey, String monitorInstanceName, boolean monitorRootPathOnly) { if (zkConnection == null) { throw new NullPointerException("Zookeeper connection is null!"); } _uid = UID.getAndIncrement(); if (LOG.isInfoEnabled()) { LOG.info("ZkClient created with _uid {}, stacktrace {}", _uid, Thread.currentThread().getStackTrace()); } _connection = zkConnection; _pathBasedZkSerializer = zkSerializer; _operationRetryTimeoutInMillis = operationRetryTimeout; _isNewSessionEventFired = false; _asyncCallRetryThread = new ZkAsyncRetryThread(zkConnection.getServers()); _asyncCallRetryThread.start(); if (LOG.isInfoEnabled()) { LOG.info("ZkClient created with _uid {}, _asyncCallRetryThread id {}", _uid, _asyncCallRetryThread.getId()); } connect(connectionTimeout, this); try { if (monitorKey != null && !monitorKey.isEmpty() && monitorType != null && !monitorType .isEmpty()) { _monitor = new ZkClientMonitor(monitorType, monitorKey, monitorInstanceName, monitorRootPathOnly, _eventThread); _monitor.register(); } else { LOG.info("ZkClient monitor key or type is not provided. Skip monitoring."); } } catch (JMException e) { LOG.error("Error in creating ZkClientMonitor", e); } }

Target:
protected ZkClient(IZkConnection zkConnection, int connectionTimeout, long operationRetryTimeout, PathBasedZkSerializer zkSerializer, String monitorType, String monitorKey, String monitorInstanceName, boolean monitorRootPathOnly) { if (zkConnection == null) { throw new NullPointerException("Zookeeper connection is null!"); } _uid = UID.getAndIncrement(); _connection = zkConnection; _pathBasedZkSerializer = zkSerializer; _operationRetryTimeoutInMillis = operationRetryTimeout; _isNewSessionEventFired = false; _asyncCallRetryThread = new ZkAsyncRetryThread(zkConnection.getServers()); _asyncCallRetryThread.start(); LOG.debug("ZkClient created with _uid {}, _asyncCallRetryThread id {}", _uid, _asyncCallRetryThread.getId()); connect(connectionTimeout, this); try { if (monitorKey != null && !monitorKey.isEmpty() && monitorType != null && !monitorType .isEmpty()) { _monitor = new ZkClientMonitor(monitorType, monitorKey, monitorInstanceName, monitorRootPathOnly, _eventThread); _monitor.register(); } else { LOG.info("ZkClient monitor key or type is not provided. Skip monitoring."); } } catch (JMException e) { LOG.error("Error in creating ZkClientMonitor", e); } }
Source:
public void testBuildOneFile_Commit_FiresIndexChangedEvent() throws Exception { final String path = "a-file-path"; final FileMode mode = FileMode.REGULAR_FILE; final long lastModified = 1218123387057L; final int length = 1342; final DirCacheEntry entOrig; final DirCache dc = db.lockDirCache(); final String message = "received IndexChangedEvent"; IndexChangedListener listener = new IndexChangedListener() { public void onIndexChanged(IndexChangedEvent event) { throw new RuntimeException(message); } }; ListenerList l = db.getListenerList(); l.addIndexChangedListener(listener); final DirCacheBuilder b = dc.builder(); entOrig = new DirCacheEntry(path); entOrig.setFileMode(mode); entOrig.setLastModified(lastModified); entOrig.setLength(length); b.add(entOrig); try { b.commit(); } catch (RuntimeException e) { assertEquals(e.getMessage(), message); return; } fail("IndexChangedEvent wasn't sent"); }

Target:
public void testBuildOneFile_Commit_FiresIndexChangedEvent() throws Exception { final class ReceivedEventMarkerException extends RuntimeException { private static final long serialVersionUID = 1L; } final String path = "a-file-path"; final FileMode mode = FileMode.REGULAR_FILE; final long lastModified = 1218123387057L; final int length = 1342; final DirCacheEntry entOrig; final DirCache dc = db.lockDirCache(); IndexChangedListener listener = new IndexChangedListener() { public void onIndexChanged(IndexChangedEvent event) { throw new ReceivedEventMarkerException(); } }; ListenerList l = db.getListenerList(); l.addIndexChangedListener(listener); final DirCacheBuilder b = dc.builder(); entOrig = new DirCacheEntry(path); entOrig.setFileMode(mode); entOrig.setLastModified(lastModified); entOrig.setLength(length); b.add(entOrig); try { b.commit(); } catch (ReceivedEventMarkerException e) { return; } fail("IndexChangedEvent wasn't sent"); }
Source:
public CommandFactory build() { checkNotNull(actor, "`actor` must be defined"); if (zoneOffset == null) { setZoneOffset(toZoneOffset(TimeZone.getDefault())); } final CommandFactory result = new CommandFactory(this); return result; }

Target:
public CommandFactory build() { checkNotNull(actor, "`actor` must be defined"); if (zoneOffset == null) { setZoneOffset(ZoneOffsets.getDefault()); } final CommandFactory result = new CommandFactory(this); return result; }
Source:
public void testServiceFoundWithValidResponseNoGzip() throws Exception { when(mockRequest.headers(HttpHeaders.ACCEPT_ENCODING)).thenReturn(NO_GZIP); when(mockRequest.params(QUERY_PARAM)).thenReturn(RETURN_ID); String res = Boon.toJson(cqlTransformHandler.handle(mockRequest, mockResponse)); assertThat(res, is(SERVICE_SUCCESS)); assertThat(mockResponse.status(), is(HttpStatus.OK_200)); assertTrue( mockResponse.getHeaders().get(HttpHeaders.CONTENT_DISPOSITION).matches(ATTACHMENT_REGEX)); assertNull(mockResponse.getHeaders().get(HttpHeaders.CONTENT_ENCODING)); assertThat(mockResponse.type(), is(MIME_TYPE)); }

Target:
public void testServiceFoundWithValidResponseNoGzip() throws Exception { when(mockRequest.headers(HttpHeaders.ACCEPT_ENCODING)).thenReturn(NO_GZIP); when(mockRequest.params(QUERY_PARAM)).thenReturn(RETURN_ID); String res = Boon.toJson(cqlTransformHandler.handle(mockRequest, mockResponse)); assertThat(res, is(SERVICE_SUCCESS)); assertThat(mockResponse.status(), is(HttpStatus.OK_200)); assertThat( mockResponse.getHeaders().get(HttpHeaders.CONTENT_DISPOSITION), matchesPattern(ATTACHMENT_REGEX)); assertNull(mockResponse.getHeaders().get(HttpHeaders.CONTENT_ENCODING)); assertThat(mockResponse.type(), is(MIME_TYPE)); }
Source:
private boolean handleRenameForTableLevelReplication(Context withinContext, String oldName, String newName) { if (ReplUtils.tableIncludedInReplScope(withinContext.replScope, oldName)) { boolean oldTableInBootstrapList = withinContext.removeFromListOfTablesForBootstrap(oldName); if (!ReplUtils.tableIncludedInReplScope(withinContext.replScope, newName)) { if (oldTableInBootstrapList) { return false; } else { scenario = Scenario.DROP; LOG.info("Table " + oldName + " will be dropped as the table is renamed to " + newName); return true; } } if (oldTableInBootstrapList) { withinContext.addToListOfTablesForBootstrap(newName); return false; } LOG.info("both old and new table satisfies the policy"); return true; } else { if (ReplUtils.tableIncludedInReplScope(withinContext.replScope, newName)) { LOG.info("Table " + newName + " is added for bootstrap " + " during rename from " + oldName); withinContext.addToListOfTablesForBootstrap(newName); return false; } LOG.info("both old and new table not satisfies the policy"); return false; } }

Target:
private boolean handleRenameForTableLevelReplication(Context withinContext, String oldName, String newName) { if (ReplUtils.tableIncludedInReplScope(withinContext.replScope, oldName)) { boolean oldTableInBootstrapList = withinContext.removeFromListOfTablesForBootstrap(oldName); if (!ReplUtils.tableIncludedInReplScope(withinContext.replScope, newName)) { if (oldTableInBootstrapList) { return false; } else { scenario = Scenario.DROP; LOG.info("Table " + oldName + " will be dropped as the table is renamed to " + newName); return true; } } if (oldTableInBootstrapList) { withinContext.addToListOfTablesForBootstrap(newName); return false; } LOG.info("both old and new table satisfies the policy"); return true; } else { if (ReplUtils.tableIncludedInReplScope(withinContext.replScope, newName)) { LOG.info("Table " + newName + " is added for bootstrap " + " during rename from " + oldName); withinContext.addToListOfTablesForBootstrap(newName); return false; } LOG.info("both old and new table does not satisfies the policy"); return false; } }
Source:
private int addSingleSPA(Entity entity, double xpCap) { int unitType = entity.getUnitType(); List<SpecialAbility> choices = coalescedSPAList(unitType, xpCap); if (choices.size() == 0) { return 0; } while (choices.size() > 0) { int spaIndex = Compute.randomInt(choices.size()); SpecialAbility spa = choices.get(spaIndex); if (entity.hasAbility(spa.getName()) || !extraEligibilityCheck(spa, entity)) { choices.remove(spaIndex); } else { String spaValue; switch (spa.getName()) { case OptionsConstants.MISC_HUMAN_TRO: spaValue = pickRandomHumanTRO(); break; case OptionsConstants.GUNNERY_RANGE_MASTER: spaValue = pickRandomRangeMaster(); break; case OptionsConstants.GUNNERY_SPECIALIST: spaValue = pickRandomGunnerySpecialization(entity); break; case OptionsConstants.GUNNERY_WEAPON_SPECIALIST: spaValue = pickRandomWeapon(entity, false); break; case OptionsConstants.GUNNERY_SANDBLASTER: spaValue = pickRandomWeapon(entity, true); break; default: if(entity.getCrew() == null || entity.getCrew().getOptions() == null || entity.getCrew().getOptions(spa.getName()) == null) { return 0; } entity.getCrew().getOptions().getOption(spa.getName()).setValue(true); return spa.getCost(); } if (!spaValue.equals(Crew.SPECIAL_NONE)) { entity.getCrew().getOptions().getOption(spa.getName()).setValue(spaValue); return spa.getCost(); } } } return 0; }

Target:
private int addSingleSPA(Entity entity, double xpCap) { int unitType = entity.getUnitType(); List<SpecialAbility> choices = coalescedSPAList(unitType, xpCap); if (choices.size() == 0) { return 0; } while (choices.size() > 0) { int spaIndex = Compute.randomInt(choices.size()); SpecialAbility spa = choices.get(spaIndex); if (entity.hasAbility(spa.getName()) || !extraEligibilityCheck(spa, entity)) { choices.remove(spaIndex); } else { String spaValue; switch (spa.getName()) { case OptionsConstants.MISC_HUMAN_TRO: spaValue = pickRandomHumanTRO(); break; case OptionsConstants.GUNNERY_RANGE_MASTER: spaValue = pickRandomRangeMaster(); break; case OptionsConstants.GUNNERY_SPECIALIST: spaValue = pickRandomGunnerySpecialization(entity); break; case OptionsConstants.GUNNERY_WEAPON_SPECIALIST: spaValue = pickRandomWeapon(entity, false); break; case OptionsConstants.GUNNERY_SANDBLASTER: spaValue = pickRandomWeapon(entity, true); break; default: if ((entity.getCrew() == null) || (entity.getCrew().getOptions() == null) || (entity.getCrew().getOptions(spa.getName()) == null)) { return 0; } entity.getCrew().getOptions().getOption(spa.getName()).setValue(true); return spa.getCost(); } if (!spaValue.equals(Crew.SPECIAL_NONE)) { entity.getCrew().getOptions().getOption(spa.getName()).setValue(spaValue); return spa.getCost(); } } } return 0; }
Source:
public static void initializeEnvironment() throws IOException, ParseException { if (initialized) return; initialized = true; if (Strings.isNullOrEmpty(USERNAME) || Strings.isNullOrEmpty(PASSWORD)) { USERNAME = System.getenv("TMDB_USERNAME"); PASSWORD = System.getenv("TMDB_PASSWORD"); } if (Strings.isNullOrEmpty(API_KEY)) { API_KEY = System.getenv("TMDB_APIKEY"); } if (API_KEY == null) { System.err.println("Your Environment is not Set for Testing. Please Define the proper Environment variables and try again."); System.exit(0); } unauthenticatedInstance = new BaseTestCase.TestTmdb(API_KEY); authenticatedInstance = new BaseTestCase.TestTmdb(API_KEY); initializeTestingIntegrityData(); initializeAccountData(); initializeGuestData(); }

Target:
public static void initializeEnvironment() throws IOException, ParseException, InterruptedException { if (initialized) { return; } if (Strings.isNullOrEmpty(USERNAME) || Strings.isNullOrEmpty(PASSWORD)) { USERNAME = System.getenv("TMDB_USERNAME"); PASSWORD = System.getenv("TMDB_PASSWORD"); } if (Strings.isNullOrEmpty(API_KEY)) { API_KEY = System.getenv("TMDB_APIKEY"); } if (API_KEY == null) { System.err.println("Your Environment is not Set for Testing. Please Define the proper Environment variables and try again."); System.exit(0); } unauthenticatedInstance = new BaseTestCase.TestTmdb(API_KEY); authenticatedInstance = new BaseTestCase.TestTmdb(API_KEY); initializeData(); initialized = true; }
Source:
private void checkAndHandleIfAllMBusChannelsAreAlreadyOccupied(final SmartMeter gatewayDevice) throws FunctionalException { final List<SmartMeter> mBusDevices = this.smartMeteringDeviceRepository .getMbusDevicesForGateway(gatewayDevice.getId()); if (mBusDevices != null && mBusDevices.size() >= MAXIMUM_NUMBER_OF_MBUS_CHANNELS) { throw new FunctionalException(FunctionalExceptionType.ALL_MBUS_CHANNELS_OCCUPIED, ComponentType.DOMAIN_SMART_METERING, new OsgpException(ComponentType.DOMAIN_SMART_METERING, "All MBus channels are already occupied for gateway " + gatewayDevice.getDeviceIdentification())); } }

Target:
private void checkAndHandleIfAllMBusChannelsAreAlreadyOccupied(final SmartMeter gatewayDevice) throws FunctionalException { final List<SmartMeter> mBusDevices = this.smartMeteringDeviceRepository .getMbusDevicesForGateway(gatewayDevice.getId()); if (mBusDevices != null && mBusDevices.size() >= MAXIMUM_NUMBER_OF_MBUS_CHANNELS) { throw new FunctionalException(FunctionalExceptionType.ALL_MBUS_CHANNELS_OCCUPIED, ComponentType.DOMAIN_SMART_METERING, new OsgpException(ComponentType.DOMAIN_SMART_METERING, "All M-Bus channels are already occupied for gateway " + gatewayDevice.getDeviceIdentification())); } }
Source:
public static String convertTemperature(String temperature) { String temp = ""; switch (temperature.length()) { case 1: temp += temperature.substring(0, 1); break; case 2: if (!temperature.substring(0, 1).equalsIgnoreCase("0")) { temp += "-"; } temp += temperature.substring(1, 2); break; default: temp += temperature.substring(1, 3); temp += "."; temp += temperature.substring(3); break; } return (temp); }

Target:
public static String convertTemperature(String temperature) { String temp = ""; switch (temperature.length()) { case 1: temp = temperature.substring(0, 1); break; case 2: if (!temperature.substring(0, 1).equalsIgnoreCase("0")) { temp = "-"; } temp += temperature.substring(1, 2); break; default: temp = temperature.substring(1, 3); temp += "."; temp += temperature.substring(3); break; } return (temp); }
Source:
public Array<T> dropRightUntil(Predicate<? super T> predicate) { Objects.requireNonNull(predicate, "predicate is null"); for (int i = length() - 1; i >= 0; i--) { if (predicate.test(get(i))) { return take(i + 1); } } return empty(); }

Target:
public Array<T> dropRightUntil(Predicate<? super T> predicate) { return Collections.dropRightUntil(this, predicate); }
Source:
private void drain() { synchronized (this) { if (busy) { missed = true; return; } } while (!child.isUnsubscribed()) { Notification<T> tn; tn = terminalNotification; if (tn != null) { if (requested.get() > 0) { terminalNotification = null; child.onNext(tn); if (!child.isUnsubscribed()) { child.onCompleted(); } return; } } synchronized (this) { if (!missed) { busy = false; return; } } } }

Target:
private void drain() { synchronized (this) { if (busy) { missed = true; return; } } final AtomicLong localRequested = this.requested; while (!child.isUnsubscribed()) { Notification<T> tn; tn = terminalNotification; if (tn != null) { if (localRequested.get() > 0) { terminalNotification = null; child.onNext(tn); if (!child.isUnsubscribed()) { child.onCompleted(); } return; } } synchronized (this) { if (!missed) { busy = false; return; } } } }
Source:
public void addResponseToRecipientStats(FeedbackResponseAttributes response) { if (!response.recipient.equalsIgnoreCase(recipientEmail)) { return; } FeedbackRubricResponseDetails rubricResponse = (FeedbackRubricResponseDetails) response.getResponseDetails(); for (int i = 0; i < getNumOfRubricSubQuestions(); i++) { int choice = rubricResponse.getAnswer(i); if (choice >= 0) { ++numOfResponsesPerSubQuestionPerChoice[i][choice]; totalPerSubQuestion[i] += rubricWeightsForEachCell.get(i).get(choice); respondentsPerSubQuestion[i]++; } } }

Target:
public void addResponseToRecipientStats(FeedbackResponseAttributes response) { if (!response.recipient.equalsIgnoreCase(recipientEmail)) { return; } FeedbackRubricResponseDetails rubricResponse = (FeedbackRubricResponseDetails) response.getResponseDetails(); for (int i = 0; i < getNumOfRubricSubQuestions(); i++) { int choice = rubricResponse.getAnswer(i); if (choice >= 0) { ++numOfResponsesPerSubQuestionPerChoice[i][choice]; totalPerSubQuestion[i] += weights.get(i).get(choice); respondentsPerSubQuestion[i]++; } } }
Source:
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { String claims = Optional.of(exception) .map(e -> (OAuth2AuthenticationException) e) .map(OAuth2AuthenticationException::getError) .map(e -> (AzureOAuthError)e) .map(AzureOAuthError ::getClaims) .orElse(null); if (claims == null) { defaultHandler.onAuthenticationFailure(request, response, exception); } else { response.setStatus(302); request.getSession().setAttribute(Constants.CONDITIONAL_ACCESS_POLICY_CLAIMS,claims); String redirectUrl = Optional.of(request) .map(HttpServletRequest::getSession) .map(s -> s.getAttribute(Constants.SAVED_REQUEST)) .map(r -> (DefaultSavedRequest) r) .map(DefaultSavedRequest::getRedirectUrl) .orElse(null); response.sendRedirect(redirectUrl); } }

Target:
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { String claims = Optional.of(exception) .map(e -> (OAuth2AuthenticationException) e) .map(OAuth2AuthenticationException::getError) .map(e -> (AzureOAuth2Error) e) .map(AzureOAuth2Error::getClaims) .orElse(null); if (claims == null) { defaultHandler.onAuthenticationFailure(request, response, exception); } else { response.setStatus(302); request.getSession().setAttribute(Constants.CONDITIONAL_ACCESS_POLICY_CLAIMS, claims); String redirectUrl = Optional.of(request) .map(HttpServletRequest::getSession) .map(s -> s.getAttribute(Constants.SAVED_REQUEST)) .map(r -> (DefaultSavedRequest) r) .map(DefaultSavedRequest::getRedirectUrl) .orElse(null); response.sendRedirect(redirectUrl); } }
Source:
private <C> C populateProperties(String channelName, Class<C> propertiesClass, Properties defaults) { C beanInstance; try { beanInstance = propertiesClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new BeanInitializationException(e.getMessage()); } RelaxedDataBinder dataBinder = new RelaxedDataBinder(beanInstance); dataBinder.setIgnoreUnknownFields(false); dataBinder.setDisallowedFields(bindingPropertyFields); dataBinder.bind(new MutablePropertyValues(defaults)); dataBinder = new RelaxedDataBinder(beanInstance, "spring.cloud.stream.bindings." + channelName); dataBinder.setIgnoreUnknownFields(false); dataBinder.setDisallowedFields(bindingPropertyFields); if (applicationContext != null && applicationContext.getEnvironment() != null) { dataBinder.bind(new PropertySourcesPropertyValues(applicationContext.getEnvironment().getPropertySources())); } return beanInstance; }

Target:
private <C> C populateProperties(String channelName, Class<C> propertiesClass, Properties defaults) { C beanInstance; try { beanInstance = propertiesClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new BeanInitializationException(e.getMessage()); } RelaxedDataBinder dataBinder = new RelaxedDataBinder(beanInstance); dataBinder.setIgnoreUnknownFields(ignoreUnknownProperties); dataBinder.setDisallowedFields(bindingPropertyFields); dataBinder.bind(new MutablePropertyValues(defaults)); if (applicationContext != null && applicationContext.getEnvironment() != null) { dataBinder = new RelaxedDataBinder(beanInstance, "spring.cloud.stream.bindings." + channelName); dataBinder.setConversionService(conversionService); dataBinder.setIgnoreUnknownFields(ignoreUnknownProperties); dataBinder.setDisallowedFields(bindingPropertyFields); dataBinder.bind(new PropertySourcesPropertyValues(applicationContext.getEnvironment().getPropertySources())); } return beanInstance; }
Source:
private Exception createExceptionFromFault(Fault fault) { String message = fault.getFaultstring(); Detail faultDetail = fault.getDetail(); if (faultDetail == null || faultDetail.getAny().size() == 0) { try { return new SOAPFaultException(SOAPFactory.newInstance().createFault(message, fault.getFaultcode())); } catch (SOAPException e) { throw new RuntimeCamelException(e); } } Object detailObj = faultDetail.getAny().get(0); if (!JAXBIntrospector.isElement(detailObj)) { try { return new SOAPFaultException(SOAPFactory.newInstance().createFault(message, fault.getFaultcode())); } catch (SOAPException e) { throw new RuntimeCamelException(e); } } JAXBElement<?> detailEl = (JAXBElement<?>) detailObj; Class<? extends Exception> exceptionClass = getDataFormat().getElementNameStrategy().findExceptionForFaultName(detailEl.getName()); Constructor<? extends Exception> messageConstructor; Constructor<? extends Exception> constructor; try { Object detail = JAXBIntrospector.getValue(detailEl); try { constructor = exceptionClass.getConstructor(String.class, detail.getClass()); return constructor.newInstance(message, detail); } catch (NoSuchMethodException e) { messageConstructor = exceptionClass.getConstructor(String.class); return messageConstructor.newInstance(message); } } catch (Exception e) { throw new RuntimeCamelException(e); } }

Target:
private Exception createExceptionFromFault(Fault fault) { String message = fault.getFaultstring(); Detail faultDetail = fault.getDetail(); if (faultDetail == null || faultDetail.getAny().size() == 0) { try { return new SOAPFaultException(SOAPFactory.newInstance().createFault(message, fault.getFaultcode())); } catch (SOAPException e) { throw new RuntimeCamelException(e); } } Object detailObj = faultDetail.getAny().get(0); if (!(detailObj instanceof JAXBElement)) { try { return new SOAPFaultException(SOAPFactory.newInstance().createFault(message, fault.getFaultcode())); } catch (SOAPException e) { throw new RuntimeCamelException(e); } } JAXBElement<?> detailEl = (JAXBElement<?>) detailObj; Class<? extends Exception> exceptionClass = getDataFormat().getElementNameStrategy().findExceptionForFaultName(detailEl.getName()); Constructor<? extends Exception> messageConstructor; Constructor<? extends Exception> constructor; try { Object detail = JAXBIntrospector.getValue(detailEl); try { constructor = exceptionClass.getConstructor(String.class, detail.getClass()); return constructor.newInstance(message, detail); } catch (NoSuchMethodException e) { messageConstructor = exceptionClass.getConstructor(String.class); return messageConstructor.newInstance(message); } } catch (Exception e) { throw new RuntimeCamelException(e); } }
Source:
public void onComplete() { final Subscription s = this.s; final ReconnectMono<T> p = this.parent; final T value = p.value; if (s == Operators.cancelledSubscription() || !S.compareAndSet(this, s, null)) { p.doFinally(); return; } if (value == null) { p.terminate(new IllegalStateException("Unexpected empty source")); } else { p.complete(); } }

Target:
public void onComplete() { final Subscription s = this.s; final ReconnectMono<T> p = this.parent; final T value = p.value; if (s == Operators.cancelledSubscription() || !S.compareAndSet(this, s, null)) { p.doFinally(); return; } if (value == null) { p.terminate(new IllegalStateException("Source completed empty")); } else { p.complete(); } }
Source:
private InputStream getObject(String bucketName, String objectName, Object key, String keyDecryptionCipherMode) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, XmlPullParserException, InvalidEncryptionMetadataException, InvalidArgumentException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException { ObjectStat stat = statObject(bucketName, objectName); Key masterKey = null; String dataDecryptionCipherMode = "AES/CBC/PKCS5Padding"; if ((stat.contentKey() == null) && (stat.encryptionIv() == null)) { throw new InvalidEncryptionMetadataException("encryption key or iv not present in object metadata"); } InputStream stream = getObject(bucketName, objectName); if (key instanceof KeyPair) { masterKey = ((KeyPair) key).getPrivate(); } else if (key instanceof SecretKey) { masterKey = (SecretKey) key; } else { throw new InvalidArgumentException("key should be an instance of KeyPair or SecretKey"); } byte[] encryptedDataKey = BaseEncoding.base64().decode(stat.contentKey()); byte[] iv = BaseEncoding.base64().decode(stat.encryptionIv()); byte[] plainDataKey = Crypto.decrypt(encryptedDataKey, masterKey, keyDecryptionCipherMode); SecretKey dataEncryptionKey = new SecretKeySpec(plainDataKey, 0, plainDataKey.length, "AES"); CipherInputStream decryptedStream = Crypto.decryptInputStream(stream, dataEncryptionKey, dataDecryptionCipherMode, iv); return decryptedStream; }

Target:
private InputStream getObject(String bucketName, String objectName, Object key, String keyDecryptionCipherMode) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, XmlPullParserException, InvalidEncryptionMetadataException, InvalidArgumentException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException { ObjectStat stat = statObject(bucketName, objectName); Key masterKey = null; String dataDecryptionCipherMode = "AES/CBC/PKCS5Padding"; if (key instanceof KeyPair) { masterKey = ((KeyPair) key).getPrivate(); } else if (key instanceof SecretKey) { masterKey = (SecretKey) key; } else { throw new InternalException( "Unknown key object. This should not happen. Please report this issue at <LINK_0>"); } if ((stat.contentKey() == null) && (stat.encryptionIv() == null)) { throw new InvalidEncryptionMetadataException("encryption key or iv not present in object metadata"); } InputStream stream = getObject(bucketName, objectName); byte[] encryptedDataKey = BaseEncoding.base64().decode(stat.contentKey()); byte[] iv = BaseEncoding.base64().decode(stat.encryptionIv()); byte[] plainDataKey = Crypto.decrypt(encryptedDataKey, masterKey, keyDecryptionCipherMode); SecretKey dataEncryptionKey = new SecretKeySpec(plainDataKey, 0, plainDataKey.length, "AES"); CipherInputStream decryptedStream = Crypto.decrypt(stream, dataEncryptionKey, dataDecryptionCipherMode, iv); return decryptedStream; }
Source:
public ReportDocument(String targetDir, String testName, int testsSize, boolean separateClusterCharts) { super(targetDir, String.format("test_%s.html", testName), "Test " + testName); this.testSize = testsSize; this.testName = testName; this.separateClusterCharts = separateClusterCharts; }

Target:
public ReportDocument(String targetDir, String testName, int testsSize, boolean separateClusterCharts) { super(targetDir, String.format("test_%s.html", testName), "Test " + testName); this.testName = testName; this.testSize = testsSize; this.separateClusterCharts = separateClusterCharts; }
Source:
public static JSONObject getUsageCountForMonetization(long from, long to) throws APIManagementException { JSONObject jsonObject = null; String granularity = null; APIManagerConfiguration configuration = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService() .getAPIManagerConfiguration(); granularity = configuration.getFirstProperty( APIConstants.Monetization.USAGE_PUBLISHER_GRANULARITY); if (StringUtils.isEmpty(granularity)) { granularity = APIConstants.Monetization.USAGE_PUBLISH_DEFAULT_GRANULARITY; } StringBuilder query = new StringBuilder( "from " + APIConstants.Monetization.MONETIZATION_USAGE_RECORD_AGG + " within " + from + "L, " + to + "L per '" + granularity + "' select " + APIConstants.Analytics.API_NAME + ", " + APIConstants.Analytics.API_VERSION + ", " + APIConstants.Analytics.API_CREATOR + ", " + APIConstants.Analytics.API_CREATOR_TENANT_DOMAIN + ", " + APIConstants.Analytics.APPLICATION_ID + ", " + "sum (requestCount) as requestCount " + "group by " + APIConstants.Analytics.API_NAME + ", " + APIConstants.Analytics.API_VERSION + ", " + APIConstants.Analytics.API_CREATOR + ", " + APIConstants.Analytics.API_CREATOR_TENANT_DOMAIN + ", " + APIConstants.Analytics.APPLICATION_ID ); try { jsonObject = APIUtil.executeQueryOnStreamProcessor( APIConstants.Monetization.MONETIZATION_USAGE_RECORD_APP, query.toString()); } catch (APIManagementException ex) { String msg = "Unable to Retrieve monetization usage records"; handleException(msg, ex); } return jsonObject; }

Target:
public static JSONObject getUsageCountForMonetization(long from, long to) throws APIManagementException { JSONObject jsonObject = null; String granularity = null; APIManagerConfiguration configuration = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService() .getAPIManagerConfiguration(); granularity = configuration.getFirstProperty( APIConstants.Monetization.USAGE_PUBLISHER_GRANULARITY); if (StringUtils.isEmpty(granularity)) { granularity = APIConstants.Monetization.USAGE_PUBLISH_DEFAULT_GRANULARITY; } StringBuilder query = new StringBuilder( "from " + APIConstants.Monetization.MONETIZATION_USAGE_RECORD_AGG + " within " + from + "L, " + to + "L per '" + granularity + "' select " + APIConstants.Analytics.API_NAME + ", " + APIConstants.Analytics.API_VERSION + ", " + APIConstants.Analytics.API_CREATOR + ", " + APIConstants.Analytics.API_CREATOR_TENANT_DOMAIN + ", " + APIConstants.Analytics.APPLICATION_ID + ", " + "sum (requestCount) as requestCount " + "group by " + APIConstants.Analytics.API_NAME + ", " + APIConstants.Analytics.API_VERSION + ", " + APIConstants.Analytics.API_CREATOR + ", " + APIConstants.Analytics.API_CREATOR_TENANT_DOMAIN + ", " + APIConstants.Analytics.APPLICATION_ID ); try { jsonObject = APIUtil.executeQueryOnStreamProcessor( APIConstants.Monetization.MONETIZATION_USAGE_RECORD_APP, query.toString()); if(jsonObject == null){ jsonObject = new JSONObject(); } } catch (APIManagementException ex) { String msg = "Unable to Retrieve monetization usage records"; handleException(msg, ex); } return jsonObject; }
Source:
protected String buildEmailMessage(List<ProcurementCardSkippedTransaction> skippedTransactions) { StringBuilder sb = new StringBuilder(); sb.append("The ").append(bankFileType).append(" bank file had the following transactions skipped: "); sb.append(KFSConstants.NEWLINE).append(KFSConstants.NEWLINE); for (ProcurementCardSkippedTransaction skippedTransaction : skippedTransactions) { sb.append("File Line Number: ").append(skippedTransaction.getFileLineNumber()); sb.append(" Card Holder Name: ").append(skippedTransaction.getCardHolderName()); sb.append(" Transaction Amount: ").append(skippedTransaction.getTransactionAmount()); sb.append(KFSConstants.NEWLINE); } return sb.toString(); }

Target:
protected String buildEmailMessage(List<ProcurementCardSkippedTransaction> skippedTransactions) { StringBuilder sb = new StringBuilder(); String body = MessageFormat.format(getEmailBodyTempalte(), bankFileType); sb.append(body).append(KFSConstants.NEWLINE).append(KFSConstants.NEWLINE); for (ProcurementCardSkippedTransaction skippedTransaction : skippedTransactions) { sb.append("File Line Number: ").append(skippedTransaction.getFileLineNumber()); sb.append(" Card Holder Name: ").append(skippedTransaction.getCardHolderName()); sb.append(" Transaction Amount: ").append(skippedTransaction.getTransactionAmount()); sb.append(KFSConstants.NEWLINE); } return sb.toString(); }
Source:
public Object invoke(MethodInvocation invocation) throws Throwable { DigdagTimed timed = invocation.getMethod().getAnnotation(DigdagTimed.class); Category category = Category.fromString(timed.category()); String value = mkValue(timed, invocation); String metricsName = metrics.mkMetricsName(category, value); Timer.Sample sample = metrics.timerStart(category); try { return invocation.proceed(); } catch (Exception ex) { throw ex; } finally { try { Tags taskTags = timed.taskRequest() ? getTaskRequest(invocation) : Tags.empty(); metrics.timerStop(category, metricsName, taskTags.and(timed.extraTags()), sample); } catch (Exception e) { } } }

Target:
public Object invoke(MethodInvocation invocation) throws Throwable { DigdagTimed timed = invocation.getMethod().getAnnotation(DigdagTimed.class); Category category = Category.fromString(timed.category()); String value = mkValue(timed, invocation); String metricsName = metrics.mkMetricsName(category, value); Tags taskTags = Tags.empty(); try { taskTags = timed.taskRequest() ? getTaskRequest(invocation) : Tags.empty(); } catch (Exception e) { logger.debug(e.toString()); } Timer.Sample sample = metrics.timerStart(category); try { return invocation.proceed(); } catch (Exception ex) { throw ex; } finally { try { metrics.timerStop(category, metricsName, taskTags.and(timed.extraTags()), sample); } catch (Exception e) { } } }
Source:
public static ForgeArchive getDeployment() { ForgeArchive archive = ShrinkWrap .create(ForgeArchive.class) .addBeansXML() .addAsResource(WindupCommandTest.class.getResource(TEST_OLD_WINDUP), TEST_OLD_WINDUP) .addAsAddonDependencies( AddonDependencyEntry.create("org.jboss.windup.ui:windup-ui"), AddonDependencyEntry.create("org.jboss.windup.exec:windup-exec"), AddonDependencyEntry.create("org.jboss.windup.graph:windup-graph"), AddonDependencyEntry.create("org.jboss.windup.rules.apps:windup-rules-java"), AddonDependencyEntry.create("org.jboss.windup.utils:windup-utils"), AddonDependencyEntry.create("org.jboss.forge.furnace.container:cdi"), AddonDependencyEntry.create("org.jboss.forge.addon:maven"), AddonDependencyEntry.create("org.jboss.forge.addon:ui-test-harness") ); return archive; }

Target:
public static AddonArchive getDeployment() { AddonArchive archive = ShrinkWrap .create(AddonArchive.class) .addBeansXML() .addAsResource(WindupCommandTest.class.getResource(TEST_OLD_WINDUP), TEST_OLD_WINDUP); return archive; }
Source:
private static AsyncCallback<JavaScriptObject> mine() { return new GerritCallback<JavaScriptObject>() { public void onSuccess(JavaScriptObject result) { redisplay(); } public void onFailure(Throwable err) { if (SubmitFailureDialog.isConflict(err)) { new SubmitFailureDialog(err.getMessage()).center(); redisplay(); } else { super.onFailure(err); } } private void redisplay() { Gerrit.display(PageLinks.MINE); } }; }

Target:
private static AsyncCallback<JavaScriptObject> mine() { return new GerritCallback<JavaScriptObject>() { public void onSuccess(JavaScriptObject result) { Gerrit.display(PageLinks.MINE); } public void onFailure(Throwable err) { if (SubmitFailureDialog.isConflict(err)) { new SubmitFailureDialog(err.getMessage()).center(); Gerrit.display(PageLinks.MINE); } else { super.onFailure(err); } } }; }
Source:
private void message(String prefix, String string, Object[] objects) { Throwable e = null; for (int n = 0; n < objects.length; n++) { Object o = objects[n]; if (o instanceof Throwable) { Throwable t = e = (Throwable) o; if (t instanceof BundleException) { objects[n] = translateToMessage((BundleException) t); } else { for (Throwable cause; (t instanceof InvocationTargetException) && ((cause = t.getCause()) != null);) { t = cause; } objects[n] = t.getMessage(); } } } StringBuilder sb = new StringBuilder(prefix); try (Formatter f = new Formatter(sb)) { f.format(string, objects); } catch (IllegalFormatException fe) { sb.append(fe); } String message = sb.toString(); out.println(message); if (e != null) e.printStackTrace(out); out.flush(); DatagramSocket socket = commsSocket.get(); if (socket != null) { int severity; if (message.startsWith("! ")) { severity = 0; } else if (message.startsWith("# ") && parms.trace) { severity = 2; } else { return; } try (ByteBufferOutputStream outputStream = new ByteBufferOutputStream(); DataOutputStream dos = new DataOutputStream(outputStream)) { dos.writeInt(severity); dos.writeUTF(message.substring(2)); if (e != null) { dos.writeUTF(Exceptions.toString(e)); } ByteBuffer bb = outputStream.toByteBuffer(); socket.send(new DatagramPacket(bb.array(), bb.arrayOffset(), bb.remaining())); } catch (IOException ioe) { out.println("! Unable to send notification to " + socket.getRemoteSocketAddress()); if (parms.trace) ioe.printStackTrace(out); out.flush(); } } }

Target:
private void message(String prefix, String string, Object[] objects) { Throwable e = null; for (int n = 0; n < objects.length; n++) { Object o = objects[n]; if (o instanceof Throwable) { Throwable t = e = (Throwable) o; if (t instanceof BundleException) { objects[n] = translateToMessage((BundleException) t); } else { for (Throwable cause; (t instanceof InvocationTargetException) && ((cause = t.getCause()) != null);) { t = cause; } objects[n] = t.getMessage(); } } } StringBuilder sb = new StringBuilder(prefix); try (Formatter f = new Formatter(sb)) { f.format(string, objects); } catch (IllegalFormatException fe) { sb.append(fe); } String message = sb.toString(); out.println(message); if (e != null) e.printStackTrace(out); out.flush(); DatagramSocket socket = commsSocket.get(); if (socket != null) { int severity; if (message.startsWith("! ")) { severity = 0; } else if (message.startsWith("# ") && parms.trace) { severity = 2; } else { return; } try (ByteBufferOutputStream outputStream = new ByteBufferOutputStream(); DataOutputStream dos = new DataOutputStream(outputStream)) { dos.writeInt(severity); dos.writeUTF(message.substring(2)); if (e != null) { dos.writeUTF(toString(e)); } ByteBuffer bb = outputStream.toByteBuffer(); socket.send(new DatagramPacket(bb.array(), bb.arrayOffset(), bb.remaining())); } catch (IOException ioe) { out.println("! Unable to send notification to " + socket.getRemoteSocketAddress()); if (parms.trace) ioe.printStackTrace(out); out.flush(); } } }
Source:
public void load() throws IOException, ConfigInvalidException { try { fromText(RawParseUtils.decode(IO.readFully(getFile()))); } catch (FileNotFoundException noFile) { clear(); } catch (IOException e) { final IOException e2 = new IOException("Cannot read " + getFile()); e2.initCause(e); throw e2; } catch (ConfigInvalidException e) { throw new ConfigInvalidException("Cannot read " + getFile(), e); } lastModified = getFile().lastModified(); }

Target:
public void load() throws IOException, ConfigInvalidException { lastModified = getFile().lastModified(); try { fromText(RawParseUtils.decode(IO.readFully(getFile()))); } catch (FileNotFoundException noFile) { clear(); } catch (IOException e) { final IOException e2 = new IOException("Cannot read " + getFile()); e2.initCause(e); throw e2; } catch (ConfigInvalidException e) { throw new ConfigInvalidException("Cannot read " + getFile(), e); } }
Source:
private FirmwareUpdateMessageDataContainer mapFirmwareModuleTypes(final String firmwareIndentification, final List<FirmwareModuleType> firmwareModuleTypes) { String moduleVersionComm = ""; String moduleVersionFunc = ""; String moduleVersionMa = ""; String moduleVersionMbus = ""; String moduleVersionSec = ""; for (final FirmwareModuleType firmwareModuleType : firmwareModuleTypes) { if (FirmwareModuleType.COMMUNICATION.equals(firmwareModuleType)) { moduleVersionComm = firmwareModuleType.toString(); } if (FirmwareModuleType.FUNCTIONAL.equals(firmwareModuleType)) { moduleVersionFunc = firmwareModuleType.toString(); } if (FirmwareModuleType.MODULE_ACTIVE.equals(firmwareModuleType)) { moduleVersionMa = firmwareModuleType.toString(); } if (FirmwareModuleType.M_BUS.equals(firmwareModuleType)) { moduleVersionMbus = firmwareModuleType.toString(); } if (FirmwareModuleType.SECURITY.equals(firmwareModuleType)) { moduleVersionSec = firmwareModuleType.toString(); } } final FirmwareModuleData firmwareModuleData = new FirmwareModuleData(moduleVersionComm, moduleVersionFunc, moduleVersionMa, moduleVersionMbus, moduleVersionSec); return new FirmwareUpdateMessageDataContainer(firmwareModuleData, firmwareIndentification); }

Target:
private FirmwareUpdateMessageDataContainer mapFirmwareModuleTypes(final String firmwareIndentification, final List<FirmwareModuleType> firmwareModuleTypes) { String moduleVersionComm = null; String moduleVersionFunc = null; String moduleVersionMa = null; String moduleVersionMbus = null; String moduleVersionSec = null; for (final FirmwareModuleType firmwareModuleType : firmwareModuleTypes) { final String firmwareModuleTypeString = firmwareModuleType.toString(); if (FirmwareModuleType.COMMUNICATION.equals(firmwareModuleType)) { moduleVersionComm = firmwareModuleTypeString; } if (FirmwareModuleType.FUNCTIONAL.equals(firmwareModuleType)) { moduleVersionFunc = firmwareModuleTypeString; } if (FirmwareModuleType.MODULE_ACTIVE.equals(firmwareModuleType)) { moduleVersionMa = firmwareModuleTypeString; } if (FirmwareModuleType.M_BUS.equals(firmwareModuleType)) { moduleVersionMbus = firmwareModuleTypeString; } if (FirmwareModuleType.SECURITY.equals(firmwareModuleType)) { moduleVersionSec = firmwareModuleTypeString; } } final FirmwareModuleData firmwareModuleData = new FirmwareModuleData(moduleVersionComm, moduleVersionFunc, moduleVersionMa, moduleVersionMbus, moduleVersionSec); return new FirmwareUpdateMessageDataContainer(firmwareModuleData, firmwareIndentification); }
Source:
public void onSaveInstanceState(Bundle state) { state.putBoolean(EMAIL_SENT, true); }

Target:
public void onSaveInstanceState(Bundle state) { super.onSaveInstanceState(state); state.putBoolean(EMAIL_SENT, true); }
Source:
public void setState(final String commandId, final boolean state) { if (commandId.equals(IOutlineViewState.SHOW_ELEMENT_CONTENT)) { showElementContent = state; } }

Target:
public void setState(final String commandId, final boolean state) { if (commandId.equals(SHOW_ELEMENT_CONTENT)) { showElementContent = state; } }
Source:
public SessionStore<J2EContext> buildFromTrackableSession(final J2EContext context, final Object trackableSession) { if (trackableSession != null) { return new J2EProvidedSessionStore((HttpSession) trackableSession); } else { return (SessionStore<J2EContext>) SessionStore.EMPTY; } }

Target:
public Optional<SessionStore<J2EContext>> buildFromTrackableSession(final J2EContext context, final Object trackableSession) { return trackableSession != null ? Optional.of(new J2EProvidedSessionStore((HttpSession) trackableSession)) : Optional.empty(); }
Source:
private Collection<T> removeCollection(int priority) { PriorityHolder<T>[] current = getArray(); int len = current.length; int low = 0; int high = len - 1; while (low <= high) { int mid = (low + high) >>> 1; PriorityHolder<T> midVal = current[mid]; if (midVal.getPriority() > priority) low = mid + 1; else if (midVal.getPriority() < priority) high = mid - 1; else { PriorityHolder<T>[] newArray = newPrioritySetArrayInstance(len - 1); System.arraycopy(current, 0, newArray, 0, mid); System.arraycopy(current, mid + 1, newArray, mid, len - mid - 1); setArray(newArray); return midVal.getValues(); } } return null; }

Target:
private Collection<T> removeCollection(int priority) { PriorityHolder<T>[] current = getArray(); int len = current.length; int low = 0; int high = len - 1; while (low <= high) { int mid = (low + high) / 2; PriorityHolder<T> midVal = current[mid]; if (midVal.getPriority() > priority) low = mid + 1; else if (midVal.getPriority() < priority) high = mid - 1; else { PriorityHolder<T>[] newArray = newPrioritySetArrayInstance(len - 1); System.arraycopy(current, 0, newArray, 0, mid); System.arraycopy(current, mid + 1, newArray, mid, len - mid - 1); setArray(newArray); return midVal.getValues(); } } return null; }
Source:
public void onMessage(Message message) { try { CarbonMessage jmsCarbonMessage = JMSUtils.createJMSCarbonMessage(message); jmsCarbonMessage.setProperty(org.wso2.carbon.messaging.Constants.PROTOCOL, JMSConstants.PROTOCOL_JMS); jmsCarbonMessage.setProperty(JMSConstants.JMS_SERVICE_ID, serviceId); if (Session.CLIENT_ACKNOWLEDGE == this.acknowledgementMode) { carbonMessageProcessor.receive(jmsCarbonMessage, new AcknowledgementCallback(message, session)); } else if (Session.SESSION_TRANSACTED == this.acknowledgementMode) { carbonMessageProcessor.receive(jmsCarbonMessage, new CommitOrRollback(session)); } else { carbonMessageProcessor.receive(jmsCarbonMessage, null); } } catch (Exception e) { logger.error("Error while getting the message from jms server : " + e.getMessage(), e); throw new RuntimeException(new JMSConnectorException("Error while getting the message from jms " + "server", e)); } }

Target:
public void onMessage(Message message) { try { CarbonMessage jmsCarbonMessage = JMSUtils.createJMSCarbonMessage(message); jmsCarbonMessage.setProperty(org.wso2.carbon.messaging.Constants.PROTOCOL, JMSConstants.PROTOCOL_JMS); jmsCarbonMessage.setProperty(JMSConstants.JMS_SERVICE_ID, serviceId); if (Session.CLIENT_ACKNOWLEDGE == this.acknowledgementMode) { carbonMessageProcessor.receive(jmsCarbonMessage, new AcknowledgementCallback(message, session)); } else if (Session.SESSION_TRANSACTED == this.acknowledgementMode) { carbonMessageProcessor.receive(jmsCarbonMessage, new TransactedSessionCallback(session)); } else { carbonMessageProcessor.receive(jmsCarbonMessage, null); } } catch (Exception e) { throw new RuntimeException("Error while getting the message from jms provider.", e); } }
Source:
public void testCreate() throws StripeException { final List<String> enabledEvents = new ArrayList<String>(); enabledEvents.add("*"); final Map<String, Object> params = new HashMap<String, Object>(); params.put("enabled_events", enabledEvents); params.put("url", "<LINK_0>"); final WebhookEndpoint endpoint = WebhookEndpoint.create(params); assertNotNull(endpoint); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/webhook_endpoints"), params ); }

Target:
public void testCreate() throws StripeException { final List<String> enabledEvents = new ArrayList<String>(); enabledEvents.add("charge.succeeded"); final Map<String, Object> params = new HashMap<String, Object>(); params.put("enabled_events", enabledEvents); params.put("url", "<LINK_0>"); final WebhookEndpoint endpoint = WebhookEndpoint.create(params); assertNotNull(endpoint); verifyRequest( ApiResource.RequestMethod.POST, String.format("/v1/webhook_endpoints"), params ); }
Source:
protected static final void commonInit() { if (DEBUG) Slog.d(TAG, "Entered RuntimeInit!"); LoggingHandler loggingHandler = new LoggingHandler(); RuntimeHooks.setUncaughtExceptionPreHandler(loggingHandler); Thread.setDefaultUncaughtExceptionHandler(new KillApplicationHandler(loggingHandler)); RuntimeHooks.setThreadPrioritySetter(new RuntimeThreadPrioritySetter()); RuntimeHooks.setTimeZoneIdSupplier(() -> SystemProperties.get("persist.sys.timezone")); LogManager.getLogManager().reset(); new AndroidConfig(); String userAgent = getDefaultUserAgent(); System.setProperty("http.agent", userAgent); NetworkManagementSocketTagger.install(); String trace = SystemProperties.get("ro.kernel.android.tracing"); if (trace.equals("1")) { Slog.i(TAG, "NOTE: emulator trace profiling enabled"); Debug.enableEmulatorTraceOutput(); } initialized = true; }

Target:
protected static final void commonInit() { if (DEBUG) Slog.d(TAG, "Entered RuntimeInit!"); LoggingHandler loggingHandler = new LoggingHandler(); RuntimeHooks.setUncaughtExceptionPreHandler(loggingHandler); Thread.setDefaultUncaughtExceptionHandler(new KillApplicationHandler(loggingHandler)); RuntimeHooks.setTimeZoneIdSupplier(() -> SystemProperties.get("persist.sys.timezone")); LogManager.getLogManager().reset(); new AndroidConfig(); String userAgent = getDefaultUserAgent(); System.setProperty("http.agent", userAgent); NetworkManagementSocketTagger.install(); String trace = SystemProperties.get("ro.kernel.android.tracing"); if (trace.equals("1")) { Slog.i(TAG, "NOTE: emulator trace profiling enabled"); Debug.enableEmulatorTraceOutput(); } initialized = true; }